@payloadcms/richtext-lexical 4.0.0-internal.435b2d6 → 4.0.0-internal.44ac9c8

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 (405) hide show
  1. package/dist/exports/client/Field-BPLEYPXV.js +2 -0
  2. package/dist/exports/client/Field-BPLEYPXV.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-43E5QYAA.js +2 -0
  5. package/dist/exports/client/chunk-43E5QYAA.js.map +7 -0
  6. package/dist/exports/client/chunk-LN6VX25I.js +2 -0
  7. package/dist/exports/client/chunk-LN6VX25I.js.map +7 -0
  8. package/dist/exports/client/component-D5QLYS7W.js +2 -0
  9. package/dist/exports/client/component-D5QLYS7W.js.map +7 -0
  10. package/dist/exports/client/index.d.ts +1 -1
  11. package/dist/exports/client/index.d.ts.map +1 -1
  12. package/dist/exports/client/index.js +27 -27
  13. package/dist/exports/client/index.js.map +4 -4
  14. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  15. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  16. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  17. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  18. package/dist/features/blocks/client/component/index.d.ts +0 -6
  19. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  20. package/dist/features/blocks/client/component/index.js +126 -69
  21. package/dist/features/blocks/client/component/index.js.map +1 -1
  22. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  23. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  24. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  25. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  26. package/dist/features/blocks/server/index.js +2 -2
  27. package/dist/features/blocks/server/index.js.map +1 -1
  28. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  29. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  30. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  31. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  32. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  33. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  34. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  35. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  36. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  37. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  38. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  39. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  40. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  41. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  42. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  43. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  44. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  45. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  46. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  47. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  48. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  49. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  50. package/dist/features/debug/testRecorder/client/plugin/index.css +0 -1
  51. package/dist/features/heading/constants.d.ts +2 -0
  52. package/dist/features/heading/constants.d.ts.map +1 -0
  53. package/dist/features/heading/constants.js +2 -0
  54. package/dist/features/heading/constants.js.map +1 -0
  55. package/dist/features/heading/server/index.d.ts.map +1 -1
  56. package/dist/features/heading/server/index.js +5 -1
  57. package/dist/features/heading/server/index.js.map +1 -1
  58. package/dist/features/heading/server/validate.d.ts +6 -0
  59. package/dist/features/heading/server/validate.d.ts.map +1 -0
  60. package/dist/features/heading/server/validate.js +15 -0
  61. package/dist/features/heading/server/validate.js.map +1 -0
  62. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  63. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  64. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +1 -1
  65. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  66. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -1
  67. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  68. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  69. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  70. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +1 -0
  71. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  72. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  73. package/dist/features/link/nodes/AutoLinkNode.d.ts +1 -1
  74. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  75. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  76. package/dist/features/link/nodes/LinkNode.d.ts +1 -1
  77. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  78. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  79. package/dist/features/link/server/index.js +2 -2
  80. package/dist/features/link/server/index.js.map +1 -1
  81. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  82. package/dist/features/lists/checklist/server/index.js +5 -2
  83. package/dist/features/lists/checklist/server/index.js.map +1 -1
  84. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  85. package/dist/features/lists/orderedList/server/index.js +5 -2
  86. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  87. package/dist/features/lists/shared/constants.d.ts +2 -0
  88. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  89. package/dist/features/lists/shared/constants.js +2 -0
  90. package/dist/features/lists/shared/constants.js.map +1 -0
  91. package/dist/features/lists/shared/validate.d.ts +5 -0
  92. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  93. package/dist/features/lists/shared/validate.js +15 -0
  94. package/dist/features/lists/shared/validate.js.map +1 -0
  95. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  96. package/dist/features/lists/unorderedList/server/index.js +5 -2
  97. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  98. package/dist/features/relationship/client/index.d.ts +2 -2
  99. package/dist/features/relationship/client/index.d.ts.map +1 -1
  100. package/dist/features/relationship/client/index.js.map +1 -1
  101. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  102. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  103. package/dist/features/relationship/client/plugins/index.js +27 -31
  104. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  105. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  106. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  107. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  108. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  109. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  110. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  111. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  112. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  113. package/dist/features/relationship/server/index.d.ts +8 -1
  114. package/dist/features/relationship/server/index.d.ts.map +1 -1
  115. package/dist/features/relationship/server/index.js +28 -11
  116. package/dist/features/relationship/server/index.js.map +1 -1
  117. package/dist/features/relationship/server/schema.d.ts +2 -2
  118. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  119. package/dist/features/relationship/server/schema.js +5 -10
  120. package/dist/features/relationship/server/schema.js.map +1 -1
  121. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  122. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  123. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  124. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  125. package/dist/features/table/client/index.d.ts.map +1 -0
  126. package/dist/features/table/client/index.js.map +1 -0
  127. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  128. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  129. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  130. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  131. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  132. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
  133. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  134. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  135. package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +41 -18
  136. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  137. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  138. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  139. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  140. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  141. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  142. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  143. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  144. package/dist/features/table/client/utils/debounce.js.map +1 -0
  145. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  146. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  147. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  148. package/dist/features/table/markdownTransformer.js.map +1 -0
  149. package/dist/features/table/server/index.d.ts +3 -0
  150. package/dist/features/table/server/index.d.ts.map +1 -0
  151. package/dist/features/{experimental_table → table}/server/index.js +4 -4
  152. package/dist/features/table/server/index.js.map +1 -0
  153. package/dist/features/table/server/schema.d.ts.map +1 -0
  154. package/dist/features/table/server/schema.js.map +1 -0
  155. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  156. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  157. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  158. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  159. package/dist/features/toolbars/fixed/client/Toolbar/index.css +78 -6
  160. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  161. package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
  162. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  163. package/dist/features/toolbars/inline/client/Toolbar/index.css +0 -1
  164. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  165. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  166. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  167. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  168. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  169. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  170. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -13
  171. package/dist/features/typesServer.d.ts +1 -1
  172. package/dist/features/typesServer.d.ts.map +1 -1
  173. package/dist/features/typesServer.js.map +1 -1
  174. package/dist/features/upload/client/component/index.js +2 -1
  175. package/dist/features/upload/client/component/index.js.map +1 -1
  176. package/dist/features/upload/client/index.d.ts +3 -2
  177. package/dist/features/upload/client/index.d.ts.map +1 -1
  178. package/dist/features/upload/client/index.js.map +1 -1
  179. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  180. package/dist/features/upload/client/plugin/index.js +47 -52
  181. package/dist/features/upload/client/plugin/index.js.map +1 -1
  182. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  183. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  184. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  185. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  186. package/dist/features/upload/server/index.d.ts +6 -2
  187. package/dist/features/upload/server/index.d.ts.map +1 -1
  188. package/dist/features/upload/server/index.js +20 -16
  189. package/dist/features/upload/server/index.js.map +1 -1
  190. package/dist/features/upload/server/schema.d.ts +2 -2
  191. package/dist/features/upload/server/schema.d.ts.map +1 -1
  192. package/dist/features/upload/server/schema.js +4 -8
  193. package/dist/features/upload/server/schema.js.map +1 -1
  194. package/dist/features/upload/server/validate.d.ts +2 -2
  195. package/dist/features/upload/server/validate.d.ts.map +1 -1
  196. package/dist/features/upload/server/validate.js +3 -0
  197. package/dist/features/upload/server/validate.js.map +1 -1
  198. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  199. package/dist/field/Diff/converters/listitem/index.js +2 -1
  200. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  201. package/dist/field/Diff/index.d.ts +3 -2
  202. package/dist/field/Diff/index.d.ts.map +1 -1
  203. package/dist/field/Diff/index.js +1 -0
  204. package/dist/field/Diff/index.js.map +1 -1
  205. package/dist/field/RenderLexical/index.d.ts +3 -1
  206. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  207. package/dist/field/RenderLexical/index.js +23 -23
  208. package/dist/field/RenderLexical/index.js.map +1 -1
  209. package/dist/field/ViewSelector.d.ts.map +1 -1
  210. package/dist/field/ViewSelector.js +1 -0
  211. package/dist/field/ViewSelector.js.map +1 -1
  212. package/dist/field/bundled.css +1 -1
  213. package/dist/field/index.css +10 -10
  214. package/dist/i18n.d.ts.map +1 -1
  215. package/dist/i18n.js +68 -0
  216. package/dist/i18n.js.map +1 -1
  217. package/dist/index.d.ts +2 -2
  218. package/dist/index.d.ts.map +1 -1
  219. package/dist/index.js +5 -5
  220. package/dist/index.js.map +1 -1
  221. package/dist/lexical/LexicalEditor.css +18 -20
  222. package/dist/lexical/LexicalEditor.js.map +1 -1
  223. package/dist/lexical/config/server/loader.d.ts +1 -1
  224. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  225. package/dist/lexical/config/server/loader.js +2 -2
  226. package/dist/lexical/config/server/loader.js.map +1 -1
  227. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  228. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  229. package/dist/lexical/config/server/sanitize.js +2 -2
  230. package/dist/lexical/config/server/sanitize.js.map +1 -1
  231. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +16 -24
  232. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  233. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  234. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  235. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +0 -1
  236. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  237. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -20
  238. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  239. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  240. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  241. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
  242. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  243. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  244. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  245. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  246. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  247. package/dist/lexical/ui/ContentEditable.css +16 -15
  248. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  249. package/dist/lexical/ui/icons/H3/index.js +13 -6
  250. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  251. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  252. package/dist/lexical/ui/icons/H4/index.js +13 -6
  253. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  254. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  255. package/dist/lexical/ui/icons/H5/index.js +13 -6
  256. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  257. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  258. package/dist/lexical/ui/icons/H6/index.js +13 -6
  259. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  260. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  261. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  262. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  263. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  264. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  265. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  266. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  267. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  268. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  269. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  270. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  271. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  272. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  273. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  274. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  275. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  276. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  277. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  278. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  279. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  280. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  281. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  282. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  283. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  284. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  285. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  286. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  287. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  288. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  289. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  290. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  291. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  292. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  293. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  294. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  295. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  296. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  297. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  298. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  299. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  300. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  301. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  302. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  303. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  304. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  305. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  306. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  307. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  308. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  309. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  310. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  311. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  312. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  313. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  314. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  315. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  316. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  317. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  318. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  319. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  320. package/dist/types/index.d.ts +1 -1
  321. package/dist/types/index.d.ts.map +1 -1
  322. package/dist/types/index.js.map +1 -1
  323. package/dist/types/nodeTypes.d.ts +1 -1
  324. package/dist/types/nodeTypes.d.ts.map +1 -1
  325. package/dist/types/nodeTypes.js.map +1 -1
  326. package/dist/utilities/createServerFeature.d.ts +1 -1
  327. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  328. package/dist/utilities/createServerFeature.js +2 -2
  329. package/dist/utilities/createServerFeature.js.map +1 -1
  330. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  331. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  332. package/dist/utilities/editorConfigFactory.js +9 -9
  333. package/dist/utilities/editorConfigFactory.js.map +1 -1
  334. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  335. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  336. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  337. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  338. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  339. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  340. package/package.json +97 -24
  341. package/dist/dependencyChecker.spec.js +0 -16
  342. package/dist/dependencyChecker.spec.js.map +0 -1
  343. package/dist/exports/client/Field-QGSHF22S.js +0 -2
  344. package/dist/exports/client/Field-QGSHF22S.js.map +0 -7
  345. package/dist/exports/client/chunk-UD4DQ4AK.js +0 -2
  346. package/dist/exports/client/chunk-UD4DQ4AK.js.map +0 -7
  347. package/dist/exports/client/chunk-X3D4LZS7.js +0 -2
  348. package/dist/exports/client/chunk-X3D4LZS7.js.map +0 -7
  349. package/dist/exports/client/component-PHZQBOJE.js +0 -2
  350. package/dist/exports/client/component-PHZQBOJE.js.map +0 -7
  351. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  352. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  353. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  354. package/dist/features/experimental_table/client/index.js.map +0 -1
  355. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  356. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  357. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  358. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  359. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  360. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  361. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  362. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  363. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  364. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  365. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  366. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  367. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  368. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  369. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  370. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  371. package/dist/features/experimental_table/server/index.d.ts +0 -3
  372. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  373. package/dist/features/experimental_table/server/index.js.map +0 -1
  374. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  375. package/dist/features/experimental_table/server/schema.js.map +0 -1
  376. package/dist/features/link/markdownTransformer.spec.js +0 -195
  377. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  378. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  379. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  380. package/dist/lexical/utils/url.spec.js +0 -114
  381. package/dist/lexical/utils/url.spec.js.map +0 -1
  382. package/dist/utilities/jsx/jsx.spec.js +0 -178
  383. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  384. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  385. /package/dist/features/{experimental_table → table}/client/index.js +0 -0
  386. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -0
  387. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  388. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  389. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  390. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  391. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  392. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -0
  393. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  394. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  395. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  396. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  397. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  398. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  399. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  400. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  401. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  402. /package/dist/features/{experimental_table → table}/markdownTransformer.d.ts +0 -0
  403. /package/dist/features/{experimental_table → table}/markdownTransformer.js +0 -0
  404. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  405. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -1,26 +1,26 @@
1
- "use client";import{a as be,c as xt,d as Ct,e as bt}from"./chunk-ESITTE3C.js";import{a as qe}from"./chunk-DBWINSQN.js";import{a as Oo,b as Qe}from"./chunk-UD4DQ4AK.js";import{a as hr,b as gr,c as Oe}from"./chunk-5VIL27GI.js";import{a as Xc}from"./chunk-WSAPGI3Z.js";import{a as se,b as xr,c as Fo,d as Bo,e as Zc,f as Yc,h as qc,j as Qc,m as eu}from"./chunk-X3D4LZS7.js";import{a as Jc,b as U}from"./chunk-RJ5MAOKZ.js";function X(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as lu}from"react/compiler-runtime";import{useLexicalComposerContext as iu}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as ke}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as su}from"@lexical/utils";import{$getSelection as au,$isElementNode as me,$isNodeSelection as cu,$isRangeSelection as kt,COMMAND_PRIORITY_LOW as uu,FORMAT_ELEMENT_COMMAND as _t}from"lexical";import{useEffect as du}from"react";import{jsx as Cr}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-.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",br=({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:tu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as kr}from"react/jsx-runtime";import"react";var ou="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",_r=({className:t})=>kr("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:kr("path",{clipRule:"evenodd",d:ou,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Tr}from"react/jsx-runtime";import"react";var nu="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})=>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:nu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as wr}from"react/jsx-runtime";import"react";var ru="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",Er=({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:ru,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 Sr=t=>({type:"dropdown",ChildComponent:Ut,iconOnly:!0,items:t,key:"align",order:30});var Ie=t=>me(t)?t.getFormatType():t.__format,Nr=[Sr([{ChildComponent:Ut,isActive:({selection:t})=>{if(!kt(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(_t,"left")},order:1},{ChildComponent:br,isActive:({selection:t})=>{if(!kt(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(_t,"center")},order:2},{ChildComponent:Er,isActive:({selection:t})=>{if(!kt(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(_t,"right")},order:3},{ChildComponent:_r,isActive:({selection:t})=>{if(!kt(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(_t,"justify")},order:4}])],mu=()=>{let t=lu(3),[e]=iu(),o,n;return t[0]!==e?(o=()=>e.registerCommand(_t,hu,uu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),du(o,n),null},pu=A({plugins:[{Component:mu,position:"normal"}],toolbarFixed:{groups:Nr},toolbarInline:{groups:Nr}});function fu(t){return(me(t)||ke(t))&&!t.isInline()}function hu(t){let e=au();if(!kt(e)&&!cu(e))return!1;let o=e.getNodes();for(let n of o){let r=su(n,fu);r!==null&&r.setFormat(t)}return!0}import{QUOTE as Cu}from"@lexical/markdown";import{$createQuoteNode as Ir,$isQuoteNode as vr,QuoteNode as bu}from"@lexical/rich-text";import{$setBlocksType as Mr}from"@lexical/selection";import{$getSelection as Ar,$isRangeSelection as ku}from"lexical";import{jsx as Lr}from"react/jsx-runtime";import"react";var gu="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",Po=({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",{d:gu,fill:"currentColor"})});import{jsx as yr}from"react/jsx-runtime";import"react";var xu={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"},Tt=({className:t,size:e=24})=>yr("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:yr("path",{clipRule:"evenodd",d:xu[e],fill:"currentColor",fillRule:"evenodd"})});var te=t=>({type:"dropdown",ChildComponent:Tt,items:t,key:"text",order:25});var Rr=[te([{ChildComponent:Po,isActive:({selection:t})=>{if(!ku(t))return!1;for(let e of t.getNodes())if(!vr(e)&&!vr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ar();Mr(e,()=>Ir())})},order:20}])],_u=A({markdownTransformers:[Cu],nodes:[bu],slashMenu:{groups:[X([{Icon:Po,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ar();Mr(e,()=>Ir())})}}])]},toolbarFixed:{groups:Rr},toolbarInline:{groups:Rr}});import{getTranslation as qt}from"@payloadcms/translations";import{jsx as $r}from"react/jsx-runtime";import"react";var Tu="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",jo=({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",{d:Tu,fill:"currentColor"})});import{jsx as Dr}from"react/jsx-runtime";import"react";var wu="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",Ho=({className:t})=>Dr("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:Dr("path",{clipRule:"evenodd",d:wu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Eu}from"react/jsx-runtime";import"react";function Or(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()=>Eu("img",{alt:u,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as el}from"lexical";import{JSOX as Go}from"jsox";function Vt({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=Su(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function Su(t,e){let o=t[e];return o==='"'?Fr(t,e):o==="'"?Fr(t,e,!0):o==="{"?Lu(t,e):o==="["?Nu(t,e):vu(t,e)}function Nu(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:Go.parse(`[${n}]`)}}function Fr(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 Lu(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:yu(n)}}function yu(t){return t[0]!=="{"?Go.parse(t):Go.parse(t.replace(/(\w+):/g,'"$1":'))}function vu(t,e){let o="",n=e;for(;n<t.length&&t[n]!==" ";)o+=t[n],n++;return{newIndex:n-1,value:o}}function wt({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${Ru(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,Br)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Br)}}`));return e.join(" ")}function Ru(t){return t.replace(/"/g,"&quot;")}function Br(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Wt({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,p=!1,h=0,f=u[0].slice(0,r.index),g=0,_=n;e:for(let[R,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(R===0&&(k=(r.index??0)+r[0].length-C);k<x.length;){let T=x[k],I=x[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)),_=R;for(let N=k;N<x.length;N++)if(x[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)),_=R,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){p=!0,_=R,g=k+2;break e}else if(T===">"&&a===0&&!m){d=!0,k++;continue}s+=T}k++}if(d?i?.length>0&&R>0&&(i+=`
1
+ "use client";import{a as Ce,c as bt,d as kt,e as _t}from"./chunk-ESITTE3C.js";import{a as Qe}from"./chunk-DBWINSQN.js";import{a as Po,b as et,c as tt,d as ve,e as ot}from"./chunk-43E5QYAA.js";import{a as kr,b as _r,c as Oe}from"./chunk-5VIL27GI.js";import{a as ou}from"./chunk-WSAPGI3Z.js";import{a as ae,b as Tr,c as Er,d as Bo,e as jo,f as nu,g as ru,i as lu,k as iu,n as su}from"./chunk-LN6VX25I.js";import{a as tu,b as W}from"./chunk-RJ5MAOKZ.js";function Q(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as mu}from"react/compiler-runtime";import{useLexicalComposerContext as pu}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as be}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as fu}from"@lexical/utils";import{$getSelection as hu,$isElementNode as pe,$isNodeSelection as gu,$isRangeSelection as Tt,COMMAND_PRIORITY_LOW as xu,FORMAT_ELEMENT_COMMAND as Et}from"lexical";import{useEffect as Cu}from"react";import{jsx as wr}from"react/jsx-runtime";import"react";var au="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",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:au,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Nr}from"react/jsx-runtime";import"react";var cu="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",Lr=({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:cu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as yr}from"react/jsx-runtime";import"react";var uu="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})=>yr("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:yr("path",{clipRule:"evenodd",d:uu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Rr}from"react/jsx-runtime";import"react";var du="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",vr=({className:t})=>Rr("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:Rr("path",{clipRule:"evenodd",d:du,fill:"currentColor",fillRule:"evenodd"})});var M=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 Ir=t=>({type:"dropdown",ChildComponent:Ut,iconOnly:!0,items:t,key:"align",order:30});var Ie=t=>pe(t)?t.getFormatType():t.__format,Mr=[Ir([{ChildComponent:Ut,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||be(e))&&Ie(e)==="left")continue;let o=e.getParent();if(!((pe(o)||be(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:Sr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||be(e))&&Ie(e)==="center")continue;let o=e.getParent();if(!((pe(o)||be(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:vr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||be(e))&&Ie(e)==="right")continue;let o=e.getParent();if(!((pe(o)||be(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:Lr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||be(e))&&Ie(e)==="justify")continue;let o=e.getParent();if(!((pe(o)||be(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}])],bu=()=>{let t=mu(3),[e]=pu(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Et,Tu,xu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Cu(o,n),null},ku=M({plugins:[{Component:bu,position:"normal"}],toolbarFixed:{groups:Mr},toolbarInline:{groups:Mr}});function _u(t){return(pe(t)||be(t))&&!t.isInline()}function Tu(t){let e=hu();if(!Tt(e)&&!gu(e))return!1;let o=e.getNodes();for(let n of o){let r=fu(n,_u);r!==null&&r.setFormat(t)}return!0}import{QUOTE as Su}from"@lexical/markdown";import{$createQuoteNode as Fr,$isQuoteNode as Dr,QuoteNode as Nu}from"@lexical/rich-text";import{$setBlocksType as Pr}from"@lexical/selection";import{$getSelection as Br,$isRangeSelection as Lu}from"lexical";import{jsx as Ar}from"react/jsx-runtime";import"react";var Eu="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})=>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:Eu,fill:"currentColor"})});import{jsx as $r}from"react/jsx-runtime";import"react";var wu={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})=>$r("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:$r("path",{clipRule:"evenodd",d:wu[e],fill:"currentColor",fillRule:"evenodd"})});var ne=t=>({type:"dropdown",ChildComponent:wt,items:t,key:"text",order:25});var Or=[ne([{ChildComponent:Ho,isActive:({selection:t})=>{if(!Lu(t))return!1;for(let e of t.getNodes())if(!Dr(e)&&!Dr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Br();Pr(e,()=>Fr())})},order:20}])],yu=M({markdownTransformers:[Su],nodes:[Nu],slashMenu:{groups:[Q([{Icon:Ho,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Br();Pr(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 Ru="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",Go=({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:Ru,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",zo=({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 Iu}from"react/jsx-runtime";import"react";function Gr(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()=>Iu("img",{alt:u,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as cl}from"lexical";import{JSOX as Uo}from"jsox";function Wt({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=Mu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function Mu(t,e){let o=t[e];return o==='"'?zr(t,e):o==="'"?zr(t,e,!0):o==="{"?$u(t,e):o==="["?Au(t,e):Ou(t,e)}function Au(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:Uo.parse(`[${n}]`)}}function zr(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 $u(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:Du(n)}}function Du(t){return t[0]!=="{"?Uo.parse(t):Uo.parse(t.replace(/(\w+):/g,'"$1":'))}function Ou(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}="${Fu(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,Ur)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Ur)}}`));return e.join(" ")}function Fu(t){return t.replace(/"/g,"&quot;")}function Ur(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,p=!1,f=0,h=u[0].slice(0,r.index),x=0,C=n;e:for(let[w,g]of u.entries()){let b=l?g.trim():g,k=0;if(l)for(let T=0;T<g.length&&g[T]===" ";T++)k++;let _=0;for(w===0&&(_=(r.index??0)+r[0].length-k);_<b.length;){let T=b[_],I=b[_+1];if(d){if(T==="`"&&f++,f%2===0)if(T==="<"&&I==="/"){if(c--,c<0){i[i.length-1]===`
2
+ `&&(i=i.slice(0,-1)),C=w;for(let N=_;N<b.length;N++)if(b[N]===">"){x=N+1;break}break e}}else if(T==="/"&&I===">"){if(c--,c<0){i[i.length-1]===`
3
+ `&&(i=i.slice(0,-1)),C=w,x=_+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){p=!0,C=w,x=_+2;break e}else if(T===">"&&a===0&&!m){d=!0,_++;continue}s+=T}_++}if(d?i?.length>0&&w>0&&(i+=`
4
4
  `):s+=`
5
- `,o&&c<0){let T=x.match(o);if(T?.index!==void 0){_=R,g=T.index+T[0].length-1;break}}if(R===u.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
5
+ `,o&&c<0){let T=b.match(o);if(T?.index!==void 0){C=w,x=T.index+T[0].length-1;break}}if(w===u.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
6
6
  `)+`
7
7
 
8
- . Start match: `+JSON.stringify(r))}return{afterEndLine:u[_].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:n+_,endlineLastCharIndex:g,propsString:s}}import{jsx as md}from"react/jsx-runtime";import pd from"bson-objectid";import{$applyNodeReplacement as fd}from"lexical";import"react";import{DecoratorBlockNode as Iu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Mu}from"@lexical/utils";import Au from"bson-objectid";import{$applyNodeReplacement as $u}from"lexical";var Et=class extends Iu{__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=Du(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Mu(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 Du(t){return $u(new Et({fields:{...t,id:t?.id||new Au.default().toHexString()}}))}import{jsx as V,jsxs as St}from"react/jsx-runtime";import{useLexicalComposerContext as Uu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Vu}from"@lexical/react/useLexicalEditable";import{getTranslation as Wu}from"@payloadcms/translations";import{Button as Gr,Collapsible as zu,Drawer as Ku,EditDepthProvider as Ju,ErrorPill as Xu,Form as Zu,formatDrawerSlug as Yu,MoreIcon as qu,Pill as Qu,Popup as ed,PopupList as Uo,RenderFields as td,SectionTitle as od,useConfig as nd,useDocumentForm as rd,useDocumentInfo as Ur,useEditDepth as ld,useFormSubmitted as id,useServerFunctions as sd,useTranslation as ad,XIcon as cd}from"@payloadcms/ui";import{abortAndIgnore as Vo}from"@payloadcms/ui/shared";import{$getNodeByKey as Kt,$getRoot as ud,SKIP_DOM_SELECTION_TAG as Wo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as Jt,reduceFieldsToValues as Vr}from"payload/shared";import Fe,{useCallback as zo,useEffect as Xt,useMemo as Be,useRef as Ko}from"react";import{v4 as dd}from"uuid";import{c as Ou}from"react/compiler-runtime";import{jsx as zt,jsxs as Fu}from"react/jsx-runtime";import{useLexicalEditable as Bu}from"@lexical/react/useLexicalEditable";import{RenderFields as Pu,useFormSubmitted as ju}from"@payloadcms/ui";import Hu,{createContext as Gu}from"react";var Pr=Gu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>Hu.use(Pr),jr=t=>{let e=Ou(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:u}=l,c=ju()&&i>0,a=Bu(),m;e[0]!==o||e[1]!==i||e[2]!==c?(m=f=>{let{children:g,..._}=f;return zt(o,{errorCount:i,fieldHasErrors:c,..._,children:g})},e[0]=o,e[1]=i,e[2]=c,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return n?Fu(Pr,{value:h,children:[n,zt(s,{})]}):zt(p,{children:zt(Pu,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function Hr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Wr=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=id(),{id:u,collectionSlug:d,globalSlug:c}=Ur(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=U(),{fields:g}=rd(),_=Ko(new AbortController),L=ld(),[R,b]=Fe.useState(0),{config:x}=nd(),C=Yu({slug:`lexical-blocks-create-${f}-${l.id}`,depth:L}),{toggleDrawer:k}=Oe(C),{getDocPreferences:T,setDocFieldPreferences:I}=Ur(),[N]=Uu(),E=Vu(),S=l.blockType,{getFormState:w}=sd(),v=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}.fields`,[y,M]=Fe.useState(()=>{let P=p?.[l.id]?.formState;if(!P)return!1;let q=Object.fromEntries(Object.entries(P).map(([G,W])=>[G,G in l?{...W,initialValue:l[G],value:l[G]}:W]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),$=Ko(!1),D=Ko(e);Xt(()=>{$.current?(D.current!==e&&M(!1),D.current=e):$.current=!0},[e]);let[F]=Fe.useState(()=>dd()),[B,Y]=Fe.useState(()=>{if(!r)return y?._components?.customComponents?.BlockLabel??void 0}),[J,Je]=Fe.useState(()=>{if(!n)return y?._components?.customComponents?.Block??void 0}),Re=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]);Xt(()=>{let P=new AbortController;return l&&!y&&(async()=>{let{state:G}=await w({id:u,collectionSlug:d,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Jt(g,{excludeFiles:!0}),globalSlug:c,initialBlockData:l,operation:"update",readOnly:!E,renderAllFields:!0,schemaPath:v,signal:P.signal});if(G){G.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let W=Vr(Jt(G,{excludeFiles:!0}),!0);N.update(()=>{let z=Kt(s);if(z&&Me(z)){let ie=W;ie.blockType=S,z.setFields(ie,!0)}},{tag:Wo}),M(G),r||Y(G._components?.customComponents?.BlockLabel??void 0),n||Je(G._components?.customComponents?.Block??void 0)}})(),()=>{Vo(P)}},[w,v,E,u,r,n,l,N,s,y,d,c,T,g,S]);let[le,Ce]=Fe.useState(p?.[l.id]?.collapsed??!1),Ht=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}`,ft=a.blocks?.[Ht]?.[0]?.blocks?.[0],ee=typeof ft=="string"?x.blocksMap[ft]:ft,{i18n:ht,t:de}=ad(),Ao=zo(async({formState:P,submit:q})=>{Vo(_.current);let G=new AbortController;_.current=G;let{state:W}=await w({id:u,collectionSlug:d,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Jt(g,{excludeFiles:!0}),formState:P,globalSlug:c,initialBlockFormState:P,operation:"update",readOnly:!E,renderAllFields:!!q,schemaPath:v,signal:G.signal});if(!W)return P;P.blockName&&(W.blockName=P.blockName);let z=Vr(Hr({fields:Jt(W,{excludeFiles:!0})}),!0);if(setTimeout(()=>{N.update(()=>{let ie=Kt(s);if(ie&&Me(ie)){let Ye=z;Ye.blockType=S,ie.setFields(Ye,!0)}},{tag:Wo})},0),q){r||Y(W._components?.customComponents?.BlockLabel??void 0),n||Je(W._components?.customComponents?.Block??void 0);let ie=0;for(let Ye of Object.values(W))Ye?.valid===!1&&ie++;b(ie)}return W},[w,u,d,T,c,v,S,g,E,N,s,n,r]);Xt(()=>()=>{Vo(_.current)},[]);let Gt=zo(()=>{N.update(()=>{Kt(s)?.remove()})},[N,s]),[lr,Uc]=Fe.useState(0);Xt(()=>{let P=()=>{N.getEditorState().read(()=>{let G=ud().getChildren(),W=0;for(let z of G)if(Me(z)){if(z.getKey()===s){Uc(W);return}W++}})};return P(),N.registerUpdateListener(()=>{P()})},[N,s]);let Ze=ee?.labels?.singular?Wu(ee.labels.singular,ht):ee?.slug,ir=zo(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]),sr=Be(()=>()=>V(Gr,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!E,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:Ze})}),[o,E,de,Ze,k]),ar=Be(()=>()=>V(Gr,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!E,icon:"x",onClick:P=>{P.preventDefault(),Gt()},round:!0,tooltip:"Remove Block"}),[o,E,Gt]),$o=Be(()=>({Actions:P,children:q,className:G,collapsibleProps:W,disableBlockName:z,editButton:ie,errorCount:Ye,fieldHasErrors:Do,Label:pr,Pill:fr,removeButton:Wc,showDragHandle:zc=!0,showRowNumber:Kc=!0})=>V("div",{className:`${o}__container ${o}-${S}`,children:V(zu,{actions:typeof P<"u"?P:E?V(ed,{button:V(qu,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",render:({close:gt})=>St(Uo.ButtonGroup,{buttonSize:"medium",children:[(Re&&ie!==!1||!Re&&ie)&&V(Uo.Button,{onClick:()=>{k(),gt()},children:de("general:edit")}),Wc!==!1&&St(Uo.Button,{onClick:()=>{Gt(),gt()},children:[V(cd,{}),de("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Do?`${o}__row--has-errors`:`${o}__row--no-errors`,G].filter(Boolean).join(" "),collapsibleStyle:Do?"error":"default",dragHandleProps:zc?{id:s,attributes:{role:"button",tabIndex:0},listeners:{}}:void 0,header:V("div",{className:`${o}__block-header`,children:typeof pr<"u"?pr:typeof xe<"u"?xe:St("div",{className:`${o}__block-label`,children:[Kc&&V("span",{className:`${o}__block-number`,children:String(lr+1).padStart(2,"0")}),typeof fr<"u"?fr:V(Qu,{className:`${o}__block-pill ${o}__block-pill-${S}`,pillStyle:"white",size:"small",children:Ze??S}),!z&&!ee?.admin?.disableBlockName&&V(od,{path:"blockName",readOnly:!E}),Do&&V(Xu,{count:Ye??0,i18n:ht,withMessage:!0})]})}),isCollapsed:le,onToggle:gt=>{ir(gt),Ce(gt)},...W||{},children:q},0)}),[Re,xe,Ze,o,ee?.admin?.disableBlockName,S,ht,le,ir,E,s,Gt,lr,de,k]),cr=l?.id,{headerActions:ur,submitRef:dr}=hr(),mr=Be(()=>()=>V(Ju,{children:V(Ku,{className:"",headerActions:ur,slug:C,title:de(`lexical:blocks:inlineBlocks:${cr?"edit":"create"}`,{label:Ze??de("lexical:blocks:inlineBlocks:label")}),children:y?St("div",{className:"fields-drawer",children:[V(td,{fields:ee?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!E}),V(gr,{submitRef:dr})]}):null})}),[y,C,cr,Ze,de,E,ee?.fields,v,ur,dr]),Vc=Be(()=>y?V("div",{"data-block-drawer-slug":C,style:{display:"contents"},children:V(Zu,{beforeSubmit:[async({formState:P})=>await Ao({formState:P,submit:!0})],el:"div",fields:ee?.fields??[],initialState:y,onChange:[Ao],onSubmit:(P,q)=>{q.blockType=S,N.update(()=>{let G=Kt(s);G&&Me(G)&&G.setFields(q,!0)},{tag:Wo}),k()},submitted:i,uuid:F,children:V(jr,{baseClass:o,BlockDrawer:mr,Collapsible:$o,CustomBlock:Re,CustomLabel:xe,EditButton:sr,errorCount:R,formSchema:ee?.fields??[],initialState:y,nodeKey:s,RemoveButton:ar})})}):null,[$o,mr,Re,xe,S,C,ar,sr,o,N,R,k,ee?.fields,F,y,s,Ao,i]);return ee?Vc:V($o,{disableBlockName:!0,fieldHasErrors:!0,children:St("div",{className:`${o}-not-found`,children:["Error: Block '",S,"' not found in the config but exists in the lexical data"]})})};var ce=class extends Et{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 md(Wr,{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 fd(new ce({fields:{...t,id:t?.id||new pd.default().toHexString()}}))}function Me(t){return t instanceof ce}import{createHeadlessEditor as hd}from"@lexical/headless";import{$convertToMarkdownString as gd}from"@lexical/markdown";function Jo(t,e){return({editorState:n})=>{let r=hd({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=gd(e)}),l}}import{createHeadlessEditor as Nd}from"@lexical/headless";import{$convertFromMarkdownString as Qr,TRANSFORMERS as Sd}from"@lexical/markdown";var zr=/^[\t ]*$/,xd=/^(\s*)(\d+)\.\s/,Cd=/^(\s*)[-*+]\s/,bd=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,Kr=/^(#{1,6})\s/,kd=/^>\s/,_d=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,Jr=/[ \t]*(\\`\\`\\`|```)$/,Td=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,wd=/^\|(.+)\|\s?$/,Ed=/^(\| ?:?-*:? ?)+\|\s?$/,Xr=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Zr=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function Yr(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];let e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function qr(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?Yr(i):null,c=u!==void 0&&Yr(u)!==null;if(Td.test(i)){r.push(i);continue}if(Jr.test(i)){l===0&&(n=!0),l===1&&(n=!1),l>0&&l--,r.push(i);continue}if(_d.test(i)){n=!0,l++,r.push(i);continue}if(n){r.push(i);continue}zr.test(i)||zr.test(u)||!u||Kr.test(u)||Kr.test(i)||kd.test(i)||xd.test(i)||Cd.test(i)||bd.test(i)||wd.test(i)||Ed.test(i)||c||!e||Xr.test(i)||Zr.test(i)||Xr.test(u)||Zr.test(u)||Jr.test(u)?r.push(i):r[r.length-1]=u+" "+(d===null?i.trim():i.trimStart())}return r.join(`
10
- `)}function Zt(t,e=Sd,o,n=!1,r=!1){if(n)return Qr(t,e,o,!0);let l=qr(t,r);return Qr(l,e,o,!1,!1)}function Yt(t,e){return({markdown:n})=>{let r=Nd({nodes:t});return r.update(()=>{Zt(n,e,void 0,!1,!0)},{discrete:!0}),r.getEditorState().toJSON()}}function Ld(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var ol=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=tl(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=tl(n,!0);r&&(o=o.concat(r))}return o};function tl(t,e){if(!t.jsx)return null;let o=Ld(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[xt],export:s=>{if(!bt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=Jo(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?" "+wt({props:a}):""}>${d.children}</${i.blockType}>`:`<${i.blockType}${c?" "+wt({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:u}=Wt({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}=Wt({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?Vt({propsString:d}):{}});if(a===!1)return;let m=Ct({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=Jo(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,p="";if(m.includes(`
11
- `))for(let h of m.split(`
12
- `)){let f="";!t?.jsx?.doNotTrimChildren&&h!==""&&(f=" "),f+=h+`
13
- `,p+=f}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
- `;return`<${i.blockType}${c?" "+wt({props:a}):""}>
15
- ${p}</${i.blockType}>`}return`<${i.blockType}${c?" "+wt({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:p,beforeStartLine:h,content:f,endLineIndex:g,propsString:_}=Wt({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:u,startMatch:d,trimChildren:!1}),L="";if(t?.jsx?.doNotTrimChildren)L=f.endsWith(`
16
- `)?f.slice(0,-1):f;else if(f.includes(`
17
- `)){let C=f.split(`
18
- `),k=0;for(let T of C){if(k++,T.startsWith(" "))L+=T.slice(2);else if(T==="")L+=T;else{L=f.endsWith(`
19
- `)?f.slice(0,-1):f;break}L+=k===C.length?"":`
20
- `}}else L=(f.startsWith(" ")?f.slice(2):f)+`
21
- `;if(!t?.jsx?.import)return[!1,u];let R=Yt(r,l),b=t.jsx.import({children:L,closeMatch:null,htmlToLexical:null,markdownToLexical:R,openMatch:d,props:_?Vt({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=R({markdown:h})?.root?.children??[];let T=C?.[0];T&&i.append(el(T))}if(i.append(x),p?.length){k=R({markdown:p})?.root?.children;let T=i.getChildren()[i.getChildren().length-1],I=el(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(`
8
+ . Start match: `+JSON.stringify(r))}return{afterEndLine:u[C].trim().slice(x),beforeStartLine:h,content:i,endLineIndex:n+C,endlineLastCharIndex:x,propsString:s}}import{jsx as Nd}from"react/jsx-runtime";import Ld from"bson-objectid";import{$applyNodeReplacement as yd}from"lexical";import"react";import{DecoratorBlockNode as Pu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Bu}from"@lexical/utils";import ju from"bson-objectid";import{$applyNodeReplacement as Hu}from"lexical";var Nt=class extends Pu{__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=Gu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Bu(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 Gu(t){return Hu(new Nt({fields:{...t,id:t?.id||new ju.default().toHexString()}}))}import{jsx as G,jsxs as Me,Fragment as od}from"react/jsx-runtime";import{useLexicalComposerContext as nd}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as rd}from"@lexical/react/useLexicalEditable";import{getTranslation as ld}from"@payloadcms/translations";import{Button as Zr,Collapsible as id,Drawer as sd,EditDepthProvider as ad,ErrorPill as cd,Form as ud,formatDrawerSlug as dd,MoreIcon as md,Pill as pd,Popup as fd,PopupList as Lt,RenderFields as hd,SectionTitle as gd,useConfig as xd,useDocumentForm as Cd,useDocumentInfo as qr,useEditDepth as bd,useFormSubmitted as kd,useServerFunctions as _d,useTranslation as Td,XIcon as Ed}from"@payloadcms/ui";import{abortAndIgnore as Ko}from"@payloadcms/ui/shared";import{$getNodeByKey as Xt,$getRoot as wd,SKIP_DOM_SELECTION_TAG as Jo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as Yt,reduceFieldsToValues as Qr}from"payload/shared";import Fe,{useCallback as Xo,useEffect as Zt,useMemo as Pe,useRef as Yo}from"react";import{v4 as Sd}from"uuid";import{c as zu}from"react/compiler-runtime";import{jsx as Kt,jsxs as Uu}from"react/jsx-runtime";import{useLexicalEditable as Wu}from"@lexical/react/useLexicalEditable";import{RenderFields as Vu,useFormSubmitted as Ku}from"@payloadcms/ui";import Ju,{createContext as Xu}from"react";var Wr=Xu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ce=()=>Ju.use(Wr),Vr=t=>{let e=zu(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:u}=l,c=Ku()&&i>0,a=Wu(),m;e[0]!==o||e[1]!==i||e[2]!==c?(m=h=>{let{children:x,...C}=h;return Kt(o,{errorCount:i,fieldHasErrors:c,...C,children:x})},e[0]=o,e[1]=i,e[2]=c,e[3]=m):m=e[3];let p=m,f={...l,BlockCollapsible:p};return n?Uu(Wr,{value:f,children:[n,Kt(s,{})]}):Kt(p,{children:Kt(Vu,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};import{useId as td}from"react";import{$getNodeByKey as Jt,COMMAND_PRIORITY_HIGH as Yu,KEY_ENTER_COMMAND as Zu,SKIP_DOM_SELECTION_TAG as qu}from"lexical";import{useCallback as Wo,useEffect as Kr,useLayoutEffect as Qu,useRef as Vo,useState as ed}from"react";function Jr({editor:t,nodeKey:e}){let[o,n]=ed(null),r=Vo(null),l=Vo(!1),s=Vo(!1),i=o!==null;Kr(()=>t.registerCommand(Zu,a=>{let m=a?.target;return m instanceof HTMLElement&&!!t.getElementByKey(e)?.contains(m)&&!!m.closest(".collapsible__actions button")},Yu),[t,e]),Kr(()=>{if(!i)return;let a,m=()=>{l.current=!0},p=()=>{l.current=!1,s.current&&(a=setTimeout(()=>{r.current=null,n(null)},0))};return document.addEventListener("pointerdown",m,!0),document.addEventListener("pointerup",p,!0),document.addEventListener("pointercancel",p,!0),()=>{document.removeEventListener("pointerdown",m,!0),document.removeEventListener("pointerup",p,!0),document.removeEventListener("pointercancel",p,!0),clearTimeout(a),l.current=!1,s.current=!1}},[i]),Qu(()=>{if(o===null)return;let a=[];return t.getEditorState().read(()=>{let m=Jt(e),p=m?.getParent()?.getChildren(),f=m?.getIndexWithinParent();if(!p||f===void 0||f===o)return;let h=p.map(I=>t.getElementByKey(I.getKey())),x=h[f],C=h[o],E=h[f+(o>f?1:-1)];if(!x||!C||!E)return;let w=x.getBoundingClientRect(),g=C.getBoundingClientRect(),b=E.getBoundingClientRect(),k=o>f,_=k?g.bottom-w.bottom:g.top-w.top,T=k?w.top-b.top:w.bottom-b.bottom;for(let I=Math.min(f,o);I<=Math.max(f,o);I++){let N=h[I];if(N){let S=N.style.translate;a.push(()=>{N.style.translate=S}),N.style.translate=`0 ${I===f?_:T}px`}}x.querySelector(".collapsible__drag")?.scrollIntoView({block:"nearest"})}),()=>a.forEach(m=>m())},[t,e,o]);let u=Wo(({direction:a,index:m})=>{t.isEditable()&&t.update(()=>{let p=Jt(e),f=p?.getParent()?.getChildren();if(!p||!f)return;let h=p.getIndexWithinParent(),x=m??h+(a??0),C=f[x];C&&C!==p&&(x<h?C.insertBefore(p):C.insertAfter(p))},{onUpdate:()=>{requestAnimationFrame(()=>{let p=t.getElementByKey(e)?.querySelector(".collapsible__toggle-wrap");(p?.querySelector(".collapsible__drag")??p?.querySelector(".LexicalEditorTheme__block__actions-button"))?.focus()})},tag:qu})},[t,e]),d=Wo(a=>{t.isEditable()&&(a.key===" "||a.key==="Enter"?(a.preventDefault(),a.stopPropagation(),r.current===null?(t.getEditorState().read(()=>{r.current=Jt(e)?.getIndexWithinParent()??null}),n(r.current)):(u({index:r.current}),r.current=null,n(null))):r.current!==null&&(a.key==="Escape"||a.key==="Tab"?(r.current=null,n(null),a.key==="Escape"&&(a.preventDefault(),a.stopPropagation())):(a.key==="ArrowUp"||a.key==="ArrowDown")&&(a.preventDefault(),a.stopPropagation(),t.getEditorState().read(()=>{let m=Jt(e)?.getParent()?.getChildrenSize()??0;r.current=Math.max(0,Math.min(m-1,(r.current??0)+(a.key==="ArrowDown"?1:-1)))}),n(r.current))))},[t,u,e]),c=Wo(()=>{if(l.current){s.current=!0;return}r.current=null,n(null)},[]);return{isReordering:i,move:u,onBlur:c,onKeyDown:d,targetIndex:o}}function Xr({children:t,editor:e,nodeKey:o}){let n=Jr({editor:e,nodeKey:o}),r=td();return t({...n,reorderInstructionsID:r})}function Yr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var el=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=kd(),{id:u,collectionSlug:d,globalSlug:c}=qr(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:f},uuid:h}=W(),{fields:x}=Cd(),C=Yo(new AbortController),E=bd(),[w,g]=Fe.useState(0),{config:b}=xd(),k=dd({slug:`lexical-blocks-create-${h}-${l.id}`,depth:E}),{toggleDrawer:_}=Oe(k),{getDocPreferences:T,setDocFieldPreferences:I}=qr(),[N]=nd(),S=rd(),y=l.blockType,{getFormState:L}=_d(),R=`${f}.lexical_internal_feature.blocks.lexical_blocks.${y}.fields`,[v,A]=Fe.useState(()=>{let H=p?.[l.id]?.formState;if(!H)return!1;let q=Object.fromEntries(Object.entries(H).map(([U,K])=>[U,U in l?{...K,initialValue:l[U],value:l[U]}:K]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),$=Yo(!1),O=Yo(e);Zt(()=>{$.current?(O.current!==e&&A(!1),O.current=e):$.current=!0},[e]);let[B]=Fe.useState(()=>Sd()),[F,z]=Fe.useState(()=>{if(!r)return v?._components?.customComponents?.BlockLabel??void 0}),[V,Ye]=Fe.useState(()=>{if(!n)return v?._components?.customComponents?.Block??void 0}),Re=Pe(()=>n?G(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ce}):V,[n,o,l,s,V]),ge=Pe(()=>r?G(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ce}):F,[r,o,l,s,F]);Zt(()=>{let H=new AbortController;return l&&!v&&(async()=>{let{state:U}=await L({id:u,collectionSlug:d,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Yt(x,{excludeFiles:!0}),globalSlug:c,initialBlockData:l,operation:"update",readOnly:!S,renderAllFields:!0,schemaPath:R,signal:H.signal});if(U){U.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let K=Qr(Yt(U,{excludeFiles:!0}),!0);N.update(()=>{let J=Xt(s);if(J&&Ae(J)){let ue=K;ue.blockType=y,J.setFields(ue,!0)}},{tag:Jo}),A(U),r||z(U._components?.customComponents?.BlockLabel??void 0),n||Ye(U._components?.customComponents?.Block??void 0)}})(),()=>{Ko(H)}},[L,R,S,u,r,n,l,N,s,v,d,c,T,x,y]);let[se,xe]=Fe.useState(p?.[l.id]?.collapsed??!1),Gt=`${f}.lexical_internal_feature.blocks.lexical_blocks.${y}`,xt=a.blocks?.[Gt]?.[0]?.blocks?.[0],oe=typeof xt=="string"?b.blocksMap[xt]:xt,{i18n:Ct,t:Y}=Td(),$o=Xo(async({formState:H,submit:q})=>{Ko(C.current);let U=new AbortController;C.current=U;let{state:K}=await L({id:u,collectionSlug:d,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Yt(x,{excludeFiles:!0}),formState:H,globalSlug:c,initialBlockFormState:H,operation:"update",readOnly:!S,renderAllFields:!!q,schemaPath:R,signal:U.signal});if(!K)return H;H.blockName&&(K.blockName=H.blockName);let J=Qr(Yr({fields:Yt(K,{excludeFiles:!0})}),!0);if(setTimeout(()=>{N.update(()=>{let ue=Xt(s);if(ue&&Ae(ue)){let De=J;De.blockType=y,ue.setFields(De,!0)}},{tag:Jo})},0),q){r||z(K._components?.customComponents?.BlockLabel??void 0),n||Ye(K._components?.customComponents?.Block??void 0);let ue=0;for(let De of Object.values(K))De?.valid===!1&&ue++;g(ue)}return K},[L,u,d,T,c,R,y,x,S,N,s,n,r]);Zt(()=>()=>{Ko(C.current)},[]);let zt=Xo(()=>{N.update(()=>{Xt(s)?.remove()})},[N,s]),[sr,Vc]=Fe.useState(0);Zt(()=>{let H=()=>{N.getEditorState().read(()=>{let U=wd().getChildren(),K=0;for(let J of U)if(Ae(J)){if(J.getKey()===s){Vc(K);return}K++}})};return H(),N.registerUpdateListener(()=>{H()})},[N,s]);let qe=oe?.labels?.singular?ld(oe.labels.singular,Ct):oe?.slug,ar=Xo(H=>{T().then(q=>{let K=q?.fields?.[m.name]?.collapsed,J=K&&K?.length?K:[];H?J.includes(l.id)||J.push(l.id):J.includes(l.id)&&J.splice(J.indexOf(l.id),1),I(m.name,{collapsed:J,hello:"hi"})})},[T,m.name,I,l.id]),cr=Pe(()=>()=>G(Zr,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!S,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),_(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"medium",tooltip:Y("lexical:blocks:inlineBlocks:edit",{label:qe})}),[o,S,Y,qe,_]),ur=Pe(()=>()=>G(Zr,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!S,icon:"x",onClick:H=>{H.preventDefault(),zt()},round:!0,tooltip:"Remove Block"}),[o,S,zt]),Do=Pe(()=>function({Actions:q,children:U,className:K,collapsibleProps:J,disableBlockName:ue,editButton:De,errorCount:Jc,fieldHasErrors:Oo,Label:hr,Pill:gr,removeButton:Xc,showDragHandle:Yc=!0,showRowNumber:Zc=!0}){return G(Xr,{editor:N,nodeKey:s,children:({isReordering:xr,move:Cr,onBlur:qc,onKeyDown:Qc,reorderInstructionsID:br,targetIndex:eu})=>G("div",{className:`${o}__container ${o}-${y}`,onKeyDownCapture:X=>{let Fo=X.target;X.altKey||X.ctrlKey||X.metaKey||Fo.closest(".collapsible")?.parentElement!==X.currentTarget||(Fo.matches(".collapsible__drag")&&[" ","ArrowDown","ArrowUp","Enter","Escape","Tab"].includes(X.key)?(Qc(X),X.stopPropagation()):X.key==="Tab"&&Fo.matches(".collapsible__toggle")&&X.stopPropagation())},children:Me(id,{actions:typeof q<"u"?q:S?G(fd,{button:G(md,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",popupType:"menu",render:({close:X})=>Me(Lt.ButtonGroup,{buttonSize:"medium",children:[G(Lt.Button,{onClick:()=>{X(),Cr({direction:-1})},children:Y("general:moveUp")}),G(Lt.Button,{onClick:()=>{X(),Cr({direction:1})},children:Y("general:moveDown")}),(Re&&De!==!1||!Re&&De)&&G(Lt.Button,{onClick:()=>{_(),X()},children:Y("general:edit")}),Xc!==!1&&Me(Lt.Button,{onClick:()=>{zt(),X()},children:[G(Ed,{}),Y("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Oo?`${o}__row--has-errors`:`${o}__row--no-errors`,K].filter(Boolean).join(" "),collapsibleStyle:Oo?"error":"default",dragHandleProps:Yc&&S?{id:s,attributes:{"aria-describedby":br,"aria-pressed":xr,role:"button",tabIndex:0},listeners:{onBlur:qc}}:void 0,header:G("div",{className:`${o}__block-header`,children:typeof hr<"u"?hr:typeof ge<"u"?ge:Me("div",{className:`${o}__block-label`,children:[Zc&&G("span",{className:`${o}__block-number`,children:String(sr+1).padStart(2,"0")}),typeof gr<"u"?gr:G(pd,{className:`${o}__block-pill ${o}__block-pill-${y}`,pillStyle:"white",size:"small",children:qe??y}),!ue&&!oe?.admin?.disableBlockName&&G(gd,{path:"blockName",readOnly:!S}),Oo&&G(cd,{count:Jc??0,i18n:Ct,withMessage:!0})]})}),isCollapsed:se,onToggle:X=>{ar(X),xe(X)},...J||{},AfterCollapsible:Me(od,{children:[J?.AfterCollapsible,G("span",{className:"sr-only",role:"status",children:xr?`${Y("general:order")}: ${(eu??0)+1}`:""})]}),children:[Me("span",{className:"sr-only",id:br,children:["Space / Enter \xB7 ",Y("general:moveUp")," \u2191 \xB7 ",Y("general:moveDown")," \u2193 \xB7"," ",Y("general:cancel")," Escape"]}),U]},0)})})},[N,Re,ge,qe,o,oe?.admin?.disableBlockName,y,Ct,se,ar,S,s,zt,sr,Y,_]),dr=l?.id,{headerActions:mr,submitRef:pr}=kr(),fr=Pe(()=>()=>G(ad,{children:G(sd,{className:"",headerActions:mr,slug:k,title:Y(`lexical:blocks:inlineBlocks:${dr?"edit":"create"}`,{label:qe??Y("lexical:blocks:inlineBlocks:label")}),children:v?Me("div",{className:"fields-drawer",children:[G(hd,{fields:oe?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:R,permissions:!0,readOnly:!S}),G(_r,{submitRef:pr})]}):null})}),[v,k,dr,qe,Y,S,oe?.fields,R,mr,pr]),Kc=Pe(()=>v?G("div",{"data-block-drawer-slug":k,style:{display:"contents"},children:G(ud,{beforeSubmit:[async({formState:H})=>await $o({formState:H,submit:!0})],el:"div",fields:oe?.fields??[],initialState:v,onChange:[$o],onSubmit:(H,q)=>{q.blockType=y,N.update(()=>{let U=Xt(s);U&&Ae(U)&&U.setFields(q,!0)},{tag:Jo}),_()},submitted:i,uuid:B,children:G(Vr,{baseClass:o,BlockDrawer:fr,Collapsible:Do,CustomBlock:Re,CustomLabel:ge,EditButton:cr,errorCount:w,formSchema:oe?.fields??[],initialState:v,nodeKey:s,RemoveButton:ur})})}):null,[Do,fr,Re,ge,y,k,ur,cr,o,N,w,_,oe?.fields,B,v,s,$o,i]);return oe?Kc:G(Do,{disableBlockName:!0,fieldHasErrors:!0,children:Me("div",{className:`${o}-not-found`,children:["Error: Block '",y,"' not found in the config but exists in the lexical data"]})})};var de=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=Be(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return Nd(el,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return yd(new de({fields:{...t,id:t?.id||new Ld.default().toHexString()}}))}function Ae(t){return t instanceof de}import{createHeadlessEditor as Rd}from"@lexical/headless";import{$convertToMarkdownString as vd}from"@lexical/markdown";function Zo(t,e){return({editorState:n})=>{let r=Rd({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=vd(e)}),l}}import{createHeadlessEditor as jd}from"@lexical/headless";import{$convertFromMarkdownString as al,TRANSFORMERS as Bd}from"@lexical/markdown";var tl=/^[\t ]*$/,Id=/^(\s*)(\d+)\.\s/,Md=/^(\s*)[-*+]\s/,Ad=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,ol=/^(#{1,6})\s/,$d=/^>\s/,Dd=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,nl=/[ \t]*(\\`\\`\\`|```)$/,Od=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Fd=/^\|(.+)\|\s?$/,Pd=/^(\| ?:?-*:? ?)+\|\s?$/,rl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,ll=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function il(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];let e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function sl(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?il(i):null,c=u!==void 0&&il(u)!==null;if(Od.test(i)){r.push(i);continue}if(nl.test(i)){l===0&&(n=!0),l===1&&(n=!1),l>0&&l--,r.push(i);continue}if(Dd.test(i)){n=!0,l++,r.push(i);continue}if(n){r.push(i);continue}tl.test(i)||tl.test(u)||!u||ol.test(u)||ol.test(i)||$d.test(i)||Id.test(i)||Md.test(i)||Ad.test(i)||Fd.test(i)||Pd.test(i)||c||!e||rl.test(i)||ll.test(i)||rl.test(u)||ll.test(u)||nl.test(u)?r.push(i):r[r.length-1]=u+" "+(d===null?i.trim():i.trimStart())}return r.join(`
10
+ `)}function qt(t,e=Bd,o,n=!1,r=!1){if(n)return al(t,e,o,!0);let l=sl(t,r);return al(l,e,o,!1,!1)}function Qt(t,e){return({markdown:n})=>{let r=jd({nodes:t});return r.update(()=>{qt(n,e,void 0,!1,!0)},{discrete:!0}),r.getEditorState().toJSON()}}function Hd(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var dl=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=ul(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=ul(n,!0);r&&(o=o.concat(r))}return o};function ul(t,e){if(!t.jsx)return null;let o=Hd(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),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?" "+St({props:a}):""}>${d.children}</${i.blockType}>`:`<${i.blockType}${c?" "+St({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=Qt(r,l),a=t.jsx.import({children:u,closeMatch:null,htmlToLexical:null,markdownToLexical:c,openMatch:i,props:d?Wt({propsString:d}):{}});if(a===!1)return;let m=kt({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[de],export:s=>{if(!Ae(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=Zo(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,p="";if(m.includes(`
11
+ `))for(let f of m.split(`
12
+ `)){let h="";!t?.jsx?.doNotTrimChildren&&f!==""&&(h=" "),h+=f+`
13
+ `,p+=h}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
+ `;return`<${i.blockType}${c?" "+St({props:a}):""}>
15
+ ${p}</${i.blockType}>`}return`<${i.blockType}${c?" "+St({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:p,beforeStartLine:f,content:h,endLineIndex:x,propsString:C}=Vt({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:u,startMatch:d,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=h.endsWith(`
16
+ `)?h.slice(0,-1):h;else if(h.includes(`
17
+ `)){let k=h.split(`
18
+ `),_=0;for(let T of k){if(_++,T.startsWith(" "))E+=T.slice(2);else if(T==="")E+=T;else{E=h.endsWith(`
19
+ `)?h.slice(0,-1):h;break}E+=_===k.length?"":`
20
+ `}}else E=(h.startsWith(" ")?h.slice(2):h)+`
21
+ `;if(!t?.jsx?.import)return[!1,u];let w=Qt(r,l),g=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:w,openMatch:d,props:C?Wt({propsString:C}):{}});if(g===!1)return[!1,u];let b=Be({...g,blockType:t.slug});if(b){let k=null,_=null;if(f?.length){k=w({markdown:f})?.root?.children??[];let T=k?.[0];T&&i.append(cl(T))}if(i.append(b),p?.length){_=w({markdown:p})?.root?.children;let T=i.getChildren()[i.getChildren().length-1],I=cl(_[0])?.getChildren();if(I?.length)for(let N of I)T.append(N)}}return[!0,x]},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 x="";if(i)for(let C of i)x+=C.getTextContent();c=[x]}let a="";t?.jsx?.doNotTrimChildren?a=c.join(`
22
22
  `):a=c.join(`
23
- `).trim();let m=u[1]?.trim(),p=Yt(r,l),h=t.jsx.import({children:a,closeMatch:d,htmlToLexical:null,markdownToLexical:p,openMatch:u,props:m?Vt({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 nl}from"lexical";var et=nl("INSERT_BLOCK_COMMAND"),tt=nl("INSERT_INLINE_BLOCK_COMMAND");import{c as yd}from"react/compiler-runtime";import{useLexicalComposerContext as vd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Rd,$wrapNodeInElement as Id,mergeRegister as Md}from"@lexical/utils";import{formatDrawerSlug as Ad,useEditDepth as $d}from"@payloadcms/ui";import{$createParagraphNode as Dd,$getNodeByKey as Od,$getPreviousSelection as Fd,$getSelection as Bd,$insertNodes as Pd,$isParagraphNode as jd,$isRangeSelection as Hd,$isRootOrShadowRoot as Gd,COMMAND_PRIORITY_EDITOR as rl}from"lexical";import{useEffect as Ud,useState as Vd}from"react";var ll=()=>{let t=yd(12),[e]=vd(),[o,n]=Vd(null),{setCreatedInlineBlock:r,uuid:l}=U(),s=$d(),i="lexical-inlineBlocks-create-"+l,u;t[0]!==s||t[1]!==i?(u=Ad({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=u):u=t[2];let d=u,{toggleDrawer:c}=Oe(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 Md(e.registerCommand(et,p=>(e.update(()=>{let h=Bd()||Fd();if(Hd(h)){let f=Pe(p),{focus:g}=h,_=g.getNode();Rd(f),jd(_)&&!_.__first&&_.remove()}}),!0),rl),e.registerCommand(tt,p=>{if(o){let f=Od(o);return!f||!bt(f)?!1:(f.setFields(p),n(null),!0)}let h=Ct(p);return r?.(h),Pd([h]),Gd(h.getParentOrThrow())&&Id(h,Dd).selectEnd(),!0},rl))},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],Ud(a,m),null};var Wd=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:ol({blocks:d,inlineBlocks:c}),nodes:[ce,xt],plugins:[{Component:ll,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[d?.length?{items:d.map(a=>({Icon:Or(a,jo),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(et,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,c?.length?{items:c.map(a=>({Icon:Ho,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(tt,{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:jo,items:d.map((a,m)=>({isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?qt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(et,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,c?.length?{type:"dropdown",ChildComponent:Ho,items:c.map((a,m)=>({isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?qt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(tt,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Jd}from"react/compiler-runtime";import{jsx as He,jsxs as qo}from"react/jsx-runtime";import{useLexicalComposerContext as Xd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Zd,$createTextNode as Yd,$getRoot as qd,getDOMSelection as Xo}from"lexical";import*as ul from"react";import{useCallback as je,useEffect as Zo,useLayoutEffect as sl,useRef as Yo,useState as Qt}from"react";var zd=se&&"documentMode"in document?document.documentMode:null,il=se&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Qb=se&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),e6=se&&"InputEvent"in window&&!zd?"getTargetRanges"in new window.InputEvent("input"):!1,t6=se&&/Version\/[\d.].*Safari/.test(navigator.userAgent),o6=se&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,n6=se&&/Android/.test(navigator.userAgent),r6=se&&/Win/.test(navigator.platform),Kd=se&&/^(?=.*Chrome).*/i.test(navigator.userAgent),l6=se&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Kd;var Qd=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)},e1=(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)},t1=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);
23
+ `).trim();let m=u[1]?.trim(),p=Qt(r,l),f=t.jsx.import({children:a,closeMatch:d,htmlToLexical:null,markdownToLexical:p,openMatch:u,props:m?Wt({propsString:m}):{}});if(f===!1)return!1;let h=Be({...f,blockType:t.slug});h&&s.append(h);return}return!1}})),n)}import{createCommand as ml}from"lexical";var nt=ml("INSERT_BLOCK_COMMAND"),rt=ml("INSERT_INLINE_BLOCK_COMMAND");import{c as Gd}from"react/compiler-runtime";import{useLexicalComposerContext as zd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ud,$wrapNodeInElement as Wd,mergeRegister as Vd}from"@lexical/utils";import{formatDrawerSlug as Kd,useEditDepth as Jd}from"@payloadcms/ui";import{$createParagraphNode as Xd,$getNodeByKey as Yd,$getPreviousSelection as Zd,$getSelection as qd,$insertNodes as Qd,$isParagraphNode as em,$isRangeSelection as tm,$isRootOrShadowRoot as om,COMMAND_PRIORITY_EDITOR as pl}from"lexical";import{useEffect as nm,useState as rm}from"react";var fl=()=>{let t=Gd(12),[e]=zd(),[o,n]=rm(null),{setCreatedInlineBlock:r,uuid:l}=W(),s=Jd(),i="lexical-inlineBlocks-create-"+l,u;t[0]!==s||t[1]!==i?(u=Kd({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=u):u=t[2];let d=u,{toggleDrawer:c}=Oe(d,!0),a;t[3]!==e||t[4]!==r||t[5]!==o?(a=()=>{if(!e.hasNodes([de]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Vd(e.registerCommand(nt,p=>(e.update(()=>{let f=qd()||Zd();if(tm(f)){let h=Be(p),{focus:x}=f,C=x.getNode();Ud(h),em(C)&&!C.__first&&C.remove()}}),!0),pl),e.registerCommand(rt,p=>{if(o){let h=Yd(o);return!h||!_t(h)?!1:(h.setFields(p),n(null),!0)}let f=kt(p);return r?.(f),Qd([f]),om(f.getParentOrThrow())&&Wd(f,Xd).selectEnd(),!0},pl))},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],nm(a,m),null};var lm=M(({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:dl({blocks:d,inlineBlocks:c}),nodes:[de,bt],plugins:[{Component:fl,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[d?.length?{items:d.map(a=>({Icon:Gr(a,Go),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(nt,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,c?.length?{items:c.map(a=>({Icon:zo,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(rt,{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:Go,items:d.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(nt,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,c?.length?{type:"dropdown",ChildComponent:zo,items:c.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(rt,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as am}from"react/compiler-runtime";import{jsx as He,jsxs as tn}from"react/jsx-runtime";import{useLexicalComposerContext as cm}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as um,$createTextNode as dm,$getRoot as mm,getDOMSelection as qo}from"lexical";import*as bl from"react";import{useCallback as je,useEffect as Qo,useLayoutEffect as gl,useRef as en,useState as to}from"react";var im=ae&&"documentMode"in document?document.documentMode:null,hl=ae&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),A7=ae&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),$7=ae&&"InputEvent"in window&&!im?"getTargetRanges"in new window.InputEvent("input"):!1,D7=ae&&/Version\/[\d.].*Safari/.test(navigator.userAgent),O7=ae&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,F7=ae&&/Android/.test(navigator.userAgent),P7=ae&&/Win/.test(navigator.platform),sm=ae&&/^(?=.*Chrome).*/i.test(navigator.userAgent),B7=ae&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!sm;var pm=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)},fm=(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)},hm=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);
24
24
  await assertSelection(page, {
25
25
  anchorPath: [${r.anchorPath.toString()}],
26
26
  anchorOffset: ${r.anchorOffset},
@@ -30,7 +30,7 @@ ${p}</${i.blockType}>`}return`<${i.blockType}${c?" "+wt({props:a}):""}/>`},handl
30
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(`
31
31
  `);default:return` await repeat(${t.count}, async () => {
32
32
  ${o}
33
- );`}};function o1(t){return t.key.toLowerCase()==="a"&&(il?t.metaKey:t.ctrlKey)}function n1(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 al(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 cl=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function r1(t){let[e,o]=Qt([]),[n,r]=Qt(!1),[,l]=Qt(""),[s,i]=Qt(""),u=Yo(null),d=Yo(!1),c=Yo(null),a=je(()=>t,[t]),m=je(()=>{let b=t.getRootElement(),x=Xo(t._window);return b==null||x==null||x.anchorNode==null||x.focusNode==null||!b.contains(x.anchorNode)||!b.contains(x.focusNode)?null:`
33
+ );`}};function gm(t){return t.key.toLowerCase()==="a"&&(hl?t.metaKey:t.ctrlKey)}function xm(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 xl(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 Cl=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Cm(t){let[e,o]=to([]),[n,r]=to(!1),[,l]=to(""),[s,i]=to(""),u=en(null),d=en(!1),c=en(null),a=je(()=>t,[t]),m=je(()=>{let g=t.getRootElement(),b=qo(t._window);return g==null||b==null||b.anchorNode==null||b.focusNode==null||!g.contains(b.anchorNode)||!g.contains(b.focusNode)?null:`
34
34
  import {
35
35
  initializeE2E,
36
36
  assertHTMLSnapshot,
@@ -47,19 +47,19 @@ describe('Test case', () => {
47
47
  const {page} = e2e;
48
48
 
49
49
  await page.focus('div[contenteditable="true"]');
50
- ${e.map(t1).join(`
50
+ ${e.map(hm).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[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]);sl(()=>{let b=C=>{if(!n)return;let k=C.key;o1(C)?p("selectAll",""):cl.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;!cl.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]),sl(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),Zo(()=>{if(e){let b=m();b!==null&&i(b),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),Zo(()=>t.registerUpdateListener(({dirtyElements:x,dirtyLeaves:C,editorState:k})=>{if(!n)return;let T=k._selection,I=u.current,N=d.current;if(I!==T){if(C.size===0&&x.size===0&&!N){let S=Xo(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,p]),Zo(()=>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=qd();x.clear();let C=Yd();x.append(Zd().append(C)),C.select()}),o([])),r(x=>!x)},[n]),f=je(()=>{if(!n)return;let b=Xo(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:x,anchorOffset:C,focusNode:k,focusOffset:T}=n1(b),I=a().getRootElement(),N;x!==null&&(N=al(x,I));let E;k!==null&&(E=al(k,I)),p("snapshot",{anchorNode:x,anchorOffset:C,anchorPath:N,focusNode:k,focusOffset:T,focusPath:E})},[p,n,a]),g=je(()=>{Qd(m())},[m]),_=je(()=>{e1("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?qo("div",{className:"test-recorder-output",children:[qo("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:c,children:s})]}):null]}var dl=()=>{let t=Jd(3),[e]=Xd(),[o,n]=r1(e),r;return t[0]!==o||t[1]!==n?(r=qo(ul.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 l1=A({plugins:[{Component:dl,position:"bottom"}]});import{c as i1}from"react/compiler-runtime";import{jsx as s1}from"react/jsx-runtime";import{useLexicalComposerContext as a1}from"@lexical/react/LexicalComposerContext.js";import{TreeView as c1}from"@lexical/react/LexicalTreeView.js";import"react";var ml=()=>{let t=i1(2),[e]=a1(),o;return t[0]!==e?(o=s1(c1,{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 u1=A({plugins:[{Component:ml,position:"bottom"}]});import{BOLD_ITALIC_STAR as m1,BOLD_ITALIC_UNDERSCORE as p1,BOLD_STAR as f1,BOLD_UNDERSCORE as h1}from"@lexical/markdown";import{$isTableSelection as g1}from"@lexical/table";import{$isRangeSelection as x1,FORMAT_TEXT_COMMAND as C1}from"lexical";import{jsx as pl}from"react/jsx-runtime";import"react";var d1="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})=>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",{clipRule:"evenodd",d:d1,fill:"currentColor",fillRule:"evenodd"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var hl=[Z([{ChildComponent:fl,isActive:({selection:t})=>x1(t)||g1(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(C1,"bold")},order:1}])],b1=A(({featureProviderMap:t})=>{let e=[f1,h1];return t.get("italic")&&e.push(p1,m1),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:hl},toolbarInline:{groups:hl}}});import{INLINE_CODE 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 gl}from"react/jsx-runtime";import"react";var k1="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",xl=({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",{clipRule:"evenodd",d:k1,fill:"currentColor",fillRule:"evenodd"})});var Cl=[Z([{ChildComponent:xl,isActive:({selection:t})=>w1(t)||T1(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(E1,"code")},order:7}])],S1=A({enableFormats:["code"],markdownTransformers:[_1],toolbarFixed:{groups:Cl},toolbarInline:{groups:Cl}});import{ITALIC_STAR as L1,ITALIC_UNDERSCORE as y1}from"@lexical/markdown";import{$isTableSelection as v1}from"@lexical/table";import{$isRangeSelection as R1,FORMAT_TEXT_COMMAND as I1}from"lexical";import{jsx as bl}from"react/jsx-runtime";import"react";var N1="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",kl=({className:t})=>bl("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:bl("path",{clipRule:"evenodd",d:N1,fill:"currentColor",fillRule:"evenodd"})});var _l=[Z([{ChildComponent:kl,isActive:({selection:t})=>R1(t)||v1(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(I1,"italic")},order:2}])],M1=A({enableFormats:["italic"],markdownTransformers:[L1,y1],toolbarFixed:{groups:_l},toolbarInline:{groups:_l}});import{STRIKETHROUGH as $1}from"@lexical/markdown";import{$isTableSelection as D1}from"@lexical/table";import{$isRangeSelection as O1,FORMAT_TEXT_COMMAND as F1}from"lexical";import{jsx as Tl}from"react/jsx-runtime";import"react";var A1="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",wl=({className:t})=>Tl("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:Tl("path",{d:A1,fill:"currentColor"})});var El=[Z([{ChildComponent:wl,isActive:({selection:t})=>O1(t)||D1(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(F1,"strikethrough")},order:4}])],B1=A({enableFormats:["strikethrough"],markdownTransformers:[$1],toolbarFixed:{groups:El},toolbarInline:{groups:El}});import{$isTableSelection as j1}from"@lexical/table";import{$isRangeSelection as H1,FORMAT_TEXT_COMMAND as G1}from"lexical";import{jsx as Sl}from"react/jsx-runtime";import"react";var P1="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",Nl=({className:t})=>Sl("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:Sl("path",{d:P1,fill:"currentColor"})});var Ll=[Z([{ChildComponent:Nl,isActive:({selection:t})=>H1(t)||j1(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(G1,"subscript")},order:5}])],U1=A({enableFormats:["subscript"],toolbarFixed:{groups:Ll},toolbarInline:{groups:Ll}});import{$isTableSelection as W1}from"@lexical/table";import{$isRangeSelection as z1,FORMAT_TEXT_COMMAND as K1}from"lexical";import{jsx as yl}from"react/jsx-runtime";import"react";var V1="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",vl=({className:t})=>yl("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:yl("path",{d:V1,fill:"currentColor"})});var Rl=[Z([{ChildComponent:vl,isActive:({selection:t})=>z1(t)||W1(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(K1,"superscript")},order:6}])],J1=A({enableFormats:["superscript"],toolbarFixed:{groups:Rl},toolbarInline:{groups:Rl}});import{$isTableSelection as Z1}from"@lexical/table";import{$isRangeSelection as Y1,FORMAT_TEXT_COMMAND as q1}from"lexical";import{jsx as Il}from"react/jsx-runtime";import"react";var X1="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",Ml=({className:t})=>Il("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:Il("path",{clipRule:"evenodd",d:X1,fill:"currentColor",fillRule:"evenodd"})});var Al=[Z([{ChildComponent:Ml,isActive:({selection:t})=>Y1(t)||Z1(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(q1,"underline")},order:3}])],Q1=A({enableFormats:["underline"],toolbarFixed:{groups:Al},toolbarInline:{groups:Al}});import{jsx as en}from"react/jsx-runtime";import{jsx as em}from"react/jsx-runtime";function tm(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])=>[tm(o),n])):{};return em("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as om}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as nm}from"@lexical/selection";import{$getNodeByKey as rm,$getState as lm,$setState as im,createState as sm,TextNode as am}from"lexical";import{useEffect as cm}from"react";function $l(t){let e=new Map;for(let o in t){let n=t[o],r=sm(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function Qo(t,e,o,n){t.update(()=>{nm(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);im(r,l.stateConfig,n)})})}function Dl({stateMap:t}){let[e]=om();return cm(()=>e.registerMutationListener(am,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=rm(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((u,d)=>{let c=lm(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 Ol=(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:()=>en(eo,{css:i.css}),key:s,label:i.label,onSelect:({editor:u})=>{Qo(u,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>en(eo,{css:{color:"var(--color-icon-secondary)"}}),items:[...[{ChildComponent:()=>en(eo,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)Qo(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},um=A(({props:t})=>{let e=$l(t.state);return{plugins:[{Component:()=>Dl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Ol(t,e)},toolbarInline:{groups:Ol(t,e)}}});import{c as Cm}from"react/compiler-runtime";import{useLexicalComposerContext as bm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as km,$isHeadingNode as Zl,HeadingNode as Ql}from"@lexical/rich-text";import{$setBlocksType as _m}from"@lexical/selection";import{$getSelection as Tm,$isRangeSelection as wm}from"lexical";import{useEffect as Em}from"react";import{jsx as Fl}from"react/jsx-runtime";import"react";var dm="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",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:dm,fill:"currentColor"})});import{jsx as Pl}from"react/jsx-runtime";import"react";var mm="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",jl=({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:mm,fill:"currentColor"})});import{jsx as Hl}from"react/jsx-runtime";import"react";var pm="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",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",{d:pm,fill:"currentColor"})});import{jsx as Ul}from"react/jsx-runtime";import"react";var fm="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",Vl=({className:t})=>Ul("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:Ul("path",{d:fm,fill:"currentColor"})});import{jsx as Wl}from"react/jsx-runtime";import"react";var hm="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",zl=({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:hm,fill:"currentColor"})});import{jsx as Kl}from"react/jsx-runtime";import"react";var gm="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",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",{d:gm,fill:"currentColor"})});import{HEADING as xm}from"@lexical/markdown";var Xl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`;return{...xm,regExp:new RegExp(o)}};var Yl=t=>{let e=Tm();_m(e,()=>km(t))},ql={h1:Bl,h2:jl,h3:Gl,h4:Vl,h5:zl,h6:Jl},Sm=A(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((n,r)=>({ChildComponent:ql[n],isActive:({selection:l})=>{if(!wm(l))return!1;for(let s of l.getNodes()){if(Zl(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(Zl(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(()=>{Yl(n)})},order:r+2})))];return{markdownTransformers:[Xl(e)],nodes:[Ql],plugins:[{Component:Nm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[X(e.map(n=>({Icon:ql[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(()=>{Yl(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),Nm=t=>{let e=Cm(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]=bm(),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]),Em(d,c),null};import{$isNodeSelection as Vm}from"lexical";import{jsx as ei}from"react/jsx-runtime";import"react";var Lm="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",tn=({className:t})=>ei("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:ei("path",{d:Lm,fill:"currentColor"})});import{jsx as ti}from"react/jsx-runtime";import"react";var ym={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"},oi=({className:t,size:e=24})=>ti("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ti("path",{clipRule:"evenodd",d:ym[e],fill:"currentColor",fillRule:"evenodd"})});var _e=t=>({type:"dropdown",ChildComponent:oi,items:t,key:"add",order:10});import{addClassNamesToElement as vm}from"@lexical/utils";import{$applyNodeReplacement as Rm,createCommand as Im,DecoratorNode as Mm}from"lexical";var Lt=Im("INSERT_HORIZONTAL_RULE_COMMAND"),Nt=class extends Mm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Am,priority:0})}}static importJSON(e){return ni()}createDOM(e){let o=document.createElement("hr");return vm(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 Am(){return{node:ni()}}function ni(){return Rm(new Nt)}import{$applyNodeReplacement as $m}from"lexical";import"react";var Te=class extends Nt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return ot()}decorate(){return null}exportJSON(){return super.exportJSON()}};function ot(){return $m(new Te)}function Ge(t){return t instanceof Te}var ri={type:"element",dependencies:[Te],export:(t,e)=>Ge(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=ot();e&&t.replace(e)}};import{c as Dm}from"react/compiler-runtime";import{useLexicalComposerContext as Om}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as li,$insertNodeToNearestRoot as Fm}from"@lexical/utils";import{$getRoot as Bm,$getSelection as ii,$isRangeSelection as si,$isRootOrShadowRoot as ai,COMMAND_PRIORITY_EDITOR as Pm}from"lexical";import{useEffect as jm}from"react";var on="LexicalEditorTheme__hrSelected",ci=()=>{let t=Dm(3),[e]=Om(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(Lt,Hm,Pm),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let d=Bm().getChildren(),c=ii(),a=[];for(let b=0;b<d.length;b++){let x=d[b];if(Ge(x)){let C=e.getElementByKey(x.getKey());C&&a.push({element:C,index:b})}}if(a.length===0)return;if(!si(c)||c.isCollapsed()){for(let{element:b}of a)b.classList.remove(on);return}let m=c.anchor.getNode(),p=c.focus.getNode(),h=li(m,Gm)||m,f=li(p,Um)||p,g=d.indexOf(h),_=d.indexOf(f);if(g===-1||_===-1)return;let L=Math.min(g,_),R=Math.max(g,_);for(let{element:b,index:x}of a)x>=L&&x<=R?b.classList.add(on):b.classList.remove(on)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),jm(o,n),null};function Hm(t){let e=ii();if(!si(e))return!1;if(e.focus.getNode()!==null){let n=ot();Fm(n)}return!0}function Gm(t){return ai(t.getParent())}function Um(t){return ai(t.getParent())}var Wm=A({markdownTransformers:[ri],nodes:[Te],plugins:[{Component:ci,position:"normal"}],slashMenu:{groups:[X([{Icon:tn,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,void 0)}}])]},toolbarFixed:{groups:[_e([{ChildComponent:tn,isActive:({selection:t})=>{if(!Vm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ge(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,void 0)}}])]}});import{$findMatchingParent as ki}from"@lexical/utils";import{$isElementNode as rp,INDENT_CONTENT_COMMAND as lp,OUTDENT_CONTENT_COMMAND as ip}from"lexical";import{jsx as nn}from"react/jsx-runtime";import"react";var zm="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",ui=({className:t})=>nn("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:nn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:nn("path",{clipRule:"evenodd",d:zm,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as di}from"react/jsx-runtime";import"react";var Km="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",mi=({className:t})=>di("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:di("path",{clipRule:"evenodd",d:Km,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Jm}from"react/jsx-runtime";import{useLexicalComposerContext as Xm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Zm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Ym,mergeRegister as pi}from"@lexical/utils";import{$getSelection as qm,$isElementNode as xi,$isRangeSelection as Qm,COMMAND_PRIORITY_LOW as fi,INDENT_CONTENT_COMMAND as hi,KEY_TAB_COMMAND as ep,OUTDENT_CONTENT_COMMAND as tp,TabNode as op}from"lexical";import{useEffect as gi}from"react";var Ci=({clientProps:t})=>{let[e]=Xm(),{disabledNodes:o,disableTabNode:n}=t;return gi(()=>{if(!(!e||!o?.length))return pi(e.registerCommand(hi,()=>np(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),fi),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);xi(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),gi(()=>{if(!(!e||!n))return pi(e.registerCommand(ep,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?tp:hi,void 0)),fi),e.registerNodeTransform(op,r=>{r.remove()}))},[e,n]),Jm(Zm,{})};function np(t){let e=qm();if(!Qm(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=Ym(l,d=>xi(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 bi=t=>({type:"buttons",items:t,key:"indent",order:35});var _i=({disabledNodes:t})=>[bi([{ChildComponent:ui,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Ti(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!ki(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ip,void 0)},order:1},{ChildComponent:mi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Ti(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!ki(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(lp,void 0)},order:2}])],sp=A(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Ci,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:_i({disabledNodes:e})},toolbarInline:{groups:_i({disabledNodes:e})}}}),Ti=t=>rp(t)&&t.canIndent();import{$findMatchingParent as Sf}from"@lexical/utils";import{$getSelection as hn,$isRangeSelection as ns}from"lexical";import{jsx as wi}from"react/jsx-runtime";import"react";var ap={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})=>wi("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:wi("path",{d:ap[e],fill:"currentColor"})});import{$isAtNodeEnd as Ei}from"@lexical/selection";function nt(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?Ei(o)?n:r:Ei(e)?n:r}var rn=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as _p}from"lexical";function ln(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 cp=/^(?:[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 Si(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||cp.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 dp,isHTMLAnchorElement as mp}from"@lexical/utils";import cn from"bson-objectid";import{$applyNodeReplacement as pp,$createTextNode as Ni,$getSelection as fp,$isElementNode as Li,$isRangeSelection as an,createCommand as hp,ElementNode as gp}from"lexical";var xp=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends gp{__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:Cp,priority:1})}}static importJSON(e){let o=we({}).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 cn.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=sn(o.rel,"add","noopener")),dp(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(!an(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(Li(n)){let r=we({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=sn(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=sn(o.rel,"remove","noopener"))),!1}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields).setID(o.id)}};function Cp(t){let e=null;if(mp(t)){let o=t.textContent;o!==null&&o!==""&&(e=we({id:new cn.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function we({id:t,fields:e}){return pp(new oe({id:t??new cn.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var pe=hp("TOGGLE_LINK_COMMAND");function un(t){let e=fp();if(!an(e)&&(t===null||!t.selectedNodes?.length))return;let o=an(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:bp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ni(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||Li(l)&&!l.isInline())){if(K(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ni(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=we({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 bp(t){return kp(t,e=>K(e))}function kp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function sn(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 Tp=(t,e)=>{let[,o,n]=e,r=we({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=_p(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},wp=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=ln(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=ln(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:Tp,trigger:")"}),yi=wp();import{$applyNodeReplacement as Ep,$isElementNode as Sp}from"lexical";var Ee=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=yt({}).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(Sp(n)){let r=yt({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields)}};function yt({fields:t}){return Ep(new Ee({id:"",fields:t}))}function Se(t){return t instanceof Ee}import{c as Np}from"react/compiler-runtime";import{useLexicalComposerContext as Lp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as yp}from"@lexical/utils";import{$createTextNode as vi,$getSelection as vp,$isElementNode as Ii,$isLineBreakNode as Mi,$isNodeSelection as Rp,$isRangeSelection as Ip,$isTextNode as vt,TextNode as Mp}from"lexical";import{useEffect as Ap}from"react";function Ri(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 Ai(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var $p=/[.,;\s]/;function no(t){return t!==void 0&&$p.test(t)}function $i(t){return no(t[t.length-1])}function mn(t){return no(t[0])}function Dp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Di(t){let e=t.getPreviousSibling();return Ii(e)&&(e=e.getLastDescendant()),e===null||Mi(e)||vt(e)&&$i(e.getTextContent())}function Oi(t){let e=t.getNextSibling();return Ii(e)&&(e=e.getFirstDescendant()),e===null||Mi(e)||vt(e)&&mn(e.getTextContent())}function Op(t,e,o,n){return(t>0?no(o[t-1]):Di(n[0]))?e<o.length?no(o[e]):Oi(n[n.length-1]):!1}function Fp(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 Bp(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=yt({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=vi(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 p=a.getTextContent().length,h=i,f=i+p;if(h<o)if(f<=o)d.push(a);else{let[g,_]=a.splitText(o-h);g&&d.push(g),c=_}i+=p}),u){let a=vp(),m=a?a.getNodes().find(vt):void 0,p=vi(u.getTextContent());return p.setFormat(u.getFormat()),p.setDetail(u.getDetail()),p.setStyle(u.getStyle()),l.append(p,...d),m&&m===u&&(Ip(a)?p.select(a.anchor.offset,a.focus.offset):Rp(a)&&p.select(0,p.getTextContent().length)),u.replace(l),c}}}function Pp(t,e,o){let n=[...t],r=n.map(u=>u.getTextContent()).join(""),l=r,s,i=0;for(;(s=Ai(l,e))!=null&&s!==null;){let u=s.index,d=s.length,c=u+d;if(Op(i+u,i+c,r,n)){let[m,,p,h]=Fp(n,i+u,i+c),f=i+u-m,g=i+c-m,_=Bp(p,f,g,s);n=_?[_,...h]:h,o(s.url,null),i=0}else i+=c;l=l.substring(c)}}function dn(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=Ai(l,e);if(s===null||s.text!==l){oo(t),o(null,t.getFields()?.url??null);return}if(!Di(t)||!Oi(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 jp(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;(!mn(l)||Dp(l,s))&&(n.append(t),dn(n,e,o),o(null,n.getFields()?.url??null))}Se(r)&&!$i(l)&&(oo(r),dn(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 Hp(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 Gp(t,e,o){let n=Np(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([Ee]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,u)=>{o?.(i,u)};return yp(t.registerNodeTransform(Mp,i=>{let u=i.getParentOrThrow(),d=i.getPreviousSibling();if(Se(u))dn(u,e,s);else if(!K(u)){if(i.isSimpleText()&&(mn(i.getTextContent())||!Se(d))){let c=Hp(i);Pp(c,e,s)}jp(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]),Ap(r,l)}var Up=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Vp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Wp=[Ri(Up,t=>t.startsWith("http")?t:`https://${t}`),Ri(Vp,t=>`mailto:${t}`)],Fi=()=>{let[t]=Lp();return Gp(t,Wp),null};import{jsx as zp}from"react/jsx-runtime";import{ClickableLinkPlugin as Kp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Bi=()=>zp(Kp,{});import{jsx as ff}from"react/jsx-runtime";import"react";import{createPortal as hf}from"react-dom";import{jsx as ne,jsxs as Ue,Fragment as pn}from"react/jsx-runtime";import{useLexicalComposerContext as Zp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Yp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Vi,mergeRegister as Wi}from"@lexical/utils";import{getTranslation as fn}from"@payloadcms/translations";import{formatDrawerSlug as qp,NewTabIcon as zi,useConfig as Qp,useEditDepth as ef,useLocale as tf,useTranslation as of,WriteIcon as nf}from"@payloadcms/ui";import{requests as rf}from"@payloadcms/ui/shared";import{$getSelection as Ki,$isLineBreakNode as lf,$isRangeSelection as Ji,COMMAND_PRIORITY_HIGH as sf,COMMAND_PRIORITY_LOW as Xi,getDOMSelection as af,KEY_ESCAPE_COMMAND as cf,SELECTION_CHANGE_COMMAND as uf}from"lexical";import{formatAdminURL as df}from"payload/shared";import mf,{useCallback as Zi,useEffect as io,useLayoutEffect as pf,useRef as Yi,useState as Ve}from"react";import{jsx as Pi}from"react/jsx-runtime";import"react";var Jp="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",ji=({className:t})=>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",{d:Jp,fill:"currentColor"})});import{jsx as Hi}from"react/jsx-runtime";import"react";var Gi={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"},Ui=({className:t,small:e})=>Hi("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:Hi("path",{clipRule:"evenodd",d:e?Gi.small:Gi.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,p;if(c<=a)p=e.getBoundingClientRect();else{let h=m+t.width,f=m>a,_=Math.min(c,f?h:a);_<c&&(e.style.width=`${_}px`,e.style.maxWidth=`${_}px`,e.offsetHeight),f&&(d=t.right-_),p=e.getBoundingClientRect()}u<i.top&&(u+=p.height+t.height+n*2),d+p.width>i.right&&(d=i.right-p.width-r),u-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${u}px)`}import{createCommand as Xp}from"lexical";var lo=Xp("TOGGLE_LINK_WITH_MODAL_COMMAND");function qi(t){t.preventDefault()}function Qi({anchorElem:t}){let[e]=Zp(),[o,n]=Ve(),r=Yi(null),l=Yi(null),[s,i]=Ve(null),[u,d]=Ve(null),{fieldProps:{schemaPath:c},uuid:a}=U(),m=Yp(),{config:p,getEntityConfig:h}=Qp(),{i18n:f,t:g}=of(),[_,L]=Ve(),R=ef(),[b,x]=Ve(!1),[C,k]=Ve([]),T=tf(),[I,N]=Ve(!1),E=qp({slug:"lexical-rich-text-link-"+a,depth:R}),{toggleDrawer:S}=Oe(E),w=Zi(()=>{x(!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)},[x,i,d,k]),v=Zi(()=>{let y=Ki(),M;if(!Ji(y)||!y){w();return}let $=nt(y);M=e.getElementByKey($.getKey())?.getBoundingClientRect();let D=Vi($,K),F=y.getNodes().filter(le=>!lf(le)).find(le=>{let Ce=Vi(le,K);return D&&!D.is(Ce)||Ce&&!Ce.is(D)});if(D==null||F){w();return}n(D);let B=D.getFields(),Y={...B,id:D.getID(),text:D.getTextContent()};if(B?.linkType==="custom")i(B?.url??null),d(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)d(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,Ht=B.doc?.relationTo;if(!Ce||!Ht)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let rr=g("fields:linkedTo",{label:`${fn(le.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(rr),rf.get(df({apiRoute:p.routes.api,path:`/${Ht}/${Ce}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:T?.code}}).then(async Xe=>{if(!Xe.ok)throw new Error(`HTTP error! Status: ${Xe.status}`);let ft=await Xe.json(),ee=le?.admin?.useAsTitle||"id",ht=ft[ee],de=g("fields:linkedTo",{label:`${fn(le.labels.singular,f)} - ${ht}`}).replace(/<[^>]*>?/g,"");d(de)}).catch(()=>{let Xe=g("fields:linkedTo",{label:`${fn(le.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${Ce}`}).replace(/<[^>]*>?/g,"");d(Xe)})}}L(Y),x(!0),k(y?y?.getNodes():[]),Se(D)?N(!0):N(!1);let J=r.current,Je=af(e._window),{activeElement:Re}=document;if(J===null)return;let xe=e.getRootElement();return Je!==null&&xe!==null&&xe.contains(Je.anchorNode)?(M||(M=Je.getRangeAt(0).getBoundingClientRect()),M!=null&&(M.y+=40,l.current=M)):(Re==null||Re.className!=="link-input")&&(xe!==null&&ro(null,J,t),i(null),d(null)),!0},[e,w,p.routes.admin,p.routes.api,p.serverURL,h,g,f,T?.code,t]);return io(()=>Wi(e.registerCommand(lo,y=>(e.dispatchCommand(pe,y),v(),S(),!0),Xi)),[e,v,S,E]),io(()=>{let y=t.parentElement,M=()=>{e.getEditorState().read(()=>{v()})};return window.addEventListener("resize",M),y?.addEventListener("scroll",M),()=>{window.removeEventListener("resize",M),y?.removeEventListener("scroll",M)}},[t.parentElement,e,v]),io(()=>Wi(e.registerUpdateListener(({editorState:y})=>{y.read(()=>{v()})}),e.registerCommand(uf,()=>(v(),!0),Xi),e.registerCommand(cf,()=>b?(w(),!0):!1,sf)),[e,v,b,w]),io(()=>{e.getEditorState().read(()=>{v()})},[e,v]),pf(()=>{!b||!r.current||!t||!l.current||ro(l.current,r.current,t)},[s,u,b,t,o]),Ue(mf.Fragment,{children:[ne("div",{className:"link-editor","data-theme":"dark",ref:r,children:Ue("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?ne(to,{}):ne(ji,{}),s&&s.length>0?Ue("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[u!=null&&u.length>0?u:s,o?.__fields.newTab?Ue(pn,{children:[ne(zi,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):u!=null&&u.length>0?Ue(pn,{children:[ne("span",{className:"link-input__label-pure",children:u}),o?.__fields.newTab?Ue(pn,{children:[ne(zi,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):null,m&&Ue("div",{className:"link-input__actions",children:[ne("button",{"aria-label":"Edit link",className:"link-edit",onClick:y=>{y.preventDefault(),S()},onMouseDown:qi,tabIndex:0,type:"button",children:ne(nf,{})}),!I&&ne("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(pe,null)},onMouseDown:qi,tabIndex:0,type:"button",children:ne(Ui,{small:!0})})]})]})}),ne(Oo,{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=Ki(),B=null;if(Ji(F)?B=nt(F).getParent():C.length&&(B=C[0]?.getParent()??null),B&&Se(B)){let Y=we({fields:D});B.replace(Y,!0)}}),e.dispatchCommand(pe,{fields:D,selectedNodes:C,text:$.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var es=t=>{let{anchorElem:e=document.body}=t;return hf(ff(Qi,{anchorElem:e}),e)};import{c as gf}from"react/compiler-runtime";import{useLexicalComposerContext as xf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cf}from"@lexical/utils";import{$getSelection as bf,$isElementNode as kf,$isRangeSelection as _f,COMMAND_PRIORITY_LOW as ts,PASTE_COMMAND as Tf}from"lexical";import{useEffect as wf}from"react";var os=t=>{let e=gf(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 Cf(n.registerCommand(pe,s=>s===null?(un(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),un(s),!0),ts),n.registerCommand(Tf,s=>{let i=bf();if(!_f(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let u=s.clipboardData.getData("text");if(!Si(u))return!1;if(!i.getNodes().some(Ef)){let d={doc:null,linkType:"custom",newTab:!1,url:u};return n.dispatchCommand(pe,{fields:d,text:null}),s.preventDefault(),!0}return!1},ts))},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]),wf(r,l),null};function Ef(t){return kf(t)}var rs=[rn([{ChildComponent:to,isActive:({selection:t})=>{if(ns(t)){let e=nt(t);return Sf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(ns(t)&&hn()?.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=hn()?.getTextContent(),n=hn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(lo,{fields:r,selectedNodes:n,text:o})}},order:1}])],Nf=A(({props:t})=>({markdownTransformers:[yi],nodes:[oe,t?.disableAutoLinks===!0?null:Ee].filter(Boolean),plugins:[{Component:os,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Fi,position:"normal"},{Component:Bi,position:"normal"},{Component:es,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:rs},toolbarInline:{groups:rs}}));import{$isListNode as xn,INSERT_CHECK_LIST_COMMAND as as,ListItemNode as Mf,ListNode as Af}from"@lexical/list";import{CHECK_LIST as $f}from"@lexical/markdown";import{$isRangeSelection as Df}from"lexical";import{jsx as ls}from"react/jsx-runtime";import"react";var Lf={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"},gn=({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",{d:Lf[e],fill:"currentColor"})});import{jsx as yf}from"react/jsx-runtime";import{ListPlugin as vf}from"@lexical/react/LexicalListPlugin.js";import"react";var rt=()=>yf(vf,{});function so(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function lt(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{jsx as Rf}from"react/jsx-runtime";import{CheckListPlugin as If}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var is=()=>Rf(If,{});var ss=[te([{ChildComponent:gn,isActive:({selection:t})=>{if(!Df(t))return!1;for(let e of t.getNodes()){if(xn(e)&&e.getListType()==="check")continue;let o=e.getParent();if(xn(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(xn(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(as,void 0)},order:12}])],Of=A(({featureProviderMap:t})=>{let e=[{Component:is,position:"normal"}],o=so("checklist",t);return o&&e.push({Component:rt,position:"normal"}),{markdownTransformers:[$f],nodes:o?[Af,Mf]:[],plugins:e,slashMenu:{groups:[lt([{Icon:gn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(as,void 0)}}])]},toolbarFixed:{groups:ss},toolbarInline:{groups:ss}}});import{$isListNode as bn,INSERT_ORDERED_LIST_COMMAND as ds,ListItemNode as Bf,ListNode as Pf}from"@lexical/list";import{ORDERED_LIST as jf}from"@lexical/markdown";import{$isRangeSelection as Hf}from"lexical";import{jsx as cs}from"react/jsx-runtime";import"react";var Ff={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"},Cn=({className:t,size:e=24})=>cs("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:cs("path",{clipRule:"evenodd",d:Ff[e],fill:"currentColor",fillRule:"evenodd"})});var us=[te([{ChildComponent:Cn,isActive:({selection:t})=>{if(!Hf(t))return!1;for(let e of t.getNodes()){if(bn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(bn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(bn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ds,void 0)},order:10}])],Gf=A(({featureProviderMap:t})=>{let e=so("ordered",t);return{markdownTransformers:[jf],nodes:e?[Pf,Bf]:[],plugins:e?[{Component:rt,position:"normal"}]:[],slashMenu:{groups:[lt([{Icon:Cn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(ds,void 0)}}])]},toolbarFixed:{groups:us},toolbarInline:{groups:us}}});import{$isListNode as _n,INSERT_UNORDERED_LIST_COMMAND as fs,ListItemNode as Vf,ListNode as Wf}from"@lexical/list";import{UNORDERED_LIST as zf}from"@lexical/markdown";import{$isRangeSelection as Kf}from"lexical";import{jsx as ms}from"react/jsx-runtime";import"react";var Uf="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",kn=({className:t})=>ms("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:ms("path",{d:Uf,fill:"currentColor"})});var ps=[te([{ChildComponent:kn,isActive:({selection:t})=>{if(!Kf(t))return!1;for(let e of t.getNodes()){if(_n(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(_n(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(_n(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(fs,void 0)},order:11}])],Jf=A({markdownTransformers:[zf],nodes:[Wf,Vf],plugins:[{Component:rt,position:"normal"}],slashMenu:{groups:[lt([{Icon:kn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(fs,void 0)}}])]},toolbarFixed:{groups:ps},toolbarInline:{groups:ps}});import{$setBlocksType as xs}from"@lexical/selection";import{$createParagraphNode as Cs,$getSelection as bs,$isParagraphNode as hs,$isRangeSelection as Xf}from"lexical";var gs=[te([{ChildComponent:Tt,isActive:({selection:t})=>{if(!Xf(t))return!1;for(let e of t.getNodes())if(!hs(e)&&!hs(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=bs();xs(e,()=>Cs())})},order:1}])],Zf=A({slashMenu:{groups:[X([{Icon:Tt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=bs();xs(e,()=>Cs())})}}])]},toolbarFixed:{groups:gs},toolbarInline:{groups:gs}});import{c as b0}from"react/compiler-runtime";import{jsx as Ps}from"react/jsx-runtime";import{useLexicalComposerContext as k0}from"@lexical/react/LexicalComposerContext";import{useEffect as _0,useState as T0}from"react";import{jsx as Bs,Fragment as C0}from"react/jsx-runtime";import"react";import{jsx as Yf}from"react/jsx-runtime";var ks={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Yf("blockquote",{children:o})}};import{jsx as qf}from"react/jsx-runtime";var _s={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return qf(n,{children:o})}};import{jsx as Qf}from"react/jsx-runtime";var Ts={horizontalrule:Qf("hr",{})};import{jsx as e0}from"react/jsx-runtime";var ws={linebreak:e0("br",{})};import{jsx as Es}from"react/jsx-runtime";var Ss=({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 Es("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="#")),Es("a",{href:s,rel:r,target:l,children:n})}});import{jsx as it,jsxs as t0,Fragment as o0}from"react/jsx-runtime";import{v4 as n0}from"uuid";var Ns={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return it(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=n0();return it("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:t0(o0,{children:[it("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),it("label",{htmlFor:l,children:r}),it("br",{})]})})}else return it("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as Tn}from"react/jsx-runtime";var Ls={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Tn("p",{children:o}):Tn("p",{children:Tn("br",{})})}};var ys={tab:" "};import{jsx as Rt}from"react/jsx-runtime";var vs={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Rt("div",{className:"lexical-table-container",children:Rt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Rt("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 Rt(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 Rt("tr",{className:"lexical-table-row",children:o})}};import{jsx as We}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},r0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,l0="\xA0",i0=`
54
+ `},[t,e]),p=je((g,b)=>{o(k=>{let _=e.length-1,T=e[_];if(T&&T.name===g){if(g==="type")return[...e.slice(0,_),{...T,value:T.value+b}];if(T.value===b)return[...e.slice(0,_),{...T,count:T.count+1}]}return[...k,{name:g,count:1,value:b}]})},[e,o]);gl(()=>{let g=k=>{if(!n)return;let _=k.key;gm(k)?p("selectAll",""):Cl.has(_)?p("press",k.key):[..._].length>1?p("keydown",k.key):p("type",k.key)},b=k=>{if(!n)return;let _=k.key;!Cl.has(_)&&[..._].length>1&&p("keyup",k.key)};return t.registerRootListener((k,_)=>{_!==null&&(_.removeEventListener("keydown",g),_.removeEventListener("keyup",b)),k!==null&&(k.addEventListener("keydown",g),k.addEventListener("keyup",b))})},[t,n,p]),gl(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),Qo(()=>{if(e){let g=m();g!==null&&i(g),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),Qo(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:k,editorState:_})=>{if(!n)return;let T=_._selection,I=u.current,N=d.current;if(I!==T){if(k.size===0&&b.size===0&&!N){let y=qo(t._window);if(y&&(y.anchorNode==null||y.focusNode==null))return}u.current=T}d.current=!1;let S=m();S!==null&&i(S)}),[t,m,n,p]),Qo(()=>n?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,n]);let f=je(g=>{n||(g.update(()=>{let b=mm();b.clear();let k=dm();b.append(um().append(k)),k.select()}),o([])),r(b=>!b)},[n]),h=je(()=>{if(!n)return;let g=qo(t._window);if(g===null||g.anchorNode==null||g.focusNode==null)return;let{anchorNode:b,anchorOffset:k,focusNode:_,focusOffset:T}=xm(g),I=a().getRootElement(),N;b!==null&&(N=xl(b,I));let S;_!==null&&(S=xl(_,I)),p("snapshot",{anchorNode:b,anchorOffset:k,anchorPath:N,focusNode:_,focusOffset:T,focusPath:S})},[p,n,a]),x=je(()=>{pm(m())},[m]),C=je(()=>{fm("test.js",m())},[m]);return[He("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:g=>{f(a()),g.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?tn("div",{className:"test-recorder-output",children:[tn("div",{className:"test-recorder-toolbar",children:[He("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:g=>{h(),g.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),He("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:g=>{x(),g.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),He("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:g=>{C(),g.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),He("pre",{id:"test-recorder",ref:c,children:s})]}):null]}var kl=()=>{let t=am(3),[e]=cm(),[o,n]=Cm(e),r;return t[0]!==o||t[1]!==n?(r=tn(bl.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 bm=M({plugins:[{Component:kl,position:"bottom"}]});import{c as km}from"react/compiler-runtime";import{jsx as _m}from"react/jsx-runtime";import{useLexicalComposerContext as Tm}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Em}from"@lexical/react/LexicalTreeView.js";import"react";var _l=()=>{let t=km(2),[e]=Tm(),o;return t[0]!==e?(o=_m(Em,{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 wm=M({plugins:[{Component:_l,position:"bottom"}]});import{BOLD_ITALIC_STAR as Nm,BOLD_ITALIC_UNDERSCORE as Lm,BOLD_STAR as ym,BOLD_UNDERSCORE as Rm}from"@lexical/markdown";import{$isTableSelection as vm}from"@lexical/table";import{$isRangeSelection as Im,FORMAT_TEXT_COMMAND as Mm}from"lexical";import{jsx as Tl}from"react/jsx-runtime";import"react";var Sm="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",El=({className:t})=>Tl("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:Tl("path",{clipRule:"evenodd",d:Sm,fill:"currentColor",fillRule:"evenodd"})});var ee=t=>({type:"buttons",items:t,key:"format",order:40});var wl=[ee([{ChildComponent:El,isActive:({selection:t})=>Im(t)||vm(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Mm,"bold")},order:1}])],Am=M(({featureProviderMap:t})=>{let e=[ym,Rm];return t.get("italic")&&e.push(Lm,Nm),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:wl},toolbarInline:{groups:wl}}});import{INLINE_CODE as Dm}from"@lexical/markdown";import{$isTableSelection as Om}from"@lexical/table";import{$isRangeSelection as Fm,FORMAT_TEXT_COMMAND as Pm}from"lexical";import{jsx as Sl}from"react/jsx-runtime";import"react";var $m="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",Nl=({className:t})=>Sl("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:Sl("path",{clipRule:"evenodd",d:$m,fill:"currentColor",fillRule:"evenodd"})});var Ll=[ee([{ChildComponent:Nl,isActive:({selection:t})=>Fm(t)||Om(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Pm,"code")},order:7}])],Bm=M({enableFormats:["code"],markdownTransformers:[Dm],toolbarFixed:{groups:Ll},toolbarInline:{groups:Ll}});import{ITALIC_STAR as Hm,ITALIC_UNDERSCORE as Gm}from"@lexical/markdown";import{$isTableSelection as zm}from"@lexical/table";import{$isRangeSelection as Um,FORMAT_TEXT_COMMAND as Wm}from"lexical";import{jsx as yl}from"react/jsx-runtime";import"react";var jm="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",Rl=({className:t})=>yl("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:yl("path",{clipRule:"evenodd",d:jm,fill:"currentColor",fillRule:"evenodd"})});var vl=[ee([{ChildComponent:Rl,isActive:({selection:t})=>Um(t)||zm(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Wm,"italic")},order:2}])],Vm=M({enableFormats:["italic"],markdownTransformers:[Hm,Gm],toolbarFixed:{groups:vl},toolbarInline:{groups:vl}});import{STRIKETHROUGH as Jm}from"@lexical/markdown";import{$isTableSelection as Xm}from"@lexical/table";import{$isRangeSelection as Ym,FORMAT_TEXT_COMMAND as Zm}from"lexical";import{jsx as Il}from"react/jsx-runtime";import"react";var Km="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",Ml=({className:t})=>Il("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:Il("path",{d:Km,fill:"currentColor"})});var Al=[ee([{ChildComponent:Ml,isActive:({selection:t})=>Ym(t)||Xm(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Zm,"strikethrough")},order:4}])],qm=M({enableFormats:["strikethrough"],markdownTransformers:[Jm],toolbarFixed:{groups:Al},toolbarInline:{groups:Al}});import{$isTableSelection as ep}from"@lexical/table";import{$isRangeSelection as tp,FORMAT_TEXT_COMMAND as op}from"lexical";import{jsx as $l}from"react/jsx-runtime";import"react";var Qm="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",Dl=({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:Qm,fill:"currentColor"})});var Ol=[ee([{ChildComponent:Dl,isActive:({selection:t})=>tp(t)||ep(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(op,"subscript")},order:5}])],np=M({enableFormats:["subscript"],toolbarFixed:{groups:Ol},toolbarInline:{groups:Ol}});import{$isTableSelection as lp}from"@lexical/table";import{$isRangeSelection as ip,FORMAT_TEXT_COMMAND as sp}from"lexical";import{jsx as Fl}from"react/jsx-runtime";import"react";var rp="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",Pl=({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:rp,fill:"currentColor"})});var Bl=[ee([{ChildComponent:Pl,isActive:({selection:t})=>ip(t)||lp(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(sp,"superscript")},order:6}])],ap=M({enableFormats:["superscript"],toolbarFixed:{groups:Bl},toolbarInline:{groups:Bl}});import{$isTableSelection as up}from"@lexical/table";import{$isRangeSelection as dp,FORMAT_TEXT_COMMAND as mp}from"lexical";import{jsx as jl}from"react/jsx-runtime";import"react";var cp="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",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",{clipRule:"evenodd",d:cp,fill:"currentColor",fillRule:"evenodd"})});var Gl=[ee([{ChildComponent:Hl,isActive:({selection:t})=>dp(t)||up(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(mp,"underline")},order:3}])],pp=M({enableFormats:["underline"],toolbarFixed:{groups:Gl},toolbarInline:{groups:Gl}});import{jsx as nn}from"react/jsx-runtime";import{jsx as fp}from"react/jsx-runtime";function hp(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])=>[hp(o),n])):{};return fp("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as gp}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as xp}from"@lexical/selection";import{$getNodeByKey as Cp,$getState as bp,$setState as kp,createState as _p,TextNode as Tp}from"lexical";import{useEffect as Ep}from"react";function zl(t){let e=new Map;for(let o in t){let n=t[o],r=_p(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function on(t,e,o,n){t.update(()=>{xp(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);kp(r,l.stateConfig,n)})})}function Ul({stateMap:t}){let[e]=gp();return Ep(()=>e.registerMutationListener(Tp,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=Cp(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((u,d)=>{let c=bp(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 Wl=(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:()=>nn(oo,{css:i.css}),key:s,label:i.label,onSelect:({editor:u})=>{on(u,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>nn(oo,{css:{color:"var(--color-icon-secondary)"}}),items:[...[{ChildComponent:()=>nn(oo,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)on(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},wp=M(({props:t})=>{let e=zl(t.state);return{plugins:[{Component:()=>Ul({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Wl(t,e)},toolbarInline:{groups:Wl(t,e)}}});import{c as jp}from"react/compiler-runtime";import{useLexicalComposerContext as Hp}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Gp,$isHeadingNode as li,HeadingNode as ai}from"@lexical/rich-text";import{$setBlocksType as zp}from"@lexical/selection";import{$getSelection as Up,$isRangeSelection as Wp}from"lexical";import{useEffect as Vp}from"react";import{jsx as Vl}from"react/jsx-runtime";import"react";var Sp="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",Kl=({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:Sp,fill:"currentColor"})});import{jsx as Jl}from"react/jsx-runtime";import"react";var Np="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",Xl=({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:Np,fill:"currentColor"})});import{jsx as Yl,jsxs as Lp}from"react/jsx-runtime";import"react";var yp="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 0V11H7z",Rp="M16.59 13.32 A1.5 1.25 0 1 1 18 15 A1.5 1.25 0 1 1 16.59 16.68",Zl=({className:t})=>Lp("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:[Yl("path",{d:yp,fill:"currentColor"}),Yl("path",{d:Rp,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ql,jsxs as vp}from"react/jsx-runtime";import"react";var Ip="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 0V11H7z",Mp="M18.85 17.5 V12.5 L16.5 15.85 H19.5",Ql=({className:t})=>vp("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:Ip,fill:"currentColor"}),ql("path",{d:Mp,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ei,jsxs as Ap}from"react/jsx-runtime";import"react";var $p="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 0V11H7z",Dp="M19.2 12.5 H16.8 V14.9 A1.5 1.5 0 1 1 16.7 16.9",ti=({className:t})=>Ap("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:[ei("path",{d:$p,fill:"currentColor"}),ei("path",{d:Dp,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as oi,jsxs as Op}from"react/jsx-runtime";import"react";var Fp="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 0V11H7z",Pp="M18.85 12.55 C17.45 13.05 16.5 14.25 16.5 16 A1.5 1.5 0 1 1 19.5 16 A1.5 1.5 0 1 1 16.5 16",ni=({className:t})=>Op("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:[oi("path",{d:Fp,fill:"currentColor"}),oi("path",{d:Pp,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{HEADING as Bp}from"@lexical/markdown";var ri=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`;return{...Bp,regExp:new RegExp(o)}};var ii=t=>{let e=Up();zp(e,()=>Gp(t))},si={h1:Kl,h2:Xl,h3:Zl,h4:Ql,h5:ti,h6:ni},Kp=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ne(e.map((n,r)=>({ChildComponent:si[n],isActive:({selection:l})=>{if(!Wp(l))return!1;for(let s of l.getNodes()){if(li(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(li(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(()=>{ii(n)})},order:r+2})))];return{markdownTransformers:[ri(e)],nodes:[ai],plugins:[{Component:Jp,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Q(e.map(n=>({Icon:si[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(()=>{ii(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),Jp=t=>{let e=jp(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]=Hp(),d,c;return e[4]!==u||e[5]!==l||e[6]!==i?(d=()=>{if(!(!i||l.length===6))return u.registerNodeTransform(ai,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]),Vp(d,c),null};import{$isNodeSelection as mf}from"lexical";import{jsx as ci}from"react/jsx-runtime";import"react";var Xp="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})=>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:Xp,fill:"currentColor"})});var ke=t=>({type:"dropdown",ChildComponent:Tr,items:t,key:"add",order:10});import{addClassNamesToElement as Yp}from"@lexical/utils";import{$applyNodeReplacement as Zp,createCommand as qp,DecoratorNode as Qp}from"lexical";var Rt=qp("INSERT_HORIZONTAL_RULE_COMMAND"),yt=class extends Qp{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:ef,priority:0})}}static importJSON(e){return ui()}createDOM(e){let o=document.createElement("hr");return Yp(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 ef(){return{node:ui()}}function ui(){return Zp(new yt)}import{$applyNodeReplacement as tf}from"lexical";import"react";var _e=class extends yt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return lt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function lt(){return tf(new _e)}function Ge(t){return t instanceof _e}var di={type:"element",dependencies:[_e],export:(t,e)=>Ge(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=lt();e&&t.replace(e)}};import{c as of}from"react/compiler-runtime";import{useLexicalComposerContext as nf}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as mi,$insertNodeToNearestRoot as rf}from"@lexical/utils";import{$getRoot as lf,$getSelection as pi,$isRangeSelection as fi,$isRootOrShadowRoot as hi,COMMAND_PRIORITY_EDITOR as sf}from"lexical";import{useEffect as af}from"react";var ln="LexicalEditorTheme__hrSelected",gi=()=>{let t=of(3),[e]=nf(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(Rt,cf,sf),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let d=lf().getChildren(),c=pi(),a=[];for(let g=0;g<d.length;g++){let b=d[g];if(Ge(b)){let k=e.getElementByKey(b.getKey());k&&a.push({element:k,index:g})}}if(a.length===0)return;if(!fi(c)||c.isCollapsed()){for(let{element:g}of a)g.classList.remove(ln);return}let m=c.anchor.getNode(),p=c.focus.getNode(),f=mi(m,uf)||m,h=mi(p,df)||p,x=d.indexOf(f),C=d.indexOf(h);if(x===-1||C===-1)return;let E=Math.min(x,C),w=Math.max(x,C);for(let{element:g,index:b}of a)b>=E&&b<=w?g.classList.add(ln):g.classList.remove(ln)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),af(o,n),null};function cf(t){let e=pi();if(!fi(e))return!1;if(e.focus.getNode()!==null){let n=lt();rf(n)}return!0}function uf(t){return hi(t.getParent())}function df(t){return hi(t.getParent())}var pf=M({markdownTransformers:[di],nodes:[_e],plugins:[{Component:gi,position:"normal"}],slashMenu:{groups:[Q([{Icon:rn,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Rt,void 0)}}])]},toolbarFixed:{groups:[ke([{ChildComponent:rn,isActive:({selection:t})=>{if(!mf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ge(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Rt,void 0)}}])]}});import{$findMatchingParent as Li}from"@lexical/utils";import{$isElementNode as Nf,INDENT_CONTENT_COMMAND as Lf,OUTDENT_CONTENT_COMMAND as yf}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var ff="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",xi=({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:ff,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as Ci}from"react/jsx-runtime";import"react";var hf="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",bi=({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",{clipRule:"evenodd",d:hf,fill:"currentColor",fillRule:"evenodd"})});import{jsx as gf}from"react/jsx-runtime";import{useLexicalComposerContext as xf}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Cf}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as bf,mergeRegister as ki}from"@lexical/utils";import{$getSelection as kf,$isElementNode as wi,$isRangeSelection as _f,COMMAND_PRIORITY_LOW as _i,INDENT_CONTENT_COMMAND as Ti,KEY_TAB_COMMAND as Tf,OUTDENT_CONTENT_COMMAND as Ef,TabNode as wf}from"lexical";import{useEffect as Ei}from"react";var Si=({clientProps:t})=>{let[e]=xf(),{disabledNodes:o,disableTabNode:n}=t;return Ei(()=>{if(!(!e||!o?.length))return ki(e.registerCommand(Ti,()=>Sf(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),_i),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);wi(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),Ei(()=>{if(!(!e||!n))return ki(e.registerCommand(Tf,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?Ef:Ti,void 0)),_i),e.registerNodeTransform(wf,r=>{r.remove()}))},[e,n]),gf(Cf,{})};function Sf(t){let e=kf();if(!_f(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=bf(l,d=>wi(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 Ni=t=>({type:"buttons",items:t,key:"indent",order:35});var yi=({disabledNodes:t})=>[Ni([{ChildComponent:xi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Ri(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!Li(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(yf,void 0)},order:1},{ChildComponent:bi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Ri(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!Li(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Lf,void 0)},order:2}])],Rf=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Si,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:yi({disabledNodes:e})},toolbarInline:{groups:yi({disabledNodes:e})}}}),Ri=t=>Nf(t)&&t.canIndent();import{$findMatchingParent as V1}from"@lexical/utils";import{$getSelection as Cn,$isRangeSelection as us}from"lexical";import{jsx as vi}from"react/jsx-runtime";import"react";var vf={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})=>vi("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:vi("path",{d:vf[e],fill:"currentColor"})});import{$isAtNodeEnd as Ii}from"@lexical/selection";function it(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?Ii(o)?n:r:Ii(e)?n:r}var an=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as zf}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 If=/^(?:[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+)?$/,Mf=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Mi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||If.test(t)||Mf.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 Af,isHTMLAnchorElement as $f}from"@lexical/utils";import mn from"bson-objectid";import{$applyNodeReplacement as Df,$createTextNode as Ai,$getSelection as Of,$isElementNode as $i,$isRangeSelection as dn,createCommand as Ff,ElementNode as Pf}from"lexical";var Bf=new Set(["http:","https:","mailto:","sms:","tel:"]),re=class extends Pf{__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:jf,priority:1})}}static importJSON(e){let o=Te({}).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")),Af(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($i(n)){let r=Te({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Bf.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 jf(t){let e=null;if($f(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new mn.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Te({id:t,fields:e}){return Df(new re({id:t??new mn.default().toHexString(),fields:e}))}function Z(t){return t instanceof re}var fe=Ff("TOGGLE_LINK_COMMAND");function pn(t){let e=Of();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();Z(s)&&(s.getChildren().forEach(u=>{s.insertBefore(u)}),s.remove())});return}if(o?.length===1){let l=o[0],s=Z(l)?l:Hf(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ai(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||$i(l)&&!l.isInline())){if(Z(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ai(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=Te({fields:t.fields}),Z(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),Z(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 Hf(t){return Gf(t,e=>Z(e))}function Gf(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 Uf=(t,e)=>{let[,o,n]=e,r=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=zf(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},Wf=t=>({type:"text-match",dependencies:[re],export:(e,o)=>{if(!Z(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:Uf,trigger:")"}),Di=Wf();import{$applyNodeReplacement as Vf,$isElementNode as Kf}from"lexical";var Ee=class extends re{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(Kf(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 Vf(new Ee({id:"",fields:t}))}function we(t){return t instanceof Ee}import{c as Jf}from"react/compiler-runtime";import{useLexicalComposerContext as Xf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Yf}from"@lexical/utils";import{$createTextNode as Oi,$getSelection as Zf,$isElementNode as Pi,$isLineBreakNode as Bi,$isNodeSelection as qf,$isRangeSelection as Qf,$isTextNode as It,TextNode as e1}from"lexical";import{useEffect as t1}from"react";function Fi(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 ji(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var o1=/[.,;\s]/;function lo(t){return t!==void 0&&o1.test(t)}function Hi(t){return lo(t[t.length-1])}function hn(t){return lo(t[0])}function n1(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Gi(t){let e=t.getPreviousSibling();return Pi(e)&&(e=e.getLastDescendant()),e===null||Bi(e)||It(e)&&Hi(e.getTextContent())}function zi(t){let e=t.getNextSibling();return Pi(e)&&(e=e.getFirstDescendant()),e===null||Bi(e)||It(e)&&hn(e.getTextContent())}function r1(t,e,o,n){return(t>0?lo(o[t-1]):Gi(n[0]))?e<o.length?lo(o[e]):zi(n[n.length-1]):!1}function l1(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 i1(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=Oi(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 p=a.getTextContent().length,f=i,h=i+p;if(f<o)if(h<=o)d.push(a);else{let[x,C]=a.splitText(o-f);x&&d.push(x),c=C}i+=p}),u){let a=Zf(),m=a?a.getNodes().find(It):void 0,p=Oi(u.getTextContent());return p.setFormat(u.getFormat()),p.setDetail(u.getDetail()),p.setStyle(u.getStyle()),l.append(p,...d),m&&m===u&&(Qf(a)?p.select(a.anchor.offset,a.focus.offset):qf(a)&&p.select(0,p.getTextContent().length)),u.replace(l),c}}}function s1(t,e,o){let n=[...t],r=n.map(u=>u.getTextContent()).join(""),l=r,s,i=0;for(;(s=ji(l,e))!=null&&s!==null;){let u=s.index,d=s.length,c=u+d;if(r1(i+u,i+c,r,n)){let[m,,p,f]=l1(n,i+u,i+c),h=i+u-m,x=i+c-m,C=i1(p,h,x,s);n=C?[C,...f]:f,o(s.url,null),i=0}else i+=c;l=l.substring(c)}}function fn(t,e,o){let n=t.getChildren(),r=n.length;for(let u=0;u<r;u++){let d=n[u];if(!It(d)||!d.isSimpleText()){ro(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=ji(l,e);if(s===null||s.text!==l){ro(t),o(null,t.getFields()?.url??null);return}if(!Gi(t)||!zi(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 a1(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;(!hn(l)||n1(l,s))&&(n.append(t),fn(n,e,o),o(null,n.getFields()?.url??null))}we(r)&&!Hi(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 c1(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 u1(t,e,o){let n=Jf(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([Ee]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,u)=>{o?.(i,u)};return Yf(t.registerNodeTransform(e1,i=>{let u=i.getParentOrThrow(),d=i.getPreviousSibling();if(we(u))fn(u,e,s);else if(!Z(u)){if(i.isSimpleText()&&(hn(i.getTextContent())||!we(d))){let c=c1(i);s1(c,e,s)}a1(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]),t1(r,l)}var d1=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,m1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,p1=[Fi(d1,t=>t.startsWith("http")?t:`https://${t}`),Fi(m1,t=>`mailto:${t}`)],Ui=()=>{let[t]=Xf();return u1(t,p1),null};import{jsx as f1}from"react/jsx-runtime";import{ClickableLinkPlugin as h1}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Wi=()=>f1(h1,{});import{jsx as D1}from"react/jsx-runtime";import"react";import{createPortal as O1}from"react-dom";import{jsx as le,jsxs as ze,Fragment as gn}from"react/jsx-runtime";import{useLexicalComposerContext as C1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as b1}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Zi,mergeRegister as qi}from"@lexical/utils";import{getTranslation as xn}from"@payloadcms/translations";import{formatDrawerSlug as k1,NewTabIcon as Qi,useConfig as _1,useEditDepth as T1,useLocale as E1,useTranslation as w1,WriteIcon as S1}from"@payloadcms/ui";import{requests as N1}from"@payloadcms/ui/shared";import{$getSelection as es,$isLineBreakNode as L1,$isRangeSelection as ts,COMMAND_PRIORITY_HIGH as y1,COMMAND_PRIORITY_LOW as os,getDOMSelection as R1,KEY_ESCAPE_COMMAND as v1,SELECTION_CHANGE_COMMAND as I1}from"lexical";import{formatAdminURL as M1}from"payload/shared";import A1,{useCallback as ns,useEffect as ao,useLayoutEffect as $1,useRef as rs,useState as Ue}from"react";import{jsx as Vi}from"react/jsx-runtime";import"react";var g1="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",Ki=({className:t})=>Vi("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:Vi("path",{d:g1,fill:"currentColor"})});import{jsx as Ji}from"react/jsx-runtime";import"react";var Xi={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"},Yi=({className:t,small:e})=>Ji("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:Ji("path",{clipRule:"evenodd",d:e?Xi.small:Xi.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,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,p;if(c<=a)p=e.getBoundingClientRect();else{let f=m+t.width,h=m>a,C=Math.min(c,h?f:a);C<c&&(e.style.width=`${C}px`,e.style.maxWidth=`${C}px`,e.offsetHeight),h&&(d=t.right-C),p=e.getBoundingClientRect()}u<i.top&&(u+=p.height+t.height+n*2),d+p.width>i.right&&(d=i.right-p.width-r),u-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${u}px)`}import{createCommand as x1}from"lexical";var so=x1("TOGGLE_LINK_WITH_MODAL_COMMAND");function ls(t){t.preventDefault()}function is({anchorElem:t}){let[e]=C1(),[o,n]=Ue(),r=rs(null),l=rs(null),[s,i]=Ue(null),[u,d]=Ue(null),{fieldProps:{schemaPath:c},uuid:a}=W(),m=b1(),{config:p,getEntityConfig:f}=_1(),{i18n:h,t:x}=w1(),[C,E]=Ue(),w=T1(),[g,b]=Ue(!1),[k,_]=Ue([]),T=E1(),[I,N]=Ue(!1),S=k1({slug:"lexical-rich-text-link-"+a,depth:w}),{toggleDrawer:y}=Oe(S),L=ns(()=>{b(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),d(null),_([]),E(void 0)},[b,i,d,_]),R=ns(()=>{let v=es(),A;if(!ts(v)||!v){L();return}let $=it(v);A=e.getElementByKey($.getKey())?.getBoundingClientRect();let O=Zi($,Z),B=v.getNodes().filter(se=>!L1(se)).find(se=>{let xe=Zi(se,Z);return O&&!O.is(xe)||xe&&!xe.is(O)});if(O==null||B){L();return}n(O);let F=O.getFields(),z={...F,id:O.getID(),text:O.getTextContent()};if(F?.linkType==="custom")i(F?.url??null),d(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${F?.doc?.relationTo}/${F?.doc?.value}`);let se=F?.doc?.relationTo?f({collectionSlug:F?.doc?.relationTo}):void 0;if(!se)d(F?.label?String(F?.label):null),i(F?.url?String(F?.url):null);else{let xe=typeof F.doc?.value=="object"?F.doc.value.id:F.doc?.value,Gt=F.doc?.relationTo;if(!xe||!Gt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ir=x("fields:linkedTo",{label:`${xn(se.labels.singular,h)} - ${x("lexical:link:loadingWithEllipsis",h)}`}).replace(/<[^>]*>?/g,"");d(ir),N1.get(M1({apiRoute:p.routes.api,path:`/${Gt}/${xe}`,serverURL:p.serverURL}),{headers:{"Accept-Language":h.language},params:{depth:0,locale:T?.code}}).then(async Ze=>{if(!Ze.ok)throw new Error(`HTTP error! Status: ${Ze.status}`);let xt=await Ze.json(),oe=se?.admin?.useAsTitle||"id",Ct=xt[oe],Y=x("fields:linkedTo",{label:`${xn(se.labels.singular,h)} - ${Ct}`}).replace(/<[^>]*>?/g,"");d(Y)}).catch(()=>{let Ze=x("fields:linkedTo",{label:`${xn(se.labels.singular,h)} - ${x("general:untitled",h)} - ID: ${xe}`}).replace(/<[^>]*>?/g,"");d(Ze)})}}E(z),b(!0),_(v?v?.getNodes():[]),we(O)?N(!0):N(!1);let V=r.current,Ye=R1(e._window),{activeElement:Re}=document;if(V===null)return;let ge=e.getRootElement();return Ye!==null&&ge!==null&&ge.contains(Ye.anchorNode)?(A||(A=Ye.getRangeAt(0).getBoundingClientRect()),A!=null&&(A.y+=40,l.current=A)):(Re==null||Re.className!=="link-input")&&(ge!==null&&io(null,V,t),i(null),d(null)),!0},[e,L,p.routes.admin,p.routes.api,p.serverURL,f,x,h,T?.code,t]);return ao(()=>qi(e.registerCommand(so,v=>(e.dispatchCommand(fe,v),R(),y(),!0),os)),[e,R,y,S]),ao(()=>{let v=t.parentElement,A=()=>{e.getEditorState().read(()=>{R()})};return window.addEventListener("resize",A),v?.addEventListener("scroll",A),()=>{window.removeEventListener("resize",A),v?.removeEventListener("scroll",A)}},[t.parentElement,e,R]),ao(()=>qi(e.registerUpdateListener(({editorState:v})=>{v.read(()=>{R()})}),e.registerCommand(I1,()=>(R(),!0),os),e.registerCommand(v1,()=>g?(L(),!0):!1,y1)),[e,R,g,L]),ao(()=>{e.getEditorState().read(()=>{R()})},[e,R]),$1(()=>{!g||!r.current||!t||!l.current||io(l.current,r.current,t)},[s,u,g,t,o]),ze(A1.Fragment,{children:[le("div",{className:"link-editor","data-theme":"dark",hidden:!g,ref:r,children:ze("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?le(no,{}):le(Ki,{}),s&&s.length>0?ze("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[u!=null&&u.length>0?u:s,o?.__fields.newTab?ze(gn,{children:[le(Qi,{size:16})," ",le("div",{className:"link-input__divider"})," "]}):null]}):u!=null&&u.length>0?ze(gn,{children:[le("span",{className:"link-input__label-pure",children:u}),o?.__fields.newTab?ze(gn,{children:[le(Qi,{size:16})," ",le("div",{className:"link-input__divider"})," "]}):null]}):null,m&&ze("div",{className:"link-input__actions",children:[le("button",{"aria-label":"Edit link",className:"link-edit",onClick:v=>{v.preventDefault(),y()},onMouseDown:ls,tabIndex:0,type:"button",children:le(S1,{})}),!I&&le("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(fe,null)},onMouseDown:ls,tabIndex:0,type:"button",children:le(Yi,{small:!0})})]})]})}),le(Po,{className:"lexical-link-edit-drawer",data:C,drawerSlug:S,drawerTitle:x("fields:editLink"),featureKey:"link",handleDrawerSubmit:(v,A)=>{let $=A,O={...$};delete O.text,e.update(()=>{let B=es(),F=null;if(ts(B)?F=it(B).getParent():k.length&&(F=k[0]?.getParent()??null),F&&we(F)){let z=Te({fields:O});F.replace(z,!0)}}),e.dispatchCommand(fe,{fields:O,selectedNodes:k,text:$.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var ss=t=>{let{anchorElem:e=document.body}=t;return O1(D1(is,{anchorElem:e}),e)};import{c as F1}from"react/compiler-runtime";import{useLexicalComposerContext as P1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as B1}from"@lexical/utils";import{$getSelection as j1,$isElementNode as H1,$isRangeSelection as G1,COMMAND_PRIORITY_LOW as as,PASTE_COMMAND as z1}from"lexical";import{useEffect as U1}from"react";var cs=t=>{let e=F1(5),{clientProps:o}=t,[n]=P1(),r,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==n?(r=()=>{if(!n.hasNodes([re]))throw new Error("LinkPlugin: LinkNode not registered on editor");return B1(n.registerCommand(fe,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),as),n.registerCommand(z1,s=>{let i=j1();if(!G1(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let u=s.clipboardData.getData("text");if(!Mi(u))return!1;if(!i.getNodes().some(W1)){let d={doc:null,linkType:"custom",newTab:!1,url:u};return n.dispatchCommand(fe,{fields:d,text:null}),s.preventDefault(),!0}return!1},as))},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]),U1(r,l),null};function W1(t){return H1(t)}var ds=[an([{ChildComponent:no,isActive:({selection:t})=>{if(us(t)){let e=it(t);return V1(e,Z)!=null}return!1},isEnabled:({selection:t})=>!!(us(t)&&Cn()?.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=Cn()?.getTextContent(),n=Cn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(so,{fields:r,selectedNodes:n,text:o})}},order:1}])],K1=M(({props:t})=>({markdownTransformers:[Di],nodes:[re,t?.disableAutoLinks===!0?null:Ee].filter(Boolean),plugins:[{Component:cs,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Ui,position:"normal"},{Component:Wi,position:"normal"},{Component:ss,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ds},toolbarInline:{groups:ds}}));import{$isListNode as kn,INSERT_CHECK_LIST_COMMAND as hs,ListItemNode as Q1,ListNode as e0}from"@lexical/list";import{CHECK_LIST as t0}from"@lexical/markdown";import{$isRangeSelection as o0}from"lexical";import{jsx as ms}from"react/jsx-runtime";import"react";var J1={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})=>ms("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:ms("path",{d:J1[e],fill:"currentColor"})});import{jsx as X1}from"react/jsx-runtime";import{ListPlugin as Y1}from"@lexical/react/LexicalListPlugin.js";import"react";var st=()=>X1(Y1,{});function co(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function at(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{jsx as Z1}from"react/jsx-runtime";import{CheckListPlugin as q1}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var ps=()=>Z1(q1,{});var fs=[ne([{ChildComponent:bn,isActive:({selection:t})=>{if(!o0(t))return!1;for(let e of t.getNodes()){if(kn(e)&&e.getListType()==="check")continue;let o=e.getParent();if(kn(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(kn(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(hs,void 0)},order:12}])],n0=M(({featureProviderMap:t})=>{let e=[{Component:ps,position:"normal"}],o=co("checklist",t);return o&&e.push({Component:st,position:"normal"}),{markdownTransformers:[t0],nodes:o?[e0,Q1]:[],plugins:e,slashMenu:{groups:[at([{Icon:bn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(hs,void 0)}}])]},toolbarFixed:{groups:fs},toolbarInline:{groups:fs}}});import{$isListNode as Tn,INSERT_ORDERED_LIST_COMMAND as Cs,ListItemNode as l0,ListNode as i0}from"@lexical/list";import{ORDERED_LIST as s0}from"@lexical/markdown";import{$isRangeSelection as a0}from"lexical";import{jsx as gs}from"react/jsx-runtime";import"react";var r0={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"},_n=({className:t,size:e=24})=>gs("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:gs("path",{clipRule:"evenodd",d:r0[e],fill:"currentColor",fillRule:"evenodd"})});var xs=[ne([{ChildComponent:_n,isActive:({selection:t})=>{if(!a0(t))return!1;for(let e of t.getNodes()){if(Tn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Tn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(Tn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Cs,void 0)},order:10}])],c0=M(({featureProviderMap:t})=>{let e=co("ordered",t);return{markdownTransformers:[s0],nodes:e?[i0,l0]:[],plugins:e?[{Component:st,position:"normal"}]:[],slashMenu:{groups:[at([{Icon:_n,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Cs,void 0)}}])]},toolbarFixed:{groups:xs},toolbarInline:{groups:xs}}});import{$isListNode as wn,INSERT_UNORDERED_LIST_COMMAND as _s,ListItemNode as d0,ListNode as m0}from"@lexical/list";import{UNORDERED_LIST as p0}from"@lexical/markdown";import{$isRangeSelection as f0}from"lexical";import{jsx as bs}from"react/jsx-runtime";import"react";var u0="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",En=({className:t})=>bs("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:bs("path",{d:u0,fill:"currentColor"})});var ks=[ne([{ChildComponent:En,isActive:({selection:t})=>{if(!f0(t))return!1;for(let e of t.getNodes()){if(wn(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(wn(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(wn(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_s,void 0)},order:11}])],h0=M({markdownTransformers:[p0],nodes:[m0,d0],plugins:[{Component:st,position:"normal"}],slashMenu:{groups:[at([{Icon:En,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_s,void 0)}}])]},toolbarFixed:{groups:ks},toolbarInline:{groups:ks}});import{$setBlocksType as ws}from"@lexical/selection";import{$createParagraphNode as Ss,$getSelection as Ns,$isParagraphNode as Ts,$isRangeSelection as g0}from"lexical";var Es=[ne([{ChildComponent:wt,isActive:({selection:t})=>{if(!g0(t))return!1;for(let e of t.getNodes())if(!Ts(e)&&!Ts(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ns();ws(e,()=>Ss())})},order:1}])],x0=M({slashMenu:{groups:[Q([{Icon:wt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ns();ws(e,()=>Ss())})}}])]},toolbarFixed:{groups:Es},toolbarInline:{groups:Es}});import{c as j0}from"react/compiler-runtime";import{jsx as Js}from"react/jsx-runtime";import{useLexicalComposerContext as H0}from"@lexical/react/LexicalComposerContext";import{useEffect as G0,useState as z0}from"react";import{jsx as Ks,Fragment as B0}from"react/jsx-runtime";import"react";import{jsx as C0}from"react/jsx-runtime";var Ls={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return C0("blockquote",{children:o})}};import{jsx as b0}from"react/jsx-runtime";var ys=new Set(["h1","h2","h3","h4","h5","h6"]);var Rs={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=ys.has(t.tag)?t.tag:"h1";return b0(n,{children:o})}};import{jsx as k0}from"react/jsx-runtime";var vs={horizontalrule:k0("hr",{})};import{jsx as _0}from"react/jsx-runtime";var Is={linebreak:_0("br",{})};import{jsx as Ms}from"react/jsx-runtime";var As=({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 Ms("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="#")),Ms("a",{href:s,rel:r,target:l,children:n})}});import{jsx as ct,jsxs as T0,Fragment as E0}from"react/jsx-runtime";import{v4 as w0}from"uuid";var $s=new Set(["ol","ul"]);var Ds={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=$s.has(t.tag)?t.tag:"ul";return ct(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=w0();return ct("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:T0(E0,{children:[ct("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),ct("label",{htmlFor:l,children:r}),ct("br",{})]})})}else return ct("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as Sn}from"react/jsx-runtime";var Os={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Sn("p",{children:o}):Sn("p",{children:Sn("br",{})})}};var Fs={tab:" "};import{jsx as Mt}from"react/jsx-runtime";var Ps={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 We}from"react/jsx-runtime";import"react";var D={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},S0=D.IS_BOLD|D.IS_ITALIC|D.IS_STRIKETHROUGH|D.IS_UNDERLINE|D.IS_CODE|D.IS_SUBSCRIPT|D.IS_SUPERSCRIPT|D.IS_HIGHLIGHT,N0="\xA0",L0=`
56
56
 
57
- `,Rs="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Is="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",s0=new RegExp("^[^"+Is+"]*["+Rs+"]"),a0=new RegExp("^[^"+Rs+"]*["+Is+"]"),c0={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},u0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},d0={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},m0={[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"},p0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},f0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Ms={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=We("strong",{children:e})),t.format&O.IS_ITALIC&&(e=We("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=We("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=We("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=We("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=We("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=We("sup",{children:e})),e}};import{jsx as It}from"react/jsx-runtime";var As={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 It("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return It("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(It("source",{media:`(max-width: ${i.width}px)`,srcSet:u,type:i.mimeType},s))}return l.push(It("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),It("picture",{children:l})}};var st={...Ls,...Ms,...ws,...ks,...vs,..._s,...Ts,...Ns,...Ss({}),...As,...ys};import{jsx as co,Fragment as h0}from"react/jsx-runtime";import ao from"react";function $s(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 g0(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 Ds(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 x0(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]=Ds(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]=Ds(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=g0(r))}return e}function Os({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if($s(e)){let l=r?x0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Fs({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return co(h0,{})}function Fs({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:p=>Fs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.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 wn({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:st}):u=i:u=st;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Os({converters:u,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Bs(C0,{children:d}):Bs("div",{className:t??"payload-richtext",children:d})}function js(){let t=b0(7),[e]=k0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=T0(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]),_0(l,s);let i;return t[5]!==n?(i=Ps("div",{className:"debug-jsx-converter",children:Ps(wn,{converters:st,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var w0=A({plugins:[{Component:js,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)"}},E0={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 mh}from"lexical";import{jsx as Hs}from"react/jsx-runtime";import"react";var S0="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",En=({className:t})=>Hs("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:Hs("path",{d:S0,fill:"currentColor"})});import{jsx as R0}from"react/jsx-runtime";import{$applyNodeReplacement as I0}from"lexical";import*as Us from"react";import{DecoratorBlockNode as N0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as L0}from"@lexical/utils";import{$applyNodeReplacement as y0}from"lexical";function v0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Gs({relationTo:o,value:e})}:null}var Mt=class extends N0{__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:v0,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=Gs(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return L0(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 Gs(t){return y0(new Mt({data:t}))}var M0=Us.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function A0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:ze({relationTo:o,value:e})}:null}var Ne=class extends Mt{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:A0,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=ze(o);return n.setFormat(e.format),n}decorate(e,o){return R0(M0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function ze(t){return I0(new Ne({data:t}))}function Sn(t){return t instanceof Ne}import{c as eh}from"react/compiler-runtime";import{jsx as th}from"react/jsx-runtime";import{useLexicalComposerContext as oh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as nh}from"@lexical/utils";import{$getPreviousSelection as rh,$getSelection as lh,$isParagraphNode as ih,$isRangeSelection as sh,COMMAND_PRIORITY_EDITOR as ah,createCommand as ch}from"lexical";import{useEffect as uh}from"react";import{c as zs}from"react/compiler-runtime";import{jsx as Nn}from"react/jsx-runtime";import{useLexicalComposerContext as Ks}from"@lexical/react/LexicalComposerContext.js";import{toast as W0}from"@payloadcms/ui";import{$getNodeByKey as z0,COMMAND_PRIORITY_EDITOR as Js}from"lexical";import{useEffect as Xs,useState as K0}from"react";import{c as $0}from"react/compiler-runtime";import{jsx as D0}from"react/jsx-runtime";import{useLexicalComposerContext as O0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as F0,useModal as B0}from"@payloadcms/ui";import{$getNodeByKey as Vs,$getPreviousSelection as P0,$getRoot as j0,$getSelection as H0,$isRangeSelection as G0,$setSelection as U0}from"lexical";import{useEffect as V0,useState as Ws}from"react";var At=t=>{let e=$0(23),[o]=O0(),[n,r]=Ws(null),[l,s]=Ws(!1),[i,u,d]=F0(t),{closeDrawer:c,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=d,{modalState:h}=B0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let N=H0()??P0();r(N)},e[0]=f):f=e[0];let g=f,_;e[1]!==o||e[2]!==n?(_=()=>{n&&o.update(()=>{if(G0(n)){let{anchor:N,focus:E}=n;Vs(N.key)&&Vs(E.key)&&U0(n.clone())}else j0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=_):_=e[3];let L=_,R;e[4]!==c?(R=()=>{c()},e[4]=c,e[5]=R):R=e[5];let b=R,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]),V0(x,C);let k;e[12]!==u?(k=N=>D0(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 J0=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=z0(o);r&&r.replace(ze({relationTo:e,value:n}))}):t.dispatchCommand(Ln,{relationTo:e,value:n})},X0=t=>{let e=zs(14),{enabledCollectionSlugs:o}=t,[n]=Ks(),[r,l]=K0(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}=At(i),a,m;e[3]!==n||e[4]!==c?(a=()=>n.registerCommand(qe,g=>(l(g?.replace?g?.replace.nodeKey:null),c(),!0),Js),m=[n,c],e[3]=n,e[4]=c,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Xs(a,m);let p;e[7]!==u||e[8]!==n||e[9]!==r?(p=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]=p):p=e[10];let h=p,f;return e[11]!==d||e[12]!==h?(f=Nn(d,{onSelect:h}),e[11]=d,e[12]=h,e[13]=f):f=e[13],f},Z0=()=>{let t=zs(3),[e]=Ks(),o,n;return t[0]!==e?(o=()=>e.registerCommand(qe,Y0,Js),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Xs(o,n),null},Zs=({enabledCollectionSlugs:t})=>t?.length?Nn(X0,{enabledCollectionSlugs:t}):Nn(Z0,{});function Y0(){return W0.error("No relationship collections enabled"),!0}import{useConfig as q0,useEntityVisibility as Q0}from"@payloadcms/ui";import*as qs from"react";var Ys=(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}}=q0(),{visibleEntities:l}=Q0();return qs.useMemo(()=>{let s=Ys(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 Ln=ch("INSERT_RELATIONSHIP_COMMAND"),Qs=t=>{let e=eh(8),{clientProps:o}=t,[n]=oh(),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([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Ln,dh,ah)},d=[n],e[3]=n,e[4]=u,e[5]=d):(u=e[4],d=e[5]),uh(u,d);let c;return e[6]!==i?(c=th(Zs,{enabledCollectionSlugs:i}),e[6]=i,e[7]=c):c=e[7],c};function dh(t){let e=lh()||rh();if(sh(e)){let o=ze(t),{focus:n}=e,r=n.getNode();nh(o),ih(r)&&!r.__first&&r.remove()}return!0}var ph=A({nodes:[Ne],plugins:[{Component:Qs,position:"normal"}],slashMenu:{groups:[X([{Icon:En,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:En,isActive:({selection:t})=>{if(!mh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Sn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(qe,{replace:!1})}}])]}});import{c as Hh}from"react/compiler-runtime";import{jsx as fe,jsxs as Gh}from"react/jsx-runtime";import{useLexicalComposerContext as Uh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as ca}from"@lexical/react/useLexicalEditable";import{useScrollInfo as Vh,useThrottledEffect as Wh,useTranslation as zh}from"@payloadcms/ui";import*as ho from"react";import{useMemo as Mn}from"react";import{jsx as fh,jsxs as hh}from"react/jsx-runtime";import{Tooltip as gh,useTranslation as xh}from"@payloadcms/ui";import{$addUpdateTag as Ch}from"lexical";import{useCallback as ea,useEffect as bh,useMemo as ta,useRef as kh,useState as _h}from"react";var yn="toolbar-popup__button",$t=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=xh(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=U(),[u,d]=_h(!1),c=kh(null);bh(()=>{c.current?.removeAttribute("data-pressing")},[t]);let a=ta(()=>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=ta(()=>[yn,n?"":"disabled",t?"active":"",r.key?`${yn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),p=ea(()=>{n&&o.focus(()=>{o.update(()=>{Ch("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=ea(f=>{f.preventDefault(),f.currentTarget.setAttribute("data-pressing","")},[]);return hh("button",{"aria-label":a,className:m,"data-button-key":r.key,disabled:!n,onClick:p,onMouseDown:h,onPointerEnter:()=>d(!0),onPointerLeave:()=>{d(!1),c.current?.removeAttribute("data-pressing")},ref:c,type:"button",children:[fh(gh,{className:`${yn}__tooltip`,show:u,children:a}),e]})};import{c as yh}from"react/compiler-runtime";import{jsx as at}from"react/jsx-runtime";import vh,{useMemo as Rh}from"react";import{useTranslation as Ih}from"@payloadcms/ui";import{jsx as Ae,jsxs as oa}from"react/jsx-runtime";import{Button as Th}from"@payloadcms/ui";import{$addUpdateTag as wh,isDOMNode as Eh}from"lexical";import mo,{useCallback as Sh,useEffect as po,useMemo as ra,useRef as vn,useState as Rn}from"react";import{createPortal as Nh}from"react-dom";var na="toolbar-popup__dropdown-item",la=mo.createContext(null);function ia({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let u=ra(()=>[na,n===!1?"disabled":"",t?"active":"",l?.key?`${na}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),d=vn(null),c=mo.use(la);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=c;return po(()=>{d?.current!=null&&a(d)},[d,a]),Ae(Th,{"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(()=>{wh("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:i,type:"button",children:e})}function Lh({children:t,dropdownKey:e,dropDownRef:o,itemsContainerClassNames:n,onClose:r}){let[l,s]=Rn(),[i,u]=Rn(),d=Sh(m=>{s(p=>p!=null?[...p,m]:[m])},[s]),c=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=ra(()=>({registerItem:d}),[d]);return po(()=>{l!=null&&i==null&&u(l[0]),i!=null&&i?.current!=null&&i.current.focus()},[l,i]),Ae(la,{value:a,children:Ae("div",{className:(n??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":e,"data-theme":"dark",onKeyDown:c,ref:o,children:t})})}function sa({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:u}){let d=vn(null),c=vn(null),[a,m]=Rn(!1),p=()=>{m(!1),c?.current!=null&&c.current.focus()};po(()=>{let f=c.current,g=d.current;if(a&&f!==null&&g!==null){let{left:_,top:L}=f.getBoundingClientRect(),R=window.scrollY||document.documentElement.scrollTop;g.style.top=`${L+R+f.offsetHeight+5}px`,g.style.left=`${Math.min(_-5,window.innerWidth-g.offsetWidth-20)}px`}},[d,c,a]),po(()=>{let f=c.current;if(f!==null&&a){let g=_=>{let L=_.target;Eh(L)&&(u&&d.current&&d.current.contains(L)||f.contains(L)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[d,c,a,u]);let h=Nh(Ae(Lh,{dropdownKey:r,dropDownRef:d,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return oa(mo.Fragment,{children:[oa("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:c,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(mo.Fragment,{children:h})]})}var In="toolbar-popup__dropdown",Mh=t=>{let e=yh(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:u}=Ih(),{fieldProps:d}=U(),{featureClientSchemaMap:c,schemaPath:a}=d;if(i.Component){let p;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(p=i?.Component&&at(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]!==c||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:c,i18n:u,schemaPath:a}):i.label),p.length>25?h=p.substring(0,25)+"...":h=p,m=at(ia,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?at(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?p:void 0,children:at("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},Ah=vh.memo(Mh),Dt=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:u,key:d}=n,c=Rh(()=>u?.length?u.map(a=>at(Ah,{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 at(sa,{buttonAriaLabel:`${d} dropdown`,buttonClassName:[In,`${In}-${d}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:d,Icon:l,itemsContainerClassNames:[`${In}-items`,...s||[]],label:i,children:c},d)};import{mergeRegister as $h}from"@lexical/utils";import{$getSelection as Dh}from"lexical";import{useCallback as Oh,useDeferredValue as Fh,useEffect as Bh,useRef as aa,useState as Ph}from"react";function jh(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 fo(t,e){let[o,n]=Ph(()=>jh(e)),r=Fh(o),l=U(),s=aa(l);s.current=l;let i=aa(e);i.current=e;let u=xr(),d=Oh(()=>{t.getEditorState().read(()=>{let c=Dh();if(!c)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=[],R=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let x of f.items){let C=x.isActive?(!R||g.length<R)&&x.isActive({editor:t,editorConfigContext:m,selection:c}):!1,k=x.isEnabled?x.isEnabled({editor:t,editorConfigContext:m,selection:c}):!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:c}):!0;h.set(f.key,{activeItemKeys:g,activeItems:_,enabledGroup:b,enabledItemKeys:L})}n({groupStates:h,itemStates:p})})},[t]);return Bh(()=>{u(d);let c=()=>{u(d)},a=$h(t.registerUpdateListener(c));return document.addEventListener("mouseup",c),()=>{a(),document.removeEventListener("mouseup",c)}},[t,u,d]),r}function Kh({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($t,{active:t,editor:o,enabled:n,item:r,children:fe(r.ChildComponent,{})},r.key):null}function Jh({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=zh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:u}}=U(),d=l.groupStates.get(n.key),c=Mn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,d?.activeItems]),a=Mn(()=>{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 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,d?.activeItems,s,i,u]);return Gh("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&d?fe(Dt,{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 p=l.itemStates.get(m.key);return fe(Kh,{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 Xh({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=ho.useRef(null),s=ca(),{y:i}=Vh(),u=fo(o,n?.features?.toolbarFixed?.groups),d=Mn(()=>{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 Wh(()=>{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]),fe("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&fe(ho.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((c,a)=>fe(Jh,{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=Hh(6),{clientProps:o}=t,[n]=Uh(),r=U();if(!ca())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=fe(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 Zh=A({plugins:[{Component:da,position:"aboveContainer"}]});import{c as Yh}from"react/compiler-runtime";import{jsx as Le,jsxs as fa}from"react/jsx-runtime";import{useLexicalComposerContext as qh}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 e5,COMMAND_PRIORITY_LOW as t5,getDOMSelection as xa,SELECTION_CHANGE_COMMAND as o5}from"lexical";import{useCallback as xo,useEffect as Ot,useMemo as n5,useRef as pa,useState as r5}from"react";import"react";import{createPortal as l5}from"react-dom";function An(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 go(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(),p=c.getBoundingClientRect(),h=u.top-a.height-d,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+d*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 i5({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($t,{active:t,editor:o,enabled:n,item:r,children:Le(r.ChildComponent,{})},r.key):null}function s5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=U(),s=r.groupStates.get(o.key),i=n5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return fa("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(Dt,{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 Le(i5,{active:d?.active??!1,anchorElem:t,editor:e,enabled:d?.enabled??!0,item:u},u.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Le("div",{className:"divider"})]},o.key)}function a5({anchorElem:t,editor:e}){let o=pa(null),n=pa(null),{editorConfig:r}=U(),l=fo(e,r?.features?.toolbarInline?.groups),s=xo(()=>{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=xo(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 p=c.clientX,h=c.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),u=xo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ot(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",u)}),[o,i,u]);let d=xo(()=>{let c=ga(),a=xa(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(c!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=An(a,h),g=go({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&go({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Ot(()=>{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]),Ot(()=>(e.getEditorState().read(()=>{d()}),ha(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(o5,()=>(d(),!1),t5))),[e,d]),fa("div",{className:"inline-toolbar-popup",ref:o,children:[Le("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,a)=>Le(s5,{anchorElem:t,editor:e,group:c,index:a,toolbarStates:l},c.key))]})}function c5(t,e){let o=Yh(12),[n,r]=r5(!1),l=Qh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=ga(),h=xa(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 R of _)if(e5(R)){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,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]),Ot(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]),Ot(c,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=l5(Le(a5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Ca=t=>{let{anchorElem:e}=t,[o]=qh();return c5(o,e)};var u5=A({plugins:[{Component:Ca,position:"floatingAnchorElem"}]});import{TableCellNode as t2,TableNode as o2,TableRowNode as n2}from"@lexical/table";import{jsx as ba}from"react/jsx-runtime";import"react";var d5={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"},$n=({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:d5[e],fill:"currentColor",fillRule:"evenodd"})});import{$convertToMarkdownString as m5}from"@lexical/markdown";import{$createTableCellNode as p5,$createTableNode as f5,$createTableRowNode as h5,$isTableCellNode as ka,$isTableNode as Dn,$isTableRowNode as On,TableCellHeaderStates as Co,TableCellNode as g5,TableNode as x5,TableRowNode as C5}from"@lexical/table";import{$isParagraphNode as b5,$isTextNode as k5}from"lexical";var Ta=/^\|(.+)\|\s?$/,_5=/^(\| ?:?-*:? ?)+\|\s?$/,wa=({allTransformers:t})=>({type:"element",dependencies:[x5,C5,g5],export:e=>{if(!Dn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!On(n))continue;let l=!1;for(let s of n.getChildren())ka(s)&&(r.push(m5(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(_5.test(r)){let a=e.getPreviousSibling();if(!a||!Dn(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!On(p))return;p.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&&!(!b5(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!k5(a))break;let m=_a(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 d=f5();for(let a of s){let m=h5();d.append(m);for(let p=0;p<u;p++)m.append(p<a.length?a[p]:Ea("",t))}let c=e.getPreviousSibling();Dn(c)&&T5(c)===u?(c.append(...d.getChildren()),e.remove()):e.replace(d),d.selectEnd()}});function T5(t){let e=t.getFirstChild();return On(e)?e.getChildrenSize():0}var Ea=(t,e)=>{t=t.replace(/\\n/g,`
59
- `);let o=p5(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 E5}from"react/compiler-runtime";import{jsx as j,jsxs as ye}from"react/jsx-runtime";import{useLexicalComposerContext as Ra}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as S5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as La,$deleteTableColumnAtSelection as N5,$deleteTableRowAtSelection as L5,$getNodeTriplet as y5,$getTableCellNodeFromLexicalNode as ya,$getTableColumnIndexFromTableCellNode as v5,$getTableNodeFromLexicalNodeOrThrow as De,$getTableRowIndexFromTableCellNode as R5,$insertTableColumnAtSelection as I5,$insertTableRowAtSelection as M5,$isTableCellNode as Ia,$isTableSelection as Ft,$mergeCells as A5,$unmergeCell as $5,getTableElement as Fn,getTableObserverFromTableElement as Bn,TableCellHeaderStates as $e,TableCellNode as D5}from"@lexical/table";import{mergeRegister as O5}from"@lexical/utils";import{useScrollInfo as F5}from"@payloadcms/ui";import{$getSelection as ko,$isElementNode as B5,$isRangeSelection as Pn,$isTextNode as P5,$setSelection as j5,COMMAND_PRIORITY_CRITICAL as H5,getDOMSelection as G5,isDOMNode as U5,SELECTION_CHANGE_COMMAND as V5}from"lexical";import*as jn from"react";import{useCallback as ue,useEffect as ct,useRef as bo,useState as ut}from"react";import{createPortal as Ma}from"react-dom";import{jsx as Sa}from"react/jsx-runtime";import"react";var w5={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:w5[e],fill:"currentColor",fillRule:"evenodd"})});function va(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function W5(){let t=ko();if(Pn(t)&&!t.isCollapsed()||Ft(t)&&!t.anchor.is(t.focus)||!Pn(t)&&!Ft(t))return!1;let[e]=y5(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function z5(t){let e=t.getLastDescendant();P5(e)?e.select():B5(e)?e.selectEnd():e!==null&&e.selectNext()}function K5({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Ra(),s=bo(null),[i,u]=ut(r),[d,c]=ut({columns:1,rows:1}),[a,m]=ut(!1),[p,h]=ut(!1),{y:f}=F5();ct(()=>l.registerMutationListener(D5,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{u(i.getLatest())})},{skipInitialization:!0}),[l,i]),ct(()=>{l.getEditorState().read(()=>{let w=ko();if(Ft(w)){let v=va(w);c(va(w)),m(v.columns>1||v.rows>1)}h(W5())})},[l]),ct(()=>{let w=e.current,v=s.current,y=l.getRootElement();if(w!=null&&v!=null&&y!=null){let M=y.getBoundingClientRect(),$=w.getBoundingClientRect();v.style.opacity="1";let D=v.getBoundingClientRect(),F=5,B=$.right+F;if(B+D.width>window.innerWidth||B+D.width>M.right){let J=$.left-D.width-F;B=(J<0?F:J)+window.pageXOffset}v.style.left=`${B+window.pageXOffset}px`;let Y=$.top;if(Y+D.height>window.innerHeight){let J=$.bottom-D.height;Y=J<0?F:J}v.style.top=`${Y}px`}},[e,s,l,f]),ct(()=>{function w(v){s.current!=null&&e.current!=null&&U5(v.target)&&!s.current.contains(v.target)&&!e.current.contains(v.target)&&n(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[n,e]);let g=ue(()=>{l.update(()=>{if(i.isAttached()){let w=De(i),v=Fn(w,l.getElementByKey(w.getKey()));if(v===null)throw new Error("Expected to find tableElement in DOM");let y=Bn(v);y!==null&&y.$clearHighlight(),w.markDirty(),u(i.getLatest())}j5(null)})},[l,i]),_=()=>{l.update(()=>{let w=ko();if(!Ft(w))return;let y=w.getNodes().filter(Ia),M=A5(y);M&&(z5(M),o())})},L=()=>{l.update(()=>{$5()})},R=ue(w=>{l.update(()=>{for(let v=0;v<d.rows;v++)M5(w);o()})},[l,o,d.rows]),b=ue(w=>{l.update(()=>{for(let v=0;v<d.columns;v++)I5(w);o()})},[l,o,d.columns]),x=ue(()=>{l.update(()=>{L5(),o()})},[l,o]),C=ue(()=>{l.update(()=>{De(i).remove(),g(),o()})},[l,i,g,o]),k=ue(()=>{l.update(()=>{N5(),o()})},[l,o]),T=ue(()=>{l.update(()=>{let w=De(i),v=R5(i),[y]=La(w,null,null),M=new Set,$=i.getHeaderStyles()^$e.ROW;if(y[v])for(let D=0;D<y[v].length;D++){let F=y[v][D];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles($,$e.ROW)))}g(),o()})},[l,i,g,o]),I=ue(()=>{l.update(()=>{let w=De(i),v=v5(i),[y]=La(w,null,null),M=new Set,$=i.getHeaderStyles()^$e.COLUMN;if(y)for(let D=0;D<y.length;D++){let F=y?.[D]?.[v];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles($,$e.COLUMN)))}g(),o()})},[l,i,g,o]),N=ue(()=>{l.update(()=>{if(i.isAttached()){let w=De(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),E=ue(()=>{l.update(()=>{if(i.isAttached()){let w=De(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"})}):p&&(S=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>L(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),Ma(ye("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[S?ye(jn.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:()=>R(!1),type:"button",children:ye("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:()=>R(!0),type:"button",children:ye("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:ye("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:ye("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:()=>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:ye("span",{className:"text",children:[(i.__headerState&$e.ROW)===$e.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&$e.COLUMN)===$e.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function J5({anchorElem:t,cellMerge:e}){let[o]=Ra(),n=bo(null),r=bo(null),[l,s]=ut(!1),[i,u]=ut(null),d=ue(()=>{let a=n.current,m=ko(),p=G5(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(Pn(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let b=ya(m.anchor.getNode());if(b==null||(L=o.getElementByKey(b.getKey()),L==null||!b.isAttached()))return f();let x=De(b),C=Fn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Bn(C),u(b)}else if(Ft(m)){let b=ya(m.anchor.getNode());if(!Ia(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let x=De(b),C=Fn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Bn(C),L=o.getElementByKey(b.getKey())}else if(!h)return f();if(_===null||L===null)return f();let R=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",R),a.classList.toggle("table-cell-action-button-container--inactive",!R),R){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]);ct(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(d)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return O5(o.registerUpdateListener(p),o.registerCommand(V5,p,H5),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let c=bo(i);return ct(()=>{c.current!==i&&s(!1),c.current=i},[c,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&ye(jn.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(Na,{})}),l&&j(K5,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Aa=t=>{let e=E5(3),{anchorElem:o}=t,n=S5(),r;return e[0]!==o||e[1]!==n?(r=Ma(n?j(J5,{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 To,jsxs as Z5}from"react/jsx-runtime";import{useLexicalComposerContext as Y5}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as q5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Q5,$getTableNodeFromLexicalNodeOrThrow as Hn,$getTableRowIndexFromTableCellNode as eg,$isTableCellNode as $a,$isTableRowNode as tg,getDOMCellFromTarget as og,getTableElement as ng,TableNode as Da}from"@lexical/table";import{calculateZoomLevel as Oa,mergeRegister as rg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Gn,isHTMLElement as lg,SKIP_SCROLL_INTO_VIEW_TAG as Fa}from"lexical";import*as Pa from"react";import{useCallback as Bt,useEffect as Un,useRef as _o,useState as dt}from"react";import{createPortal as ig}from"react-dom";var sg=33,Ba=92;function ag({editor:t}){let e=_o(null),o=_o(null),n=_o(null),[r,l]=dt(!1),s=U(),i=_o(null),[u,d]=dt(null),[c,a]=dt(null),[m,p]=dt(!1),[h,f]=dt(null),g=Bt(()=>{a(null),e.current=null,f(null),i.current=null,n.current=null},[]),_=E=>(E.buttons&1)===1;Un(()=>{let E=new Set;return rg(t.registerMutationListener(Da,S=>{for(let[w,v]of S)v==="destroyed"?E.delete(w):E.add(w);l(E.size>0)}),t.registerNodeTransform(Da,S=>{if(S.getColWidths())return S;let w=S.getColumnCount(),v=Ba;return S.setColWidths(Array(w).fill(v)),S}))},[t]),Un(()=>{if(!r)return;let E=y=>{let M=y.target;if(lg(M)){if(h){d({x:y.clientX,y:y.clientY});return}if(p(_(y)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let $=og(M);$&&c!==$?t.getEditorState().read(()=>{let D=Gn($.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let F=Hn(D),B=ng(F,t.getElementByKey(F.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=M,n.current=B.getBoundingClientRect(),a($)},{editor:t}):$==null&&g()}}},S=y=>{p(!0)},w=y=>{p(!1)},v=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()=>{v()}},[c,h,t,r,g]);let L=E=>E==="bottom",R=Bt(E=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Gn(c.elem);if(!$a(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Hn(S),v=eg(S),y=w.getChildren(),$=S.getColSpan()===w.getColumnCount()?v:v+S.getRowSpan()-1;if($>=y.length||$<0)throw new Error("Expected table cell to be inside of table row.");let D=y[$];if(!tg(D))throw new Error("Expected table row");let F=D.getHeight();if(F===void 0){let Y=D.getChildren();F=Math.min(...Y.map(J=>b(J,t)??1/0))}let B=Math.max(F+E,sg);D.setHeight(B)},{tag:Fa})},[c,t]),b=(E,S)=>S.getElementByKey(E.getKey())?.clientHeight,x=(E,S)=>{let w;return S.forEach(v=>{v.forEach((y,M)=>{y.cell===E&&(w=M)})}),w},C=Bt(E=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Gn(c.elem);if(!$a(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Hn(S),[v]=Q5(w,null,null),y=x(S,v);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,Ba);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:v,y}=i.current;if(c===null)return;let M=Oa(w.target);if(L(E)){let $=(w.clientY-y)/M;R($)}else{let $=(w.clientX-v)/M;C($)}g(),document.removeEventListener("mouseup",S)}};return S},[c,g,C,R]),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),f(E),document.addEventListener("mouseup",k(E))},[c,k]),[I,N]=dt({bottom:null,left:null,right:null,top:null});return Un(()=>{if(c){let{height:E,left:S,top:w,width:v}=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:`${v}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${E}px`,left:`${window.scrollX+S+v-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]),To("div",{ref:o,children:c!=null&&!m&&Z5(Pa.Fragment,{children:[To("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),To("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var ja=()=>{let t=X5(3),[e]=Y5(),o=q5(),n;return t[0]!==e||t[1]!==o?(n=o?ig(To(ag,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],n};import{c as gg}from"react/compiler-runtime";import{jsx as Vn,jsxs as xg,Fragment as Cg}from"react/jsx-runtime";import{useLexicalComposerContext as bg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ja}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as kg,$getTableColumnIndexFromTableCellNode as _g,$getTableRowIndexFromTableCellNode as Tg,$insertTableColumnAtSelection as wg,$insertTableRowAtSelection as Eg,$isTableCellNode as Sg,$isTableNode as Ua,getTableElement as Ng,TableNode as Lg}from"@lexical/table";import{$findMatchingParent as yg,mergeRegister as vg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Va,isHTMLElement as Rg}from"lexical";import{useEffect as Wa,useMemo as Ig,useRef as za,useState as wo}from"react";import"react";import{createPortal as Mg}from"react-dom";import{c as pg}from"react/compiler-runtime";import{useEffect as fg,useRef as hg}from"react";var cg="Expected a function",ug=Math.max,dg=Math.min;function mg(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(cg);e=e||0,typeof o=="object"&&(i=!!o.leading,u="maxWait"in o,d=u?ug(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function p(C){let k=n,T=s;return n=s=void 0,l=C,c=t.apply(T,k),c}function h(C){return l=C,a=setTimeout(_,e),i?p(C):c}function f(C){let k=C-r,T=C-l,I=e-k;return u?dg(I,d-T):I}function g(C){let k=C-r,T=C-l;return r===void 0||k>=e||k<0||u&&T>=d}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,c)}function R(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function b(){return a===void 0?c: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)),c}return x.cancel=R,x.flush=b,x}var Ha=mg;function Ga(t,e,o){let n=pg(6),r=hg(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 Ag({anchorElem:t}){let[e]=bg(),o=Ja(),n=U(),[r,l]=wo(!1),[s,i]=wo(!1),[u,d]=wo(!1),[c,a]=wo({}),m=za(new Set),p=za(null),h=Ga(_=>{let{isOutside:L,tableDOMNode:R}=$g(_,n.editorConfig?.lexical);if(L){l(!1),i(!1);return}if(!R)return;p.current=R;let b=null,x=null,C=null;if(e.getEditorState().read(()=>{let $=Va(R);if(Sg($)){let D=yg($,F=>Ua(F));if(!Ua(D))return;if(C=Ng(D,e.getElementByKey(D.getKey())),C){let F=D.getChildrenSize(),B=D.getChildAtIndex(0)?.getChildrenSize(),Y=Tg($),J=_g($);Y===F-1?b=$:J===B-1&&(x=$)}}},{editor:e}),!C)return;let k=C.parentElement;if(!k)return;let{bottom:T,height:I,left:N,right:E,width:S,y:w}=C.getBoundingClientRect(),v=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(v=k.scrollWidth>k.clientWidth);let{left:y,y:M}=t.getBoundingClientRect();b?(i(!1),l(!0),a({height:Ka,left:v&&k?k.offsetLeft:N-y,top:T-M+5,width:v&&k?k.offsetWidth:S})):x&&(i(!0),l(!1),a({height:I,left:E-y+5,top:w-M,width:Ka}))},50,250),f=Ig(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Wa(()=>{if(u)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[u,h]),Wa(()=>vg(e.registerMutationListener(Lg,_=>{e.getEditorState().read(()=>{let L=!1;for(let[R,b]of _)switch(b){case"created":{m.current.add(R),L=!0;break}case"destroyed":{m.current.delete(R),L=!0;break}default:break}if(L){f.disconnect();for(let R of m.current){let{tableElement:b}=kg(R);f.observe(b)}d(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=_=>{e.update(()=>{p.current&&(Va(p.current)?.selectEnd(),_?(Eg(),l(!1)):(wg(),i(!1)))})};return o?xg(Cg,{children:[r&&Vn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...c},type:"button"}),s&&Vn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...c},type:"button"})]}):null}function $g(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 Xa(t){let e=gg(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!Ja())return null;let l;return e[0]!==n?(l=Mg(Vn(Ag,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as Kn,jsxs as Bg}from"react/jsx-runtime";import{useLexicalComposerContext as Pg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as jg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Hg,TableCellNode as Gg,TableNode as Ug,TableRowNode as Vg}from"@lexical/table";import{mergeRegister as Wg}from"@lexical/utils";import{$getSelection as zg,$isRangeSelection as Kg,$setSelection as Jg,COMMAND_PRIORITY_EDITOR as Xg,createCommand as Zg}from"lexical";import{createContext as Yg,use as qg,useCallback as tc,useEffect as oc,useMemo as Qg,useRef as e2,useState as Eo}from"react";import*as nc from"react";import{jsx as Q,jsxs as ve}from"react/jsx-runtime";import{useCallback as Wn,useEffect as Za,useRef as zn,useState as Pt}from"react";import*as Qa from"react";import{createPortal as Dg}from"react-dom";var Ya=10,qa=7;function Og(){return ve("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 Fg(){return ve("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]=Pt(0),[u,d]=Pt(0),[c,a]=Pt(""),[m,p]=Pt(""),[h,f]=Pt(null),g=zn(null),_=zn(null),L=zn(null),R=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(""),p(""),f(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 x=Wn((N,E)=>{N>0&&E>0&&r(N,E)},[r]),C=Wn((N,E)=>{i(N),d(E)},[]),k=Wn(()=>{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<=R&&N<=b,w=E<=s&&N<=u,v="table-grid-popup__cell";S&&w?v+=" table-grid-popup__cell--hover":S&&(v+=" table-grid-popup__cell--selected"),T.push(Q("div",{"aria-label":`${E} columns, ${N} rows`,className:v,onClick:()=>x(E,N),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),x(E,N))},onMouseEnter:()=>C(E,N),role:"button",tabIndex:-1},`${N}-${E}`))}let I=s>0&&u>0;return Dg(ve(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:ve("div",{className:"table-grid-popup__content",children:[ve("div",{className:"table-grid-popup__header",children:[ve("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(Og,{})}),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:c})]}),Q("span",{className:"table-grid-popup__separator",children:"\xD7"}),ve("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(Fg,{})}),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})]})]}),ve("div",{className:"table-grid-popup__grid",onMouseLeave:k,children:[T,I&&ve("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/Ya*100}%)`,top:`calc(${(u-1)/qa*100}%)`},children:[R," \xD7 ",b]})]})]})})]}),t)}var So=Zg("OPEN_EMBED_DRAWER_COMMAND"),rc=Yg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function lc({children:t}){let[e,o]=Eo({cellEditorConfig:null,cellEditorPlugins:null});return Kn(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=qg(rc),[o,n]=Eo(!1),[r,l]=Eo(null),s=e2(null),[i,u]=Eo(null);oc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;u(m??a.parentElement)}},[t]),oc(()=>{if(!t.hasNodes([Ug,Vg,Gg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Wg(t.registerCommand(So,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),p=null;t.getEditorState().read(()=>{let f=zg();if(Kg(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},Xg))},[e,t,i]);let d=tc(()=>{n(!1)},[]),c=tc((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&Jg(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(Hg,{columns:String(a),rows:String(m)})},1)},[t]);return Bg(nc.Fragment,{children:[Kn(ec,{anchorElem:i,editor:t,isOpen:o,onClose:d,onInsert:c,position:r}),Kn(jg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var r2=A({markdownTransformers:[wa],nodes:[o2,t2,n2],plugins:[{Component:ic,position:"normal"},{Component:ja,position:"normal"},{Component:Aa,position:"floatingAnchorElem"},{Component:Xa,position:"floatingAnchorElem"}],providers:[lc],slashMenu:{groups:[X([{Icon:$n,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(So,{})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:$n,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(So,{})}}])]}});import{$isNodeSelection as j2}from"lexical";import{jsx as sc}from"react/jsx-runtime";import"react";var l2="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",Jn=({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:l2,fill:"currentColor",fillRule:"evenodd"})});import{jsx as mc}from"react/jsx-runtime";import pc from"bson-objectid";import{$applyNodeReplacement as d2}from"lexical";import*as fc from"react";import i2 from"bson-objectid";function No(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 i2.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as s2}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as a2}from"@lexical/utils";import cc from"bson-objectid";import{$applyNodeReplacement as c2}from"lexical";var jt=class extends s2{__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=>No(o,ac),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new cc.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=ac({data:o});return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return a2(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 ac({data:t}){return t?.id||(t.id=new cc.default().toHexString()),c2(new jt({data:t}))}import{jsx as uc}from"react/jsx-runtime";import{ShimmerEffect as u2}from"@payloadcms/ui";var dc=()=>uc("div",{className:"lexical-upload",children:uc(u2,{height:"95px",width:"203px"})});var m2=fc.lazy(()=>import("./component-PHZQBOJE.js").then(t=>({default:t.UploadComponent}))),he=class extends jt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>No(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 pc.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(dc,{}):mc(m2,{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 pc.default().toHexString()),d2(new he({data:t}))}function mt(t){return t instanceof he}import{c as k2}from"react/compiler-runtime";import{jsx as _2}from"react/jsx-runtime";import{useLexicalComposerContext as T2}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Sc,$insertNodeToNearestRoot as Yn,mergeRegister as w2}from"@lexical/utils";import{useBulkUpload as E2,useEffectEvent as S2,useModal as N2}from"@payloadcms/ui";import qn from"bson-objectid";import{$createRangeSelection as L2,$getPreviousSelection as kc,$getSelection as _c,$isParagraphNode as Qn,$isRangeSelection as Tc,$setSelection as y2,COMMAND_PRIORITY_EDITOR as v2,COMMAND_PRIORITY_LOW as wc,createCommand as R2,DROP_COMMAND as I2,getDOMSelectionFromTarget as M2,isHTMLElement as Ec,PASTE_COMMAND as A2}from"lexical";import{useEffect as $2}from"react";import{c as hc}from"react/compiler-runtime";import{jsx as Xn}from"react/jsx-runtime";import{useLexicalComposerContext as gc}from"@lexical/react/LexicalComposerContext.js";import{toast as p2}from"@payloadcms/ui";import{$getNodeByKey as f2,COMMAND_PRIORITY_EDITOR as xc}from"lexical";import{useEffect as Cc,useState as h2}from"react";var g2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=f2(o);r&&r.replace(ge({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(Zn,{fields:null,relationTo:e,value:n})},x2=t=>{let e=hc(13),{enabledCollectionSlugs:o}=t,[n]=gc(),[r,l]=h2(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}=At(s),c,a;e[2]!==n||e[3]!==d?(c=()=>n.registerCommand(Qe,f=>(l(f?.replace?f?.replace.nodeKey:null),d(),!0),xc),a=[n,d],e[2]=n,e[3]=d,e[4]=c,e[5]=a):(c=e[4],a=e[5]),Cc(c,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=f=>{let{collectionSlug:g,doc:_}=f;i(),g2({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=Xn(u,{onSelect:p}),e[10]=u,e[11]=p,e[12]=h):h=e[12],h},C2=()=>{let t=hc(3),[e]=gc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Qe,b2,xc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Cc(o,n),null},bc=({enabledCollectionSlugs:t})=>t?.length?Xn(x2,{enabledCollectionSlugs:t}):Xn(C2,{});function b2(){return p2.error("No upload collections enabled"),!0}function D2(t){let e=t.target;return!!(Ec(e)&&!e.closest("code, span.editor-image")&&Ec(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function O2(t){let e,o=M2(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 Zn=R2("INSERT_UPLOAD_COMMAND"),Nc=t=>{let e=k2(21),{clientProps:o}=t,[n]=T2(),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:p}=E2(),{isModalOpen:h,openModal:f}=N2(),g;e[3]!==u||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==d||e[9]!==c||e[10]!==a||e[11]!==m||e[12]!==p?(g=x=>{let{files:C}=x;if(C?.length!==0&&(c(k=>[...k??[],...C.map(F2)]),!h(u))){if(!i.length||!i[0])return;d(i[0]),p(i),a(()=>{n.update(B2)}),m(k=>{let T=new Map(k.map(P2));n.update(()=>{for(let I of Sc()){let N=I.node;if(mt(N)){let E=N.getData();if(E?.pending){let S=T.get(E.pending?.formID);S&&N.replace(ge({data:{id:new qn.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]=d,e[9]=c,e[10]=a,e[11]=m,e[12]=p,e[13]=g):g=e[13];let _=S2(g),L;e[14]!==n||e[15]!==_?(L=()=>{if(!n.hasNodes([he]))throw new Error("UploadPlugin: UploadNode not registered on editor");return w2(n.registerNodeTransform(he,x=>{let C=x.getData();if(!C?.pending)return;(async function(){let I=null,N=C?.pending?.src,E=C?.pending?.formID;if(N?.startsWith("data:")){let S=N.match(/data:(image\/[a-zA-Z]+);base64,/),w=S?S[1]:"image/png",v=N.replace(/^data:image\/[a-zA-Z]+;base64,/,""),y=atob(v),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(),v=N.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];I={alt:void 0,file:new File([w],v,{type:w.type}),formID:E}}I&&_({files:[I]})})()}),n.registerCommand(Zn,x=>(n.update(()=>{let C=_c()||kc();if(Tc(C)){let k=ge({data:{id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}}),{focus:T}=C,I=T.getNode();Yn(k),Qn(I)&&!I.__first&&I.remove()}}),!0),v2),n.registerCommand(A2,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 qn.default().toHexString()})}),k.length?(n.update(()=>{let T=_c()||kc();if(Tc(T))for(let I of k){let N=ge({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:E}=T,S=E.getNode();Yn(N),Qn(S)&&!S.__first&&S.remove()}}),_({files:k}),!0):!1},wc),n.registerCommand(I2,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 qn.default().toHexString()})}),k.length?(x.preventDefault(),x.stopPropagation(),n.update(()=>{if(D2(x)){let T=O2(x),I=L2();T!=null&&I.applyDOMRange(T),y2(I);for(let N of k){let E=ge({data:{pending:{formID:N.formID,src:URL.createObjectURL(N.file)}}}),{focus:S}=I,w=S.getNode();Yn(E),Qn(w)&&!w.__first&&w.remove()}}}),_({files:k}),!0):!1},wc))},e[14]=n,e[15]=_,e[16]=L):L=e[16];let R;e[17]!==n?(R=[n],e[17]=n,e[18]=R):R=e[18],$2(L,R);let b;return e[19]!==i?(b=_2(bc,{enabledCollectionSlugs:i}),e[19]=i,e[20]=b):b=e[20],b};function F2(t){return{file:t.file,formID:t.formID}}function B2(){for(let t of Sc()){let e=t.node;mt(e)&&e.getData()?.pending&&e.remove()}}function P2(t){return[t.formID,t]}var H2=A({nodes:[he],plugins:[{Component:Nc,position:"normal"}],slashMenu:{groups:[X([{Icon:Jn,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:[_e([{ChildComponent:Jn,isActive:({selection:t})=>{if(!j2(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return mt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]}});import{c as U2}from"react/compiler-runtime";import{jsx as Lo}from"react/jsx-runtime";import{createElement as V2}from"react";import{ShimmerEffect as W2,useConfig as z2}from"@payloadcms/ui";import{lazy as K2,Suspense as J2,useEffect as X2,useState as Z2}from"react";var Lc={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 er={namespace:"lexical",theme:Lc};function yc({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 G2}from"payload/shared";var vc=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?G2(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 tr(t,e,o,n){return{admin:o,features:vc(t),lexical:e,resolvedFeatureMap:t,view:n}}var Y2=K2(()=>import("./Field-QGSHF22S.js").then(t=>({default:t.RichText}))),q2=t=>Lo(Fo,{inheritable:!0,views:t.views,children:Lo(Q2,{...t})}),Q2=t=>{let e=U2(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 p=m,h=i===void 0?er:i,{currentView:f}=Bo(),g=d?.[f]?.admin??a,_=d?.[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 R=L,{config:b}=z2(),[x,C]=Z2(null),k,T;e[7]!==n||e[8]!==b||e[9]!==f||e[10]!==g||e[11]!==R||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==x||e[16]!==u||e[17]!==d?(k=()=>{if(x&&x.view===f)return;let N=d?.[f],E=N?.filterFeatures?N.filterFeatures(n):n,S=[];for(let v of Object.values(E))!v.clientFeatureProvider||!v.clientFeatureProps||S.push(v.clientFeatureProvider(v.clientFeatureProps));let w=yc({config:b,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:u??s.name,unSanitizedEditorConfig:{features:S,lexical:R}});C(tr(w,R,g,f))},T=[g,n,b,p,l,s,x,R,u,f,d],e[7]=n,e[8]=b,e[9]=f,e[10]=g,e[11]=R,e[12]=p,e[13]=l,e[14]=s,e[15]=x,e[16]=u,e[17]=d,e[18]=k,e[19]=T):(k=e[18],T=e[19]),X2(k,T);let I;return e[20]!==x||e[21]!==t?(I=Lo(J2,{fallback:Lo(W2,{height:"35vh"}),children:x&&V2(Y2,{...t,editorConfig:x,key:x.view})}),e[20]=x,e[21]=t,e[22]=I):I=e[22],I};function ex(...t){return t.filter(Boolean).join(" ")}var tx=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var yo=new WeakMap;function Rc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function vo(t,e){let o=yo.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Rc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let u=Rc(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},yo.set(t,o)}return o.listeners.add(e),()=>{ox(t,e)}}function ox(t,e){let o=yo.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(yo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function nx(t,e){return vo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function rx(t,e){return vo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function lx(t,e){return vo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function ix(t,e){return vo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as sx}from"react/compiler-runtime";import{jsx as ax}from"react/jsx-runtime";import"react";var cx=()=>{let t=sx(2),{EditButton:e}=be(),o;return t[0]!==e?(o=e?ax(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as ux}from"react/compiler-runtime";import{jsx as dx}from"react/jsx-runtime";import"react";var mx=()=>{let t=ux(2),{RemoveButton:e}=be(),o;return t[0]!==e?(o=e?dx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as px}from"react/compiler-runtime";import{jsx as fx}from"react/jsx-runtime";import"react";var hx=()=>{let t=px(2),{Label:e}=be(),o;return t[0]!==e?(o=e?fx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gx}from"react/compiler-runtime";import{jsx as xx}from"react/jsx-runtime";import"react";var Cx=t=>{let e=gx(3),{children:o}=t,{InlineBlockContainer:n}=be(),r;return e[0]!==n||e[1]!==o?(r=n?xx(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as bx}from"react/jsx-runtime";import"react";var kx=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?bx(n,{...o,children:e}):null};import{c as _x}from"react/compiler-runtime";import{jsx as Tx}from"react/jsx-runtime";import"react";var wx=()=>{let t=_x(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?Tx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Ex}from"react/compiler-runtime";import{jsx as Sx}from"react/jsx-runtime";import"react";var Nx=()=>{let t=Ex(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?Sx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Lx}from"qs-esm";var yx=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let u=Lx({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 Ic={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
57
+ `,Bs="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",js="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",y0=new RegExp("^[^"+js+"]*["+Bs+"]"),R0=new RegExp("^[^"+Bs+"]*["+js+"]"),v0={bold:D.IS_BOLD,code:D.IS_CODE,highlight:D.IS_HIGHLIGHT,italic:D.IS_ITALIC,strikethrough:D.IS_STRIKETHROUGH,subscript:D.IS_SUBSCRIPT,superscript:D.IS_SUPERSCRIPT,underline:D.IS_UNDERLINE},I0={directionless:D.IS_DIRECTIONLESS,unmergeable:D.IS_UNMERGEABLE},M0={center:D.IS_ALIGN_CENTER,end:D.IS_ALIGN_END,justify:D.IS_ALIGN_JUSTIFY,left:D.IS_ALIGN_LEFT,right:D.IS_ALIGN_RIGHT,start:D.IS_ALIGN_START},A0={[D.IS_ALIGN_CENTER]:"center",[D.IS_ALIGN_END]:"end",[D.IS_ALIGN_JUSTIFY]:"justify",[D.IS_ALIGN_LEFT]:"left",[D.IS_ALIGN_RIGHT]:"right",[D.IS_ALIGN_START]:"start"},$0={normal:D.IS_NORMAL,segmented:D.IS_SEGMENTED,token:D.IS_TOKEN},D0={[D.IS_NORMAL]:"normal",[D.IS_SEGMENTED]:"segmented",[D.IS_TOKEN]:"token"};var Hs={text:({node:t})=>{let e=t.text;return t.format&D.IS_BOLD&&(e=We("strong",{children:e})),t.format&D.IS_ITALIC&&(e=We("em",{children:e})),t.format&D.IS_STRIKETHROUGH&&(e=We("span",{style:{textDecoration:"line-through"},children:e})),t.format&D.IS_UNDERLINE&&(e=We("span",{style:{textDecoration:"underline"},children:e})),t.format&D.IS_CODE&&(e=We("code",{children:e})),t.format&D.IS_SUBSCRIPT&&(e=We("sub",{children:e})),t.format&D.IS_SUPERSCRIPT&&(e=We("sup",{children:e})),e}};import{jsx as At}from"react/jsx-runtime";var Gs={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 ut={...Os,...Hs,...Is,...Ls,...Ps,...Rs,...vs,...Ds,...As({}),...Gs,...Fs};import{jsx as mo,Fragment as O0}from"react/jsx-runtime";import uo from"react";function zs(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 F0(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 Us(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 P0(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]=Us(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]=Us(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=F0(r))}return e}function Ws({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(zs(e)){let l=r?P0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Vs({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return mo(O0,{})}function Vs({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:p=>Vs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:r}}),parent:r}):d:c=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(c)){if(a.textAlign||a.paddingInlineStart){let m={...a,...c?.props?.style??{}};return uo.cloneElement(c,{key:u,style:m})}return uo.cloneElement(c,{key:u})}return c}catch(c){return console.error("Error converting lexical node to JSX:",c,"node:",i),null}}).filter(Boolean)}function Nn({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:ut}):u=i:u=ut;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Ws({converters:u,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Ks(B0,{children:d}):Ks("div",{className:t??"payload-richtext",children:d})}function Xs(){let t=j0(7),[e]=H0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=z0(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]),G0(l,s);let i;return t[5]!==n?(i=Js("div",{className:"debug-jsx-converter",children:Js(Nn,{converters:ut,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var U0=M({plugins:[{Component:Xs,position:"bottom"}]});var j={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)"}},W0={text:{"text-red":{css:{color:`light-dark(${j.red[600]}, ${j.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${j.orange[600]}, ${j.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${j.yellow[700]}, ${j.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${j.green[700]}, ${j.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${j.blue[600]}, ${j.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${j.purple[600]}, ${j.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${j.pink[600]}, ${j.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${j.red[400]}, ${j.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${j.orange[400]}, ${j.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${j.yellow[300]}, ${j.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${j.green[400]}, ${j.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${j.blue[400]}, ${j.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${j.purple[400]}, ${j.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${j.pink[400]}, ${j.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Dh}from"lexical";import{jsx as Ys}from"react/jsx-runtime";import"react";var V0="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",Ln=({className:t})=>Ys("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:Ys("path",{d:V0,fill:"currentColor"})});import{jsx as Z0}from"react/jsx-runtime";import{$applyNodeReplacement as q0}from"lexical";import*as qs from"react";import{DecoratorBlockNode as K0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as J0}from"@lexical/utils";import{$applyNodeReplacement as X0}from"lexical";function Y0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Zs({relationTo:o,value:e})}:null}var $t=class extends K0{__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:Y0,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=Zs(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return J0(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 Zs(t){return X0(new $t({data:t}))}var Q0=qs.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function eh(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 Se=class extends $t{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:eh,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 Z0(Q0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ve(t){return q0(new Se({data:t}))}function yn(t){return t instanceof Se}import{c as Eh}from"react/compiler-runtime";import{jsx as wh}from"react/jsx-runtime";import{useLexicalComposerContext as Sh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Nh}from"@lexical/utils";import{$getPreviousSelection as Lh,$getSelection as yh,$isParagraphNode as Rh,$isRangeSelection as vh,COMMAND_PRIORITY_EDITOR as Ih,createCommand as Mh}from"lexical";import{useEffect as Ah}from"react";import{c as ta}from"react/compiler-runtime";import{jsx as Rn}from"react/jsx-runtime";import{useLexicalComposerContext as oa}from"@lexical/react/LexicalComposerContext.js";import{toast as mh}from"@payloadcms/ui";import{$getNodeByKey as ph,COMMAND_PRIORITY_EDITOR as na}from"lexical";import{useEffect as ra,useState as fh}from"react";import{c as th}from"react/compiler-runtime";import{jsx as oh}from"react/jsx-runtime";import{useLexicalComposerContext as nh}from"@lexical/react/LexicalComposerContext";import{useListDrawer as rh,useModal as lh}from"@payloadcms/ui";import{$getNodeByKey as Qs,$getPreviousSelection as ih,$getRoot as sh,$getSelection as ah,$isRangeSelection as ch,$setSelection as uh}from"lexical";import{useEffect as dh,useState as ea}from"react";var Dt=t=>{let e=th(23),[o]=nh(),[n,r]=ea(null),[l,s]=ea(!1),[i,u,d]=rh(t),{closeDrawer:c,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=lh(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let N=ah()??ih();r(N)},e[0]=h):h=e[0];let x=h,C;e[1]!==o||e[2]!==n?(C=()=>{n&&o.update(()=>{if(ch(n)){let{anchor:N,focus:S}=n;Qs(N.key)&&Qs(S.key)&&uh(n.clone())}else sh().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=C):C=e[3];let E=C,w;e[4]!==c?(w=()=>{c()},e[4]=c,e[5]=w):w=e[5];let g=w,b,k;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let N=f[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},k=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=b,e[11]=k):(b=e[10],k=e[11]),dh(b,k);let _;e[12]!==u?(_=N=>oh(u,{...N,onClick:()=>{x()}}),e[12]=u,e[13]=_):_=e[13];let T;e[14]!==p?(T=()=>{x(),p(),s(!0)},e[14]=p,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==g||e[18]!==m||e[19]!==a||e[20]!==_||e[21]!==T?(I={closeListDrawer:g,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:_,openListDrawer:T},e[16]=i,e[17]=g,e[18]=m,e[19]=a,e[20]=_,e[21]=T,e[22]=I):I=e[22],I};var hh=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=ph(o);r&&r.replace(Ve({relationTo:e,value:n}))}):t.dispatchCommand(vn,{relationTo:e,value:n})},gh=t=>{let e=ta(14),{enabledCollectionSlugs:o}=t,[n]=oa(),[r,l]=fh(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}=Dt(i),a,m;e[3]!==n||e[4]!==c?(a=()=>n.registerCommand(Qe,x=>(l(x?.replace?x?.replace.nodeKey:null),c(),!0),na),m=[n,c],e[3]=n,e[4]=c,e[5]=a,e[6]=m):(a=e[5],m=e[6]),ra(a,m);let p;e[7]!==u||e[8]!==n||e[9]!==r?(p=x=>{let{collectionSlug:C,doc:E}=x;hh({editor:n,relationTo:C,replaceNodeKey:r,value:E.id}),u()},e[7]=u,e[8]=n,e[9]=r,e[10]=p):p=e[10];let f=p,h;return e[11]!==d||e[12]!==f?(h=Rn(d,{onSelect:f}),e[11]=d,e[12]=f,e[13]=h):h=e[13],h},xh=()=>{let t=ta(3),[e]=oa(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Qe,Ch,na),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ra(o,n),null},la=({enabledCollectionSlugs:t})=>t?.length?Rn(gh,{enabledCollectionSlugs:t}):Rn(xh,{});function Ch(){return mh.error("No relationship collections enabled"),!0}import{c as bh}from"react/compiler-runtime";import{useConfig as kh,useEntityVisibility as _h}from"@payloadcms/ui";import"react";var po=t=>{let e=bh(11),{enabledCollectionSlugs:o}=t,{config:n}=kh(),{collections:r}=n,{visibleEntities:l}=_h(),s,i;if(e[0]!==r||e[1]!==o||e[2]!==l){let d;e[5]!==o||e[6]!==l?(d=a=>{let{slug:m}=a;return o.includes(m)&&(!l?.collections||l.collections.includes(m))},e[5]=o,e[6]=l,e[7]=d):d=e[7];let c=r.filter(d);s=c,i=c.map(Th),e[0]=r,e[1]=o,e[2]=l,e[3]=s,e[4]=i}else s=e[3],i=e[4];let u;return e[8]!==s||e[9]!==i?(u={enabledCollections:s,enabledCollectionSlugs:i},e[8]=s,e[9]=i,e[10]=u):u=e[10],u};function Th(t){return t.slug}var vn=Mh("INSERT_RELATIONSHIP_COMMAND"),ia=t=>{let e=Eh(7),{clientProps:o}=t,[n]=Sh(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=po(r),s,i;e[2]!==n?(s=()=>{if(!n.hasNodes([Se]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(vn,$h,Ih)},i=[n],e[2]=n,e[3]=s,e[4]=i):(s=e[3],i=e[4]),Ah(s,i);let u;return e[5]!==l?(u=wh(la,{enabledCollectionSlugs:l}),e[5]=l,e[6]=u):u=e[6],u};function $h(t){let e=yh()||Lh();if(vh(e)){let o=Ve(t),{focus:n}=e,r=n.getNode();Nh(o),Rh(r)&&!r.__first&&r.remove()}return!0}var Oh=M({nodes:[Se],plugins:[{Component:ia,position:"normal"}],slashMenu:{groups:[Q([{Icon:Ln,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Ln,isActive:({selection:t})=>{if(!Dh(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 x5}from"react/compiler-runtime";import{jsx as he,jsxs as C5}from"react/jsx-runtime";import{useLexicalComposerContext as b5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ca}from"@lexical/react/useLexicalEditable";import{useScrollInfo as k5,useThrottledEffect as _5,useTranslation as T5}from"@payloadcms/ui";import*as ba from"react";import{useMemo as Dn}from"react";import{jsx as Fh,jsxs as Ph}from"react/jsx-runtime";import{Tooltip as Bh,useTranslation as jh}from"@payloadcms/ui";import{$addUpdateTag as Hh}from"lexical";import{useCallback as sa,useEffect as Gh,useMemo as aa,useRef as zh,useState as Uh}from"react";var In="toolbar-popup__button",Ot=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=jh(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=W(),[u,d]=Uh(!1),c=zh(null);Gh(()=>{c.current?.removeAttribute("data-pressing")},[t]);let a=aa(()=>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(/^./,h=>h.toUpperCase()),[s,l,i,r]),m=aa(()=>[In,n?"":"disabled",t?"active":"",r.key?`${In}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),p=sa(()=>{n&&o.focus(()=>{o.update(()=>{Hh("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),f=sa(h=>{h.preventDefault(),h.currentTarget.setAttribute("data-pressing","")},[]);return Ph("button",{"aria-label":a,"aria-pressed":r.isActive?t:void 0,className:m,"data-button-key":r.key,disabled:!n,onClick:p,onMouseDown:f,onPointerEnter:()=>d(!0),onPointerLeave:()=>{d(!1),c.current?.removeAttribute("data-pressing")},ref:c,type:"button",children:[Fh(Bh,{className:`${In}__tooltip`,show:u,children:a}),e]})};import{c as Zh}from"react/compiler-runtime";import{jsx as dt}from"react/jsx-runtime";import qh,{useMemo as Qh}from"react";import{useTranslation as e5}from"@payloadcms/ui";import{jsx as Ke,jsxs as ca}from"react/jsx-runtime";import{Button as Wh}from"@payloadcms/ui";import{$addUpdateTag as Vh,isDOMNode as Kh}from"lexical";import An,{useCallback as Jh,useEffect as ho,useId as Xh,useMemo as da,useRef as fo,useState as Mn}from"react";var ua="toolbar-popup__dropdown-item",ma=An.createContext(null);function pa({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let u=da(()=>[ua,n===!1?"disabled":"",t?"active":"",l?.key?`${ua}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),d=fo(null),c=An.use(ma);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=c;return ho(()=>{d?.current!=null&&a(d)},[d,a]),Ke(Wh,{"aria-label":i,buttonStyle:"ghost",className:u,disabled:n===!1,extraButtonProps:{"aria-checked":l.isActive?!!t:void 0,"data-item-key":s,role:l.isActive?"menuitemcheckbox":"menuitem",tabIndex:-1},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{Vh("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:i,type:"button",children:e})}function Yh({id:t,children:e,dropdownKey:o,dropDownRef:n,itemsContainerClassNames:r,onClose:l,shouldAutoFocus:s}){let[i,u]=Mn(),[d,c]=Mn(),a=Jh(f=>{u(h=>h!=null?[...h,f]:[f])},[u]),m=f=>{if(i==null)return;let{key:h}=f,x=i.filter(C=>!C.current?.disabled);["ArrowDown","ArrowUp","Escape"].includes(h)&&f.preventDefault(),h==="Escape"?l():h==="Tab"?setTimeout(()=>l({restoreFocus:!1})):h==="ArrowUp"?c(C=>{if(C==null)return x[0];let E=x.indexOf(C)-1;return x[E===-1?x.length-1:E]}):h==="ArrowDown"&&c(C=>{if(C==null)return x[0];let E=x.indexOf(C);return x[E===x.length-1?0:E+1]})},p=da(()=>({registerItem:a}),[a]);return ho(()=>{s&&i!=null&&d==null&&c(i.find(f=>!f.current?.disabled)),d!=null&&d?.current!=null&&d.current.focus()},[i,d,s]),Ke(ma,{value:p,children:Ke("div",{className:(r??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":o,"data-theme":"dark",id:t,onKeyDown:m,popover:"manual",ref:n,role:"menu",tabIndex:-1,children:e})})}function fa({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:u}){let d=fo(null),c=fo(null),a=fo(!1),m=Xh(),p=`toolbar-dropdown-${r}-${m}`,[f,h]=Mn(!1),x=({restoreFocus:C=!0}={})=>{h(!1),C&&c?.current!=null&&c.current.focus()};return ho(()=>{let C=c.current,E=d.current;if(f&&C!==null&&E!==null){E.matches(":popover-open")||E.showPopover();let w=()=>{let{bottom:g,left:b,top:k}=C.getBoundingClientRect(),_=8,T=5,I=g+T,N=k-E.offsetHeight-T,S=Math.max(_,window.innerHeight-E.offsetHeight-_),y=I+E.offsetHeight+_<=window.innerHeight?I:N>=_?N:I;E.style.position="fixed",E.style.top=`${Math.max(_,Math.min(y,S))}px`,E.style.left=`${Math.max(8,Math.min(b-5,window.innerWidth-E.offsetWidth-20))}px`};return w(),window.addEventListener("resize",w),window.addEventListener("scroll",w,{capture:!0,passive:!0}),()=>{window.removeEventListener("resize",w),window.removeEventListener("scroll",w,{capture:!0})}}},[d,c,f]),ho(()=>{let C=c.current;if(C!==null&&f){let E=w=>{let g=w.target;Kh(g)&&(u&&d.current&&d.current.contains(g)||C.contains(g)||h(!1))};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}}},[d,c,f,u]),ca(An.Fragment,{children:[ca("button",{"aria-controls":p,"aria-expanded":f,"aria-haspopup":"menu","aria-label":t,className:e+(f?" active":""),"data-dropdown-key":r,disabled:n,onClick:C=>{C.preventDefault(),a.current=!1,h(!f)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),a.current=!0,h(!f))},onMouseDown:C=>{C.preventDefault()},ref:c,type:"button",children:[l&&Ke(l,{}),i&&Ke("span",{className:"toolbar-popup__dropdown-label",children:i}),Ke("i",{className:"toolbar-popup__dropdown-caret"})]}),f&&Ke(Yh,{dropdownKey:r,dropDownRef:d,id:p,itemsContainerClassNames:s,onClose:x,shouldAutoFocus:a.current,children:o})]})}var $n="toolbar-popup__dropdown",t5=t=>{let e=Zh(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:u}=e5(),{fieldProps:d}=W(),{featureClientSchemaMap:c,schemaPath:a}=d;if(i.Component){let p;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(p=i?.Component&&dt(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]!==c||e[10]!==u||e[11]!==s||e[12]!==i||e[13]!==a){let p=i.key,f;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:u,schemaPath:a}):i.label),p.length>25?f=p.substring(0,25)+"...":f=p,m=dt(pa,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?dt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?p:void 0,children:dt("span",{className:"text",children:f})},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},o5=qh.memo(t5),Ft=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:u,key:d}=n,c=Qh(()=>u?.length?u.map(a=>dt(o5,{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 dt(fa,{buttonAriaLabel:`${d} dropdown`,buttonClassName:[$n,`${$n}-${d}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:d,Icon:l,itemsContainerClassNames:[`${$n}-items`,...s||[]],label:i,children:c},d)};import{mergeRegister as n5}from"@lexical/utils";import{$getSelection as r5}from"lexical";import{useCallback as l5,useDeferredValue as i5,useEffect as s5,useRef as ha,useState as a5}from"react";function c5(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]=a5(()=>c5(e)),r=i5(o),l=W(),s=ha(l);s.current=l;let i=ha(e);i.current=e;let u=Er(),d=l5(()=>{t.getEditorState().read(()=>{let c=r5();if(!c)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,f=new Map;for(let h of a){let x=[],C=[],E=[],w=h.type==="dropdown"?h.maxActiveItems??1:void 0;for(let b of h.items){let k=b.isActive?(!w||x.length<w)&&b.isActive({editor:t,editorConfigContext:m,selection:c}):!1,_=b.isEnabled?b.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;k&&(x.push(b.key),C.push(b)),_&&E.push(b.key),p.set(b.key,{active:k,enabled:_})}let g=h.type==="dropdown"&&h.isEnabled?h.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;f.set(h.key,{activeItemKeys:x,activeItems:C,enabledGroup:g,enabledItemKeys:E})}n({groupStates:f,itemStates:p})})},[t]);return s5(()=>{u(d);let c=()=>{u(d)},a=n5(t.registerUpdateListener(c));return document.addEventListener("mouseup",c),()=>{a(),document.removeEventListener("mouseup",c)}},[t,u,d]),r}import{c as u5}from"react/compiler-runtime";import{useEffect as d5}from"react";var m5=".fixed-toolbar__scroll",p5=40;function f5({clientWidth:t,deltaMode:e,deltaY:o,isRightToLeft:n}){let r=e===1?o*p5:e===2?o*t:o;return n?-r:r}function ga(t){if(!(Math.abs(t.deltaY)>Math.abs(t.deltaX)))return;let o=t.target;if(!(o instanceof Element))return;let n=o.closest(m5);!n||!(n.scrollWidth>n.clientWidth)||(t.preventDefault(),n.scrollLeft+=f5({clientWidth:n.clientWidth,deltaMode:t.deltaMode,deltaY:t.deltaY,isRightToLeft:getComputedStyle(n).direction==="rtl"}))}var mt=0;function xa(){let t=u5(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],d5(h5,e)}function h5(){return mt===0&&document.addEventListener("wheel",ga,{passive:!1}),mt=mt+1,g5}function g5(){mt=mt-1,mt===0&&document.removeEventListener("wheel",ga)}function E5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&he(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?he(Ot,{active:t,editor:o,enabled:n,item:r,children:he(r.ChildComponent,{})},r.key):null}function w5({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=T5(),{fieldProps:{featureClientSchemaMap:i,schemaPath:u}}=W(),d=l.groupStates.get(n.key),c=Dn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,d?.activeItems]),a=Dn(()=>{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 p=m[0],f=p.key;return p.label&&(f=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:u}):p.label),f.length>25&&(f=f.substring(0,25)+"..."),f},[n,d?.activeItems,s,i,u]);return C5("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&d?he(Ft,{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 p=l.itemStates.get(m.key);return he(E5,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&he("div",{className:"divider"})]},n.key)}function S5({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=ba.useRef(null),s=Ca(),{y:i}=k5();xa();let u=go(o,n?.features?.toolbarFixed?.groups),d=Dn(()=>{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 _5(()=>{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]),he("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&he("div",{className:"fixed-toolbar__scroll",children:n?.features&&n.features?.toolbarFixed?.groups.map((c,a)=>he(w5,{anchorElem:t,editor:o,editorConfig:n,group:c,index:a,toolbarStates:u},c.key))})})}var ka=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ka(t.parentEditor)}return!1},_a=t=>{let e=x5(6),{clientProps:o}=t,[n]=b5(),r=W();if(!Ca())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=ka(r);if(o?.disableIfParentHasFixedToolbar&&a){c=null;break e}if(!u?.features?.toolbarFixed?.groups?.length){c=null;break e}d=he(S5,{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 N5=M({plugins:[{Component:_a,position:"aboveContainer"}]});import{c as L5}from"react/compiler-runtime";import{jsx as Ne,jsxs as wa}from"react/jsx-runtime";import{useLexicalComposerContext as y5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as R5}from"@lexical/react/useLexicalEditable";import{mergeRegister as Sa}from"@lexical/utils";import{$getSelection as Na,$isRangeSelection as Ta,$isTextNode as v5,COMMAND_PRIORITY_LOW as I5,getDOMSelection as La,SELECTION_CHANGE_COMMAND as M5}from"lexical";import{useCallback as Co,useEffect as Pt,useMemo as A5,useRef as Ea,useState as $5}from"react";import"react";import{createPortal as D5}from"react-dom";function On(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 xo(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(),p=c.getBoundingClientRect(),f=u.top-a.height-d,h=u.left-l;s==="center"&&(h=u.left+u.width/2-a.width/2);let x=0;return!e&&f<p.top&&!i&&(x=a.height+u.height+d*2,f+=x),s==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,r.style.opacity="1",i&&n!==0?(f-=m.bottom-n+a.height-3,r.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,r.style.transform=`translate(${h}px, ${f}px)`),x}function O5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&Ne(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?Ne(Ot,{active:t,editor:o,enabled:n,item:r,children:Ne(r.ChildComponent,{})},r.key):null}function F5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=W(),s=r.groupStates.get(o.key),i=A5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return wa("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?Ne(Ft,{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 Ne(O5,{active:d?.active??!1,anchorElem:t,editor:e,enabled:d?.enabled??!0,item:u},u.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Ne("div",{className:"divider"})]},o.key)}function P5({anchorElem:t,editor:e}){let o=Ea(null),n=Ea(null),{editorConfig:r}=W(),l=go(e,r?.features?.toolbarInline?.groups),s=Co(()=>{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=Co(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 p=c.clientX,f=c.clientY,h=document.elementFromPoint(p,f);o.current.contains(h)||s()}}},[s]),u=Co(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Pt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",u)}),[o,i,u]);let d=Co(()=>{let c=Na(),a=La(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",f=e.getRootElement();if(c!==null&&a!==null&&!a.isCollapsed&&f!==null&&f.contains(a.anchorNode)){let h=On(a,f),x=xo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:h});n.current&&xo({anchorElem:o.current,anchorFlippedOffset:x,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:h,verticalGap:8})}else s()},[e,s,t]);return Pt(()=>{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]),Pt(()=>(e.getEditorState().read(()=>{d()}),Sa(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(M5,()=>(d(),!1),I5))),[e,d]),wa("div",{className:"inline-toolbar-popup",ref:o,children:[Ne("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,a)=>Ne(F5,{anchorElem:t,editor:e,group:c,index:a,toolbarStates:l},c.key))]})}function B5(t,e){let o=L5(12),[n,r]=$5(!1),l=R5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Na(),f=La(t._window),h=t.getRootElement();if(f!==null&&(!Ta(p)||h===null||!h.contains(f.anchorNode))){r(!1);return}if(!Ta(p))return;if(p.getTextContent()!==""){let C=p.getNodes(),E=!1;for(let w of C)if(v5(w)){r(!0),E=!0;break}E||r(!1)}else r(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){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]),Pt(u,d);let c,a;if(o[5]!==t||o[6]!==i?(c=()=>Sa(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]),Pt(c,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=D5(Ne(P5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var ya=t=>{let{anchorElem:e}=t,[o]=y5();return B5(o,e)};var j5=M({plugins:[{Component:ya,position:"floatingAnchorElem"}]});import{TableCellNode as D2,TableNode as O2,TableRowNode as F2}from"@lexical/table";import{jsx as Ra}from"react/jsx-runtime";import"react";var H5={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"},Fn=({className:t,size:e=24})=>Ra("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:Ra("path",{clipRule:"evenodd",d:H5[e],fill:"currentColor",fillRule:"evenodd"})});import{$convertToMarkdownString as G5}from"@lexical/markdown";import{$createTableCellNode as z5,$createTableNode as U5,$createTableRowNode as W5,$isTableCellNode as va,$isTableNode as Pn,$isTableRowNode as Bn,TableCellHeaderStates as bo,TableCellNode as V5,TableNode as K5,TableRowNode as J5}from"@lexical/table";import{$isParagraphNode as X5,$isTextNode as Y5}from"lexical";var Ma=/^\|(.+)\|\s?$/,Z5=/^(\| ?:?-*:? ?)+\|\s?$/,Aa=({allTransformers:t})=>({type:"element",dependencies:[K5,J5,V5],export:e=>{if(!Pn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!Bn(n))continue;let l=!1;for(let s of n.getChildren())va(s)&&(r.push(G5(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===bo.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
58
+ `)},regExp:Ma,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(Z5.test(r)){let a=e.getPreviousSibling();if(!a||!Pn(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Bn(p))return;p.getChildren().forEach(f=>{va(f)&&f.setHeaderStyles(bo.ROW,bo.ROW)}),e.remove();return}let l=Ia(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(!Y5(a))break;let m=Ia(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 d=U5();for(let a of s){let m=W5();d.append(m);for(let p=0;p<u;p++)m.append(p<a.length?a[p]:$a("",t))}let c=e.getPreviousSibling();Pn(c)&&q5(c)===u?(c.append(...d.getChildren()),e.remove()):e.replace(d),d.selectEnd()}});function q5(t){let e=t.getFirstChild();return Bn(e)?e.getChildrenSize():0}var $a=(t,e)=>{t=t.replace(/\\n/g,`
59
+ `);let o=z5(bo.NO_STATUS);return qt(t,e,o,!1,!0),o},Ia=(t,e)=>{let o=t.match(Ma);return!o||!o[1]?null:o[1].split("|").map(n=>$a(n,e))};import{c as og}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as ja}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ng}from"@lexical/react/useLexicalEditable";import{$computeTableMap as rg,$deleteTableColumnAtSelection as lg,$deleteTableRowAtSelection as ig,$getNodeTriplet as sg,$getTableCellNodeFromLexicalNode as Ba,$getTableNodeFromLexicalNodeOrThrow as $e,$getTableRowIndexFromTableCellNode as ag,$insertTableColumnAtSelection as cg,$insertTableRowAtSelection as ug,$isTableCellNode as Ha,$isTableSelection as Bt,$mergeCells as dg,$setTableColumnIsHeader as mg,$setTableRowIsHeader as pg,$unmergeCell as fg,getTableElement as jn,getTableObserverFromTableElement as Hn,TableCellHeaderStates as pt,TableCellNode as hg}from"@lexical/table";import{mergeRegister as gg}from"@lexical/utils";import{useScrollInfo as xg}from"@payloadcms/ui";import{$getSelection as _o,$isElementNode as Cg,$isRangeSelection as Gn,$isTextNode as bg,$setSelection as kg,COMMAND_PRIORITY_CRITICAL as _g,getDOMSelection as Tg,isDOMNode as Eg,SELECTION_CHANGE_COMMAND as wg}from"lexical";import*as zn from"react";import{useCallback as me,useEffect as ft,useRef as ko,useState as ht}from"react";import{createPortal as Ga}from"react-dom";import{jsx as Da}from"react/jsx-runtime";import"react";var Q5={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"},Oa=({className:t,size:e=24})=>Da("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Da("path",{clipRule:"evenodd",d:Q5[e],fill:"currentColor",fillRule:"evenodd"})});import{$computeTableCellRectBoundary as eg,$computeTableMap as tg,$getNodeTriplet as Fa}from"@lexical/table";function Pa({selection:t}){let[e,,o]=Fa(t.anchor),[n]=Fa(t.focus),[r,l,s]=tg(o,e,n),{maxColumn:i,maxRow:u,minColumn:d,minRow:c}=eg(r,l,s);return{columns:i-d+1,rows:u-c+1}}function Sg(){let t=_o();if(Gn(t)&&!t.isCollapsed()||Bt(t)&&!t.anchor.is(t.focus)||!Gn(t)&&!Bt(t))return!1;let[e]=sg(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Ng(t){let e=t.getLastDescendant();bg(e)?e.select():Cg(e)?e.selectEnd():e!==null&&e.selectNext()}function Lg({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=ja(),s=ko(null),[i,u]=ht(r),[d,c]=ht({columns:1,rows:1}),[a,m]=ht(!1),[p,f]=ht(!1),{y:h}=xg();ft(()=>l.registerMutationListener(hg,L=>{L.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{u(i.getLatest())})},{skipInitialization:!0}),[l,i]),ft(()=>{l.getEditorState().read(()=>{let L=_o();if(Bt(L)){let R=Pa({selection:L});c(R);let v=L.anchor.is(L.focus);m(!v&&(R.columns>1||R.rows>1))}f(Sg())})},[l]),ft(()=>{let L=e.current,R=s.current,v=l.getRootElement();if(L!=null&&R!=null&&v!=null){let A=v.getBoundingClientRect(),$=L.getBoundingClientRect();R.style.opacity="1";let O=R.getBoundingClientRect(),B=5,F=$.right+B;if(F+O.width>window.innerWidth||F+O.width>A.right){let V=$.left-O.width-B;F=(V<0?B:V)+window.pageXOffset}R.style.left=`${F+window.pageXOffset}px`;let z=$.top;if(z+O.height>window.innerHeight){let V=$.bottom-O.height;z=V<0?B:V}R.style.top=`${z}px`}},[e,s,l,h]),ft(()=>{function L(R){s.current!=null&&e.current!=null&&Eg(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&n(!1)}return window.addEventListener("click",L),()=>window.removeEventListener("click",L)},[n,e]);let x=me(()=>{l.update(()=>{if(i.isAttached()){let L=$e(i),R=jn(L,l.getElementByKey(L.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let v=Hn(R);v!==null&&v.$clearHighlight(),L.markDirty(),u(i.getLatest())}kg(null)})},[l,i]),C=()=>{l.update(()=>{let L=_o();if(!Bt(L))return;let v=L.getNodes().filter(Ha),A=dg(v);A&&(Ng(A),o())})},E=()=>{l.update(()=>{fg()}),x()},w=me(L=>{l.update(()=>{for(let R=0;R<d.rows;R++)ug(L);o()})},[l,o,d.rows]),g=me(L=>{l.update(()=>{for(let R=0;R<d.columns;R++)cg(L);o()})},[l,o,d.columns]),b=me(()=>{l.update(()=>{ig(),o()})},[l,o]),k=me(()=>{l.update(()=>{$e(i).remove(),x(),o()})},[l,i,x,o]),_=me(()=>{l.update(()=>{lg(),o()})},[l,o]),T=me(()=>{l.update(()=>{let L=$e(i),R=ag(i),v=!i.hasHeaderState(pt.ROW);pg(L,R,v),x(),o()})},[l,i,x,o]),I=me(()=>{l.update(()=>{let L=$e(i),[,R]=rg(L,i,i),v=!i.hasHeaderState(pt.COLUMN);mg(L,R.startColumn,v),x(),o()})},[l,i,x,o]),N=me(()=>{l.update(()=>{if(i.isAttached()){let L=$e(i);L&&L.setRowStriping(!L.getRowStriping())}x(),o()})},[l,i,x,o]),S=me(()=>{l.update(()=>{if(i.isAttached()){let L=$e(i);L&&L.setFrozenColumns(L.getFrozenColumns()===0?1:0)}x(),o()})},[l,i,x,o]),y=null;return t&&(a?y=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(y=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Ga(Le("div",{className:"table-action-menu-dropdown",onClick:L=>{L.stopPropagation()},ref:s,children:[y?Le(zn.Fragment,{children:[y,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:P("span",{className:"text",children:"Toggle row striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>S(),type:"button",children:P("span",{className:"text",children:"Toggle first column freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>w(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>w(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>g(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>g(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&pt.ROW)===pt.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&pt.COLUMN)===pt.COLUMN?"Remove":"Add"," ","column header"]})})]}),l.getRootElement()?.closest('dialog, [role="dialog"]')??document.body)}function yg({anchorElem:t,cellMerge:e}){let[o]=ja(),n=ko(null),r=ko(null),[l,s]=ht(!1),[i,u]=ht(null),d=me(()=>{let a=n.current,m=_o(),p=Tg(o._window),f=document.activeElement;function h(){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 h();let x=o.getRootElement(),C=null,E=null;if(Gn(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let g=Ba(m.anchor.getNode());if(g==null||(E=o.getElementByKey(g.getKey()),E==null||!g.isAttached()))return h();let b=$e(g),k=jn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Hn(k),u(g)}else if(Bt(m)){let g=Ba(m.anchor.getNode());if(!Ha(g))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=$e(g),k=jn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Hn(k),E=o.getElementByKey(g.getKey())}else if(!f)return h();if(C===null||E===null)return h();let w=!C||!C.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",w),a.classList.toggle("table-cell-action-button-container--inactive",!w),w){let g=E.getBoundingClientRect(),b=t.getBoundingClientRect(),k=g.top-b.top,_=g.right-b.left;a.style.transform=`translate(${_}px, ${k}px)`}},[o,t]);ft(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(d)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return gg(o.registerUpdateListener(p),o.registerCommand(wg,p,_g),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let c=ko(i);return ft(()=>{c.current!==i&&s(!1),c.current=i},[c,i]),P("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Le(zn.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:P(Oa,{})}),l&&P(Lg,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var za=t=>{let e=og(3),{anchorElem:o}=t,n=ng(),r;return e[0]!==o||e[1]!==n?(r=Ga(n?P(yg,{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 Rg}from"react/compiler-runtime";import{jsx as Eo,jsxs as vg}from"react/jsx-runtime";import{useLexicalComposerContext as Ig}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Mg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Ag,$getTableNodeFromLexicalNodeOrThrow as Un,$getTableRowIndexFromTableCellNode as $g,$isTableCellNode as Ua,$isTableRowNode as Dg,getDOMCellFromTarget as Og,getTableElement as Fg,TableNode as Wa}from"@lexical/table";import{calculateZoomLevel as Va,mergeRegister as Pg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Wn,isHTMLElement as Bg,SKIP_SCROLL_INTO_VIEW_TAG as Ka}from"lexical";import*as Xa from"react";import{useCallback as jt,useEffect as wo,useRef as To,useState as Je}from"react";import{createPortal as jg}from"react-dom";var Hg=33,Ja=92;function Gg({editor:t}){let e=To(null),o=To(null),n=To(null),[r,l]=Je(!1),s=W(),i=To(null),[u,d]=Je(null),[c,a]=Je(null),[m,p]=Je(!1),[f,h]=Je(null),x=jt(()=>{a(null),e.current=null,h(null),i.current=null,n.current=null},[]),C=S=>(S.buttons&1)===1;wo(()=>{let S=new Set;return Pg(t.registerMutationListener(Wa,y=>{for(let[L,R]of y)R==="destroyed"?S.delete(L):S.add(L);l(S.size>0)}),t.registerNodeTransform(Wa,y=>{if(y.getColWidths())return y;let L=y.getColumnCount(),R=Ja;return y.setColWidths(Array(L).fill(R)),y}))},[t]),wo(()=>{if(!r)return;let S=v=>{let A=v.target;if(Bg(A)){if(f){d({x:v.clientX,y:v.clientY});return}if(p(C(v)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let $=Og(A);$&&c!==$?t.getEditorState().read(()=>{let O=Wn($.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let B=Un(O),F=Fg(B,t.getElementByKey(B.getKey()));if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=A,n.current=F.getBoundingClientRect(),a($)},{editor:t}):$==null&&x()}}},y=v=>{p(!0)},L=v=>{p(!1)},R=t.registerRootListener((v,A)=>{A?.removeEventListener("mousemove",S),A?.removeEventListener("mousedown",y),A?.removeEventListener("mouseup",L),v?.addEventListener("mousemove",S),v?.addEventListener("mousedown",y),v?.addEventListener("mouseup",L)});return()=>{R()}},[c,f,t,r,x]);let E=S=>S==="bottom",w=jt(S=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=Wn(c.elem);if(!Ua(y))throw new Error("TableCellResizer: Table cell node not found.");let L=Un(y),R=$g(y),v=L.getChildren(),$=y.getColSpan()===L.getColumnCount()?R:R+y.getRowSpan()-1;if($>=v.length||$<0)throw new Error("Expected table cell to be inside of table row.");let O=v[$];if(!Dg(O))throw new Error("Expected table row");let B=O.getHeight();if(B===void 0){let z=O.getChildren();B=Math.min(...z.map(V=>g(V,t)??1/0))}let F=Math.max(B+S,Hg);O.setHeight(F)},{tag:Ka})},[c,t]),g=(S,y)=>y.getElementByKey(S.getKey())?.clientHeight,b=(S,y)=>{let L;return y.forEach(R=>{R.forEach((v,A)=>{v.cell===S&&(L=A)})}),L},k=jt(S=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=Wn(c.elem);if(!Ua(y))throw new Error("TableCellResizer: Table cell node not found.");let L=Un(y),[R]=Ag(L,null,null),v=b(y,R);if(v===void 0)throw new Error("TableCellResizer: Table column not found.");let A=L.getColWidths();if(!A)return;let $=A[v];if($===void 0)return;let O=[...A],B=Math.max($+S,Ja);O[v]=B,L.setColWidths(O)},{tag:Ka})},[c,t]),_=jt(S=>{let y=L=>{if(L.preventDefault(),L.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:v}=i.current;if(c===null)return;let A=Va(L.target);if(E(S)){let $=(L.clientY-v)/A;w($)}else{let $=(L.clientX-R)/A;k($)}x(),document.removeEventListener("mouseup",y)}};return y},[c,x,k,w]),T=jt(S=>y=>{if(y.preventDefault(),y.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");i.current={x:y.clientX,y:y.clientY},d(i.current),h(S),document.addEventListener("mouseup",_(S))},[c,_]),[I,N]=Je({bottom:null,left:null,right:null,top:null});return wo(()=>{if(c){let{height:S,left:y,top:L,width:R}=c.elem.getBoundingClientRect(),v=Va(c.elem),A=!!t.getRootElement()?.closest('dialog, [role="dialog"]'),$=A?0:window.scrollX,O=A?0:window.scrollY,B=A?"fixed":"absolute",F=10,z={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${F}px`,left:`${$+y}px`,position:B,top:`${O+L+S-F/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${S}px`,left:`${$+y+R-F/2}px`,position:B,top:`${O+L}px`,width:`${F}px`}},V=n.current;f&&u&&V&&(E(f)?(z[f].left=`${$+V.left}px`,z[f].top=`${O+u.y/v}px`,z[f].height="3px",z[f].width=`${V.width}px`):(z[f].top=`${O+V.top}px`,z[f].left=`${$+u.x/v}px`,z[f].width="3px",z[f].height=`${V.height}px`),z[f].backgroundColor="#adf"),N(z)}else N({bottom:null,left:null,right:null,top:null})},[c,f,t,u]),Eo("div",{ref:o,children:c!=null&&!m&&vg(Xa.Fragment,{children:[Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var Ya=()=>{let t=Rg(7),[e]=Ig(),o=Mg(),[n,r]=Je(null),l,s;t[0]!==e?(l=()=>e.registerRootListener(u=>{r(u?.closest('dialog, [role="dialog"]')??document.body)}),s=[e],t[0]=e,t[1]=l,t[2]=s):(l=t[1],s=t[2]),wo(l,s);let i;return t[3]!==e||t[4]!==o||t[5]!==n?(i=o&&n?jg(Eo(Gg,{editor:e}),n):null,t[3]=e,t[4]=o,t[5]=n,t[6]=i):i=t[6],i};import{c as Yg}from"react/compiler-runtime";import{jsx as Vn,jsxs as Zg,Fragment as qg}from"react/jsx-runtime";import{useLexicalComposerContext as Qg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as rc}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as e2,$getTableColumnIndexFromTableCellNode as t2,$getTableRowIndexFromTableCellNode as o2,$insertTableColumnAtSelection as n2,$insertTableRowAtSelection as r2,$isTableCellNode as l2,$isTableNode as Qa,getTableElement as i2,TableNode as s2}from"@lexical/table";import{$findMatchingParent as a2,mergeRegister as c2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ec,isHTMLElement as u2}from"lexical";import{useEffect as tc,useMemo as d2,useRef as oc,useState as So}from"react";import"react";import{createPortal as m2}from"react-dom";import{c as Kg}from"react/compiler-runtime";import{useEffect as Jg,useRef as Xg}from"react";var zg="Expected a function",Ug=Math.max,Wg=Math.min;function Vg(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(zg);e=e||0,typeof o=="object"&&(i=!!o.leading,u="maxWait"in o,d=u?Ug(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function p(k){let _=n,T=s;return n=s=void 0,l=k,c=t.apply(T,_),c}function f(k){return l=k,a=setTimeout(C,e),i?p(k):c}function h(k){let _=k-r,T=k-l,I=e-_;return u?Wg(I,d-T):I}function x(k){let _=k-r,T=k-l;return r===void 0||_>=e||_<0||u&&T>=d}function C(){let k=Date.now();if(x(k))return E(k);a=setTimeout(C,h(k))}function E(k){return a=void 0,m&&n?p(k):(n=s=void 0,c)}function w(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function g(){return a===void 0?c:E(Date.now())}function b(){let k=Date.now(),_=x(k);if(n=arguments,s=this,r=k,_){if(a===void 0)return f(r);if(u)return clearTimeout(a),a=setTimeout(C,e),p(r)}return a===void 0&&(a=setTimeout(C,e)),c}return b.cancel=w,b.flush=g,b}var Za=Vg;function qa(t,e,o){let n=Kg(6),r=Xg(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=Za(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]),Jg(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 nc=16;function p2({anchorElem:t}){let[e]=Qg(),o=rc(),n=W(),[r,l]=So(!1),[s,i]=So(!1),[u,d]=So(!1),[c,a]=So({}),m=oc(new Set),p=oc(null),f=qa(C=>{let{isOutside:E,tableDOMNode:w}=f2(C,n.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!w)return;p.current=w;let g=null,b=null,k=null;if(e.getEditorState().read(()=>{let $=ec(w);if(l2($)){let O=a2($,B=>Qa(B));if(!Qa(O))return;if(k=i2(O,e.getElementByKey(O.getKey())),k){let B=O.getChildrenSize(),F=O.getChildAtIndex(0)?.getChildrenSize(),z=o2($),V=t2($);z===B-1?g=$:V===F-1&&(b=$)}}},{editor:e}),!k)return;let _=k.parentElement;if(!_)return;let{bottom:T,height:I,left:N,right:S,width:y,y:L}=k.getBoundingClientRect(),R=!1;_&&_.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(R=_.scrollWidth>_.clientWidth);let{left:v,y:A}=t.getBoundingClientRect();g?(i(!1),l(!0),a({height:nc,left:R&&_?_.offsetLeft:N-v,top:T-A+5,width:R&&_?_.offsetWidth:y})):b&&(i(!0),l(!1),a({height:I,left:S-v+5,top:L-A,width:nc}))},50,250),h=d2(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);tc(()=>{if(u)return document.addEventListener("mousemove",f),()=>{l(!1),i(!1),document.removeEventListener("mousemove",f)}},[u,f]),tc(()=>c2(e.registerMutationListener(s2,C=>{e.getEditorState().read(()=>{let E=!1;for(let[w,g]of C)switch(g){case"created":{m.current.add(w),E=!0;break}case"destroyed":{m.current.delete(w),E=!0;break}default:break}if(E){h.disconnect();for(let w of m.current){let{tableElement:g}=e2(w);h.observe(g)}d(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=C=>{e.update(()=>{p.current&&(ec(p.current)?.selectEnd(),C?(r2(),l(!1)):(n2(),i(!1)))})};return o?Zg(qg,{children:[r&&Vn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...c},type:"button"}),s&&Vn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...c},type:"button"})]}):null}function f2(t,e){let o=t.target;if(u2(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 lc(t){let e=Yg(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!rc())return null;let l;return e[0]!==n?(l=m2(Vn(p2,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as Xn,jsxs as C2}from"react/jsx-runtime";import{useLexicalComposerContext as b2}from"@lexical/react/LexicalComposerContext";import{TablePlugin as k2}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as _2,TableCellNode as T2,TableNode as E2,TableRowNode as w2}from"@lexical/table";import{mergeRegister as S2}from"@lexical/utils";import{$getSelection as N2,$isRangeSelection as L2,$setSelection as y2,COMMAND_PRIORITY_EDITOR as R2,createCommand as v2}from"lexical";import{createContext as I2,use as M2,useCallback as dc,useEffect as mc,useMemo as A2,useRef as $2,useState as No}from"react";import*as pc from"react";import{jsx as te,jsxs as ye}from"react/jsx-runtime";import{useCallback as Kn,useEffect as ic,useRef as Jn,useState as Ht}from"react";import*as cc from"react";import{createPortal as h2}from"react-dom";var sc=10,ac=7;function g2(){return ye("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function x2(){return ye("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function uc({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Ht(0),[u,d]=Ht(0),[c,a]=Ht(""),[m,p]=Ht(""),[f,h]=Ht(null),x=Jn(null),C=Jn(null),E=Jn(null),w=s>0?s:c?parseInt(c,10)||0:5,g=u>0?u:m?parseInt(m,10)||0:5;ic(()=>{o||(i(0),d(0),a(""),p(""),h(null))},[o]),ic(()=>{if(!o)return;let N=S=>{if(S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),n()),S.key==="Enter"&&f){S.preventDefault();let y=parseInt(c,10),L=parseInt(m,10);y>0&&L>0&&r(y,L)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,f,c,m]);let b=Kn((N,S)=>{N>0&&S>0&&r(N,S)},[r]),k=Kn((N,S)=>{i(N),d(S)},[]),_=Kn(()=>{i(0),d(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=ac;N++)for(let S=1;S<=sc;S++){let y=S<=w&&N<=g,L=S<=s&&N<=u,R="table-grid-popup__cell";y&&L?R+=" table-grid-popup__cell--hover":y&&(R+=" table-grid-popup__cell--selected"),T.push(te("div",{"aria-label":`${S} columns, ${N} rows`,className:R,onClick:()=>b(S,N),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),b(S,N))},onMouseEnter:()=>k(S,N),role:"button",tabIndex:-1},`${N}-${S}`))}let I=s>0&&u>0;return h2(ye(cc.Fragment,{children:[te("div",{className:"table-grid-popup__backdrop",onClick:n}),te("div",{className:"table-grid-popup",ref:x,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${f==="cols"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(g2,{})}),te("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>h(null),onChange:N=>a(N.target.value),onFocus:()=>h("cols"),placeholder:s>0?String(s):"5",ref:C,type:"number",value:c})]}),te("span",{className:"table-grid-popup__separator",children:"\xD7"}),ye("div",{className:`table-grid-popup__input-group${f==="rows"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(x2,{})}),te("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>h(null),onChange:N=>p(N.target.value),onFocus:()=>h("rows"),placeholder:u>0?String(u):"5",ref:E,type:"number",value:m})]})]}),ye("div",{className:"table-grid-popup__grid",onMouseLeave:_,children:[T,I&&ye("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/sc*100}%)`,top:`calc(${(u-1)/ac*100}%)`},children:[w," \xD7 ",g]})]})]})})]}),t)}var Lo=v2("OPEN_EMBED_DRAWER_COMMAND"),fc=I2({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function hc({children:t}){let[e,o]=No({cellEditorConfig:null,cellEditorPlugins:null});return Xn(fc,{value:A2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var gc=()=>{let[t]=b2(),e=M2(fc),[o,n]=No(!1),[r,l]=No(null),s=$2(null),[i,u]=No(null);mc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;u(m??a.parentElement)}},[t]),mc(()=>{if(!t.hasNodes([E2,w2,T2]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return S2(t.registerCommand(Lo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),p=null;t.getEditorState().read(()=>{let h=N2();if(L2(h)){s.current=h.clone();let x=h.anchor.getNode(),C=t.getElementByKey(x.getKey());if(C){let E=C.getBoundingClientRect();E.height>0&&(p={left:E.left-m.left,top:E.bottom-m.top+8})}}});let f=window.getSelection();if(f&&f.rangeCount>0){let x=f.getRangeAt(0).getBoundingClientRect();x.height>0&&(p={left:x.left-m.left,top:x.bottom-m.top+8})}return p||(p={left:0,top:40}),l(p),n(!0),!0},R2))},[e,t,i]);let d=dc(()=>{n(!1)},[]),c=dc((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&y2(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(_2,{columns:String(a),rows:String(m)})},1)},[t]);return C2(pc.Fragment,{children:[Xn(uc,{anchorElem:i,editor:t,isOpen:o,onClose:d,onInsert:c,position:r}),Xn(k2,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var P2=M({markdownTransformers:[Aa],nodes:[O2,D2,F2],plugins:[{Component:gc,position:"normal"},{Component:Ya,position:"normal"},{Component:za,position:"floatingAnchorElem"},{Component:lc,position:"floatingAnchorElem"}],providers:[hc],slashMenu:{groups:[Q([{Icon:Fn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Lo,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Fn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Lo,{})}}])]}});import{$isNodeSelection as px}from"lexical";import{jsx as xc}from"react/jsx-runtime";import"react";var B2="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",Yn=({className:t})=>xc("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:xc("path",{clipRule:"evenodd",d:B2,fill:"currentColor",fillRule:"evenodd"})});import{c as K2}from"react/compiler-runtime";import{jsx as J2}from"react/jsx-runtime";import{useLexicalComposerContext as X2}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as yc,$insertNodeToNearestRoot as Qn,mergeRegister as Y2}from"@lexical/utils";import{useBulkUpload as Z2,useEffectEvent as q2,useModal as Q2}from"@payloadcms/ui";import er from"bson-objectid";import{$createRangeSelection as ex,$getPreviousSelection as Ec,$getSelection as wc,$isParagraphNode as tr,$isRangeSelection as Sc,$setSelection as tx,COMMAND_PRIORITY_EDITOR as ox,COMMAND_PRIORITY_LOW as Nc,createCommand as nx,DROP_COMMAND as rx,getDOMSelectionFromTarget as lx,isHTMLElement as Lc,PASTE_COMMAND as ix}from"lexical";import{useEffect as sx}from"react";import{c as Cc}from"react/compiler-runtime";import{jsx as Zn}from"react/jsx-runtime";import{useLexicalComposerContext as bc}from"@lexical/react/LexicalComposerContext.js";import{toast as j2}from"@payloadcms/ui";import{$getNodeByKey as H2,COMMAND_PRIORITY_EDITOR as kc}from"lexical";import{useEffect as _c,useState as G2}from"react";var z2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=H2(o);r&&r.replace(ve({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(qn,{fields:null,relationTo:e,value:n})},U2=t=>{let e=Cc(13),{enabledCollectionSlugs:o}=t,[n]=bc(),[r,l]=G2(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}=Dt(s),c,a;e[2]!==n||e[3]!==d?(c=()=>n.registerCommand(et,h=>(l(h?.replace?h?.replace.nodeKey:null),d(),!0),kc),a=[n,d],e[2]=n,e[3]=d,e[4]=c,e[5]=a):(c=e[4],a=e[5]),_c(c,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:x,doc:C}=h;i(),z2({editor:n,relationTo:x,replaceNodeKey:r,value:C.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,f;return e[10]!==u||e[11]!==p?(f=Zn(u,{onSelect:p}),e[10]=u,e[11]=p,e[12]=f):f=e[12],f},W2=()=>{let t=Cc(3),[e]=bc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(et,V2,kc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),_c(o,n),null},Tc=({enabledCollectionSlugs:t})=>t?.length?Zn(U2,{enabledCollectionSlugs:t}):Zn(W2,{});function V2(){return j2.error("No upload collections enabled"),!0}function ax(t){let e=t.target;return!!(Lc(e)&&!e.closest("code, span.editor-image")&&Lc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function cx(t){let e,o=lx(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 qn=nx("INSERT_UPLOAD_COMMAND"),Rc=t=>{let e=K2(20),{clientProps:o}=t,[n]=X2(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=po(r),{modalSlug:s,setCollectionSlug:i,setInitialForms:u,setOnCancel:d,setOnSuccess:c,setSelectableCollections:a}=Z2(),{isModalOpen:m,openModal:p}=Q2(),f;e[2]!==s||e[3]!==n||e[4]!==l||e[5]!==m||e[6]!==p||e[7]!==i||e[8]!==u||e[9]!==d||e[10]!==c||e[11]!==a?(f=w=>{let{files:g}=w;if(g?.length!==0&&(u(b=>[...b??[],...g.map(ux)]),!m(s))){if(!l.length||!l[0])return;i(l[0]),a(l),d(()=>{n.update(dx)}),c(b=>{let k=new Map(b.map(mx));n.update(()=>{for(let _ of yc()){let T=_.node;if(ot(T)){let I=T.getData();if(I?.pending){let N=k.get(I.pending?.formID);N&&T.replace(ve({data:{id:new er.default().toHexString(),fields:{},relationTo:N.collectionSlug,value:N.doc.id}}))}}}})}),p(s)}},e[2]=s,e[3]=n,e[4]=l,e[5]=m,e[6]=p,e[7]=i,e[8]=u,e[9]=d,e[10]=c,e[11]=a,e[12]=f):f=e[12];let h=q2(f),x;e[13]!==n||e[14]!==h?(x=()=>{if(!n.hasNodes([tt]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Y2(n.registerNodeTransform(tt,w=>{let g=w.getData();if(!g?.pending)return;(async function(){let _=null,T=g?.pending?.src,I=g?.pending?.formID;if(T?.startsWith("data:")){let N=T.match(/data:(image\/[a-zA-Z]+);base64,/),S=N?N[1]:"image/png",y=T.replace(/^data:image\/[a-zA-Z]+;base64,/,""),L=atob(y),R=new Array(L.length);for(let $=0;$<L.length;$++)R[$]=L.charCodeAt($);let v=new Uint8Array(R);_={alt:void 0,file:new File([v],"pasted-image."+S?.split("/",2)[1],{type:S}),formID:I}}else if(T?.startsWith("http")||T?.startsWith("https")){let S=await(await fetch(T)).blob(),y=T.split("/").pop()||"pasted-image"+S.type.split("/",2)[1];_={alt:void 0,file:new File([S],y,{type:S.type}),formID:I}}_&&h({files:[_]})})()}),n.registerCommand(qn,w=>(n.update(()=>{let g=wc()||Ec();if(Sc(g)){let b=ve({data:{id:w.id,fields:w.fields,relationTo:w.relationTo,value:w.value}}),{focus:k}=g,_=k.getNode();Qn(b),tr(_)&&!_.__first&&_.remove()}}),!0),ox),n.registerCommand(ix,w=>{if(!(w instanceof ClipboardEvent))return!1;let g=w.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new er.default().toHexString()})}),b.length?(n.update(()=>{let k=wc()||Ec();if(Sc(k))for(let _ of b){let T=ve({data:{pending:{formID:_.formID,src:URL.createObjectURL(_.file)}}}),{focus:I}=k,N=I.getNode();Qn(T),tr(N)&&!N.__first&&N.remove()}}),h({files:b}),!0):!1},Nc),n.registerCommand(rx,w=>{if(!(w instanceof DragEvent))return!1;let g=w.dataTransfer;if(!g?.types?.length)return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new er.default().toHexString()})}),b.length?(w.preventDefault(),w.stopPropagation(),n.update(()=>{if(ax(w)){let k=cx(w),_=ex();k!=null&&_.applyDOMRange(k),tx(_);for(let T of b){let I=ve({data:{pending:{formID:T.formID,src:URL.createObjectURL(T.file)}}}),{focus:N}=_,S=N.getNode();Qn(I),tr(S)&&!S.__first&&S.remove()}}}),h({files:b}),!0):!1},Nc))},e[13]=n,e[14]=h,e[15]=x):x=e[15];let C;e[16]!==n?(C=[n],e[16]=n,e[17]=C):C=e[17],sx(x,C);let E;return e[18]!==l?(E=J2(Tc,{enabledCollectionSlugs:l}),e[18]=l,e[19]=E):E=e[19],E};function ux(t){return{file:t.file,formID:t.formID}}function dx(){for(let t of yc()){let e=t.node;ot(e)&&e.getData()?.pending&&e.remove()}}function mx(t){return[t.formID,t]}var fx=M({nodes:[tt],plugins:[{Component:Rc,position:"normal"}],slashMenu:{groups:[Q([{Icon:Yn,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:[ke([{ChildComponent:Yn,isActive:({selection:t})=>{if(!px(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ot(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{c as gx}from"react/compiler-runtime";import{jsx as yo}from"react/jsx-runtime";import{createElement as xx}from"react";import{ShimmerEffect as Cx,useConfig as bx}from"@payloadcms/ui";import{lazy as kx,Suspense as _x,useEffect as Tx,useState as Ex}from"react";var vc={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 or={namespace:"lexical",theme:vc};function Ic({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 hx}from"payload/shared";var Mc=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?hx(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 nr(t,e,o,n){return{admin:o,features:Mc(t),lexical:e,resolvedFeatureMap:t,view:n}}var wx=kx(()=>import("./Field-BPLEYPXV.js").then(t=>({default:t.RichText}))),Sx=t=>yo(Bo,{inheritable:!0,views:t.views,children:yo(Nx,{...t})}),Nx=t=>{let e=gx(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 p=m,f=i===void 0?or:i,{currentView:h}=jo(),x=d?.[h]?.admin??a,C=d?.[h]?.lexical,E;e[4]!==f||e[5]!==C?(E=typeof C=="function"?C(f):C??f,e[4]=f,e[5]=C,e[6]=E):E=e[6];let w=E,{config:g}=bx(),[b,k]=Ex(null),_,T;e[7]!==n||e[8]!==g||e[9]!==h||e[10]!==x||e[11]!==w||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==u||e[17]!==d?(_=()=>{if(b&&b.view===h)return;let N=d?.[h],S=N?.filterFeatures?N.filterFeatures(n):n,y=[];for(let R of Object.values(S))!R.clientFeatureProvider||!R.clientFeatureProps||y.push(R.clientFeatureProvider(R.clientFeatureProps));let L=Ic({config:g,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:u??s.name,unSanitizedEditorConfig:{features:y,lexical:w}});k(nr(L,w,x,h))},T=[x,n,g,p,l,s,b,w,u,h,d],e[7]=n,e[8]=g,e[9]=h,e[10]=x,e[11]=w,e[12]=p,e[13]=l,e[14]=s,e[15]=b,e[16]=u,e[17]=d,e[18]=_,e[19]=T):(_=e[18],T=e[19]),Tx(_,T);let I;return e[20]!==b||e[21]!==t?(I=yo(_x,{fallback:yo(Cx,{height:"35vh"}),children:b&&xx(wx,{...t,editorConfig:b,key:b.view})}),e[20]=b,e[21]=t,e[22]=I):I=e[22],I};function Lx(...t){return t.filter(Boolean).join(" ")}var yx=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var Ro=new WeakMap;function Ac(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function vo(t,e){let o=Ro.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Ac(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let u=Ac(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},Ro.set(t,o)}return o.listeners.add(e),()=>{Rx(t,e)}}function Rx(t,e){let o=Ro.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Ro.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function vx(t,e){return vo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function Ix(t,e){return vo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function Mx(t,e){return vo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function Ax(t,e){return vo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as $x}from"react/compiler-runtime";import{jsx as Dx}from"react/jsx-runtime";import"react";var Ox=()=>{let t=$x(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?Dx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Fx}from"react/compiler-runtime";import{jsx as Px}from"react/jsx-runtime";import"react";var Bx=()=>{let t=Fx(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?Px(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as jx}from"react/compiler-runtime";import{jsx as Hx}from"react/jsx-runtime";import"react";var Gx=()=>{let t=jx(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?Hx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as zx}from"react/compiler-runtime";import{jsx as Ux}from"react/jsx-runtime";import"react";var Wx=t=>{let e=zx(3),{children:o}=t,{InlineBlockContainer:n}=Ce(),r;return e[0]!==n||e[1]!==o?(r=n?Ux(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as Vx}from"react/jsx-runtime";import"react";var Kx=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ce();return n?Vx(n,{...o,children:e}):null};import{c as Jx}from"react/compiler-runtime";import{jsx as Xx}from"react/jsx-runtime";import"react";var Yx=()=>{let t=Jx(2),{EditButton:e}=ce(),o;return t[0]!==e?(o=e?Xx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Zx}from"react/compiler-runtime";import{jsx as qx}from"react/jsx-runtime";import"react";var Qx=()=>{let t=Zx(2),{RemoveButton:e}=ce(),o;return t[0]!==e?(o=e?qx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as eC}from"qs-esm";var tC=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let u=eC({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 $c={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
60
60
  `)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
61
61
  `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let n=o?.[1];return t.startsWith(`
62
62
  `)&&(t=t.slice(1)),t.endsWith(`
63
63
  `)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
64
- `)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as vx}from"react/jsx-runtime";import{CodeField as Rx,useFormFields as Ix}from"@payloadcms/ui";import{useId as Mx,useMemo as Ax}from"react";var Ro={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 $x=({autoComplete:t,field:e,forceRender:o,languages:n=Ro,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,typescript:d,validate:c})=>{let a=Ix(([_])=>_.language),m=a?.value||a?.initialValue||"typescript",p=Mx(),h=n[m],f=Ax(()=>({...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&&vx(Rx,{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: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 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:c},g)};import{jsx as re,jsxs as Bc}from"react/jsx-runtime";import{useLexicalEditable as Vx}from"@lexical/react/useLexicalEditable";import{ChevronIcon as Wx,Combobox as zx,CopyToClipboard as Kx,PopupList as Jx,RenderFields as Xx,useForm as Zx,useFormFields as Pc,useTranslation as Yx}from"@payloadcms/ui";import qx from"react";import{jsx as Mc}from"react/jsx-runtime";import"react";var Dx={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"},Ac=({className:t,size:e=24})=>Mc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Mc("path",{clipRule:"evenodd",d:Dx[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as or}from"react/jsx-runtime";import"react";import{useCollapsible as Px}from"@payloadcms/ui";import{jsx as $c}from"react/jsx-runtime";import"react";var Ox="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",Io=({className:t})=>$c("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:$c("path",{d:Ox,fill:"currentColor"})});import{jsx as Dc}from"react/jsx-runtime";import"react";var Fx="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",Mo=({className:t})=>Dc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Dc("path",{clipRule:"evenodd",d:Fx,fill:"currentColor",fillRule:"evenodd"})});var Bx="code-block-collapse-button",Oc=()=>{let{isCollapsed:t,toggle:e}=Px();return or("button",{className:Bx,onClick:e,type:"button",children:t?or(Mo,{}):or(Io,{})})};import{jsx as nr,jsxs as jx}from"react/jsx-runtime";import{useCollapsible as Hx,useTranslation as Gx}from"@payloadcms/ui";import"react";var Ux="code-block-floating-collapse-button",Fc=()=>{let{isCollapsed:t,toggle:e}=Hx(),{t:o}=Gx();return jx("button",{className:Ux,onClick:e,type:"button",children:[t?nr(Mo,{}):nr(Io,{}),nr("span",{children:o(t?"general:expand":"general:collapse")})]})};var Ke="payload-richtext-code-block",Qx=t=>{let{languages:e}=t,o=e||Ro,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ae(),{setModified:s}=Zx(),{t:i}=Yx(),{codeField:u}=Pc(([h])=>({codeField:h?.code})),{selectedLanguageField:d,setSelectedLanguage:c}=Pc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[d?.value],m=Vx(),p=qx.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:re(Jx.Button,{active:!1,disabled:!1,onClick:()=>{c(h)},children:re("span",{className:`${Ke}__language-code`,"data-language":h,children:f})})})),[o,c]);return re(n,{Actions:Bc("div",{className:`${Ke}__actions`,children:[re(zx,{"aria-label":i("general:language"),button:Bc("div",{className:`${Ke}__language-selector-button`,"data-selected-language":d?.value,children:[re("span",{children:a}),re(Wx,{className:`${Ke}__chevron`})]}),buttonType:"custom",className:`${Ke}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(Kx,{value:u?.value??""}),re(Oc,{}),m&&re(l,{})]}),className:Ke,collapsibleProps:{AfterCollapsible:re(Fc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${Ke}__pill`,children:re(Ac,{})}),showDragHandle:!1,showRowNumber:!1,children:re(Xx,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as eC}from"react/compiler-runtime";import{jsx as pt}from"react/jsx-runtime";import{FieldContext as tC,FieldPathContext as jc,ServerFunctionsContext as Hc,ShimmerEffect as oC,useServerFunctions as nC}from"@payloadcms/ui";import rC,{useEffect as lC,useRef as iC}from"react";var sC=t=>{let e=eC(9),{field:o,initialValue:n,Loading:r,path:l,schemaPath:s,setValue:i,value:u}=t,[d,c]=rC.useState(null),a=nC(),{_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});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=iC(!1),R,b;if(e[6]!==_?(R=()=>{L.current||(L.current=!0,_())},b=[_],e[6]=_,e[7]=R,e[8]=b):(R=e[7],b=e[8]),lC(R,b),!d)return typeof r<"u"?r:pt(oC,{});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 pt(Hc,{value:{...x},children:pt(jc,{value:f,children:d},f)});let C={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:f,setValue:i??aC,showError:!1,value:u};return pt(Hc,{value:{...x},children:pt(jc,{value:f,children:pt(tC,{value:C,children:d})},f)})};function aC(){}function Gc({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 cC=Gc;export{yt as $createAutoLinkNode,Pe as $createBlockNode,ot as $createHorizontalRuleNode,Ct as $createInlineBlockNode,we as $createLinkNode,ze as $createRelationshipNode,ge as $createUploadNode,Se as $isAutoLinkNode,Me as $isBlockNode,Ge as $isHorizontalRuleNode,bt as $isInlineBlockNode,K as $isLinkNode,Sn as $isRelationshipNode,mt as $isUploadNode,pu as AlignFeatureClient,Ee as AutoLinkNode,kx as BlockCollapsible,wx as BlockEditButton,ce as BlockNode,Nx as BlockRemoveButton,_u as BlockquoteFeatureClient,Wd as BlocksFeatureClient,b1 as BoldFeatureClient,se as CAN_USE_DOM,Of as ChecklistFeatureClient,Qx as CodeBlockBlockComponent,$x as CodeComponent,u0 as DETAIL_TYPE_TO_DETAIL,i0 as DOUBLE_LINE_BREAK,w0 as DebugJsxConverterFeatureClient,m0 as ELEMENT_FORMAT_TO_TYPE,d0 as ELEMENT_TYPE_TO_FORMAT,qc as ENABLE_SLASH_MENU_COMMAND,Jc as EditorConfigProvider,Oo as FieldsDrawer,Zh as FixedToolbarFeatureClient,Sm as HeadingFeatureClient,Wm as HorizontalRuleFeatureClient,Te as HorizontalRuleNode,et as INSERT_BLOCK_COMMAND,tt as INSERT_INLINE_BLOCK_COMMAND,r0 as IS_ALL_FORMATTING,sp as IndentFeatureClient,Cx as InlineBlockContainer,cx as InlineBlockEditButton,hx as InlineBlockLabel,xt as InlineBlockNode,mx as InlineBlockRemoveButton,S1 as InlineCodeFeatureClient,u5 as InlineToolbarFeatureClient,M1 as ItalicFeatureClient,a0 as LTR_REGEX,Nf as LinkFeatureClient,oe as LinkNode,l0 as NON_BREAKING_SPACE,O as NodeFormat,Gf as OrderedListFeatureClient,Zf as ParagraphFeatureClient,Zc as Point,s0 as RTL_REGEX,Qc as Rect,ph as RelationshipFeatureClient,Ne as RelationshipNode,sC as RenderLexical,q2 as RichTextField,Fo as RichTextViewProvider,B1 as StrikethroughFeatureClient,U1 as SubscriptFeatureClient,J1 as SuperscriptFeatureClient,p0 as TEXT_MODE_TO_TYPE,c0 as TEXT_TYPE_TO_FORMAT,f0 as TEXT_TYPE_TO_MODE,pe as TOGGLE_LINK_COMMAND,r2 as TableFeatureClient,l1 as TestRecorderFeatureClient,um as TextStateFeatureClient,$t as ToolbarButton,Dt as ToolbarDropdown,u1 as TreeViewFeatureClient,Q1 as UnderlineFeatureClient,Jf as UnorderedListFeatureClient,H2 as UploadFeatureClient,he as UploadNode,ix as addSwipeDownListener,nx as addSwipeLeftListener,rx as addSwipeRightListener,lx as addSwipeUpListener,cC as buildDefaultEditorState,Gc as buildEditorState,Ic as codeConverterClient,tx as createBlockNode,A as createClientFeature,E0 as defaultColors,er as defaultEditorLexicalConfig,An as getDOMRangeRect,eu as getEnabledNodes,yx as getRestPopulateFn,nt as getSelectedNode,Yc as isPoint,ex as joinClasses,tr as sanitizeClientEditorConfig,vc as sanitizeClientFeatures,go as setFloatingElemPosition,ro as setFloatingElemPositionForLinkEditor,X as slashMenuBasicGroupWithItems,_e as toolbarAddDropdownGroupWithItems,rn as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ae as useBlockComponentContext,U as useEditorConfigContext,be as useInlineBlockComponentContext,Xc as useLexicalDocumentDrawer,Oe as useLexicalDrawer,At as useLexicalListDrawer,Bo as useRichTextView};
64
+ `)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as oC}from"react/jsx-runtime";import{CodeField as nC,useFormFields as rC}from"@payloadcms/ui";import{useId as lC,useMemo as iC}from"react";var Io={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 sC=({autoComplete:t,field:e,forceRender:o,languages:n=Io,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,typescript:d,validate:c})=>{let a=rC(([C])=>C.language),m=a?.value||a?.initialValue||"typescript",p=lC(),f=n[m],h=iC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),x=`${e.name}-${m}-${f}`;return h&&oC(nC,{autoComplete:t,field:h,forceRender:o,onMount:(C,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:d?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[d?.target??"ESNext"],typeRoots:d?.typeRoots??["node_modules/@types"]}),E.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 g=>{let k=await(await fetch(g.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(k,g.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,validate:c},x)};import{jsx as ie,jsxs as Hc}from"react/jsx-runtime";import{useLexicalEditable as xC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as CC,Combobox as bC,CopyToClipboard as kC,PopupList as _C,RenderFields as TC,useForm as EC,useFormFields as Gc,useTranslation as wC}from"@payloadcms/ui";import SC from"react";import{jsx as Dc}from"react/jsx-runtime";import"react";var aC={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"},Oc=({className:t,size:e=24})=>Dc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Dc("path",{clipRule:"evenodd",d:aC[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as rr}from"react/jsx-runtime";import"react";import{useCollapsible as mC}from"@payloadcms/ui";import{jsx as Fc}from"react/jsx-runtime";import"react";var cC="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",Mo=({className:t})=>Fc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Fc("path",{d:cC,fill:"currentColor"})});import{jsx as Pc}from"react/jsx-runtime";import"react";var uC="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",Ao=({className:t})=>Pc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Pc("path",{clipRule:"evenodd",d:uC,fill:"currentColor",fillRule:"evenodd"})});var dC="code-block-collapse-button",Bc=()=>{let{isCollapsed:t,toggle:e}=mC();return rr("button",{className:dC,onClick:e,type:"button",children:t?rr(Ao,{}):rr(Mo,{})})};import{jsx as lr,jsxs as pC}from"react/jsx-runtime";import{useCollapsible as fC,useTranslation as hC}from"@payloadcms/ui";import"react";var gC="code-block-floating-collapse-button",jc=()=>{let{isCollapsed:t,toggle:e}=fC(),{t:o}=hC();return pC("button",{className:gC,onClick:e,type:"button",children:[t?lr(Ao,{}):lr(Mo,{}),lr("span",{children:o(t?"general:expand":"general:collapse")})]})};var Xe="payload-richtext-code-block",NC=t=>{let{languages:e}=t,o=e||Io,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ce(),{setModified:s}=EC(),{t:i}=wC(),{codeField:u}=Gc(([f])=>({codeField:f?.code})),{selectedLanguageField:d,setSelectedLanguage:c}=Gc(([f,h])=>({selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),s(!0)}})),a=o[d?.value],m=xC(),p=SC.useMemo(()=>Object.entries(o).map(([f,h])=>({name:`${f} ${h}`,Component:ie(_C.Button,{active:!1,disabled:!1,onClick:()=>{c(f)},children:ie("span",{className:`${Xe}__language-code`,"data-language":f,children:h})})})),[o,c]);return ie(n,{Actions:Hc("div",{className:`${Xe}__actions`,children:[ie(bC,{"aria-label":i("general:language"),button:Hc("div",{className:`${Xe}__language-selector-button`,"data-selected-language":d?.value,children:[ie("span",{children:a}),ie(CC,{className:`${Xe}__chevron`})]}),buttonType:"custom",className:`${Xe}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),ie(kC,{value:u?.value??""}),ie(Bc,{}),m&&ie(l,{})]}),className:Xe,collapsibleProps:{AfterCollapsible:ie(jc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:ie("div",{className:`${Xe}__pill`,children:ie(Oc,{})}),showDragHandle:!1,showRowNumber:!1,children:ie(TC,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as LC}from"react/compiler-runtime";import{jsx as gt}from"react/jsx-runtime";import{FieldContext as yC,FieldPathContext as zc,ServerFunctionsContext as Uc,ShimmerEffect as RC,useServerFunctions as vC}from"@payloadcms/ui";import IC,{useEffect as MC,useRef as AC}from"react";var $C=t=>{let e=LC(10),{name:o,field:n,initialValue:r,label:l,Loading:s,path:i,schemaPath:u,setValue:d,value:c}=t,[a,m]=IC.useState(null),p=vC(),{_internal_renderField:f}=p,[h,x]=u.split(".",2),C=o!==void 0?o:n?.name,E=l!==void 0?l:n?.label,w=i??C??"",g;e[0]!==f||e[1]!==E||e[2]!==C||e[3]!==r||e[4]!==i||e[5]!==u?(g=()=>{(async function(){let{Field:L}=await f({name:C,hidden:!1,initialValue:r??void 0,label:typeof E=="function"?void 0:E,path:i,schemaPath:u});m(L)})()},e[0]=f,e[1]=E,e[2]=C,e[3]=r,e[4]=i,e[5]=u,e[6]=g):g=e[6];let b=g,k=AC(!1),_,T;if(e[7]!==b?(_=()=>{k.current||(k.current=!0,b())},T=[b],e[7]=b,e[8]=_,e[9]=T):(_=e[8],T=e[9]),MC(_,T),!a)return typeof s<"u"?s:gt(RC,{});let I={...p,getFormState:async S=>p.getFormState({...S,collectionSlug:h==="collection"?x:void 0,globalSlug:h==="global"?x:void 0})};if(typeof c>"u"&&!d)return gt(Uc,{value:{...I},children:gt(zc,{value:w,children:a},w)});let N={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:c,path:w,setValue:d??DC,showError:!1,value:c};return gt(Uc,{value:{...I},children:gt(zc,{value:w,children:gt(yC,{value:N,children:a})},w)})};function DC(){}function Wc({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 OC=Wc;export{vt as $createAutoLinkNode,Be as $createBlockNode,lt as $createHorizontalRuleNode,kt as $createInlineBlockNode,Te as $createLinkNode,Ve as $createRelationshipNode,ve as $createUploadNode,we as $isAutoLinkNode,Ae as $isBlockNode,Ge as $isHorizontalRuleNode,_t as $isInlineBlockNode,Z as $isLinkNode,yn as $isRelationshipNode,ot as $isUploadNode,ku as AlignFeatureClient,Ee as AutoLinkNode,Kx as BlockCollapsible,Yx as BlockEditButton,de as BlockNode,Qx as BlockRemoveButton,yu as BlockquoteFeatureClient,lm as BlocksFeatureClient,Am as BoldFeatureClient,ae as CAN_USE_DOM,n0 as ChecklistFeatureClient,NC as CodeBlockBlockComponent,sC as CodeComponent,I0 as DETAIL_TYPE_TO_DETAIL,L0 as DOUBLE_LINE_BREAK,U0 as DebugJsxConverterFeatureClient,A0 as ELEMENT_FORMAT_TO_TYPE,M0 as ELEMENT_TYPE_TO_FORMAT,lu as ENABLE_SLASH_MENU_COMMAND,tu as EditorConfigProvider,Po as FieldsDrawer,N5 as FixedToolbarFeatureClient,Kp as HeadingFeatureClient,pf as HorizontalRuleFeatureClient,_e as HorizontalRuleNode,nt as INSERT_BLOCK_COMMAND,rt as INSERT_INLINE_BLOCK_COMMAND,S0 as IS_ALL_FORMATTING,Rf as IndentFeatureClient,Wx as InlineBlockContainer,Ox as InlineBlockEditButton,Gx as InlineBlockLabel,bt as InlineBlockNode,Bx as InlineBlockRemoveButton,Bm as InlineCodeFeatureClient,j5 as InlineToolbarFeatureClient,Vm as ItalicFeatureClient,R0 as LTR_REGEX,K1 as LinkFeatureClient,re as LinkNode,N0 as NON_BREAKING_SPACE,D as NodeFormat,c0 as OrderedListFeatureClient,x0 as ParagraphFeatureClient,nu as Point,y0 as RTL_REGEX,iu as Rect,Oh as RelationshipFeatureClient,Se as RelationshipNode,$C as RenderLexical,Sx as RichTextField,Bo as RichTextViewProvider,qm as StrikethroughFeatureClient,np as SubscriptFeatureClient,ap as SuperscriptFeatureClient,$0 as TEXT_MODE_TO_TYPE,v0 as TEXT_TYPE_TO_FORMAT,D0 as TEXT_TYPE_TO_MODE,fe as TOGGLE_LINK_COMMAND,P2 as TableFeatureClient,bm as TestRecorderFeatureClient,wp as TextStateFeatureClient,Ot as ToolbarButton,Ft as ToolbarDropdown,wm as TreeViewFeatureClient,pp as UnderlineFeatureClient,h0 as UnorderedListFeatureClient,fx as UploadFeatureClient,tt as UploadNode,Ax as addSwipeDownListener,vx as addSwipeLeftListener,Ix as addSwipeRightListener,Mx as addSwipeUpListener,OC as buildDefaultEditorState,Wc as buildEditorState,$c as codeConverterClient,yx as createBlockNode,M as createClientFeature,W0 as defaultColors,or as defaultEditorLexicalConfig,On as getDOMRangeRect,su as getEnabledNodes,tC as getRestPopulateFn,it as getSelectedNode,ru as isPoint,Lx as joinClasses,nr as sanitizeClientEditorConfig,Mc as sanitizeClientFeatures,xo as setFloatingElemPosition,io as setFloatingElemPositionForLinkEditor,Q as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,an as toolbarFeatureButtonsGroupWithItems,ee as toolbarFormatGroupWithItems,ne as toolbarTextDropdownGroupWithItems,ce as useBlockComponentContext,W as useEditorConfigContext,Ce as useInlineBlockComponentContext,ou as useLexicalDocumentDrawer,Oe as useLexicalDrawer,Dt as useLexicalListDrawer,jo as useRichTextView};
65
65
  //# sourceMappingURL=index.js.map