@payloadcms/richtext-lexical 3.29.0-internal.2984e42 → 3.29.0-internal.37e46b5

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 (460) hide show
  1. package/dist/exports/client/Field-FLAQN6LU.js +2 -0
  2. package/dist/exports/client/Field-FLAQN6LU.js.map +7 -0
  3. package/dist/exports/client/{RelationshipComponent-APF3CN47.js → RelationshipComponent-JPESGV4Q.js} +2 -2
  4. package/dist/exports/client/bundled.css +1 -1
  5. package/dist/exports/client/chunk-3LGFOM34.js +2 -0
  6. package/dist/exports/client/chunk-3LGFOM34.js.map +7 -0
  7. package/dist/exports/client/{chunk-Y2GOLUGU.js → chunk-PUXDVIHC.js} +2 -2
  8. package/dist/exports/client/chunk-QBDC3MVG.js +2 -0
  9. package/dist/exports/client/chunk-QBDC3MVG.js.map +7 -0
  10. package/dist/exports/client/{component-Y3OSWJM5.js → component-P5K7Z5NW.js} +2 -2
  11. package/dist/exports/client/componentInline-IBB73SHH.js +2 -0
  12. package/dist/exports/client/index.js +10 -10
  13. package/dist/exports/client/index.js.map +3 -3
  14. package/dist/exports/html/index.d.ts +15 -15
  15. package/dist/exports/html/index.d.ts.map +1 -1
  16. package/dist/exports/html/index.js +13 -13
  17. package/dist/exports/html/index.js.map +1 -1
  18. package/dist/exports/html-async/index.d.ts +15 -15
  19. package/dist/exports/html-async/index.d.ts.map +1 -1
  20. package/dist/exports/html-async/index.js +13 -13
  21. package/dist/exports/html-async/index.js.map +1 -1
  22. package/dist/exports/react/index.d.ts +15 -15
  23. package/dist/exports/react/index.d.ts.map +1 -1
  24. package/dist/exports/react/index.js +14 -14
  25. package/dist/exports/react/index.js.map +1 -1
  26. package/dist/features/blockquote/server/index.js +1 -1
  27. package/dist/features/blockquote/server/index.js.map +1 -1
  28. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  29. package/dist/features/blocks/client/component/BlockContent.js +4 -2
  30. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  31. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  32. package/dist/features/blocks/client/componentInline/index.js +4 -2
  33. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  34. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +1 -1
  35. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js +1 -1
  36. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +1 -1
  37. package/dist/features/converters/html/async/converters/blockquote.d.ts.map +1 -0
  38. package/dist/features/converters/html/async/converters/blockquote.js.map +1 -0
  39. package/dist/features/converters/html/async/converters/heading.d.ts.map +1 -0
  40. package/dist/features/converters/html/async/converters/heading.js.map +1 -0
  41. package/dist/features/converters/html/async/converters/horizontalRule.d.ts.map +1 -0
  42. package/dist/features/converters/html/async/converters/horizontalRule.js.map +1 -0
  43. package/dist/features/converters/html/async/converters/linebreak.d.ts.map +1 -0
  44. package/dist/features/converters/html/async/converters/linebreak.js.map +1 -0
  45. package/dist/features/converters/html/async/converters/link.d.ts.map +1 -0
  46. package/dist/features/converters/{lexicalToHtml → html}/async/converters/link.js +12 -4
  47. package/dist/features/converters/html/async/converters/link.js.map +1 -0
  48. package/dist/features/converters/html/async/converters/list.d.ts.map +1 -0
  49. package/dist/features/converters/{lexicalToHtml → html}/async/converters/list.js +1 -1
  50. package/dist/features/converters/html/async/converters/list.js.map +1 -0
  51. package/dist/features/converters/html/async/converters/paragraph.d.ts.map +1 -0
  52. package/dist/features/converters/html/async/converters/paragraph.js.map +1 -0
  53. package/dist/features/converters/html/async/converters/tab.d.ts.map +1 -0
  54. package/dist/features/converters/html/async/converters/tab.js.map +1 -0
  55. package/dist/features/converters/html/async/converters/table.d.ts.map +1 -0
  56. package/dist/features/converters/html/async/converters/table.js.map +1 -0
  57. package/dist/features/converters/html/async/converters/text.d.ts.map +1 -0
  58. package/dist/features/converters/html/async/converters/text.js.map +1 -0
  59. package/dist/features/converters/html/async/converters/upload.d.ts.map +1 -0
  60. package/dist/features/converters/html/async/converters/upload.js.map +1 -0
  61. package/dist/features/converters/html/async/defaultConverters.d.ts.map +1 -0
  62. package/dist/features/converters/html/async/defaultConverters.js.map +1 -0
  63. package/dist/features/converters/html/async/field/index.d.ts.map +1 -0
  64. package/dist/features/converters/{lexicalToHtml → html}/async/field/index.js +11 -11
  65. package/dist/features/converters/html/async/field/index.js.map +1 -0
  66. package/dist/features/converters/html/async/index.d.ts.map +1 -0
  67. package/dist/features/converters/html/async/index.js.map +1 -0
  68. package/dist/features/converters/html/async/types.d.ts.map +1 -0
  69. package/dist/features/converters/html/async/types.js.map +1 -0
  70. package/dist/features/converters/html/shared/findConverterForNode.d.ts.map +1 -0
  71. package/dist/features/converters/html/shared/findConverterForNode.js.map +1 -0
  72. package/dist/features/converters/html/shared/types.d.ts.map +1 -0
  73. package/dist/features/converters/html/shared/types.js.map +1 -0
  74. package/dist/features/converters/html/sync/converters/blockquote.d.ts.map +1 -0
  75. package/dist/features/converters/html/sync/converters/blockquote.js.map +1 -0
  76. package/dist/features/converters/html/sync/converters/heading.d.ts.map +1 -0
  77. package/dist/features/converters/html/sync/converters/heading.js.map +1 -0
  78. package/dist/features/converters/html/sync/converters/horizontalRule.d.ts.map +1 -0
  79. package/dist/features/converters/html/sync/converters/horizontalRule.js.map +1 -0
  80. package/dist/features/converters/html/sync/converters/linebreak.d.ts.map +1 -0
  81. package/dist/features/converters/html/sync/converters/linebreak.js.map +1 -0
  82. package/dist/features/converters/html/sync/converters/link.d.ts.map +1 -0
  83. package/dist/features/converters/{lexicalToHtml → html}/sync/converters/link.js +12 -4
  84. package/dist/features/converters/html/sync/converters/link.js.map +1 -0
  85. package/dist/features/converters/html/sync/converters/list.d.ts.map +1 -0
  86. package/dist/features/converters/{lexicalToHtml → html}/sync/converters/list.js +1 -1
  87. package/dist/features/converters/html/sync/converters/list.js.map +1 -0
  88. package/dist/features/converters/html/sync/converters/paragraph.d.ts.map +1 -0
  89. package/dist/features/converters/html/sync/converters/paragraph.js.map +1 -0
  90. package/dist/features/converters/html/sync/converters/tab.d.ts.map +1 -0
  91. package/dist/features/converters/html/sync/converters/tab.js.map +1 -0
  92. package/dist/features/converters/html/sync/converters/table.d.ts.map +1 -0
  93. package/dist/features/converters/html/sync/converters/table.js.map +1 -0
  94. package/dist/features/converters/html/sync/converters/text.d.ts.map +1 -0
  95. package/dist/features/converters/html/sync/converters/text.js.map +1 -0
  96. package/dist/features/converters/html/sync/converters/upload.d.ts.map +1 -0
  97. package/dist/features/converters/html/sync/converters/upload.js.map +1 -0
  98. package/dist/features/converters/html/sync/defaultConverters.d.ts.map +1 -0
  99. package/dist/features/converters/html/sync/defaultConverters.js.map +1 -0
  100. package/dist/features/converters/html/sync/index.d.ts.map +1 -0
  101. package/dist/features/converters/html/sync/index.js.map +1 -0
  102. package/dist/features/converters/html/sync/types.d.ts.map +1 -0
  103. package/dist/features/converters/html/sync/types.js.map +1 -0
  104. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  105. package/dist/features/converters/htmlToLexical/index.js +1 -0
  106. package/dist/features/converters/htmlToLexical/index.js.map +1 -1
  107. package/dist/features/converters/html_deprecated/converter/converters/linebreak.d.ts.map +1 -0
  108. package/dist/features/converters/html_deprecated/converter/converters/linebreak.js.map +1 -0
  109. package/dist/features/converters/html_deprecated/converter/converters/paragraph.d.ts.map +1 -0
  110. package/dist/features/converters/html_deprecated/converter/converters/paragraph.js.map +1 -0
  111. package/dist/features/converters/html_deprecated/converter/converters/tab.d.ts.map +1 -0
  112. package/dist/features/converters/html_deprecated/converter/converters/tab.js.map +1 -0
  113. package/dist/features/converters/html_deprecated/converter/converters/text.d.ts.map +1 -0
  114. package/dist/features/converters/html_deprecated/converter/converters/text.js.map +1 -0
  115. package/dist/features/converters/html_deprecated/converter/defaultConverters.d.ts.map +1 -0
  116. package/dist/features/converters/html_deprecated/converter/defaultConverters.js.map +1 -0
  117. package/dist/features/converters/html_deprecated/converter/index.d.ts.map +1 -0
  118. package/dist/features/converters/html_deprecated/converter/index.js.map +1 -0
  119. package/dist/features/converters/html_deprecated/converter/types.d.ts.map +1 -0
  120. package/dist/features/converters/html_deprecated/converter/types.js.map +1 -0
  121. package/dist/features/converters/html_deprecated/field/index.d.ts.map +1 -0
  122. package/dist/features/converters/html_deprecated/field/index.js.map +1 -0
  123. package/dist/features/converters/html_deprecated/index.d.ts.map +1 -0
  124. package/dist/features/converters/html_deprecated/index.js.map +1 -0
  125. package/dist/features/converters/jsx/Component/index.d.ts.map +1 -0
  126. package/dist/features/converters/jsx/Component/index.js.map +1 -0
  127. package/dist/features/converters/jsx/converter/converters/blockquote.d.ts.map +1 -0
  128. package/dist/features/converters/jsx/converter/converters/blockquote.js.map +1 -0
  129. package/dist/features/converters/jsx/converter/converters/heading.d.ts.map +1 -0
  130. package/dist/features/converters/jsx/converter/converters/heading.js.map +1 -0
  131. package/dist/features/converters/jsx/converter/converters/horizontalRule.d.ts.map +1 -0
  132. package/dist/features/converters/jsx/converter/converters/horizontalRule.js.map +1 -0
  133. package/dist/features/converters/jsx/converter/converters/linebreak.d.ts.map +1 -0
  134. package/dist/features/converters/jsx/converter/converters/linebreak.js.map +1 -0
  135. package/dist/features/converters/jsx/converter/converters/link.d.ts.map +1 -0
  136. package/dist/features/converters/jsx/converter/converters/link.js.map +1 -0
  137. package/dist/features/converters/jsx/converter/converters/list.d.ts.map +1 -0
  138. package/dist/features/converters/jsx/converter/converters/list.js.map +1 -0
  139. package/dist/features/converters/jsx/converter/converters/paragraph.d.ts.map +1 -0
  140. package/dist/features/converters/jsx/converter/converters/paragraph.js.map +1 -0
  141. package/dist/features/converters/jsx/converter/converters/tab.d.ts.map +1 -0
  142. package/dist/features/converters/jsx/converter/converters/tab.js.map +1 -0
  143. package/dist/features/converters/jsx/converter/converters/table.d.ts.map +1 -0
  144. package/dist/features/converters/jsx/converter/converters/table.js.map +1 -0
  145. package/dist/features/converters/jsx/converter/converters/text.d.ts.map +1 -0
  146. package/dist/features/converters/jsx/converter/converters/text.js.map +1 -0
  147. package/dist/features/converters/jsx/converter/converters/upload.d.ts.map +1 -0
  148. package/dist/features/converters/jsx/converter/converters/upload.js.map +1 -0
  149. package/dist/features/converters/jsx/converter/defaultConverters.d.ts.map +1 -0
  150. package/dist/features/converters/jsx/converter/defaultConverters.js.map +1 -0
  151. package/dist/features/converters/jsx/converter/index.d.ts.map +1 -0
  152. package/dist/features/converters/jsx/converter/index.js.map +1 -0
  153. package/dist/features/converters/jsx/converter/types.d.ts.map +1 -0
  154. package/dist/features/converters/jsx/converter/types.js.map +1 -0
  155. package/dist/features/converters/utilities/payloadPopulateFn.d.ts +1 -1
  156. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  157. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  158. package/dist/features/converters/utilities/restPopulateFn.d.ts +1 -1
  159. package/dist/features/converters/utilities/restPopulateFn.d.ts.map +1 -1
  160. package/dist/features/converters/utilities/restPopulateFn.js.map +1 -1
  161. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +3 -3
  162. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  163. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts +0 -1
  164. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  165. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +1 -5
  166. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  167. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +3 -3
  168. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  169. package/dist/features/experimental_table/server/index.js +1 -1
  170. package/dist/features/experimental_table/server/index.js.map +1 -1
  171. package/dist/features/heading/server/index.js +1 -1
  172. package/dist/features/heading/server/index.js.map +1 -1
  173. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  174. package/dist/features/indent/client/IndentPlugin.js +6 -26
  175. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  176. package/dist/features/indent/server/index.d.ts +0 -7
  177. package/dist/features/indent/server/index.d.ts.map +1 -1
  178. package/dist/features/indent/server/index.js.map +1 -1
  179. package/dist/features/link/server/index.d.ts.map +1 -1
  180. package/dist/features/link/server/index.js +7 -3
  181. package/dist/features/link/server/index.js.map +1 -1
  182. package/dist/features/lists/htmlConverter.d.ts +1 -1
  183. package/dist/features/lists/htmlConverter.d.ts.map +1 -1
  184. package/dist/features/lists/htmlConverter.js +1 -1
  185. package/dist/features/lists/htmlConverter.js.map +1 -1
  186. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +2 -2
  187. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  188. package/dist/features/typesServer.d.ts +1 -1
  189. package/dist/features/typesServer.d.ts.map +1 -1
  190. package/dist/features/typesServer.js.map +1 -1
  191. package/dist/field/Field.d.ts.map +1 -1
  192. package/dist/field/Field.js +3 -2
  193. package/dist/field/Field.js.map +1 -1
  194. package/dist/field/bundled.css +1 -1
  195. package/dist/index.d.ts +11 -13
  196. package/dist/index.d.ts.map +1 -1
  197. package/dist/index.js +10 -12
  198. package/dist/index.js.map +1 -1
  199. package/dist/lexical/config/client/EditorConfigProvider.js +4 -4
  200. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  201. package/dist/nodeTypes.d.ts +1 -1
  202. package/dist/nodeTypes.d.ts.map +1 -1
  203. package/dist/nodeTypes.js.map +1 -1
  204. package/package.json +18 -23
  205. package/dist/exports/client/Field-5SZDDPZE.js +0 -2
  206. package/dist/exports/client/Field-5SZDDPZE.js.map +0 -7
  207. package/dist/exports/client/chunk-46KMRCKV.js +0 -2
  208. package/dist/exports/client/chunk-46KMRCKV.js.map +0 -7
  209. package/dist/exports/client/chunk-BZZVLW4U.js +0 -2
  210. package/dist/exports/client/chunk-BZZVLW4U.js.map +0 -7
  211. package/dist/exports/client/componentInline-ZB4EY7EQ.js +0 -2
  212. package/dist/exports/plaintext/index.d.ts +0 -3
  213. package/dist/exports/plaintext/index.d.ts.map +0 -1
  214. package/dist/exports/plaintext/index.js +0 -2
  215. package/dist/exports/plaintext/index.js.map +0 -1
  216. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts.map +0 -1
  217. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.js.map +0 -1
  218. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts.map +0 -1
  219. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +0 -1
  220. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts.map +0 -1
  221. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.js.map +0 -1
  222. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts.map +0 -1
  223. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.js.map +0 -1
  224. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts.map +0 -1
  225. package/dist/features/converters/lexicalToHtml/async/converters/link.js.map +0 -1
  226. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +0 -1
  227. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +0 -1
  228. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts.map +0 -1
  229. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.js.map +0 -1
  230. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts.map +0 -1
  231. package/dist/features/converters/lexicalToHtml/async/converters/tab.js.map +0 -1
  232. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts.map +0 -1
  233. package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +0 -1
  234. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts.map +0 -1
  235. package/dist/features/converters/lexicalToHtml/async/converters/text.js.map +0 -1
  236. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts.map +0 -1
  237. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +0 -1
  238. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts.map +0 -1
  239. package/dist/features/converters/lexicalToHtml/async/defaultConverters.js.map +0 -1
  240. package/dist/features/converters/lexicalToHtml/async/field/index.d.ts.map +0 -1
  241. package/dist/features/converters/lexicalToHtml/async/field/index.js.map +0 -1
  242. package/dist/features/converters/lexicalToHtml/async/index.d.ts.map +0 -1
  243. package/dist/features/converters/lexicalToHtml/async/index.js.map +0 -1
  244. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +0 -1
  245. package/dist/features/converters/lexicalToHtml/async/types.js.map +0 -1
  246. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +0 -1
  247. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +0 -1
  248. package/dist/features/converters/lexicalToHtml/shared/types.d.ts.map +0 -1
  249. package/dist/features/converters/lexicalToHtml/shared/types.js.map +0 -1
  250. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts.map +0 -1
  251. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.js.map +0 -1
  252. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts.map +0 -1
  253. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +0 -1
  254. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts.map +0 -1
  255. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.js.map +0 -1
  256. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts.map +0 -1
  257. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.js.map +0 -1
  258. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts.map +0 -1
  259. package/dist/features/converters/lexicalToHtml/sync/converters/link.js.map +0 -1
  260. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +0 -1
  261. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +0 -1
  262. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts.map +0 -1
  263. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.js.map +0 -1
  264. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts.map +0 -1
  265. package/dist/features/converters/lexicalToHtml/sync/converters/tab.js.map +0 -1
  266. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts.map +0 -1
  267. package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +0 -1
  268. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts.map +0 -1
  269. package/dist/features/converters/lexicalToHtml/sync/converters/text.js.map +0 -1
  270. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts.map +0 -1
  271. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +0 -1
  272. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts.map +0 -1
  273. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.js.map +0 -1
  274. package/dist/features/converters/lexicalToHtml/sync/index.d.ts.map +0 -1
  275. package/dist/features/converters/lexicalToHtml/sync/index.js.map +0 -1
  276. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +0 -1
  277. package/dist/features/converters/lexicalToHtml/sync/types.js.map +0 -1
  278. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/linebreak.d.ts.map +0 -1
  279. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/linebreak.js.map +0 -1
  280. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.d.ts.map +0 -1
  281. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.js.map +0 -1
  282. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/tab.d.ts.map +0 -1
  283. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/tab.js.map +0 -1
  284. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/text.d.ts.map +0 -1
  285. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/text.js.map +0 -1
  286. package/dist/features/converters/lexicalToHtml_deprecated/converter/defaultConverters.d.ts.map +0 -1
  287. package/dist/features/converters/lexicalToHtml_deprecated/converter/defaultConverters.js.map +0 -1
  288. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts.map +0 -1
  289. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js.map +0 -1
  290. package/dist/features/converters/lexicalToHtml_deprecated/converter/types.d.ts.map +0 -1
  291. package/dist/features/converters/lexicalToHtml_deprecated/converter/types.js.map +0 -1
  292. package/dist/features/converters/lexicalToHtml_deprecated/field/index.d.ts.map +0 -1
  293. package/dist/features/converters/lexicalToHtml_deprecated/field/index.js.map +0 -1
  294. package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts.map +0 -1
  295. package/dist/features/converters/lexicalToHtml_deprecated/index.js.map +0 -1
  296. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +0 -1
  297. package/dist/features/converters/lexicalToJSX/Component/index.js.map +0 -1
  298. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts.map +0 -1
  299. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +0 -1
  300. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +0 -1
  301. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +0 -1
  302. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts.map +0 -1
  303. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +0 -1
  304. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts.map +0 -1
  305. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +0 -1
  306. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts.map +0 -1
  307. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +0 -1
  308. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +0 -1
  309. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +0 -1
  310. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts.map +0 -1
  311. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +0 -1
  312. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts.map +0 -1
  313. package/dist/features/converters/lexicalToJSX/converter/converters/tab.js.map +0 -1
  314. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts.map +0 -1
  315. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +0 -1
  316. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts.map +0 -1
  317. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +0 -1
  318. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +0 -1
  319. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +0 -1
  320. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts.map +0 -1
  321. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.js.map +0 -1
  322. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +0 -1
  323. package/dist/features/converters/lexicalToJSX/converter/index.js.map +0 -1
  324. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +0 -1
  325. package/dist/features/converters/lexicalToJSX/converter/types.js.map +0 -1
  326. package/dist/features/converters/lexicalToMarkdown/index.d.ts +0 -7
  327. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +0 -1
  328. package/dist/features/converters/lexicalToMarkdown/index.js +0 -24
  329. package/dist/features/converters/lexicalToMarkdown/index.js.map +0 -1
  330. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -84
  331. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  332. package/dist/features/converters/lexicalToPlaintext/shared/findConverterForNode.d.ts +0 -7
  333. package/dist/features/converters/lexicalToPlaintext/shared/findConverterForNode.d.ts.map +0 -1
  334. package/dist/features/converters/lexicalToPlaintext/shared/findConverterForNode.js +0 -15
  335. package/dist/features/converters/lexicalToPlaintext/shared/findConverterForNode.js.map +0 -1
  336. package/dist/features/converters/lexicalToPlaintext/shared/types.d.ts +0 -5
  337. package/dist/features/converters/lexicalToPlaintext/shared/types.d.ts.map +0 -1
  338. package/dist/features/converters/lexicalToPlaintext/shared/types.js +0 -2
  339. package/dist/features/converters/lexicalToPlaintext/shared/types.js.map +0 -1
  340. package/dist/features/converters/lexicalToPlaintext/sync/index.d.ts +0 -22
  341. package/dist/features/converters/lexicalToPlaintext/sync/index.d.ts.map +0 -1
  342. package/dist/features/converters/lexicalToPlaintext/sync/index.js +0 -79
  343. package/dist/features/converters/lexicalToPlaintext/sync/index.js.map +0 -1
  344. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +0 -60
  345. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +0 -1
  346. package/dist/features/converters/lexicalToPlaintext/sync/types.js +0 -2
  347. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +0 -1
  348. package/dist/features/converters/markdownToLexical/index.d.ts +0 -8
  349. package/dist/features/converters/markdownToLexical/index.d.ts.map +0 -1
  350. package/dist/features/converters/markdownToLexical/index.js +0 -21
  351. package/dist/features/converters/markdownToLexical/index.js.map +0 -1
  352. /package/dist/exports/client/{RelationshipComponent-APF3CN47.js.map → RelationshipComponent-JPESGV4Q.js.map} +0 -0
  353. /package/dist/exports/client/{chunk-Y2GOLUGU.js.map → chunk-PUXDVIHC.js.map} +0 -0
  354. /package/dist/exports/client/{component-Y3OSWJM5.js.map → component-P5K7Z5NW.js.map} +0 -0
  355. /package/dist/exports/client/{componentInline-ZB4EY7EQ.js.map → componentInline-IBB73SHH.js.map} +0 -0
  356. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/blockquote.d.ts +0 -0
  357. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/blockquote.js +0 -0
  358. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/heading.d.ts +0 -0
  359. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/heading.js +0 -0
  360. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/horizontalRule.d.ts +0 -0
  361. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/horizontalRule.js +0 -0
  362. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/linebreak.d.ts +0 -0
  363. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/linebreak.js +0 -0
  364. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/link.d.ts +0 -0
  365. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/list.d.ts +0 -0
  366. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/paragraph.d.ts +0 -0
  367. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/paragraph.js +0 -0
  368. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/tab.d.ts +0 -0
  369. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/tab.js +0 -0
  370. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/table.d.ts +0 -0
  371. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/table.js +0 -0
  372. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/text.d.ts +0 -0
  373. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/text.js +0 -0
  374. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/upload.d.ts +0 -0
  375. /package/dist/features/converters/{lexicalToHtml → html}/async/converters/upload.js +0 -0
  376. /package/dist/features/converters/{lexicalToHtml → html}/async/defaultConverters.d.ts +0 -0
  377. /package/dist/features/converters/{lexicalToHtml → html}/async/defaultConverters.js +0 -0
  378. /package/dist/features/converters/{lexicalToHtml → html}/async/field/index.d.ts +0 -0
  379. /package/dist/features/converters/{lexicalToHtml → html}/async/index.d.ts +0 -0
  380. /package/dist/features/converters/{lexicalToHtml → html}/async/index.js +0 -0
  381. /package/dist/features/converters/{lexicalToHtml → html}/async/types.d.ts +0 -0
  382. /package/dist/features/converters/{lexicalToHtml → html}/async/types.js +0 -0
  383. /package/dist/features/converters/{lexicalToHtml → html}/shared/findConverterForNode.d.ts +0 -0
  384. /package/dist/features/converters/{lexicalToHtml → html}/shared/findConverterForNode.js +0 -0
  385. /package/dist/features/converters/{lexicalToHtml → html}/shared/types.d.ts +0 -0
  386. /package/dist/features/converters/{lexicalToHtml → html}/shared/types.js +0 -0
  387. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/blockquote.d.ts +0 -0
  388. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/blockquote.js +0 -0
  389. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/heading.d.ts +0 -0
  390. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/heading.js +0 -0
  391. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/horizontalRule.d.ts +0 -0
  392. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/horizontalRule.js +0 -0
  393. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/linebreak.d.ts +0 -0
  394. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/linebreak.js +0 -0
  395. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/link.d.ts +0 -0
  396. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/list.d.ts +0 -0
  397. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/paragraph.d.ts +0 -0
  398. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/paragraph.js +0 -0
  399. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/tab.d.ts +0 -0
  400. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/tab.js +0 -0
  401. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/table.d.ts +0 -0
  402. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/table.js +0 -0
  403. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/text.d.ts +0 -0
  404. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/text.js +0 -0
  405. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/upload.d.ts +0 -0
  406. /package/dist/features/converters/{lexicalToHtml → html}/sync/converters/upload.js +0 -0
  407. /package/dist/features/converters/{lexicalToHtml → html}/sync/defaultConverters.d.ts +0 -0
  408. /package/dist/features/converters/{lexicalToHtml → html}/sync/defaultConverters.js +0 -0
  409. /package/dist/features/converters/{lexicalToHtml → html}/sync/index.d.ts +0 -0
  410. /package/dist/features/converters/{lexicalToHtml → html}/sync/index.js +0 -0
  411. /package/dist/features/converters/{lexicalToHtml → html}/sync/types.d.ts +0 -0
  412. /package/dist/features/converters/{lexicalToHtml → html}/sync/types.js +0 -0
  413. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/converters/linebreak.d.ts +0 -0
  414. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/converters/linebreak.js +0 -0
  415. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/converters/paragraph.d.ts +0 -0
  416. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/converters/paragraph.js +0 -0
  417. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/converters/tab.d.ts +0 -0
  418. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/converters/tab.js +0 -0
  419. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/converters/text.d.ts +0 -0
  420. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/converters/text.js +0 -0
  421. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/defaultConverters.d.ts +0 -0
  422. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/defaultConverters.js +0 -0
  423. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/index.d.ts +0 -0
  424. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/index.js +0 -0
  425. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/types.d.ts +0 -0
  426. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/converter/types.js +0 -0
  427. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/field/index.d.ts +0 -0
  428. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/field/index.js +0 -0
  429. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/index.d.ts +0 -0
  430. /package/dist/features/converters/{lexicalToHtml_deprecated → html_deprecated}/index.js +0 -0
  431. /package/dist/features/converters/{lexicalToJSX → jsx}/Component/index.d.ts +0 -0
  432. /package/dist/features/converters/{lexicalToJSX → jsx}/Component/index.js +0 -0
  433. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/blockquote.d.ts +0 -0
  434. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/blockquote.js +0 -0
  435. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/heading.d.ts +0 -0
  436. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/heading.js +0 -0
  437. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/horizontalRule.d.ts +0 -0
  438. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/horizontalRule.js +0 -0
  439. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/linebreak.d.ts +0 -0
  440. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/linebreak.js +0 -0
  441. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/link.d.ts +0 -0
  442. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/link.js +0 -0
  443. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/list.d.ts +0 -0
  444. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/list.js +0 -0
  445. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/paragraph.d.ts +0 -0
  446. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/paragraph.js +0 -0
  447. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/tab.d.ts +0 -0
  448. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/tab.js +0 -0
  449. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/table.d.ts +0 -0
  450. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/table.js +0 -0
  451. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/text.d.ts +0 -0
  452. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/text.js +0 -0
  453. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/upload.d.ts +0 -0
  454. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/converters/upload.js +0 -0
  455. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/defaultConverters.d.ts +0 -0
  456. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/defaultConverters.js +0 -0
  457. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/index.d.ts +0 -0
  458. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/index.js +0 -0
  459. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/types.d.ts +0 -0
  460. /package/dist/features/converters/{lexicalToJSX → jsx}/converter/types.js +0 -0
@@ -1,6 +1,6 @@
1
- "use client";import{a as ge,c as fo,d as ho,e as go}from"./chunk-46KMRCKV.js";import{a as rt}from"./chunk-DBWINSQN.js";import{a as ot,b as It,c as Ge}from"./chunk-Y2GOLUGU.js";import{a as he}from"./chunk-INBEEENE.js";import{a as Fs}from"./chunk-F26IQ5RE.js";import{a as Os,b as Ir,d as yr,e as vr,f as $s,g as Ps,i as Bs,k as Hs,l as js}from"./chunk-XO6X2M3F.js";import{a as As,b as H}from"./chunk-BZZVLW4U.js";function Q(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Re,$isRangeSelection as vt,FORMAT_ELEMENT_COMMAND as Mt}from"lexical";import{jsx as Co,jsxs as Us}from"react/jsx-runtime";import"react";var Mr=()=>Us("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Co("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Co("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Co("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as xo,jsxs as Gs}from"react/jsx-runtime";import"react";var Dr=()=>Gs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[xo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),xo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),xo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as bo,jsxs as Ws}from"react/jsx-runtime";import"react";var yt=()=>Ws("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),bo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as _o,jsxs as Vs}from"react/jsx-runtime";import"react";var Ar=()=>Vs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[_o("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),_o("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),_o("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var R=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:s,field:c,resolvedFeatures:u,schemaPath:d,unSanitizedEditorConfig:a})=>{let p=t({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:s,field:c,props:o,resolvedFeatures:u,schemaPath:d,unSanitizedEditorConfig:a});return p.sanitizedClientFeatureProps===null&&(p.sanitizedClientFeatureProps=o),p};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Or=t=>({type:"dropdown",ChildComponent:yt,items:t,key:"align",order:30});var Fr=[Or([{ChildComponent:yt,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"left")},order:1},{ChildComponent:Mr,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"center")},order:2},{ChildComponent:Ar,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"right")},order:3},{ChildComponent:Dr,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"justify")},order:4}])],Ks=R({toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{$createQuoteNode as Gr,$isQuoteNode as jr,QuoteNode as Ys}from"@lexical/rich-text";import{$setBlocksType as Wr}from"@lexical/selection";import{$getSelection as Vr,$isRangeSelection as Js}from"lexical";import{jsx as $r}from"react/jsx-runtime";import"react";var To=()=>$r("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$r("path",{d:"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",fill:"currentColor"})});import{jsx as Pr}from"react/jsx-runtime";import"react";var nt=()=>Pr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Pr("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var ne=t=>({type:"dropdown",ChildComponent:nt,items:t,key:"text",order:25});import{$createQuoteNode as Zs,$isQuoteNode as Br,QuoteNode as zs}from"@lexical/rich-text";var Hr={type:"element",dependencies:[zs],export:(t,e)=>{if(!Br(t))return null;let o=e(t).split(`
1
+ "use client";import{a as ge,c as fo,d as ho,e as go}from"./chunk-QBDC3MVG.js";import{a as rt}from"./chunk-DBWINSQN.js";import{a as ot,b as It,c as Ge}from"./chunk-PUXDVIHC.js";import{a as he}from"./chunk-INBEEENE.js";import{a as Ds}from"./chunk-F26IQ5RE.js";import{a as Ms,b as Ir,d as yr,e as vr,f as As,g as Os,i as Fs,k as $s,l as Ps}from"./chunk-XO6X2M3F.js";import{a as vs,b as H}from"./chunk-3LGFOM34.js";function q(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Re,$isRangeSelection as vt,FORMAT_ELEMENT_COMMAND as Mt}from"lexical";import{jsx as Co,jsxs as Bs}from"react/jsx-runtime";import"react";var Mr=()=>Bs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Co("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Co("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Co("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as xo,jsxs as Hs}from"react/jsx-runtime";import"react";var Dr=()=>Hs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[xo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),xo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),xo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as bo,jsxs as js}from"react/jsx-runtime";import"react";var yt=()=>js("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),bo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as _o,jsxs as Us}from"react/jsx-runtime";import"react";var Ar=()=>Us("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[_o("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),_o("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),_o("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var R=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:s,field:c,resolvedFeatures:u,schemaPath:d,unSanitizedEditorConfig:a})=>{let p=t({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:s,field:c,props:o,resolvedFeatures:u,schemaPath:d,unSanitizedEditorConfig:a});return p.sanitizedClientFeatureProps===null&&(p.sanitizedClientFeatureProps=o),p};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Or=t=>({type:"dropdown",ChildComponent:yt,items:t,key:"align",order:30});var Fr=[Or([{ChildComponent:yt,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"left")},order:1},{ChildComponent:Mr,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"center")},order:2},{ChildComponent:Ar,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"right")},order:3},{ChildComponent:Dr,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"justify")},order:4}])],Gs=R({toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{$createQuoteNode as Gr,$isQuoteNode as jr,QuoteNode as Ks}from"@lexical/rich-text";import{$setBlocksType as Wr}from"@lexical/selection";import{$getSelection as Vr,$isRangeSelection as Zs}from"lexical";import{jsx as $r}from"react/jsx-runtime";import"react";var To=()=>$r("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$r("path",{d:"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",fill:"currentColor"})});import{jsx as Pr}from"react/jsx-runtime";import"react";var nt=()=>Pr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Pr("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var ne=t=>({type:"dropdown",ChildComponent:nt,items:t,key:"text",order:25});import{$createQuoteNode as Ws,$isQuoteNode as Br,QuoteNode as Vs}from"@lexical/rich-text";var Hr={type:"element",dependencies:[Vs],export:(t,e)=>{if(!Br(t))return null;let o=e(t).split(`
2
2
  `),r=[];for(let n of o)r.push("> "+n);return r.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let i=t.getPreviousSibling();if(Br(i)){i.splice(i.getChildrenSize(),0,[...e]),i.select(0,0),t.remove();return}}let n=Zs();n.append(...e),t.replace(n),n.select(0,0)}};var Ur=[ne([{ChildComponent:To,isActive:({selection:t})=>{if(!Js(t))return!1;for(let e of t.getNodes())if(!jr(e)&&!jr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Vr();Wr(e,()=>Gr())})},order:20}])],Xs=R({markdownTransformers:[Hr],nodes:[Ys],slashMenu:{groups:[Q([{Icon:To,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Vr();Wr(e,()=>Gr())})}}])]},toolbarFixed:{groups:Ur},toolbarInline:{groups:Ur}});import{getTranslation as Ht}from"@payloadcms/translations";import{jsx as wo,jsxs as qs}from"react/jsx-runtime";import"react";var Dt=()=>qs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Kr}from"react/jsx-runtime";import"react";var At=()=>Kr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Kr("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as Qs}from"react/jsx-runtime";import"react";function Ot(t,e){return t?()=>Qs("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Dt}import{jsx as Ia}from"react/jsx-runtime";import ya from"bson-objectid";import"react";import{DecoratorBlockNode as ea}from"@lexical/react/LexicalDecoratorBlockNode.js";import ta from"bson-objectid";var it=class extends ea{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),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=oa(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}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 r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function oa(t){return new it({fields:{...t,id:t?.id||new ta.default().toHexString()}})}import{jsx as z,jsxs as lt,Fragment as ca}from"react/jsx-runtime";import{Button as Jr,Collapsible as ua,Drawer as da,EditDepthProvider as ma,ErrorPill as pa,Form as fa,formatDrawerSlug as ha,FormSubmit as ga,Pill as Ca,RenderFields as xa,SectionTitle as ba,useConfig as _a,useDocumentForm as Ta,useDocumentInfo as Xr,useEditDepth as wa,useFormSubmitted as Ea,useServerFunctions as ka,useTranslation as Na}from"@payloadcms/ui";import{abortAndIgnore as Eo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as $t,reduceFieldsToValues as qr}from"payload/shared";import st,{useCallback as ko,useEffect as No,useMemo as at,useRef as Lo}from"react";import{useLexicalComposerContext as La}from"@lexical/react/LexicalComposerContext";import{getTranslation as Sa}from"@payloadcms/translations";import{$getNodeByKey as Pt}from"lexical";import{v4 as Ra}from"uuid";import{c as ra}from"react/compiler-runtime";import{jsx as Ft,jsxs as na}from"react/jsx-runtime";import{RenderFields as ia,useFormSubmitted as la}from"@payloadcms/ui";import sa,{createContext as aa}from"react";var Zr=aa({initialState:!1}),De=()=>sa.use(Zr),zr=t=>{let e=ra(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:c,nodeKey:u,RemoveButton:d}=t,p=la()&&l>0,m,f;e[0]!==r||e[1]!==l||e[2]!==p?(f=b=>Ft(r,{editButton:b.editButton,errorCount:l,fieldHasErrors:p,Label:b.Label,removeButton:b.removeButton,children:b.children}),e[0]=r,e[1]=l,e[2]=p,e[3]=f):f=e[3],m=f;let h=m,g;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==i||e[8]!==d||e[9]!==s||e[10]!==c||e[11]!==u?(g=n?na(Zr,{value:{BlockCollapsible:h,EditButton:i,initialState:c,nodeKey:u,RemoveButton:d},children:[n,Ft(o,{})]}):Ft(h,{children:Ft(ia,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=i,e[8]=d,e[9]=s,e[10]=c,e[11]=u,e[12]=g):g=e[12],g};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 ce="lexical-block",Qr=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=Ea(),{id:i,collectionSlug:l,globalSlug:s}=Xr(),{fieldProps:{featureClientSchemaMap:c,field:u,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=H(),{fields:h}=Ta(),g=Lo(new AbortController),b=wa(),[S,I]=st.useState(0),{config:_}=_a(),T=ha({slug:`lexical-blocks-create-${f}-${o.id}`,depth:b}),{toggleDrawer:C}=he(T),{getDocPreferences:w,setDocFieldPreferences:M}=Xr(),[A]=La(),{getFormState:$}=ka(),D=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[N,x]=st.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),k=Lo(!1),y=Lo(e);No(()=>{k.current?(y.current!==e&&x(!1),y.current=e):k.current=!0},[e]);let[L,v]=st.useState(N?._components?.customComponents?.BlockLabel),[E,O]=st.useState(N?._components?.customComponents?.Block);No(()=>{let j=new AbortController;return o&&!N&&(async()=>{let{state:K}=await $({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:$t(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:D,signal:j.signal});if(K){K.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let q=qr($t(K),!0);A.update(()=>{let Z=Pt(r);if(Z&&ct(Z)){let se=q;se.blockType=o.blockType,Z.setFields(se,!0)}}),x(K),v(K._components?.customComponents?.BlockLabel),O(K._components?.customComponents?.Block)}})(),()=>{Eo(j)}},[$,D,i,o,A,r,N,l,s,w,h]);let[B,U]=st.useState(d?.[o.id]?.collapsed??!1),J=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,W=c.blocks?.[J]?.[0],G=W.blockReferences?typeof W?.blockReferences?.[0]=="string"?_.blocksMap[W?.blockReferences?.[0]]:W?.blockReferences?.[0]:W?.blocks?.[0],{i18n:te,t:ae}=Na(),X=ko(async({formState:j,submit:me})=>{Eo(g.current);let K=new AbortController;g.current=K;let{state:q}=await $({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:$t(h),formState:j,globalSlug:s,initialBlockFormState:j,operation:"update",renderAllFields:!!me,schemaPath:D,signal:K.signal});if(!q)return j;j.blockName&&(q.blockName=j.blockName);let Z=qr(Yr({fields:$t(q)}),!0);if(setTimeout(()=>{A.update(()=>{let se=Pt(r);if(se&&ct(se)){let Ue=Z;Ue.blockType=o.blockType,se.setFields(Ue,!0)}})},0),me){v(q._components?.customComponents?.BlockLabel),O(q._components?.customComponents?.Block);let se=0;for(let Ue of Object.values(q))Ue?.valid===!1&&se++;I(se)}return q},[$,i,l,w,s,D,o.blockType,h,A,r]);No(()=>()=>{Eo(g.current)},[]);let V=ko(()=>{A.update(()=>{Pt(r)?.remove()})},[A,r]),oe=G?.labels?.singular?Sa(G.labels.singular,te):G?.slug,re=ko(j=>{w().then(me=>{let q=me?.fields?.[u.name]?.collapsed,Z=q&&q?.length?q:[];j?Z.includes(o.id)||Z.push(o.id):Z.includes(o.id)&&Z.splice(Z.indexOf(o.id),1),M(u.name,{collapsed:Z,hello:"hi"})})},[w,u.name,M,o.id]),le=at(()=>()=>z(Jr,{buttonStyle:"icon-label",className:`${ce}__editButton`,disabled:p,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),C(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:ae("lexical:blocks:inlineBlocks:edit",{label:oe})}),[oe,p,ae,C]),Me=at(()=>()=>z(Jr,{buttonStyle:"icon-label",className:`${ce}__removeButton`,disabled:u?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),V()},round:!0,tooltip:"Remove Block"}),[u?.admin?.readOnly,V]),tt=at(()=>({children:j,disableBlockName:me,editButton:K,errorCount:q,fieldHasErrors:Z,Label:se,removeButton:Ue})=>z("div",{className:ce+" "+ce+"-"+o.blockType,children:z(ua,{className:[`${ce}__row`,Z?`${ce}__row--has-errors`:`${ce}__row--no-errors`].join(" "),collapsibleStyle:Z?"error":"default",header:lt("div",{className:`${ce}__block-header`,children:[se??L?se??L:lt("div",{children:[z(Ca,{className:`${ce}__block-pill ${ce}__block-pill-${o?.blockType}`,pillStyle:"white",children:oe??o?.blockType}),!me&&z(ba,{path:"blockName",readOnly:u?.admin?.readOnly||!1}),Z&&z(pa,{count:q??0,i18n:te,withMessage:!0})]}),lt("div",{children:[E&&K!==!1||!E&&K?z(le,{}):null,Ue!==!1&&A.isEditable()?z(Me,{}):null]})]}),isCollapsed:B,onToggle:Rr=>{re(Rr),U(Rr)},children:j},0)}),[E,L,le,Me,oe,A,o.blockType,te,B,re,u?.admin?.readOnly]),Rt=G?.fields??[],Sr=at(()=>()=>z(ma,{children:z(da,{className:"",slug:T,title:ae(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:oe??ae("lexical:blocks:inlineBlocks:label")}),children:N?lt(ca,{children:[z(xa,{fields:Rt,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:D,permissions:a,readOnly:!1}),z(ga,{programmaticSubmit:!0,children:ae("fields:saveChanges")})]}):null})}),[N,T,oe,ae,G?.fields,D,a]),Ds=at(()=>N?z(fa,{beforeSubmit:[async({formState:j})=>await X({formState:j,submit:!0})],el:"div",fields:Rt,initialState:N,onChange:[X],onSubmit:(j,me)=>{me.blockType=o.blockType,A.update(()=>{let K=Pt(r);K&&ct(K)&&K.setFields(me,!0)}),C()},submitted:n,uuid:Ra(),children:z(zr,{baseClass:ce,BlockDrawer:Sr,Collapsible:tt,CustomBlock:E,EditButton:le,errorCount:S,formSchema:Rt,initialState:N,nodeKey:r,RemoveButton:Me})}):null,[tt,Sr,E,Rt,Me,le,A,S,C,G?.fields,N,r,X,n]);return G?Ds:z(tt,{disableBlockName:!0,fieldHasErrors:!0,children:lt("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var Ce=class extends it{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=Bt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Ia(Qr,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Bt(t){return new Ce({fields:{...t,id:t?.id||new ya.default().toHexString()}})}function ct(t){return t instanceof Ce}import{createCommand as en}from"lexical";var We=en("INSERT_BLOCK_COMMAND"),Ve=en("INSERT_INLINE_BLOCK_COMMAND");import{c as va}from"react/compiler-runtime";import{useLexicalComposerContext as Ma}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Da,$wrapNodeInElement as Aa,mergeRegister as Oa}from"@lexical/utils";import{formatDrawerSlug as Fa,useEditDepth as $a}from"@payloadcms/ui";import{$createParagraphNode as Pa,$getNodeByKey as Ba,$getPreviousSelection as Ha,$getSelection as ja,$insertNodes as Ua,$isParagraphNode as on,$isRangeSelection as Ga,$isRootOrShadowRoot as Wa,COMMAND_PRIORITY_EDITOR as tn}from"lexical";import{useEffect as Va,useState as Ka}from"react";var rn=()=>{let t=va(12),[e]=Ma(),[o,r]=Ka(null),{setCreatedInlineBlock:n,uuid:i}=H(),l=$a(),s="lexical-inlineBlocks-create-"+i,c;t[0]!==l||t[1]!==s?(c=Fa({slug:s,depth:l}),t[0]=l,t[1]=s,t[2]=c):c=t[2];let u=c,{toggleDrawer:d}=he(u,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([Ce]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Oa(e.registerCommand(We,m=>(e.update(()=>{let f=ja()||Ha();if(Ga(f)){let h=Bt(m);Da(h);let{focus:g}=f,b=g.getNode();on(b)&&b.getTextContentSize()===0&&b.getParentOrThrow().getChildren().filter(Za).length>1&&b.remove()}}),!0),tn),e.registerCommand(Ve,m=>{if(o){let h=Ba(o);return!h||!go(h)?!1:(h.setFields(m),r(null),!0)}let f=ho(m);return n?.(f),Ua([f]),Wa(f.getParentOrThrow())&&Aa(f,Pa).selectEnd(),!0},tn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(p=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=p):p=t[11],Va(a,p),null};function Za(t){return on(t)}var za=R(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,l=e.blocks;if(!l)return{};let s=Object.entries(l).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),c=Object.entries(l).filter(([a])=>a.startsWith(i+".")&&!a.replace(i+".","").includes(".")).map(([,a])=>a[0]),u=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=c.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{nodes:[Ce,fo],plugins:[{Component:rn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[u?.length?{items:u.map(a=>({Icon:Ot(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Ht(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(We,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:At,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Ht(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ve,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[u.length?{type:"dropdown",ChildComponent:Dt,items:u.map((a,p)=>({ChildComponent:Ot(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Ht(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(We,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:At,items:d.map((a,p)=>({ChildComponent:a.imageURL?Ot(a.imageURL,a.imageAltText):At,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Ht(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ve,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Ya}from"react/compiler-runtime";import{jsx as Oe,jsxs as yo}from"react/jsx-runtime";import{useLexicalComposerContext as Ja}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Xa,$createTextNode as qa,$getRoot as Qa,getDOMSelection as So}from"lexical";import*as an from"react";import{useCallback as Ae,useEffect as Ro,useLayoutEffect as nn,useRef as Io,useState as jt}from"react";var ec=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)},tc=(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)},oc=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let i=t.getPreviousSibling();if(Br(i)){i.splice(i.getChildrenSize(),0,[...e]),i.select(0,0),t.remove();return}}let n=Ws();n.append(...e),t.replace(n),n.select(0,0)}};var Ur=[ne([{ChildComponent:To,isActive:({selection:t})=>{if(!Zs(t))return!1;for(let e of t.getNodes())if(!jr(e)&&!jr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Vr();Wr(e,()=>Gr())})},order:20}])],zs=R({markdownTransformers:[Hr],nodes:[Ks],slashMenu:{groups:[q([{Icon:To,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Vr();Wr(e,()=>Gr())})}}])]},toolbarFixed:{groups:Ur},toolbarInline:{groups:Ur}});import{getTranslation as Ht}from"@payloadcms/translations";import{jsx as wo,jsxs as Ys}from"react/jsx-runtime";import"react";var Dt=()=>Ys("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Kr}from"react/jsx-runtime";import"react";var At=()=>Kr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Kr("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as Js}from"react/jsx-runtime";import"react";function Ot(t,e){return t?()=>Js("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Dt}import{jsx as La}from"react/jsx-runtime";import Sa from"bson-objectid";import"react";import{DecoratorBlockNode as Xs}from"@lexical/react/LexicalDecoratorBlockNode.js";import qs from"bson-objectid";var it=class extends Xs{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),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=Qs(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}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 r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function Qs(t){return new it({fields:{...t,id:t?.id||new qs.default().toHexString()}})}import{jsx as z,jsxs as lt,Fragment as la}from"react/jsx-runtime";import{Button as Jr,Collapsible as sa,Drawer as aa,EditDepthProvider as ca,ErrorPill as ua,Form as da,formatDrawerSlug as ma,FormSubmit as pa,Pill as fa,RenderFields as ha,SectionTitle as ga,useConfig as Ca,useDocumentForm as xa,useDocumentInfo as Xr,useEditDepth as ba,useFormSubmitted as _a,useServerFunctions as Ta,useTranslation as wa}from"@payloadcms/ui";import{abortAndIgnore as Eo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as $t,reduceFieldsToValues as qr}from"payload/shared";import st,{useCallback as ko,useEffect as No,useMemo as at,useRef as Lo}from"react";import{useLexicalComposerContext as Ea}from"@lexical/react/LexicalComposerContext";import{getTranslation as ka}from"@payloadcms/translations";import{$getNodeByKey as Pt}from"lexical";import{v4 as Na}from"uuid";import{c as ea}from"react/compiler-runtime";import{jsx as Ft,jsxs as ta}from"react/jsx-runtime";import{RenderFields as oa,useFormSubmitted as ra}from"@payloadcms/ui";import na,{createContext as ia}from"react";var Zr=ia({initialState:!1}),De=()=>na.useContext(Zr),zr=t=>{let e=ea(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:c,nodeKey:u,RemoveButton:d}=t,p=ra()&&l>0,m,f;e[0]!==r||e[1]!==l||e[2]!==p?(f=b=>Ft(r,{editButton:b.editButton,errorCount:l,fieldHasErrors:p,Label:b.Label,removeButton:b.removeButton,children:b.children}),e[0]=r,e[1]=l,e[2]=p,e[3]=f):f=e[3],m=f;let h=m,g;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==i||e[8]!==d||e[9]!==s||e[10]!==c||e[11]!==u?(g=n?ta(Zr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:c,nodeKey:u,RemoveButton:d},children:[n,Ft(o,{})]}):Ft(h,{children:Ft(oa,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=i,e[8]=d,e[9]=s,e[10]=c,e[11]=u,e[12]=g):g=e[12],g};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 ce="lexical-block",Qr=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=_a(),{id:i,collectionSlug:l,globalSlug:s}=Xr(),{fieldProps:{featureClientSchemaMap:c,field:u,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=H(),{fields:h}=xa(),g=Lo(new AbortController),b=ba(),[S,I]=st.useState(0),{config:_}=Ca(),T=ma({slug:`lexical-blocks-create-${f}-${o.id}`,depth:b}),{toggleDrawer:C}=he(T),{getDocPreferences:w,setDocFieldPreferences:M}=Xr(),[A]=Ea(),{getFormState:$}=Ta(),D=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[N,x]=st.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),E=Lo(!1),y=Lo(e);No(()=>{E.current?(y.current!==e&&x(!1),y.current=e):E.current=!0},[e]);let[k,v]=st.useState(N?._components?.customComponents?.BlockLabel),[L,F]=st.useState(N?._components?.customComponents?.Block);No(()=>{let j=new AbortController;return o&&!N&&(async()=>{let{state:V}=await $({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:$t(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:D,signal:j.signal});if(V){V.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let X=qr($t(V),!0);A.update(()=>{let Z=Pt(r);if(Z&&ct(Z)){let se=X;se.blockType=o.blockType,Z.setFields(se,!0)}}),x(V),v(V._components?.customComponents?.BlockLabel),F(V._components?.customComponents?.Block)}})(),()=>{Eo(j)}},[$,D,i,o,A,r,N,l,s,w,h]);let[B,K]=st.useState(d?.[o.id]?.collapsed??!1),re=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,G=c.blocks?.[re]?.[0],U=G.blockReferences?typeof G?.blockReferences?.[0]=="string"?_.blocksMap[G?.blockReferences?.[0]]:G?.blockReferences?.[0]:G?.blocks?.[0],{i18n:ee,t:ae}=wa(),J=ko(async({formState:j,submit:me})=>{Eo(g.current);let V=new AbortController;g.current=V;let{state:X}=await $({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:$t(h),formState:j,globalSlug:s,initialBlockFormState:j,operation:"update",renderAllFields:!!me,schemaPath:D,signal:V.signal});if(!X)return j;j.blockName&&(X.blockName=j.blockName);let Z=qr(Yr({fields:$t(X)}),!0);if(setTimeout(()=>{A.update(()=>{let se=Pt(r);if(se&&ct(se)){let Ue=Z;Ue.blockType=o.blockType,se.setFields(Ue,!0)}})},0),me){v(X._components?.customComponents?.BlockLabel),F(X._components?.customComponents?.Block);let se=0;for(let Ue of Object.values(X))Ue?.valid===!1&&se++;I(se)}return X},[$,i,l,w,s,D,o.blockType,h,A,r]);No(()=>()=>{Eo(g.current)},[]);let W=ko(()=>{A.update(()=>{Pt(r)?.remove()})},[A,r]),te=U?.labels?.singular?ka(U.labels.singular,ee):U?.slug,oe=ko(j=>{w().then(me=>{let X=me?.fields?.[u.name]?.collapsed,Z=X&&X?.length?X:[];j?Z.includes(o.id)||Z.push(o.id):Z.includes(o.id)&&Z.splice(Z.indexOf(o.id),1),M(u.name,{collapsed:Z,hello:"hi"})})},[w,u.name,M,o.id]),le=at(()=>()=>z(Jr,{buttonStyle:"icon-label",className:`${ce}__editButton`,disabled:p,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),C(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:ae("lexical:blocks:inlineBlocks:edit",{label:te})}),[te,p,ae,C]),Me=at(()=>()=>z(Jr,{buttonStyle:"icon-label",className:`${ce}__removeButton`,disabled:u?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),W()},round:!0,tooltip:"Remove Block"}),[u?.admin?.readOnly,W]),tt=at(()=>({children:j,disableBlockName:me,editButton:V,errorCount:X,fieldHasErrors:Z,Label:se,removeButton:Ue})=>z("div",{className:ce+" "+ce+"-"+o.blockType,children:z(sa,{className:[`${ce}__row`,Z?`${ce}__row--has-errors`:`${ce}__row--no-errors`].join(" "),collapsibleStyle:Z?"error":"default",header:lt("div",{className:`${ce}__block-header`,children:[se??k?se??k:lt("div",{children:[z(fa,{className:`${ce}__block-pill ${ce}__block-pill-${o?.blockType}`,pillStyle:"white",children:te??o?.blockType}),!me&&z(ga,{path:"blockName",readOnly:u?.admin?.readOnly||!1}),Z&&z(ua,{count:X??0,i18n:ee,withMessage:!0})]}),lt("div",{children:[L&&V!==!1||!L&&V?z(le,{}):null,Ue!==!1&&A.isEditable()?z(Me,{}):null]})]}),isCollapsed:B,onToggle:Rr=>{oe(Rr),K(Rr)},children:j},0)}),[L,k,le,Me,te,A,o.blockType,ee,B,oe,u?.admin?.readOnly]),Rt=U?.fields??[],Sr=at(()=>()=>z(ca,{children:z(aa,{className:"",slug:T,title:ae(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:te??ae("lexical:blocks:inlineBlocks:label")}),children:N?lt(la,{children:[z(ha,{fields:Rt,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:D,permissions:a,readOnly:!1}),z(pa,{programmaticSubmit:!0,children:ae("fields:saveChanges")})]}):null})}),[N,T,te,ae,U?.fields,D,a]),ys=at(()=>N?z(da,{beforeSubmit:[async({formState:j})=>await J({formState:j,submit:!0})],el:"div",fields:Rt,initialState:N,onChange:[J],onSubmit:(j,me)=>{me.blockType=o.blockType,A.update(()=>{let V=Pt(r);V&&ct(V)&&V.setFields(me,!0)}),C()},submitted:n,uuid:Na(),children:z(zr,{baseClass:ce,BlockDrawer:Sr,Collapsible:tt,CustomBlock:L,EditButton:le,errorCount:S,formSchema:Rt,initialState:N,nodeKey:r,RemoveButton:Me})}):null,[tt,Sr,L,Rt,Me,le,A,S,C,U?.fields,N,r,J,n]);return U?ys:z(tt,{disableBlockName:!0,fieldHasErrors:!0,children:lt("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var Ce=class extends it{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=Bt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return La(Qr,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Bt(t){return new Ce({fields:{...t,id:t?.id||new Sa.default().toHexString()}})}function ct(t){return t instanceof Ce}import{createCommand as en}from"lexical";var We=en("INSERT_BLOCK_COMMAND"),Ve=en("INSERT_INLINE_BLOCK_COMMAND");import{c as Ra}from"react/compiler-runtime";import{useLexicalComposerContext as Ia}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ya,$wrapNodeInElement as va,mergeRegister as Ma}from"@lexical/utils";import{formatDrawerSlug as Da,useEditDepth as Aa}from"@payloadcms/ui";import{$createParagraphNode as Oa,$getNodeByKey as Fa,$getPreviousSelection as $a,$getSelection as Pa,$insertNodes as Ba,$isParagraphNode as on,$isRangeSelection as Ha,$isRootOrShadowRoot as ja,COMMAND_PRIORITY_EDITOR as tn}from"lexical";import{useEffect as Ua,useState as Ga}from"react";var rn=()=>{let t=Ra(12),[e]=Ia(),[o,r]=Ga(null),{setCreatedInlineBlock:n,uuid:i}=H(),l=Aa(),s="lexical-inlineBlocks-create-"+i,c;t[0]!==l||t[1]!==s?(c=Da({slug:s,depth:l}),t[0]=l,t[1]=s,t[2]=c):c=t[2];let u=c,{toggleDrawer:d}=he(u,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([Ce]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Ma(e.registerCommand(We,m=>(e.update(()=>{let f=Pa()||$a();if(Ha(f)){let h=Bt(m);ya(h);let{focus:g}=f,b=g.getNode();on(b)&&b.getTextContentSize()===0&&b.getParentOrThrow().getChildren().filter(Wa).length>1&&b.remove()}}),!0),tn),e.registerCommand(Ve,m=>{if(o){let h=Fa(o);return!h||!go(h)?!1:(h.setFields(m),r(null),!0)}let f=ho(m);return n?.(f),Ba([f]),ja(f.getParentOrThrow())&&va(f,Oa).selectEnd(),!0},tn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(p=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=p):p=t[11],Ua(a,p),null};function Wa(t){return on(t)}var Va=R(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,l=e.blocks;if(!l)return{};let s=Object.entries(l).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),c=Object.entries(l).filter(([a])=>a.startsWith(i+".")&&!a.replace(i+".","").includes(".")).map(([,a])=>a[0]),u=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=c.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{nodes:[Ce,fo],plugins:[{Component:rn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[u?.length?{items:u.map(a=>({Icon:Ot(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Ht(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(We,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:At,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Ht(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ve,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[u.length?{type:"dropdown",ChildComponent:Dt,items:u.map((a,p)=>({ChildComponent:Ot(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Ht(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(We,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:At,items:d.map((a,p)=>({ChildComponent:a.imageURL?Ot(a.imageURL,a.imageAltText):At,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Ht(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ve,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Ka}from"react/compiler-runtime";import{jsx as Oe,jsxs as yo}from"react/jsx-runtime";import{useLexicalComposerContext as Za}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as za,$createTextNode as Ya,$getRoot as Ja,getDOMSelection as So}from"lexical";import*as an from"react";import{useCallback as Ae,useEffect as Ro,useLayoutEffect as nn,useRef as Io,useState as jt}from"react";var Xa=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)},qa=(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)},Qa=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
4
4
  await assertSelection(page, {
5
5
  anchorPath: [${n.anchorPath.toString()}],
6
6
  anchorOffset: ${n.anchorOffset},
@@ -10,7 +10,7 @@
10
10
  `;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
11
11
  `);default:return` await repeat(${t.count}, async () => {
12
12
  ${o}
13
- );`}};function rc(t){return t.key.toLowerCase()==="a"&&(Ir?t.metaKey:t.ctrlKey)}function nc(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function ln(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var sn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function ic(t){let[e,o]=jt([]),[r,n]=jt(!1),[,i]=jt(""),[l,s]=jt(""),c=Io(null),u=Io(!1),d=Io(null),a=Ae(()=>t,[t]),p=Ae(()=>{let _=t.getRootElement(),T=So(t._window);return _==null||T==null||T.anchorNode==null||T.focusNode==null||!_.contains(T.anchorNode)||!_.contains(T.focusNode)?null:`
13
+ );`}};function ec(t){return t.key.toLowerCase()==="a"&&(Ir?t.metaKey:t.ctrlKey)}function tc(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function ln(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var sn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function oc(t){let[e,o]=jt([]),[r,n]=jt(!1),[,i]=jt(""),[l,s]=jt(""),c=Io(null),u=Io(!1),d=Io(null),a=Ae(()=>t,[t]),p=Ae(()=>{let _=t.getRootElement(),T=So(t._window);return _==null||T==null||T.anchorNode==null||T.focusNode==null||!_.contains(T.anchorNode)||!_.contains(T.focusNode)?null:`
14
14
  import {
15
15
  initializeE2E,
16
16
  assertHTMLSnapshot,
@@ -27,15 +27,15 @@ describe('Test case', () => {
27
27
  const {page} = e2e;
28
28
 
29
29
  await page.focus('div[contenteditable="true"]');
30
- ${e.map(oc).join(`
30
+ ${e.map(Qa).join(`
31
31
  `)}
32
32
  });
33
33
  });
34
- `},[t,e]),m=Ae((_,T)=>{o(C=>{let w=e.length-1,M=e[w];if(M&&M.name===_){if(_==="type")return[...e.slice(0,w),{...M,value:M.value+T}];if(M.value===T)return[...e.slice(0,w),{...M,count:M.count+1}]}return[...C,{name:_,count:1,value:T}]})},[e,o]);nn(()=>{let _=C=>{if(!r)return;let w=C.key;rc(C)?m("selectAll",""):sn.has(w)?m("press",C.key):[...w].length>1?m("keydown",C.key):m("type",C.key)},T=C=>{if(!r)return;let w=C.key;!sn.has(w)&&[...w].length>1&&m("keyup",C.key)};return t.registerRootListener((C,w)=>{w!==null&&(w.removeEventListener("keydown",_),w.removeEventListener("keyup",T)),C!==null&&(C.addEventListener("keydown",_),C.addEventListener("keyup",T))})},[t,r,m]),nn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Ro(()=>{if(e){let _=p();_!==null&&s(_),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Ro(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:C,editorState:w})=>{if(!r)return;let M=w._selection,A=c.current,$=u.current;if(A!==M){if(C.size===0&&T.size===0&&!$){let N=So(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}c.current=M}u.current=!1;let D=p();D!==null&&s(D)}),[t,p,r,m]),Ro(()=>r?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,r]);let f=Ae(_=>{r||(_.update(()=>{let T=Qa();T.clear();let C=qa();T.append(Xa().append(C)),C.select()}),o([])),n(T=>!T)},[r]),h=Ae(()=>{if(!r)return;let _=So(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:T,anchorOffset:C,focusNode:w,focusOffset:M}=nc(_),A=a().getRootElement(),$;T!==null&&($=ln(T,A));let D;w!==null&&(D=ln(w,A)),m("snapshot",{anchorNode:T,anchorOffset:C,anchorPath:$,focusNode:w,focusOffset:M,focusPath:D})},[m,r,a]),g=Ae(()=>{ec(p())},[p]),b=Ae(()=>{tc("test.js",p())},[p]);return[Oe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{f(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?yo("div",{className:"test-recorder-output",children:[yo("div",{className:"test-recorder-toolbar",children:[Oe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{g(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{b(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Oe("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var cn=()=>{let t=Ya(3),[e]=Ja(),[o,r]=ic(e),n;return t[0]!==o||t[1]!==r?(n=yo(an.Fragment,{children:[Oe("p",{children:"HI"}),o,r,Oe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var lc=R({plugins:[{Component:cn,position:"bottom"}]});import{c as sc}from"react/compiler-runtime";import{jsx as ac}from"react/jsx-runtime";import{useLexicalComposerContext as cc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as uc}from"@lexical/react/LexicalTreeView.js";import"react";var un=()=>{let t=sc(2),[e]=cc(),o;return t[0]!==e?(o=ac(uc,{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 dc=R({plugins:[{Component:un,position:"bottom"}]});import{$isTableSelection as mc}from"@lexical/table";import{$isRangeSelection as pc,FORMAT_TEXT_COMMAND as fc}from"lexical";import{jsx as dn}from"react/jsx-runtime";import"react";var mn=()=>dn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var ee=t=>({type:"buttons",items:t,key:"format",order:40});var pn={type:"text-format",format:["bold","italic"],tag:"***"},fn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},hn={type:"text-format",format:["bold"],tag:"**"},gn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Cn=[ee([{ChildComponent:mn,isActive:({selection:t})=>pc(t)||mc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(fc,"bold")},order:1}])],hc=R(({featureProviderMap:t})=>{let e=[hn,gn];return t.get("italic")&&e.push(fn,pn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Cn},toolbarInline:{groups:Cn}}});import{$isTableSelection as Cc}from"@lexical/table";import{$isRangeSelection as xc,FORMAT_TEXT_COMMAND as bc}from"lexical";import{jsx as xn,jsxs as gc}from"react/jsx-runtime";import"react";var bn=()=>gc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[xn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),xn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var _n={type:"text-format",format:["code"],tag:"`"};var Tn=[ee([{ChildComponent:bn,isActive:({selection:t})=>xc(t)||Cc(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(bc,"code")},order:7}])],_c=R({enableFormats:["code"],markdownTransformers:[_n],toolbarFixed:{groups:Tn},toolbarInline:{groups:Tn}});import{$isTableSelection as Tc}from"@lexical/table";import{$isRangeSelection as wc,FORMAT_TEXT_COMMAND as Ec}from"lexical";import{jsx as wn}from"react/jsx-runtime";import"react";var En=()=>wn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:wn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var kn={type:"text-format",format:["italic"],tag:"*"},Nn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Ln=[ee([{ChildComponent:En,isActive:({selection:t})=>wc(t)||Tc(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Ec,"italic")},order:2}])],kc=R({enableFormats:["italic"],markdownTransformers:[kn,Nn],toolbarFixed:{groups:Ln},toolbarInline:{groups:Ln}});import{$isTableSelection as Lc}from"@lexical/table";import{$isRangeSelection as Sc,FORMAT_TEXT_COMMAND as Rc}from"lexical";import{jsx as Sn,jsxs as Nc}from"react/jsx-runtime";import"react";var Rn=()=>Nc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Sn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),Sn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var In={type:"text-format",format:["strikethrough"],tag:"~~"};var yn=[ee([{ChildComponent:Rn,isActive:({selection:t})=>Sc(t)||Lc(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Rc,"strikethrough")},order:4}])],Ic=R({enableFormats:["strikethrough"],markdownTransformers:[In],toolbarFixed:{groups:yn},toolbarInline:{groups:yn}});import{$isTableSelection as yc}from"@lexical/table";import{$isRangeSelection as vc,FORMAT_TEXT_COMMAND as Mc}from"lexical";import{jsx as vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:vn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Dn=[ee([{ChildComponent:Mn,isActive:({selection:t})=>vc(t)||yc(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Mc,"subscript")},order:5}])],Dc=R({enableFormats:["subscript"],toolbarFixed:{groups:Dn},toolbarInline:{groups:Dn}});import{$isTableSelection as Ac}from"@lexical/table";import{$isRangeSelection as Oc,FORMAT_TEXT_COMMAND as Fc}from"lexical";import{jsx as An}from"react/jsx-runtime";import"react";var On=()=>An("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:An("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Fn=[ee([{ChildComponent:On,isActive:({selection:t})=>Oc(t)||Ac(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Fc,"superscript")},order:6}])],$c=R({enableFormats:["superscript"],toolbarFixed:{groups:Fn},toolbarInline:{groups:Fn}});import{$isTableSelection as Bc}from"@lexical/table";import{$isRangeSelection as Hc,FORMAT_TEXT_COMMAND as jc}from"lexical";import{jsx as $n,jsxs as Pc}from"react/jsx-runtime";import"react";var Pn=()=>Pc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$n("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),$n("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Bn=[ee([{ChildComponent:Pn,isActive:({selection:t})=>Hc(t)||Bc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(jc,"underline")},order:3}])],Uc=R({enableFormats:["underline"],toolbarFixed:{groups:Bn},toolbarInline:{groups:Bn}});import{$createHeadingNode as Kc,$isHeadingNode as Qn,HeadingNode as Zc}from"@lexical/rich-text";import{$setBlocksType as zc}from"@lexical/selection";import{$getSelection as Yc,$isRangeSelection as Jc}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var jn=()=>Hn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Hn("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Un}from"react/jsx-runtime";import"react";var Gn=()=>Un("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Un("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as Wn}from"react/jsx-runtime";import"react";var Vn=()=>Wn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Wn("path",{d:"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",fill:"currentColor"})});import{jsx as Kn}from"react/jsx-runtime";import"react";var Zn=()=>Kn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Kn("path",{d:"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",fill:"currentColor"})});import{jsx as zn}from"react/jsx-runtime";import"react";var Yn=()=>zn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:zn("path",{d:"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",fill:"currentColor"})});import{jsx as Jn}from"react/jsx-runtime";import"react";var Xn=()=>Jn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Jn("path",{d:"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",fill:"currentColor"})});import{$createHeadingNode as Gc,$isHeadingNode as Wc,HeadingNode as Vc}from"@lexical/rich-text";var vo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var qn=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Vc],export:(n,i)=>{if(!Wc(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:vo(n=>{let i="h"+n[1]?.length;return Gc(i)})}};var ei=t=>{let e=Yc();zc(e,()=>Kc(t))},ti={h1:jn,h2:Gn,h3:Vn,h4:Zn,h5:Yn,h6:Xn},Xc=R(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ne(e.map((r,n)=>({ChildComponent:ti[r],isActive:({selection:i})=>{if(!Jc(i))return!1;for(let l of i.getNodes()){if(Qn(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(Qn(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{ei(r)})},order:n+2})))];return{markdownTransformers:[qn(e)],nodes:[Zc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Q(e.map(r=>({Icon:ti[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{ei(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as pu}from"lexical";import{jsx as oi}from"react/jsx-runtime";import"react";var Mo=()=>oi("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:oi("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as ri,jsxs as qc}from"react/jsx-runtime";import"react";var ni=()=>qc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ri("path",{d:"M5 10h10",stroke:"currentColor"}),ri("path",{d:"M10 15V5",stroke:"currentColor"})]});var xe=t=>({type:"dropdown",ChildComponent:ni,items:t,key:"add",order:10});import{addClassNamesToElement as Qc}from"@lexical/utils";import{$applyNodeReplacement as eu,createCommand as tu,DecoratorNode as ou}from"lexical";var dt=tu("INSERT_HORIZONTAL_RULE_COMMAND"),ut=class extends ou{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:ru,priority:0})}}static importJSON(e){return ii()}createDOM(e){let o=document.createElement("hr");return Qc(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
35
- `}isInline(){return!1}updateDOM(){return!1}};function ru(){return{node:ii()}}function ii(){return eu(new ut)}import{$applyNodeReplacement as nu}from"lexical";import"react";var Ie=class extends ut{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return mt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function mt(){return nu(new Ie)}function Ut(t){return t instanceof Ie}var li={type:"element",dependencies:[Ie],export:(t,e)=>Ut(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=mt();e&&t.replace(e)}};import{c as iu}from"react/compiler-runtime";import{useLexicalComposerContext as lu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as su}from"@lexical/utils";import{$getSelection as au,$isRangeSelection as cu,COMMAND_PRIORITY_EDITOR as uu}from"lexical";import{useEffect as du}from"react";var si=()=>{let t=iu(3),[e]=lu(),o,r;return t[0]!==e?(o=()=>e.registerCommand(dt,mu,uu),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),du(o,r),null};function mu(t){let e=au();if(!cu(e))return!1;if(e.focus.getNode()!==null){let r=mt();su(r)}return!0}var fu=R({markdownTransformers:[li],nodes:[Ie],plugins:[{Component:si,position:"normal"}],slashMenu:{groups:[Q([{Icon:Mo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(dt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Mo,isActive:({selection:t})=>{if(!pu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ut(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(dt,void 0)}}])]}});import{$findMatchingParent as hi}from"@lexical/utils";import{$isElementNode as Iu,$isRangeSelection as yu,INDENT_CONTENT_COMMAND as vu,OUTDENT_CONTENT_COMMAND as Mu}from"lexical";import{jsx as Gt,jsxs as hu}from"react/jsx-runtime";import"react";var ai=()=>hu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Wt,jsxs as gu}from"react/jsx-runtime";import"react";var ci=()=>gu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Cu}from"react/jsx-runtime";import{useLexicalComposerContext as xu}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as bu}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as _u,mergeRegister as Tu}from"@lexical/utils";import{$getSelection as wu,$isElementNode as Eu,$isRangeSelection as ku,COMMAND_PRIORITY_LOW as ui,INDENT_CONTENT_COMMAND as di,KEY_TAB_COMMAND as Nu,OUTDENT_CONTENT_COMMAND as Lu,TabNode as Su}from"lexical";import{useEffect as mi}from"react";var pi=({clientProps:t})=>{let[e]=xu(),{disabledNodes:o,disableTabNode:r}=t;return mi(()=>{if(!(!e||!o?.length))return e.registerCommand(di,()=>Ru(n=>{if(!o.includes(n.getType())){let i=n.getIndent();n.setIndent(i+1)}}),ui)},[e,o]),mi(()=>{if(!(!e||!r))return Tu(e.registerCommand(Nu,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Lu:di,void 0)),ui),e.registerNodeTransform(Su,n=>{n.remove()}))},[e,r]),Cu(bu,{})};function Ru(t){let e=wu();if(!ku(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let i=r[n],l=i.getKey();if(o.has(l))continue;let s=_u(i,u=>Eu(u)&&!u.isInline());if(s===null)continue;let c=s.getKey();s.canIndent()&&!o.has(c)&&(o.add(c),t(s))}return o.size>0}var fi=t=>({type:"buttons",items:t,key:"indent",order:35});var gi=[fi([{ChildComponent:ai,isActive:()=>!1,isEnabled:({selection:t})=>{let e=t?.getNodes();if(!e?.length)return!1;let o=!1,r=n=>Iu(n)&&n.canIndent();for(let n of e)if(r(n)){if(n.getIndent()<=0)return!1;o=!0}if(!o&&yu(t)){let n=t.anchor.getNode();if(hi(n,l=>r(l)&&l.getIndent()>0))return!0;let i=t.focus.getNode();if(hi(i,l=>r(l)&&l.getIndent()>0))return!0}return o},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mu,void 0)},order:1},{ChildComponent:ci,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(vu,void 0)},order:2}])],Du=R({plugins:[{Component:pi,position:"normal"}],toolbarFixed:{groups:gi},toolbarInline:{groups:gi}});import{$findMatchingParent as Vd}from"@lexical/utils";import{$getSelection as jo,$isRangeSelection as Zi}from"lexical";import{jsx as Ci}from"react/jsx-runtime";import"react";var xi=()=>Ci("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ci("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as bi}from"@lexical/selection";function Ke(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?bi(o)?r:n:bi(e)?r:n}var Do=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Wu}from"lexical";import{addClassNamesToElement as Au,isHTMLAnchorElement as Ou}from"@lexical/utils";import Fo from"bson-objectid";import{$applyNodeReplacement as Fu,$createTextNode as _i,$getSelection as $u,$isElementNode as Ti,$isRangeSelection as Oo,createCommand as Pu,ElementNode as Bu}from"lexical";var Hu=new Set(["http:","https:","mailto:","sms:","tel:"]),ie=class t extends Bu{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:ju,priority:1})}}static importJSON(e){let o=be({}).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 Fo.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=Ao(o.rel,"add","noopener")),Au(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},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!Oo(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Ti(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Hu.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,r){let n=this.__fields?.url,i=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Ao(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Ao(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function ju(t){let e=null;if(Ou(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new Fo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return Fu(new ie({id:t??new Fo.default().toHexString(),fields:e}))}function Y(t){return t instanceof ie}var pe=Pu("TOGGLE_LINK_COMMAND");function $o(t){let e=$u();if(!Oo(e)&&(t===null||!t.selectedNodes?.length))return;let o=Oo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(i=>{let l=i.getParent();Y(l)&&(l.getChildren().forEach(c=>{l.insertBefore(c)}),l.remove())});return}if(o?.length===1){let i=o[0],l=Y(i)?i:Uu(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(_i(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||Ti(i)&&!i.isInline())){if(Y(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(_i(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=be({fields:t.fields}),Y(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),Y(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();n.append(...s)}i.remove();return}n!==null&&n.append(i)}})}function Uu(t){return Gu(t,e=>Y(e))}function Gu(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Ao(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var wi={type:"text-match",dependencies:[ie],export:(t,e)=>{if(!Y(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Wu(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as Vu,$isElementNode as Ku}from"lexical";var _e=class t extends ie{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=pt({}).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 r=this.getParentOrThrow().insertNewAfter(e,o);if(Ku(r)){let n=pt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function pt({fields:t}){return Vu(new _e({id:"",fields:t}))}function Te(t){return t instanceof _e}import{c as Zu}from"react/compiler-runtime";import{useLexicalComposerContext as zu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Yu}from"@lexical/utils";import{$createTextNode as Ei,$getSelection as Ju,$isElementNode as Ni,$isLineBreakNode as Li,$isNodeSelection as Xu,$isRangeSelection as qu,$isTextNode as ft,TextNode as Qu}from"lexical";import{useEffect as ed}from"react";function ki(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function Si(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var td=/[.,;\s]/;function Kt(t){return t!==void 0&&td.test(t)}function Ri(t){return Kt(t[t.length-1])}function Bo(t){return Kt(t[0])}function od(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ii(t){let e=t.getPreviousSibling();return Ni(e)&&(e=e.getLastDescendant()),e===null||Li(e)||ft(e)&&Ri(e.getTextContent())}function yi(t){let e=t.getNextSibling();return Ni(e)&&(e=e.getFirstDescendant()),e===null||Li(e)||ft(e)&&Bo(e.getTextContent())}function rd(t,e,o,r){return(t>0?Kt(o[t-1]):Ii(r[0]))?e<o.length?Kt(o[e]):yi(r[r.length-1]):!1}function nd(t,e,o){let r=[],n=[],i=[],l=0,s=0,c=[...t];for(;c.length>0;){let u=c[0],a=u.getTextContent().length,p=s;s+a<=e?(r.push(u),l+=a):p>=o?i.push(u):n.push(u),s+=a,c.shift()}return[l,r,n,i]}function id(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=pt({fields:n});if(t.length===1){let l=t[0],s;if(e===0?[s]=l.splitText(o):[,s]=l.splitText(e,o),s){let c=Ei(r.text);c.setFormat(s.getFormat()),c.setDetail(s.getDetail()),c.setStyle(s.getStyle()),i.append(c),s.replace(i)}return l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,c;e===0?c=l:[,c]=l.splitText(e);let u=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)u.push(a);else{let[g,b]=a.splitText(o-f);g&&u.push(g),d=b}s+=m}),c){let a=Ju(),p=a?a.getNodes().find(ft):void 0,m=Ei(c.getTextContent());return m.setFormat(c.getFormat()),m.setDetail(c.getDetail()),m.setStyle(c.getStyle()),i.append(m,...u),p&&p===c&&(qu(a)?m.select(a.anchor.offset,a.focus.offset):Xu(a)&&m.select(0,m.getTextContent().length)),c.replace(i),d}}}function ld(t,e,o){let r=[...t],n=r.map(c=>c.getTextContent()).join(""),i=n,l,s=0;for(;(l=Si(i,e))!=null&&l!==null;){let c=l.index,u=l.length,d=c+u;if(rd(s+c,s+d,n,r)){let[p,,m,f]=nd(r,s+c,s+d),h=s+c-p,g=s+d-p,b=id(m,h,g,l);r=b?[b,...f]:f,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function Po(t,e,o){let r=t.getChildren(),n=r.length;for(let c=0;c<n;c++){let u=r[c];if(!ft(u)||!u.isSimpleText()){Vt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=Si(i,e);if(l===null||l.text!==i){Vt(t),o(null,t.getFields()?.url??null);return}if(!Ii(t)||!yi(t)){Vt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let c=t.getFields();c.url=l?.url,t.setFields(c),o(l.url,s??null)}}function sd(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(Te(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Bo(i)||od(i,l))&&(r.append(t),Po(r,e,o),o(null,r.getFields()?.url??null))}Te(n)&&!Ri(i)&&(Vt(n),Po(n,e,o),o(null,n.getFields()?.url??null))}function Vt(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function ad(t){let e=[t],o=t.getNextSibling();for(;o!==null&&ft(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function cd(t,e,o){let r=Zu(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([_e]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,c)=>{o?.(s,c)};return Yu(t.registerNodeTransform(Qu,s=>{let c=s.getParentOrThrow(),u=s.getPreviousSibling();if(Te(c))Po(c,e,l);else if(!Y(c)){if(s.isSimpleText()&&(Bo(s.getTextContent())||!Te(u))){let d=ad(s);ld(d,e,l)}sd(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=i):(n=r[3],i=r[4]),ed(n,i)}var ud=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,dd=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,md=[ki(ud,t=>t.startsWith("http")?t:`https://${t}`),ki(dd,t=>`mailto:${t}`)],vi=()=>{let[t]=zu();return cd(t,md),null};import{jsx as pd}from"react/jsx-runtime";import{ClickableLinkPlugin as fd}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Mi=()=>pd(fd,{});import{jsx as Md}from"react/jsx-runtime";import"react";import{createPortal as Dd}from"react-dom";import{jsx as we,jsxs as ht,Fragment as gd}from"react/jsx-runtime";import{useLexicalComposerContext as Cd}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Di,mergeRegister as Ai}from"@lexical/utils";import{getTranslation as Ho}from"@payloadcms/translations";import{CloseMenuIcon as xd,EditIcon as bd,ExternalLinkIcon as Oi,formatDrawerSlug as _d,useConfig as Td,useEditDepth as wd,useLocale as Ed,useTranslation as kd}from"@payloadcms/ui";import{requests as Nd}from"@payloadcms/ui/shared";import{$getSelection as Fi,$isLineBreakNode as Ld,$isRangeSelection as $i,COMMAND_PRIORITY_HIGH as Sd,COMMAND_PRIORITY_LOW as Pi,getDOMSelection as Rd,KEY_ESCAPE_COMMAND as Id,SELECTION_CHANGE_COMMAND as yd}from"lexical";import Bi,{useCallback as Hi,useEffect as Yt,useRef as vd,useState as Fe}from"react";function Zt(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),c=i.getBoundingClientRect(),u=t.top-r,d=t.left-n;u<c.top&&(u+=l.height+t.height+r*2),d+l.width>c.right&&(d=c.right-l.width-n),u-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${u}px)`}import{createCommand as hd}from"lexical";var zt=hd("TOGGLE_LINK_WITH_MODAL_COMMAND");function ji(t){t.preventDefault()}function Ui({anchorElem:t}){let[e]=Cd(),[o,r]=Fe(),n=vd(null),[i,l]=Fe(null),[s,c]=Fe(null),{fieldProps:{schemaPath:u},uuid:d}=H(),{config:a,getEntityConfig:p}=Td(),{i18n:m,t:f}=kd(),[h,g]=Fe(),b=wd(),[S,I]=Fe(!1),[_,T]=Fe([]),C=Ed(),[w,M]=Fe(!1),A=_d({slug:"lexical-rich-text-link-"+d,depth:b}),{toggleDrawer:$}=he(A),D=Hi(()=>{I(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),M(!1),l(null),c(null),T([]),g(void 0)},[I,l,c,T]),N=Hi(()=>{let x=Fi(),k;if(!$i(x)||!x){D();return}let y=Ke(x);k=e.getElementByKey(y.getKey())?.getBoundingClientRect();let L=Di(y,Y),v=x.getNodes().filter(W=>!Ld(W)).find(W=>{let G=Di(W,Y);return L&&!L.is(G)||G&&!G.is(L)});if(L==null||v){D();return}r(L);let E=L.getFields(),O={...E,id:L.getID(),text:L.getTextContent()};if(E?.linkType==="custom")l(E?.url??null),c(null);else{l(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${E?.doc?.relationTo}/${E?.doc?.value}`);let W=E?.doc?.relationTo?p({collectionSlug:E?.doc?.relationTo}):void 0;if(!W)c(E?.label?String(E?.label):null),l(E?.url?String(E?.url):null);else{let G=typeof E.doc?.value=="object"?E.doc.value.id:E.doc?.value,te=E.doc?.relationTo;if(!G||!te)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ae=f("fields:linkedTo",{label:`${Ho(W.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");c(ae),Nd.get(`${a.serverURL}${a.routes.api}/${te}/${G}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:C?.code}}).then(async X=>{if(!X.ok)throw new Error(`HTTP error! Status: ${X.status}`);let V=await X.json(),oe=W?.admin?.useAsTitle||"id",re=V[oe],le=f("fields:linkedTo",{label:`${Ho(W.labels.singular,m)} - ${re}`}).replace(/<[^>]*>?/g,"");c(le)}).catch(()=>{let X=f("fields:linkedTo",{label:`${Ho(W.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${G}`}).replace(/<[^>]*>?/g,"");c(X)})}}g(O),I(!0),T(x?x?.getNodes():[]),Te(L)?M(!0):M(!1);let B=n.current,U=Rd(e._window),{activeElement:J}=document;if(B===null)return;let je=e.getRootElement();return U!==null&&je!==null&&je.contains(U.anchorNode)?(k||(k=U.getRangeAt(0).getBoundingClientRect()),k!=null&&(k.y+=40,Zt(k,B,t))):(J==null||J.className!=="link-input")&&(je!==null&&Zt(null,B,t),l(null),c(null)),!0},[e,D,a.routes.admin,a.routes.api,a.serverURL,p,f,m,C?.code,t]);return Yt(()=>Ai(e.registerCommand(zt,x=>(e.dispatchCommand(pe,x),N(),$(),!0),Pi)),[e,N,$,A]),Yt(()=>{let x=t.parentElement,k=()=>{e.getEditorState().read(()=>{N()})};return window.addEventListener("resize",k),x?.addEventListener("scroll",k),()=>{window.removeEventListener("resize",k),x?.removeEventListener("scroll",k)}},[t.parentElement,e,N]),Yt(()=>Ai(e.registerUpdateListener(({editorState:x})=>{x.read(()=>{N()})}),e.registerCommand(yd,()=>(N(),!0),Pi),e.registerCommand(Id,()=>S?(D(),!0):!1,Sd)),[e,N,S,D]),Yt(()=>{e.getEditorState().read(()=>{N()})},[e,N]),ht(Bi.Fragment,{children:[we("div",{className:"link-editor",ref:n,children:ht("div",{className:"link-input",children:[i&&i.length>0?ht("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?we(Oi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?ht(gd,{children:[o?.__fields.newTab?we(Oi,{}):null,we("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&ht(Bi.Fragment,{children:[we("button",{"aria-label":"Edit link",className:"link-edit",onClick:x=>{x.preventDefault(),$()},onMouseDown:ji,tabIndex:0,type:"button",children:we(bd,{})}),!w&&we("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(pe,null)},onMouseDown:ji,tabIndex:0,type:"button",children:we(xd,{})})]})]})}),we(ot,{className:"lexical-link-edit-drawer",data:h,drawerSlug:A,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(x,k)=>{let y=k,L={...y};delete L.text,e.update(()=>{let v=Fi(),E=null;if($i(v)?E=Ke(v).getParent():_.length&&(E=_[0]?.getParent()??null),E&&Te(E)){let O=be({fields:L});E.replace(O,!0)}}),e.dispatchCommand(pe,{fields:L,selectedNodes:_,text:y.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Gi=t=>{let{anchorElem:e=document.body}=t;return Dd(Md(Ui,{anchorElem:e}),e)};import{c as Fd}from"react/compiler-runtime";import{useLexicalComposerContext as $d}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Pd}from"@lexical/utils";import{$getSelection as Bd,$isElementNode as Hd,$isRangeSelection as jd,COMMAND_PRIORITY_LOW as Vi,PASTE_COMMAND as Ud}from"lexical";import{useEffect as Gd}from"react";var Ad=/^(?:[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+)?$/,Od=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function Wi(t){if(!t)return!1;if(t==="https://"||Ad.test(t)||Od.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ki=t=>{let e=Fd(5),{clientProps:o}=t,[r]=$d(),n,i;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ie]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Pd(r.registerCommand(pe,l=>l===null?($o(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),$o(l),!0),Vi),r.registerCommand(Ud,l=>{let s=Bd();if(!jd(s)||s.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let c=l.clipboardData.getData("text");if(!Wi(c))return!1;if(!s.getNodes().some(Wd)){let u={doc:null,linkType:"custom",newTab:!1,url:c};return r.dispatchCommand(pe,{fields:u,text:null}),l.preventDefault(),!0}return!1},Vi))},i=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=i):(n=e[3],i=e[4]),Gd(n,i),null};function Wd(t){return Hd(t)}var zi=[Do([{ChildComponent:xi,isActive:({selection:t})=>{if(Zi(t)){let e=Ke(t);return Vd(e,Y)!=null}return!1},isEnabled:({selection:t})=>!!(Zi(t)&&jo()?.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,r=[];if(t.getEditorState().read(()=>{o=jo()?.getTextContent(),r=jo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,newTab:!1};t.dispatchCommand(zt,{fields:n,selectedNodes:r,text:o})}},order:1}])],Kd=R(({props:t})=>({markdownTransformers:[wi],nodes:[ie,t?.disableAutoLinks===!0?null:_e].filter(Boolean),plugins:[{Component:Ki,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:vi,position:"normal"},{Component:Mi,position:"normal"},{Component:Gi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:zi},toolbarInline:{groups:zi}}));import{$isListNode as Wo,INSERT_CHECK_LIST_COMMAND as el,ListItemNode as nm,ListNode as im}from"@lexical/list";import{$isRangeSelection as lm}from"lexical";import{jsx as Yi,jsxs as Zd}from"react/jsx-runtime";import"react";var Uo=()=>Zd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Yi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Yi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as zd}from"react/jsx-runtime";import{ListPlugin as Yd}from"@lexical/react/LexicalListPlugin.js";import"react";var Ze=()=>zd(Yd,{});function ze(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Qd,ListItemNode as em,ListNode as tm}from"@lexical/list";import{$createListItemNode as Jd,$createListNode as Xd,$isListItemNode as qd,$isListNode as Go}from"@lexical/list";var Ji=4,Ye=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Jd(t==="check"?r[3]==="x":void 0);if(Go(i)&&i.getListType()===t){let c=i.getFirstChild();c!==null?c.insertBefore(l):i.append(l),e.remove()}else if(Go(n)&&n.getListType()===t)n.append(l),e.remove();else{let c=Xd(t,t==="number"?Number(r[2]):void 0);c.append(l),e.replace(c)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Ji);s&&l.setIndent(s)},$e=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(qd(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(Go(d)){r.push($e(d,e,o+1));continue}}let s=" ".repeat(o*Ji),c=t.getListType(),u=c==="number"?`${t.getStart()+i}. `:c==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+u+e(l)),i++}return r.join(`
36
- `)};var Xi={type:"element",dependencies:[tm,em],export:(t,e)=>Qd(t)?$e(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Ye("check")};import{jsx as om}from"react/jsx-runtime";import{CheckListPlugin as rm}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var qi=()=>om(rm,{});var Qi=[ne([{ChildComponent:Uo,isActive:({selection:t})=>{if(!lm(t))return!1;for(let e of t.getNodes()){if(Wo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Wo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Wo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(el,void 0)},order:12}])],sm=R(({featureProviderMap:t})=>{let e=[{Component:qi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ze,position:"normal"}),{markdownTransformers:[Xi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[im,nm],plugins:e,slashMenu:{groups:[ze([{Icon:Uo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(el,void 0)}}])]},toolbarFixed:{groups:Qi},toolbarInline:{groups:Qi}}});import{$isListNode as Ko,INSERT_ORDERED_LIST_COMMAND as rl,ListItemNode as mm,ListNode as pm}from"@lexical/list";import{$isRangeSelection as fm}from"lexical";import{jsx as gt,jsxs as am}from"react/jsx-runtime";import"react";var Vo=()=>am("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[gt("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),gt("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),gt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),gt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),gt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as cm,ListItemNode as um,ListNode as dm}from"@lexical/list";var tl={type:"element",dependencies:[dm,um],export:(t,e)=>cm(t)?$e(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Ye("number")};var ol=[ne([{ChildComponent:Vo,isActive:({selection:t})=>{if(!fm(t))return!1;for(let e of t.getNodes()){if(Ko(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Ko(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Ko(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(rl,void 0)},order:10}])],hm=R(({featureProviderMap:t})=>({markdownTransformers:[tl],nodes:t.has("orderedList")?[]:[pm,mm],plugins:t.has("orderedList")?[]:[{Component:Ze,position:"normal"}],slashMenu:{groups:[ze([{Icon:Vo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(rl,void 0)}}])]},toolbarFixed:{groups:ol},toolbarInline:{groups:ol}}));import{$isListNode as zo,INSERT_UNORDERED_LIST_COMMAND as ll,ListItemNode as _m,ListNode as Tm}from"@lexical/list";import{$isRangeSelection as wm}from"lexical";import{jsx as Je,jsxs as gm}from"react/jsx-runtime";import"react";var Zo=()=>gm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Je("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Je("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Je("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Je("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Je("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Je("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Cm,ListItemNode as xm,ListNode as bm}from"@lexical/list";var nl={type:"element",dependencies:[bm,xm],export:(t,e)=>Cm(t)?$e(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ye("bullet")};var il=[ne([{ChildComponent:Zo,isActive:({selection:t})=>{if(!wm(t))return!1;for(let e of t.getNodes()){if(zo(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(zo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(zo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ll,void 0)},order:11}])],Em=R({markdownTransformers:[nl],nodes:[Tm,_m],plugins:[{Component:Ze,position:"normal"}],slashMenu:{groups:[ze([{Icon:Zo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ll,void 0)}}])]},toolbarFixed:{groups:il},toolbarInline:{groups:il}});import{jsx as km}from"react/jsx-runtime";import{addClassNamesToElement as Nm}from"@lexical/utils";import{DecoratorNode as Lm}from"lexical";import*as sl from"react";var Sm=sl.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Ct=class t extends Lm{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Rm({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Nm(o,"unknownConverted"),o}decorate(){return km(Sm,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Rm({data:t}){return new Ct({data:t})}var Im=R(()=>({nodes:[Ct]}));import{jsx as ym}from"react/jsx-runtime";import{addClassNamesToElement as vm}from"@lexical/utils";import{DecoratorNode as Mm}from"lexical";import*as al from"react";var Dm=al.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),xt=class t extends Mm{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Am({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return vm(o,"unknownConverted"),o}decorate(){return ym(Dm,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Am({data:t}){return new xt({data:t})}var Om=R(()=>({nodes:[xt]}));import{$setBlocksType as dl}from"@lexical/selection";import{$createParagraphNode as ml,$getSelection as pl,$isParagraphNode as cl,$isRangeSelection as Fm}from"lexical";var ul=[ne([{ChildComponent:nt,isActive:({selection:t})=>{if(!Fm(t))return!1;for(let e of t.getNodes())if(!cl(e)&&!cl(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=pl();dl(e,()=>ml())})},order:1}])],$m=R({slashMenu:{groups:[Q([{Icon:nt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=pl();dl(e,()=>ml())})}}])]},toolbarFixed:{groups:ul},toolbarInline:{groups:ul}});import{$isNodeSelection as Tp}from"lexical";import{jsx as bt,jsxs as Pm}from"react/jsx-runtime";import"react";var Yo=()=>Pm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[bt("g",{clipPath:"url(#clip0_4397_10817)",children:bt("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),bt("defs",{children:bt("clipPath",{id:"clip0_4397_10817",children:bt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as jm}from"react/jsx-runtime";import*as hl from"react";import{DecoratorBlockNode as Bm}from"@lexical/react/LexicalDecoratorBlockNode.js";function Hm(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:fl({relationTo:o,value:e})}:null}var _t=class extends Bm{__data;constructor({data:e,format:o,key:r}){super(o,r),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:Hm,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=fl(o);return r.setFormat(e.format),r}static isInline(){return!1}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 fl(t){return new _t({data:t})}var Um=hl.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function Gm(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Pe({relationTo:o,value:e})}:null}var Ee=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:Gm,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Pe(o);return r.setFormat(e.format),r}decorate(e,o){return jm(Um,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Pe(t){return new Ee({data:t})}function Jo(t){return t instanceof Ee}import{c as sp}from"react/compiler-runtime";import{jsx as ap}from"react/jsx-runtime";import{useLexicalComposerContext as cp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as up}from"@lexical/utils";import{useConfig as dp}from"@payloadcms/ui";import{$getPreviousSelection as mp,$getSelection as pp,$isParagraphNode as Tl,$isRangeSelection as fp,COMMAND_PRIORITY_EDITOR as hp,createCommand as gp}from"lexical";import{useEffect as Cp}from"react";import{c as tp}from"react/compiler-runtime";import{jsx as Jt}from"react/jsx-runtime";import{useLexicalComposerContext as op}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as rp,COMMAND_PRIORITY_EDITOR as np}from"lexical";import{useEffect as ip,useState as xl}from"react";import{c as Wm}from"react/compiler-runtime";import{jsx as Vm}from"react/jsx-runtime";import{useLexicalComposerContext as Km}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Zm,useModal as zm}from"@payloadcms/ui";import{$getNodeByKey as gl,$getPreviousSelection as Ym,$getRoot as Jm,$getSelection as Xm,$isRangeSelection as qm,$setSelection as Qm}from"lexical";import{useEffect as ep,useState as Cl}from"react";var Tt=t=>{let e=Wm(23),[o]=Km(),[r,n]=Cl(null),[i,l]=Cl(!1),[s,c,u]=Zm(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=u,{modalState:f}=zm(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let $=Xm()??Ym();n($)},e[0]=h):h=e[0];let g=h,b;e[1]!==o||e[2]!==r?(b=()=>{r&&o.update(()=>{if(qm(r)){let{anchor:$,focus:D}=r;gl($.key)&&gl(D.key)&&Qm(r.clone())}else Jm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=b):b=e[3];let S=b,I;e[4]!==d?(I=()=>{d()},e[4]=d,e[5]=I):I=e[5];let _=I,T,C;e[6]!==a||e[7]!==f||e[8]!==S||e[9]!==i?(T=()=>{if(!i)return;let $=f[a];$&&!$?.isOpen&&(l(!1),setTimeout(()=>{S()},1))},C=[f,a,S,i],e[6]=a,e[7]=f,e[8]=S,e[9]=i,e[10]=T,e[11]=C):(T=e[10],C=e[11]),ep(T,C);let w;e[12]!==c?(w=$=>Vm(c,{...$,onClick:()=>{g()}}),e[12]=c,e[13]=w):w=e[13];let M;e[14]!==m?(M=()=>{g(),m(),l(!0)},e[14]=m,e[15]=M):M=e[15];let A;return e[16]!==s||e[17]!==_||e[18]!==p||e[19]!==a||e[20]!==w||e[21]!==M?(A={closeListDrawer:_,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:M},e[16]=s,e[17]=_,e[18]=p,e[19]=a,e[20]=w,e[21]=M,e[22]=A):A=e[22],A};var lp=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=rp(o);n&&n.replace(Pe({relationTo:e,value:r}))}):t.dispatchCommand(Xo,{relationTo:e,value:r})},bl=t=>{let e=tp(16),{enabledCollectionSlugs:o}=t,[r]=op(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i]=xl(n),[l,s]=xl(null),c=o||void 0,u;e[2]!==i||e[3]!==c?(u={collectionSlugs:c,selectedCollection:i},e[2]=i,e[3]=c,e[4]=u):u=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=Tt(u),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(rt,S=>(s(S?.replace?S?.replace.nodeKey:null),p(),!0),np),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),ip(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==l?(h=S=>{let{collectionSlug:I,doc:_}=S;lp({editor:r,relationTo:I,replaceNodeKey:l,value:_.id}),d()},e[9]=d,e[10]=r,e[11]=l,e[12]=h):h=e[12];let g=h,b;return e[13]!==a||e[14]!==g?(b=Jt(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=b):b=e[15],b},_l=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Jt(bl,{...t}):Jt(It,{...t,children:Jt(bl,{...t})});var Xo=gp("INSERT_RELATIONSHIP_COMMAND"),wl=t=>{let e=sp(10),{clientProps:o}=t,[r]=cp(),{config:n}=dp(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o?.disabledCollections||e[1]!==i){let a;e[3]!==o?.disabledCollections?(a=p=>{let{slug:m}=p;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=a):a=e[4],d=i.filter(a).map(xp),e[0]=o?.disabledCollections,e[1]=i,e[2]=d}else d=e[2];l=d}let s,c;e[5]!==r?(s=()=>{if(!r.hasNodes([Ee]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Xo,_p,hp)},c=[r],e[5]=r,e[6]=s,e[7]=c):(s=e[6],c=e[7]),Cp(s,c);let u;return e[8]!==l?(u=ap(_l,{enabledCollectionSlugs:l}),e[8]=l,e[9]=u):u=e[9],u};function xp(t){let{slug:e}=t;return e}function bp(t){return Tl(t)}function _p(t){let e=pp()||mp();if(fp(e)){let o=Pe(t);up(o);let{focus:r}=e,n=r.getNode();Tl(n)&&n.getTextContentSize()===0&&n.getParentOrThrow().getChildren().filter(bp).length>1&&n.remove()}return!0}var wp=R({nodes:[Ee],plugins:[{Component:wl,position:"normal"}],slashMenu:{groups:[Q([{Icon:Yo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(rt,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Yo,isActive:({selection:t})=>{if(!Tp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Jo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(rt,{replace:!1})}}])]}});import{c as Rl}from"react/compiler-runtime";import{jsx as ue,jsxs as Gp}from"react/jsx-runtime";import{useLexicalComposerContext as Wp}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Vp,useThrottledEffect as Kp,useTranslation as Zp}from"@payloadcms/ui";import*as ke from"react";import{useMemo as zp}from"react";import{c as Ep}from"react/compiler-runtime";import{jsx as kp}from"react/jsx-runtime";import{mergeRegister as Np}from"@lexical/utils";import{$addUpdateTag as Lp,$getSelection as Sp}from"lexical";import{useEffect as Xt,useState as qo}from"react";var Qo="toolbar-popup__button",wt=t=>{let e=Ep(34),{children:o,editor:r,item:n}=t,[i,l]=qo(!0),[s,c]=qo(!1),[u,d]=qo(Qo),a=H(),p;e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==i||e[4]!==n?(p=()=>{r.getEditorState().read(()=>{let M=Sp();if(M){if(n.isActive){let A=n.isActive({editor:r,editorConfigContext:a,selection:M});s!==A&&c(A)}if(n.isEnabled){let A=n.isEnabled({editor:r,editorConfigContext:a,selection:M});i!==A&&l(A)}}})},e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=n,e[5]=p):p=e[5];let m=p,f,h;e[6]!==m?(f=()=>{m()},h=[m],e[6]=m,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Xt(f,h);let g,b;e[9]!==m?(g=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),b=[m],e[9]=m,e[10]=g,e[11]=b):(g=e[10],b=e[11]),Xt(g,b);let S,I;e[12]!==r||e[13]!==m?(S=()=>Np(r.registerUpdateListener(()=>{m()})),I=[r,m],e[12]=r,e[13]=m,e[14]=S,e[15]=I):(S=e[14],I=e[15]),Xt(S,I);let _;e[16]!==s||e[17]!==i||e[18]!==n.key?(_=()=>{d([Qo,i===!1?"disabled":"",s?"active":"",n?.key?`${Qo}-`+n.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=n.key,e[19]=_):_=e[19];let T;e[20]!==s||e[21]!==u||e[22]!==i||e[23]!==n.key?(T=[i,s,u,n.key],e[20]=s,e[21]=u,e[22]=i,e[23]=n.key,e[24]=T):T=e[24],Xt(_,T);let C;e[25]!==s||e[26]!==r||e[27]!==i||e[28]!==n?(C=()=>{if(i!==!1)return r.focus(()=>{r.update(Rp),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=i,e[28]=n,e[29]=C):C=e[29];let w;return e[30]!==o||e[31]!==u||e[32]!==C?(w=kp("button",{className:u,onClick:C,onMouseDown:Ip,type:"button",children:o}),e[30]=o,e[31]=u,e[32]=C,e[33]=w):w=e[33],w};function Rp(){Lp("toolbar")}function Ip(t){t.preventDefault()}import{c as $p}from"react/compiler-runtime";import{jsx as Xe}from"react/jsx-runtime";import or,{useCallback as Pp,useEffect as Sl}from"react";import{mergeRegister as Bp}from"@lexical/utils";import{useTranslation as Hp}from"@payloadcms/ui";import{$getSelection as jp}from"lexical";import{jsx as ye,jsxs as El}from"react/jsx-runtime";import{Button as yp}from"@payloadcms/ui";import{$addUpdateTag as vp,isDOMNode as Mp}from"lexical";import qt,{useCallback as Dp,useEffect as Et,useMemo as Ap,useRef as tr,useState as Qt}from"react";import{createPortal as Op}from"react-dom";var er="toolbar-popup__dropdown-item",kl=qt.createContext(null);function Nl({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,c]=Qt(er);Et(()=>{c([er,r===!1?"disabled":"",t?"active":"",i?.key?`${er}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let u=tr(null),d=qt.use(kl);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return Et(()=>{u?.current!=null&&a(u)},[u,a]),ye(yp,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{vp("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:u,tooltip:l,type:"button",children:e})}function Fp({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=Qt(),[l,s]=Qt(),c=Dp(a=>{i(p=>p!=null?[...p,a]:[a])},[i]),u=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=Ap(()=>({registerItem:c}),[c]);return Et(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),ye(kl,{value:d,children:ye("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:u,ref:e,children:t})})}function Ll({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let c=tr(null),u=tr(null),[d,a]=Qt(!1),p=()=>{a(!1),u?.current!=null&&u.current.focus()};Et(()=>{let f=u.current,h=c.current;if(d&&f!==null&&h!==null){let{left:g,top:b}=f.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;h.style.top=`${b+S+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[c,u,d]),Et(()=>{let f=u.current;if(f!==null&&d){let h=g=>{let b=g.target;Mp(b)&&(s&&c.current&&c.current.contains(b)||f.contains(b)||a(!1))};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[c,u,d,s]);let m=Op(ye(Fp,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return El(qt.Fragment,{children:[El("button",{"aria-label":t,className:e+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),a(!d)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[n&&ye(n,{}),l&&ye("span",{className:"toolbar-popup__dropdown-label",children:l}),ye("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ye(qt.Fragment,{children:m})]})}var rr="toolbar-popup__dropdown",Up=t=>{let e=$p(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=Hp(),{fieldProps:c}=H(),{featureClientSchemaMap:u,schemaPath:d}=c;if(l.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==l?(f=l?.Component&&Xe(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=o,e[1]=r,e[2]=n,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let a=l.key,p;if(l.label){let f;e[6]!==u||e[7]!==s||e[8]!==l||e[9]!==d?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:u,i18n:s,schemaPath:d}):l.label,e[6]=u,e[7]=s,e[8]=l,e[9]=d,e[10]=f):f=e[10],a=f}a.length>25?p=a.substring(0,25)+"...":p=a;let m;return e[11]!==o||e[12]!==p||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==a?(m=Xe(Nl,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?Xe(l.ChildComponent,{}):void 0,item:l,tooltip:a,children:Xe("span",{className:"text",children:p})},l.key),e[11]=o,e[12]=p,e[13]=n,e[14]=i,e[15]=l,e[16]=a,e[17]=m):m=e[17],m},Be=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:i,label:l,maxActiveItems:s,onActiveChange:c})=>{let[u,d]=or.useState([]),[a,p]=or.useState([]),[m,f]=or.useState(!0),h=H(),{items:g,key:b}=r,S=Pp(()=>{o.getEditorState().read(()=>{let I=jp();if(!I)return;let _=[],T=[],C=[];for(let w of g)w.isActive&&(!s||_.length<s)&&w.isActive({editor:o,editorConfigContext:h,selection:I})&&(_.push(w.key),T.push(w)),w.isEnabled?w.isEnabled({editor:o,editorConfigContext:h,selection:I})&&C.push(w.key):C.push(w.key);r.isEnabled&&f(r.isEnabled({editor:o,editorConfigContext:h,selection:I})),d(_),p(C),c&&c({activeItems:T})})},[o,h,r,g,s,c]);return Sl(()=>{S()},[S]),Sl(()=>Bp(o.registerUpdateListener(()=>{S()})),[o,S]),Xe(Ll,{buttonAriaLabel:`${b} dropdown`,buttonClassName:[rr,`${rr}-${b}`,...e||[]].filter(Boolean).join(" "),disabled:!m,Icon:n,itemsContainerClassNames:[`${rr}-items`,...i||[]],label:l,children:g.length?g.map(I=>Xe(Up,{active:u.includes(I.key),anchorElem:t,editor:o,enabled:a.includes(I.key),item:I},I.key)):null},b)};function Yp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ue(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ue(wt,{editor:e,item:o,children:ue(o.ChildComponent,{})},o.key):null}function Jp(t){let e=Rl(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=Zp(),{fieldProps:c}=H(),{featureClientSchemaMap:u,schemaPath:d}=c,[a,p]=ke.useState(void 0),[m,f]=ke.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let g;e[4]!==i?(g=[i],e[4]=i,e[5]=g):g=e[5],ke.useEffect(h,g);let b;e[6]!==u||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==d?(b=T=>{let{activeItems:C}=T;if(!C.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let w=C[0],M=w.key;w.label&&(M=typeof w.label=="function"?w.label({featureClientSchemaMap:u,i18n:s,schemaPath:d}):w.label),M.length>25&&(M=M.substring(0,25)+"..."),C.length===1?(p(M),f(()=>w.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:C.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=u,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=d,e[12]=b):b=e[12];let S=b,I=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,_;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==S||e[21]!==I?(_=Gp("div",{className:I,children:[i.type==="dropdown"&&i.items.length?m?ue(Be,{anchorElem:o,editor:r,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:S}):ue(Be,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:S}):null,i.type==="buttons"&&i.items.length?i.items.map(T=>ue(Yp,{anchorElem:o,editor:r,item:T},T.key)):null,l<n.features.toolbarFixed?.groups.length-1&&ue("div",{className:"divider"})]},i.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=S,e[21]=I,e[22]=_):_=e[22],_}function Xp({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=ke.useRef(null),{y:l}=Vp(),s=zp(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Kp(()=>{if(!s)return;let c=i.current;if(!c)return;let u=c.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(u.bottom<d.top||u.top>d.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.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"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),ue("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:i,children:o.isEditable()&&ue(ke.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>ue(Jp,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Il=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Il(t.parentEditor)}return!1},yl=t=>{let e=Rl(6),{clientProps:o}=t,[r]=Wp(),n=H(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let d=Il(n);if(o?.disableIfParentHasFixedToolbar&&d){u=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){u=null;break e}c=ue(Xp,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var qp=R({plugins:[{Component:yl,position:"aboveContainer"}]});import{c as Dl}from"react/compiler-runtime";import{jsx as fe,jsxs as Al}from"react/jsx-runtime";import{useLexicalComposerContext as Qp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ol}from"@lexical/utils";import{$getSelection as Fl,$isRangeSelection as vl,$isTextNode as ef,COMMAND_PRIORITY_LOW as tf,getDOMSelection as $l,SELECTION_CHANGE_COMMAND as of}from"lexical";import{useCallback as to,useEffect as kt,useRef as Ml,useState as rf}from"react";import*as oo from"react";import{createPortal as nf}from"react-dom";function nr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function eo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:c,verticalGap:u=10}=t,d=o.parentElement;if(c===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=c.top-a.height-u,h=c.left-i;l==="center"&&(h=c.left+c.width/2-a.width/2);let g=0;return!e&&f<m.top&&!s&&(g=a.height+c.height+u*2,f+=g),l==="center"?h+a.width>m.right?h=m.right-a.width-i:h<m.left&&(h=m.left+i):h+a.width>m.right&&(h=m.right-a.width-i),h-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function lf({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&fe(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?fe(wt,{editor:e,item:o,children:fe(o.ChildComponent,{})},o.key):null}function sf(t){let e=Dl(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=H(),[s,c]=oo.useState(),u;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(u=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=u):u=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],oo.useEffect(u,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0);return}let b=g[0];c(()=>b?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==l.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==i||e[16]!==p||e[17]!==m?(f=Al("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?fe(Be,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):fe(Be,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>fe(lf,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&fe("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=l.features.toolbarInline?.groups.length,e[14]=n,e[15]=i,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function af({anchorElem:t,editor:e}){let o=Ml(null),r=Ml(null),{editorConfig:n}=H(),i=to(()=>{if(o?.current){let u=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=to(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=u.clientX,m=u.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||i()}}},[i]),s=to(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);kt(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let c=to(()=>{let u=Fl(),d=$l(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(u!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=nr(d,m),h=eo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&eo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return kt(()=>{let u=t.parentElement,d=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",d),u&&u.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),u&&u.removeEventListener("scroll",d)}},[e,c,t]),kt(()=>(e.getEditorState().read(()=>{c()}),Ol(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(of,()=>(c(),!1),tf))),[e,c]),Al("div",{className:"inline-toolbar-popup",ref:o,children:[fe("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,d)=>fe(sf,{anchorElem:t,editor:e,group:u,index:d},u.key))]})}function cf(t,e){let o=Dl(12),[r,n]=rf(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Fl(),m=$l(t._window),f=t.getRootElement();if(m!==null&&(!vl(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!vl(p))return;if(p.getTextContent()!==""){let g=p.getNodes(),b=!1;for(let S of g)if(ef(S)){n(!0),b=!0;break}b||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,c;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),c=[l],o[2]=l,o[3]=s,o[4]=c):(s=o[3],c=o[4]),kt(s,c);let u,d;if(o[5]!==t||o[6]!==l?(u=()=>Ol(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,l],o[5]=t,o[6]=l,o[7]=u,o[8]=d):(u=o[7],d=o[8]),kt(u,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=nf(fe(af,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Pl=t=>{let{anchorElem:e}=t,[o]=Qp();return cf(o,e)};var uf=R({plugins:[{Component:Pl,position:"floatingAnchorElem"}]});import{TableCellNode as eh,TableNode as th,TableRowNode as oh}from"@lexical/table";import{jsx as Bl}from"react/jsx-runtime";import"react";var ir=()=>Bl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Bl("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as df,$createTableNode as mf,$createTableRowNode as pf,$isTableCellNode as Hl,$isTableNode as lr,$isTableRowNode as sr,TableCellHeaderStates as ro,TableCellNode as ff,TableNode as hf,TableRowNode as gf}from"@lexical/table";import{$isParagraphNode as Cf,$isTextNode as xf}from"lexical";var Ul=/^\|(.+)\|\s?$/,bf=/^(\| ?:?-*:? ?)+\|\s?$/,Gl=({allTransformers:t})=>({type:"element",dependencies:[hf,gf,ff],export:e=>{if(!lr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!sr(r))continue;let i=!1;for(let l of r.getChildren())Hl(l)&&(n.push(vr(t,l).replace(/\n/g,"\\n").trim()),l.__headerState===ro.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
37
- `)},regExp:Ul,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(bf.test(n)){let a=e.getPreviousSibling();if(!a||!lr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!sr(m))return;m.getChildren().forEach(f=>{Hl(f)&&f.setHeaderStyles(ro.ROW,ro.ROW)}),e.remove();return}let i=jl(n,t);if(i==null)return;let l=[i],s=e.getPreviousSibling(),c=i.length;for(;s&&!(!Cf(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!xf(a))break;let p=jl(a.getTextContent(),t);if(p==null)break;c=Math.max(c,p.length),l.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let u=mf();for(let a of l){let p=pf();u.append(p);for(let m=0;m<c;m++)p.append(m<a.length?a[m]:Wl("",t))}let d=e.getPreviousSibling();lr(d)&&_f(d)===c?(d.append(...u.getChildren()),e.remove()):e.replace(u),u.selectEnd()}});function _f(t){let e=t.getFirstChild();return sr(e)?e.getChildrenSize():0}var Wl=(t,e)=>{t=t.replace(/\\n/g,`
38
- `);let o=df(ro.NO_STATUS);return yr(t,e,o),o},jl=(t,e)=>{let o=t.match(Ul);return!o||!o[1]?null:o[1].split("|").map(r=>Wl(r,e))};import{c as wf}from"react/compiler-runtime";import{jsx as P,jsxs as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as zl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ef}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as cr,$deleteTableColumn__EXPERIMENTAL as kf,$deleteTableRow__EXPERIMENTAL as Nf,$getNodeTriplet as Lf,$getTableCellNodeFromLexicalNode as Kl,$getTableColumnIndexFromTableCellNode as Sf,$getTableNodeFromLexicalNodeOrThrow as Le,$getTableRowIndexFromTableCellNode as Rf,$insertTableColumn__EXPERIMENTAL as If,$insertTableRow__EXPERIMENTAL as yf,$isTableCellNode as Yl,$isTableSelection as Nt,$unmergeCell as vf,getTableElement as ur,getTableObserverFromTableElement as dr,TableCellHeaderStates as ve,TableCellNode as Mf}from"@lexical/table";import{mergeRegister as Df}from"@lexical/utils";import{useScrollInfo as Af}from"@payloadcms/ui";import{$createParagraphNode as Of,$getRoot as Ff,$getSelection as io,$isElementNode as $f,$isParagraphNode as Pf,$isRangeSelection as mr,$isTextNode as Bf,COMMAND_PRIORITY_CRITICAL as Hf,getDOMSelection as jf,isDOMNode as Uf,SELECTION_CHANGE_COMMAND as Gf}from"lexical";import*as pr from"react";import{useCallback as de,useEffect as qe,useRef as no,useState as Qe}from"react";import{createPortal as Jl}from"react-dom";import{jsx as ar,jsxs as Tf}from"react/jsx-runtime";import"react";var Vl=()=>Tf("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[ar("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),ar("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),ar("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Zl(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Wf(){let t=io();if(mr(t)&&!t.isCollapsed()||Nt(t)&&!t.anchor.is(t.focus)||!mr(t)&&!Nt(t))return!1;let[e]=Lf(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Vf(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Pf(e)||!e.isEmpty())}function Kf(t){let e=t.getLastDescendant();Bf(e)?e.select():$f(e)?e.selectEnd():e!==null&&e.selectNext()}function Zf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=zl(),l=no(null),[s,c]=Qe(n),[u,d]=Qe({columns:1,rows:1}),[a,p]=Qe(!1),[m,f]=Qe(!1),{y:h}=Af();qe(()=>i.registerMutationListener(Mf,x=>{x.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{c(s.getLatest())})},{skipInitialization:!0}),[i,s]),qe(()=>{i.getEditorState().read(()=>{let x=io();if(Nt(x)){let k=Zl(x);d(Zl(x)),p(k.columns>1||k.rows>1)}f(Wf())})},[i]),qe(()=>{let x=e.current,k=l.current,y=i.getRootElement();if(x!=null&&k!=null&&y!=null){let L=y.getBoundingClientRect(),v=x.getBoundingClientRect();k.style.opacity="1";let E=k.getBoundingClientRect(),O=5,B=v.right+O;if(B+E.width>window.innerWidth||B+E.width>L.right){let J=v.left-E.width-O;B=(J<0?O:J)+window.pageXOffset}k.style.left=`${B+window.pageXOffset}px`;let U=v.top;if(U+E.height>window.innerHeight){let J=v.bottom-E.height;U=J<0?O:J}k.style.top=`${U}px`}},[e,l,i,h]),qe(()=>{function x(k){l.current!=null&&e.current!=null&&Uf(k.target)&&!l.current.contains(k.target)&&!e.current.contains(k.target)&&r(!1)}return window.addEventListener("click",x),()=>window.removeEventListener("click",x)},[r,e]);let g=de(()=>{i.update(()=>{if(s.isAttached()){let k=Le(s),y=ur(k,i.getElementByKey(k.getKey()));if(y===null)throw new Error("Expected to find tableElement in DOM");let L=dr(y);L!==null&&L.$clearHighlight(),k.markDirty(),c(s.getLatest())}Ff().selectStart()})},[i,s]),b=()=>{i.update(()=>{let x=io();if(Nt(x)){let y=x.getNodes().filter(Yl);if(y.length===0)return;let L=Le(y[0]),[v]=cr(L,null,null),E=1/0,O=-1/0,B=1/0,U=-1/0,J=new Set;for(let X of v)for(let V of X){if(!V||!V.cell)continue;let oe=V.cell.getKey();if(!J.has(oe)&&y.some(re=>re.is(V.cell))){J.add(oe);let re=V.startRow,le=V.startColumn,Me=V.cell.__rowSpan||1,tt=V.cell.__colSpan||1;E=Math.min(E,re),O=Math.max(O,re+Me-1),B=Math.min(B,le),U=Math.max(U,le+tt-1)}}if(E===1/0||B===1/0)return;let je=O-E+1,W=U-B+1,G=v?.[E]?.[B];if(!G?.cell)return;let te=G.cell;te.setColSpan(W),te.setRowSpan(je);let ae=new Set([te.getKey()]);for(let X=E;X<=O;X++)for(let V=B;V<=U;V++){let oe=v?.[X]?.[V];if(!oe?.cell)continue;let re=oe.cell,le=re.getKey();ae.has(le)||(ae.add(le),Vf(re)||te.append(...re.getChildren()),re.remove())}te.getChildrenSize()===0&&te.append(Of()),Kf(te),o()}})},S=()=>{i.update(()=>{vf()})},I=de(x=>{i.update(()=>{for(let k=0;k<u.rows;k++)yf(x);o()})},[i,o,u.rows]),_=de(x=>{i.update(()=>{for(let k=0;k<u.columns;k++)If(x);o()})},[i,o,u.columns]),T=de(()=>{i.update(()=>{Nf(),o()})},[i,o]),C=de(()=>{i.update(()=>{Le(s).remove(),g(),o()})},[i,s,g,o]),w=de(()=>{i.update(()=>{kf(),o()})},[i,o]),M=de(()=>{i.update(()=>{let x=Le(s),k=Rf(s),[y]=cr(x,null,null),L=new Set,v=s.getHeaderStyles()^ve.ROW;if(y[k])for(let E=0;E<y[k].length;E++){let O=y[k][E];O?.cell&&(L.has(O.cell)||(L.add(O.cell),O.cell.setHeaderStyles(v,ve.ROW)))}g(),o()})},[i,s,g,o]),A=de(()=>{i.update(()=>{let x=Le(s),k=Sf(s),[y]=cr(x,null,null),L=new Set,v=s.getHeaderStyles()^ve.COLUMN;if(y)for(let E=0;E<y.length;E++){let O=y?.[E]?.[k];O?.cell&&(L.has(O.cell)||(L.add(O.cell),O.cell.setHeaderStyles(v,ve.COLUMN)))}g(),o()})},[i,s,g,o]),$=de(()=>{i.update(()=>{if(s.isAttached()){let x=Le(s);x&&x.setRowStriping(!x.getRowStriping())}g(),o()})},[i,s,g,o]),D=de(()=>{i.update(()=>{if(s.isAttached()){let x=Le(s);x&&x.setFrozenColumns(x.getFrozenColumns()===0?1:0)}g(),o()})},[i,s,g,o]),N=null;return t&&(a?N=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(N=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>S(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Jl(Ne("div",{className:"table-action-menu-dropdown",onClick:x=>{x.stopPropagation()},ref:l,children:[N?Ne(pr.Fragment,{children:[N,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>$(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>D(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>I(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>I(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>_(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>_(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:Ne("span",{className:"text",children:[(s.__headerState&ve.ROW)===ve.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>A(),type:"button",children:Ne("span",{className:"text",children:[(s.__headerState&ve.COLUMN)===ve.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function zf({anchorElem:t,cellMerge:e}){let[o]=zl(),r=no(null),n=no(null),[i,l]=Qe(!1),[s,c]=Qe(null),u=de(()=>{let a=r.current,p=io(),m=jf(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")),c(null)}if(p==null||a==null)return h();let g=o.getRootElement(),b=null,S=null;if(mr(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let _=Kl(p.anchor.getNode());if(_==null||(S=o.getElementByKey(_.getKey()),S==null||!_.isAttached()))return h();let T=Le(_),C=ur(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=dr(C),c(_)}else if(Nt(p)){let _=Kl(p.anchor.getNode());if(!Yl(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let T=Le(_),C=ur(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=dr(C),S=o.getElementByKey(_.getKey())}else if(!f)return h();if(b===null||S===null)return h();let I=!b||!b.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",I),a.classList.toggle("table-cell-action-button-container--inactive",!I),I){let _=S.getBoundingClientRect(),T=t.getBoundingClientRect(),C=_.top-T.top,w=_.right-T.left;a.style.transform=`translate(${w}px, ${C}px)`}},[o,t]);qe(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(u)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return Df(o.registerUpdateListener(m),o.registerCommand(Gf,m,Hf),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=no(s);return qe(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Ne(pr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),l(!i)},ref:n,type:"button",children:P(Vl,{})}),i&&P(Zf,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Xl=t=>{let e=wf(3),{anchorElem:o}=t,r=Ef(),n;return e[0]!==o||e[1]!==r?(n=Jl(r?P(zf,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as Yf}from"react/compiler-runtime";import{jsx as so,jsxs as Jf}from"react/jsx-runtime";import{useLexicalComposerContext as Xf}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as qf}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Qf,$getTableNodeFromLexicalNodeOrThrow as fr,$getTableRowIndexFromTableCellNode as e1,$isTableCellNode as ql,$isTableRowNode as t1,getDOMCellFromTarget as o1,getTableElement as r1,TableNode as Ql}from"@lexical/table";import{calculateZoomLevel as es,mergeRegister as n1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as hr,isHTMLElement as i1}from"lexical";import*as os from"react";import{useCallback as Lt,useEffect as gr,useRef as lo,useState as et}from"react";import{createPortal as l1}from"react-dom";var s1=33,ts=92;function a1({editor:t}){let e=lo(null),o=lo(null),r=lo(null),[n,i]=et(!1),l=H(),s=lo(null),[c,u]=et(null),[d,a]=et(null),[p,m]=et(!1),[f,h]=et(null),g=Lt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),b=D=>(D.buttons&1)===1;gr(()=>{let D=new Set;return n1(t.registerMutationListener(Ql,N=>{for(let[x,k]of N)k==="destroyed"?D.delete(x):D.add(x);i(D.size>0)}),t.registerNodeTransform(Ql,N=>{if(N.getColWidths())return N;let x=N.getColumnCount(),k=ts;return N.setColWidths(Array(x).fill(k)),N}))},[t]),gr(()=>{if(!n)return;let D=y=>{let L=y.target;if(i1(L)){if(f){u({x:y.clientX,y:y.clientY});return}if(m(b(y)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let v=o1(L);v&&d!==v?t.getEditorState().read(()=>{let E=hr(v.elem);if(!E)throw new Error("TableCellResizer: Table cell node not found.");let O=fr(E),B=r1(O,t.getElementByKey(O.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=B.getBoundingClientRect(),a(v)},{editor:t}):v==null&&g()}}},N=y=>{m(!0)},x=y=>{m(!1)},k=t.registerRootListener((y,L)=>{L?.removeEventListener("mousemove",D),L?.removeEventListener("mousedown",N),L?.removeEventListener("mouseup",x),y?.addEventListener("mousemove",D),y?.addEventListener("mousedown",N),y?.addEventListener("mouseup",x)});return()=>{k()}},[d,f,t,n,g]);let S=D=>D==="bottom",I=Lt(D=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=hr(d.elem);if(!ql(N))throw new Error("TableCellResizer: Table cell node not found.");let x=fr(N),k=e1(N),y=x.getChildren(),v=N.getColSpan()===x.getColumnCount()?k:k+N.getRowSpan()-1;if(v>=y.length||v<0)throw new Error("Expected table cell to be inside of table row.");let E=y[v];if(!t1(E))throw new Error("Expected table row");let O=E.getHeight();if(O===void 0){let U=E.getChildren();O=Math.min(...U.map(J=>_(J,t)??1/0))}let B=Math.max(O+D,s1);E.setHeight(B)},{tag:"skip-scroll-into-view"})},[d,t]),_=(D,N)=>N.getElementByKey(D.getKey())?.clientHeight,T=(D,N)=>{let x;return N.forEach(k=>{k.forEach((y,L)=>{y.cell===D&&(x=L)})}),x},C=Lt(D=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=hr(d.elem);if(!ql(N))throw new Error("TableCellResizer: Table cell node not found.");let x=fr(N),[k]=Qf(x,null,null),y=T(N,k);if(y===void 0)throw new Error("TableCellResizer: Table column not found.");let L=x.getColWidths();if(!L)return;let v=L[y];if(v===void 0)return;let E=[...L],O=Math.max(v+D,ts);E[y]=O,x.setColWidths(E)},{tag:"skip-scroll-into-view"})},[d,t]),w=Lt(D=>{let N=x=>{if(x.preventDefault(),x.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:k,y}=s.current;if(d===null)return;let L=es(x.target);if(S(D)){let v=(x.clientY-y)/L;I(v)}else{let v=(x.clientX-k)/L;C(v)}g(),document.removeEventListener("mouseup",N)}};return N},[d,g,C,I]),M=Lt(D=>N=>{if(N.preventDefault(),N.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:N.clientX,y:N.clientY},u(s.current),h(D),document.addEventListener("mouseup",w(D))},[d,w]),[A,$]=et({bottom:null,left:null,right:null,top:null});return gr(()=>{if(d){let{height:D,left:N,top:x,width:k}=d.elem.getBoundingClientRect(),y=es(d.elem),L=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+x+D-L/2}px`,width:`${k}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${D}px`,left:`${window.scrollX+N+k-L/2}px`,top:`${window.scrollY+x}px`,width:`${L}px`}},E=r.current;f&&c&&E&&(S(f)?(v[f].left=`${window.scrollX+E.left}px`,v[f].top=`${window.scrollY+c.y/y}px`,v[f].height="3px",v[f].width=`${E.width}px`):(v[f].top=`${window.scrollY+E.top}px`,v[f].left=`${window.scrollX+c.x/y}px`,v[f].width="3px",v[f].height=`${E.height}px`),v[f].backgroundColor="#adf"),$(v)}else $({bottom:null,left:null,right:null,top:null})},[d,f,c]),so("div",{ref:o,children:d!=null&&!p&&Jf(os.Fragment,{children:[so("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:A.right||void 0}),so("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:A.bottom||void 0})]})})}var rs=()=>{let t=Yf(3),[e]=Xf(),o=qf(),r,n;return t[0]!==e||t[1]!==o?(n=o?l1(so(a1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as g1}from"react/compiler-runtime";import{jsx as Cr,jsxs as C1,Fragment as x1}from"react/jsx-runtime";import{useLexicalComposerContext as ds}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as b1,$getTableColumnIndexFromTableCellNode as _1,$getTableRowIndexFromTableCellNode as T1,$insertTableColumn__EXPERIMENTAL as w1,$insertTableRow__EXPERIMENTAL as E1,$isTableCellNode as k1,$isTableNode as ls,getTableElement as N1,TableNode as L1}from"@lexical/table";import{$findMatchingParent as S1,mergeRegister as R1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ss,isHTMLElement as I1}from"lexical";import{useEffect as as,useMemo as y1,useRef as cs,useState as ao}from"react";import"react";import{createPortal as v1}from"react-dom";import{c as p1}from"react/compiler-runtime";import{useEffect as f1,useRef as h1}from"react";var c1="Expected a function",u1=Math.max,d1=Math.min;function m1(t,e,o){let r,n,i=0,l,s=!1,c=!1,u,d,a,p=!0;if(typeof t!="function")throw new TypeError(c1);e=e||0,typeof o=="object"&&(s=!!o.leading,c="maxWait"in o,u=c?u1(o.maxWait||0,e):u,p="trailing"in o?!!o.trailing:p);function m(C){let w=r,M=l;return r=l=void 0,i=C,d=t.apply(M,w),d}function f(C){return i=C,a=setTimeout(b,e),s?m(C):d}function h(C){let w=C-n,M=C-i,A=e-w;return c?d1(A,u-M):A}function g(C){let w=C-n,M=C-i;return n===void 0||w>=e||w<0||c&&M>=u}function b(){let C=Date.now();if(g(C))return S(C);a=setTimeout(b,h(C))}function S(C){return a=void 0,p&&r?m(C):(r=l=void 0,d)}function I(){a!==void 0&&clearTimeout(a),i=0,r=n=l=a=void 0}function _(){return a===void 0?d:S(Date.now())}function T(){let C=Date.now(),w=g(C);if(r=arguments,l=this,n=C,w){if(a===void 0)return f(n);if(c)return clearTimeout(a),a=setTimeout(b,e),m(n)}return a===void 0&&(a=setTimeout(b,e)),d}return T.cancel=I,T.flush=_,T}var ns=m1;function is(t,e,o){let r=p1(6),n=h1(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=ns(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=i,r[4]=l):(i=r[3],l=r[4]),f1(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let d=u;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var us=20;function M1({anchorElem:t}){let[e]=ds(),o=H(),[r,n]=ao(!1),[i,l]=ao(!1),[s,c]=ao(!1),[u,d]=ao({}),a=cs(new Set),p=cs(null),m=is(g=>{let{isOutside:b,tableDOMNode:S}=D1(g,o.editorConfig?.lexical);if(b){n(!1),l(!1);return}if(!S)return;p.current=S;let I=null,_=null,T=null;if(e.getEditorState().read(()=>{let L=ss(S);if(k1(L)){let v=S1(L,E=>ls(E));if(!ls(v))return;if(T=N1(v,e.getElementByKey(v.getKey())),T){let E=v.getChildrenSize(),O=v.getChildAtIndex(0)?.getChildrenSize(),B=T1(L),U=_1(L);B===E-1?I=L:U===O-1&&(_=L)}}},{editor:e}),!T)return;let C=T.parentElement;if(!C)return;let{bottom:w,height:M,left:A,right:$,width:D,y:N}=T.getBoundingClientRect(),x=!1;C&&C.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(x=C.scrollWidth>C.clientWidth);let{left:k,y}=t.getBoundingClientRect();I?(l(!1),n(!0),d({height:us,left:x&&C?C.offsetLeft:A-k,top:w-y+5,width:x&&C?C.offsetWidth:D})):_&&(l(!0),n(!1),d({height:M,left:$-k+5,top:N-y,width:us}))},50,250),f=y1(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);as(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),l(!1),document.removeEventListener("mousemove",m)}},[s,m]),as(()=>R1(e.registerMutationListener(L1,g=>{e.getEditorState().read(()=>{let b=!1;for(let[S,I]of g)switch(I){case"created":{a.current.add(S),b=!0;break}case"destroyed":{a.current.delete(S),b=!0;break}default:break}if(b){f.disconnect();for(let S of a.current){let{tableElement:I}=b1(S);f.observe(I)}c(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{p.current&&(ss(p.current)?.selectEnd(),g?(E1(),n(!1)):(w1(),l(!1)))})};return e?.isEditable()?C1(x1,{children:[r&&Cr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&Cr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function D1(t,e){let o=t.target;if(I1(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function ms(t){let e=g1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=ds();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=v1(Cr(M1,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as A1}from"react/compiler-runtime";import{jsx as xr,jsxs as O1}from"react/jsx-runtime";import{useLexicalComposerContext as F1}from"@lexical/react/LexicalComposerContext";import{TablePlugin as $1}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as P1,TableCellNode as B1,TableNode as H1,TableRowNode as j1}from"@lexical/table";import{mergeRegister as U1}from"@lexical/utils";import{formatDrawerSlug as G1,useEditDepth as W1}from"@payloadcms/ui";import{$getSelection as V1,$isRangeSelection as K1,COMMAND_PRIORITY_EDITOR as Z1,createCommand as z1}from"lexical";import{createContext as Y1,use as J1,useEffect as X1,useMemo as q1,useState as Q1}from"react";import*as ps from"react";var co=z1("OPEN_EMBED_DRAWER_COMMAND"),fs=Y1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function hs({children:t}){let[e,o]=Q1({cellEditorConfig:null,cellEditorPlugins:null});return xr(fs,{value:q1(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var gs=()=>{let t=A1(16),[e]=F1(),o=J1(fs),r=W1(),{fieldProps:n,uuid:i}=H(),{schemaPath:l}=n,s="lexical-table-create-"+i,c;t[0]!==r||t[1]!==s?(c=G1({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=c):c=t[2];let u=c,{toggleDrawer:d}=he(u,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([H1,j1,B1]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return U1(e.registerCommand(co,()=>{let h;return h=null,e.getEditorState().read(()=>{let g=V1();K1(g)&&(h=g)}),h&&d(),!0},Z1))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],X1(a,p);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(P1,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==m?(f=O1(ps.Fragment,{children:[xr(ot,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:l,schemaPathSuffix:"fields"}),xr($1,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=u,t[13]=l,t[14]=m,t[15]=f):f=t[15],f};var rh=R({markdownTransformers:[Gl],nodes:[th,eh,oh],plugins:[{Component:gs,position:"normal"},{Component:rs,position:"normal"},{Component:Xl,position:"floatingAnchorElem"},{Component:ms,position:"floatingAnchorElem"}],providers:[hs],slashMenu:{groups:[Q([{Icon:ir,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(co,{})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:ir,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(co,{})}}])]}});import{$isNodeSelection as Ah}from"lexical";import{jsx as br,jsxs as nh}from"react/jsx-runtime";import"react";var _r=()=>nh("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[br("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),br("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),br("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as ch}from"react/jsx-runtime";import bs from"bson-objectid";import{$applyNodeReplacement as uh}from"lexical";import*as _s from"react";import{jsx as ih}from"react/jsx-runtime";import{DecoratorBlockNode as lh}from"@lexical/react/LexicalDecoratorBlockNode.js";import Cs from"bson-objectid";import{$applyNodeReplacement as sh}from"lexical";import"react";function Tr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function ah(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:xs({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Tr(e),null}var St=class extends lh{__data;constructor({data:e,format:o,key:r}){super(o,r),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:ah,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Cs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=xs({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return ih(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.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 xs({data:t}){return t?.id||(t.id=new Cs.default().toHexString()),sh(new St({data:t}))}var dh=_s.lazy(()=>import("./component-Y3OSWJM5.js").then(t=>({default:t.UploadComponent})));function mh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:He({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Tr(e),null}var Se=class extends St{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:mh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new bs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=He({data:o});return r.setFormat(e.format),r}decorate(){return ch(dh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function He({data:t}){return t?.id||(t.id=new bs.default().toHexString()),uh(new Se({data:t}))}function wr(t){return t instanceof Se}import{c as _h}from"react/compiler-runtime";import{jsx as Th}from"react/jsx-runtime";import{useLexicalComposerContext as wh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Eh,mergeRegister as kh}from"@lexical/utils";import{useConfig as Nh}from"@payloadcms/ui";import{$getPreviousSelection as Lh,$getSelection as Sh,$isParagraphNode as Rh,$isRangeSelection as Ih,COMMAND_PRIORITY_EDITOR as yh,createCommand as vh}from"lexical";import{useEffect as Mh}from"react";import{c as Ts}from"react/compiler-runtime";import{jsx as Er}from"react/jsx-runtime";import{useLexicalComposerContext as ws}from"@lexical/react/LexicalComposerContext.js";import{toast as ph}from"@payloadcms/ui";import{$getNodeByKey as fh,COMMAND_PRIORITY_EDITOR as Es}from"lexical";import{useEffect as ks,useState as hh}from"react";var gh=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=fh(o);n&&n.replace(He({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(kr,{fields:null,relationTo:e,value:r})},Ch=t=>{let e=Ts(13),{enabledCollectionSlugs:o}=t,[r]=ws(),[n,i]=hh(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:c,openListDrawer:u}=Tt(l),d,a;e[2]!==r||e[3]!==u?(d=()=>r.registerCommand(Ge,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),Es),a=[r,u],e[2]=r,e[3]=u,e[4]=d,e[5]=a):(d=e[4],a=e[5]),ks(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:g,doc:b}=h;s(),gh({editor:r,relationTo:g,replaceNodeKey:n,value:b.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==c||e[11]!==m?(f=Er(c,{onSelect:m}),e[10]=c,e[11]=m,e[12]=f):f=e[12],f},xh=()=>{let t=Ts(3),[e]=ws(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ge,bh,Es),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ks(o,r),null},Ns=t=>Er(It,{...t,FallbackComponent:xh,uploads:!0,children:Er(Ch,{...t})});function bh(){return ph.error("No upload collections enabled"),!0}var kr=vh("INSERT_UPLOAD_COMMAND"),Ls=t=>{let e=_h(5),[o]=wh(),{config:r}=Nh(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Se]))throw new Error("UploadPlugin: UploadNode not registered on editor");return kh(o.registerCommand(kr,c=>(o.update(()=>{let u=Sh()||Lh();if(Ih(u)){let d=He({data:{id:c.id,fields:c.fields,relationTo:c.relationTo,value:c.value}});Eh(d);let{focus:a}=u,p=a.getNode();Rh(p)&&!p.__first&&(p.__prev||p.__next)&&p.remove()}}),!0),yh))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Mh(i,l);let s;return e[3]!==n?(s=Th(Ns,{enabledCollectionSlugs:n.map(Dh)}),e[3]=n,e[4]=s):s=e[4],s};function Dh(t){let{slug:e}=t;return e}var Oh=R({nodes:[Se],plugins:[{Component:Ls,position:"normal"}],slashMenu:{groups:[Q([{Icon:_r,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:_r,isActive:({selection:t})=>{if(!Ah(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]}});import{c as Fh}from"react/compiler-runtime";import{jsx as Lr}from"react/jsx-runtime";import{ShimmerEffect as $h,useConfig as Ph}from"@payloadcms/ui";import{lazy as Bh,Suspense as Hh,useEffect as jh,useState as Uh}from"react";var Ss={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",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",inlineImage:"LexicalEditor__inline-image",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",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",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:"editor-upload"};var uo={namespace:"lexical",theme:Ss};function Rs({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:i}){for(let u of i.features)if(!u?.clientFeatureProps?.featureKey||u?.clientFeatureProps?.order===void 0||u?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");i.features=i.features.sort((u,d)=>u.clientFeatureProps.order-d.clientFeatureProps.order);let l=new Map;for(let u of i.features)l.set(u.clientFeatureProps.featureKey,u);let s=new Map,c=0;for(let u of i.features){let d=typeof u.feature=="function"?u.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:l,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:i}):u.feature;d.key=u.clientFeatureProps.featureKey,d.order=c,s.set(u.clientFeatureProps.featureKey,d),c++}return s}var Is=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function Nr(t,e,o){return{admin:o,features:Is(t),lexical:e,resolvedFeatureMap:t}}var Gh=Bh(()=>import("./Field-5SZDDPZE.js").then(t=>({default:t.RichText}))),Wh=t=>{let e=Fh(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:i,field:l,lexicalEditorConfig:s,schemaPath:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let d=u,a=s===void 0?uo:s,{config:p}=Ph(),[m,f]=Uh(null),h,g;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==m||e[9]!==a||e[10]!==c?(h=()=>{if(m)return;let S=[];for(let[T,C]of Object.entries(r))C.clientFeatureProvider&&S.push(C.clientFeatureProvider(C.clientFeatureProps));let I=a||uo,_=Rs({config:p,featureClientImportMap:n,featureClientSchemaMap:i,field:l,schemaPath:c??l.name,unSanitizedEditorConfig:{features:S,lexical:I}});f(Nr(_,I,d))},g=[a,d,m,r,n,i,l,p,c],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=i,e[7]=l,e[8]=m,e[9]=a,e[10]=c,e[11]=h,e[12]=g):(h=e[11],g=e[12]),jh(h,g);let b;return e[13]!==m||e[14]!==t?(b=Lr(Hh,{fallback:Lr($h,{height:"35vh"}),children:m&&Lr(Gh,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=b):b=e[15],b};function Vh(t){return t instanceof HTMLElement}function Kh(...t){return t.filter(Boolean).join(" ")}var mo=new WeakMap;function ys(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function po(t,e){let o=mo.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=ys(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let c=ys(l);for(let u of r)c!==null&&u([c[0]-s[0],c[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},mo.set(t,o)}return o.listeners.add(e),()=>{Zh(t,e)}}function Zh(t,e){let o=mo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(mo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function zh(t,e){return po(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function Yh(t,e){return po(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function Jh(t,e){return po(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function Xh(t,e){return po(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var F={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},qh=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,Qh="\xA0",eg=`
34
+ `},[t,e]),m=Ae((_,T)=>{o(C=>{let w=e.length-1,M=e[w];if(M&&M.name===_){if(_==="type")return[...e.slice(0,w),{...M,value:M.value+T}];if(M.value===T)return[...e.slice(0,w),{...M,count:M.count+1}]}return[...C,{name:_,count:1,value:T}]})},[e,o]);nn(()=>{let _=C=>{if(!r)return;let w=C.key;ec(C)?m("selectAll",""):sn.has(w)?m("press",C.key):[...w].length>1?m("keydown",C.key):m("type",C.key)},T=C=>{if(!r)return;let w=C.key;!sn.has(w)&&[...w].length>1&&m("keyup",C.key)};return t.registerRootListener((C,w)=>{w!==null&&(w.removeEventListener("keydown",_),w.removeEventListener("keyup",T)),C!==null&&(C.addEventListener("keydown",_),C.addEventListener("keyup",T))})},[t,r,m]),nn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Ro(()=>{if(e){let _=p();_!==null&&s(_),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Ro(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:C,editorState:w})=>{if(!r)return;let M=w._selection,A=c.current,$=u.current;if(A!==M){if(C.size===0&&T.size===0&&!$){let N=So(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}c.current=M}u.current=!1;let D=p();D!==null&&s(D)}),[t,p,r,m]),Ro(()=>r?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,r]);let f=Ae(_=>{r||(_.update(()=>{let T=Ja();T.clear();let C=Ya();T.append(za().append(C)),C.select()}),o([])),n(T=>!T)},[r]),h=Ae(()=>{if(!r)return;let _=So(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:T,anchorOffset:C,focusNode:w,focusOffset:M}=tc(_),A=a().getRootElement(),$;T!==null&&($=ln(T,A));let D;w!==null&&(D=ln(w,A)),m("snapshot",{anchorNode:T,anchorOffset:C,anchorPath:$,focusNode:w,focusOffset:M,focusPath:D})},[m,r,a]),g=Ae(()=>{Xa(p())},[p]),b=Ae(()=>{qa("test.js",p())},[p]);return[Oe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{f(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?yo("div",{className:"test-recorder-output",children:[yo("div",{className:"test-recorder-toolbar",children:[Oe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{g(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{b(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Oe("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var cn=()=>{let t=Ka(3),[e]=Za(),[o,r]=oc(e),n;return t[0]!==o||t[1]!==r?(n=yo(an.Fragment,{children:[Oe("p",{children:"HI"}),o,r,Oe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var rc=R({plugins:[{Component:cn,position:"bottom"}]});import{c as nc}from"react/compiler-runtime";import{jsx as ic}from"react/jsx-runtime";import{useLexicalComposerContext as lc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as sc}from"@lexical/react/LexicalTreeView.js";import"react";var un=()=>{let t=nc(2),[e]=lc(),o;return t[0]!==e?(o=ic(sc,{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 ac=R({plugins:[{Component:un,position:"bottom"}]});import{$isTableSelection as cc}from"@lexical/table";import{$isRangeSelection as uc,FORMAT_TEXT_COMMAND as dc}from"lexical";import{jsx as dn}from"react/jsx-runtime";import"react";var mn=()=>dn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Q=t=>({type:"buttons",items:t,key:"format",order:40});var pn={type:"text-format",format:["bold","italic"],tag:"***"},fn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},hn={type:"text-format",format:["bold"],tag:"**"},gn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Cn=[Q([{ChildComponent:mn,isActive:({selection:t})=>uc(t)||cc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(dc,"bold")},order:1}])],mc=R(({featureProviderMap:t})=>{let e=[hn,gn];return t.get("italic")&&e.push(fn,pn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Cn},toolbarInline:{groups:Cn}}});import{$isTableSelection as fc}from"@lexical/table";import{$isRangeSelection as hc,FORMAT_TEXT_COMMAND as gc}from"lexical";import{jsx as xn,jsxs as pc}from"react/jsx-runtime";import"react";var bn=()=>pc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[xn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),xn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var _n={type:"text-format",format:["code"],tag:"`"};var Tn=[Q([{ChildComponent:bn,isActive:({selection:t})=>hc(t)||fc(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(gc,"code")},order:7}])],Cc=R({enableFormats:["code"],markdownTransformers:[_n],toolbarFixed:{groups:Tn},toolbarInline:{groups:Tn}});import{$isTableSelection as xc}from"@lexical/table";import{$isRangeSelection as bc,FORMAT_TEXT_COMMAND as _c}from"lexical";import{jsx as wn}from"react/jsx-runtime";import"react";var En=()=>wn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:wn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var kn={type:"text-format",format:["italic"],tag:"*"},Nn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Ln=[Q([{ChildComponent:En,isActive:({selection:t})=>bc(t)||xc(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(_c,"italic")},order:2}])],Tc=R({enableFormats:["italic"],markdownTransformers:[kn,Nn],toolbarFixed:{groups:Ln},toolbarInline:{groups:Ln}});import{$isTableSelection as Ec}from"@lexical/table";import{$isRangeSelection as kc,FORMAT_TEXT_COMMAND as Nc}from"lexical";import{jsx as Sn,jsxs as wc}from"react/jsx-runtime";import"react";var Rn=()=>wc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Sn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),Sn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var In={type:"text-format",format:["strikethrough"],tag:"~~"};var yn=[Q([{ChildComponent:Rn,isActive:({selection:t})=>kc(t)||Ec(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Nc,"strikethrough")},order:4}])],Lc=R({enableFormats:["strikethrough"],markdownTransformers:[In],toolbarFixed:{groups:yn},toolbarInline:{groups:yn}});import{$isTableSelection as Sc}from"@lexical/table";import{$isRangeSelection as Rc,FORMAT_TEXT_COMMAND as Ic}from"lexical";import{jsx as vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:vn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Dn=[Q([{ChildComponent:Mn,isActive:({selection:t})=>Rc(t)||Sc(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Ic,"subscript")},order:5}])],yc=R({enableFormats:["subscript"],toolbarFixed:{groups:Dn},toolbarInline:{groups:Dn}});import{$isTableSelection as vc}from"@lexical/table";import{$isRangeSelection as Mc,FORMAT_TEXT_COMMAND as Dc}from"lexical";import{jsx as An}from"react/jsx-runtime";import"react";var On=()=>An("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:An("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Fn=[Q([{ChildComponent:On,isActive:({selection:t})=>Mc(t)||vc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Dc,"superscript")},order:6}])],Ac=R({enableFormats:["superscript"],toolbarFixed:{groups:Fn},toolbarInline:{groups:Fn}});import{$isTableSelection as Fc}from"@lexical/table";import{$isRangeSelection as $c,FORMAT_TEXT_COMMAND as Pc}from"lexical";import{jsx as $n,jsxs as Oc}from"react/jsx-runtime";import"react";var Pn=()=>Oc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$n("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),$n("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Bn=[Q([{ChildComponent:Pn,isActive:({selection:t})=>$c(t)||Fc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Pc,"underline")},order:3}])],Bc=R({enableFormats:["underline"],toolbarFixed:{groups:Bn},toolbarInline:{groups:Bn}});import{$createHeadingNode as Gc,$isHeadingNode as Qn,HeadingNode as Wc}from"@lexical/rich-text";import{$setBlocksType as Vc}from"@lexical/selection";import{$getSelection as Kc,$isRangeSelection as Zc}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var jn=()=>Hn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Hn("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Un}from"react/jsx-runtime";import"react";var Gn=()=>Un("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Un("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as Wn}from"react/jsx-runtime";import"react";var Vn=()=>Wn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Wn("path",{d:"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",fill:"currentColor"})});import{jsx as Kn}from"react/jsx-runtime";import"react";var Zn=()=>Kn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Kn("path",{d:"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",fill:"currentColor"})});import{jsx as zn}from"react/jsx-runtime";import"react";var Yn=()=>zn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:zn("path",{d:"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",fill:"currentColor"})});import{jsx as Jn}from"react/jsx-runtime";import"react";var Xn=()=>Jn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Jn("path",{d:"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",fill:"currentColor"})});import{$createHeadingNode as Hc,$isHeadingNode as jc,HeadingNode as Uc}from"@lexical/rich-text";var vo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var qn=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Uc],export:(n,i)=>{if(!jc(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:vo(n=>{let i="h"+n[1]?.length;return Hc(i)})}};var ei=t=>{let e=Kc();Vc(e,()=>Gc(t))},ti={h1:jn,h2:Gn,h3:Vn,h4:Zn,h5:Yn,h6:Xn},zc=R(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ne(e.map((r,n)=>({ChildComponent:ti[r],isActive:({selection:i})=>{if(!Zc(i))return!1;for(let l of i.getNodes()){if(Qn(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(Qn(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{ei(r)})},order:n+2})))];return{markdownTransformers:[qn(e)],nodes:[Wc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[q(e.map(r=>({Icon:ti[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{ei(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as uu}from"lexical";import{jsx as oi}from"react/jsx-runtime";import"react";var Mo=()=>oi("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:oi("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as ri,jsxs as Yc}from"react/jsx-runtime";import"react";var ni=()=>Yc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ri("path",{d:"M5 10h10",stroke:"currentColor"}),ri("path",{d:"M10 15V5",stroke:"currentColor"})]});var xe=t=>({type:"dropdown",ChildComponent:ni,items:t,key:"add",order:10});import{addClassNamesToElement as Jc}from"@lexical/utils";import{$applyNodeReplacement as Xc,createCommand as qc,DecoratorNode as Qc}from"lexical";var dt=qc("INSERT_HORIZONTAL_RULE_COMMAND"),ut=class extends Qc{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:eu,priority:0})}}static importJSON(e){return ii()}createDOM(e){let o=document.createElement("hr");return Jc(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
35
+ `}isInline(){return!1}updateDOM(){return!1}};function eu(){return{node:ii()}}function ii(){return Xc(new ut)}import{$applyNodeReplacement as tu}from"lexical";import"react";var Ie=class extends ut{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return mt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function mt(){return tu(new Ie)}function Ut(t){return t instanceof Ie}var li={type:"element",dependencies:[Ie],export:(t,e)=>Ut(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=mt();e&&t.replace(e)}};import{c as ou}from"react/compiler-runtime";import{useLexicalComposerContext as ru}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as nu}from"@lexical/utils";import{$getSelection as iu,$isRangeSelection as lu,COMMAND_PRIORITY_EDITOR as su}from"lexical";import{useEffect as au}from"react";var si=()=>{let t=ou(3),[e]=ru(),o,r;return t[0]!==e?(o=()=>e.registerCommand(dt,cu,su),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),au(o,r),null};function cu(t){let e=iu();if(!lu(e))return!1;if(e.focus.getNode()!==null){let r=mt();nu(r)}return!0}var du=R({markdownTransformers:[li],nodes:[Ie],plugins:[{Component:si,position:"normal"}],slashMenu:{groups:[q([{Icon:Mo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(dt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Mo,isActive:({selection:t})=>{if(!uu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ut(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(dt,void 0)}}])]}});import{$findMatchingParent as mi}from"@lexical/utils";import{$isElementNode as Lu,$isRangeSelection as Su,INDENT_CONTENT_COMMAND as Ru,OUTDENT_CONTENT_COMMAND as Iu}from"lexical";import{jsx as Gt,jsxs as mu}from"react/jsx-runtime";import"react";var ai=()=>mu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Wt,jsxs as pu}from"react/jsx-runtime";import"react";var ci=()=>pu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as fu}from"react/jsx-runtime";import{useLexicalComposerContext as hu}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as gu}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Cu,mergeRegister as xu}from"@lexical/utils";import{$getSelection as bu,$isElementNode as _u,$isRangeSelection as Tu,COMMAND_PRIORITY_LOW as wu,INDENT_CONTENT_COMMAND as Eu}from"lexical";import{useEffect as ku}from"react";var ui=t=>{let[e]=hu(),{disabledNodes:o}=t.clientProps;return ku(()=>{if(!(!e||!o?.length))return xu(e.registerCommand(Eu,()=>Nu(r=>{if(!o.includes(r.getType())){let n=r.getIndent();r.setIndent(n+1)}}),wu))},[e,o]),fu(gu,{})};function Nu(t){let e=bu();if(!Tu(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let i=r[n],l=i.getKey();if(o.has(l))continue;let s=Cu(i,u=>_u(u)&&!u.isInline());if(s===null)continue;let c=s.getKey();s.canIndent()&&!o.has(c)&&(o.add(c),t(s))}return o.size>0}var di=t=>({type:"buttons",items:t,key:"indent",order:35});var pi=[di([{ChildComponent:ai,isActive:()=>!1,isEnabled:({selection:t})=>{let e=t?.getNodes();if(!e?.length)return!1;let o=!1,r=n=>Lu(n)&&n.canIndent();for(let n of e)if(r(n)){if(n.getIndent()<=0)return!1;o=!0}if(!o&&Su(t)){let n=t.anchor.getNode();if(mi(n,l=>r(l)&&l.getIndent()>0))return!0;let i=t.focus.getNode();if(mi(i,l=>r(l)&&l.getIndent()>0))return!0}return o},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Iu,void 0)},order:1},{ChildComponent:ci,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ru,void 0)},order:2}])],yu=R({plugins:[{Component:ui,position:"normal"}],toolbarFixed:{groups:pi},toolbarInline:{groups:pi}});import{$findMatchingParent as Ud}from"@lexical/utils";import{$getSelection as jo,$isRangeSelection as Wi}from"lexical";import{jsx as fi}from"react/jsx-runtime";import"react";var hi=()=>fi("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:fi("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as gi}from"@lexical/selection";function Ke(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?gi(o)?r:n:gi(e)?r:n}var Do=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as ju}from"lexical";import{addClassNamesToElement as vu,isHTMLAnchorElement as Mu}from"@lexical/utils";import Fo from"bson-objectid";import{$applyNodeReplacement as Du,$createTextNode as Ci,$getSelection as Au,$isElementNode as xi,$isRangeSelection as Oo,createCommand as Ou,ElementNode as Fu}from"lexical";var $u=new Set(["http:","https:","mailto:","sms:","tel:"]),ie=class t extends Fu{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Pu,priority:1})}}static importJSON(e){let o=be({}).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 Fo.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=Ao(o.rel,"add","noopener")),vu(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},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!Oo(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(xi(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!$u.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,r){let n=this.__fields?.url,i=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Ao(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Ao(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Pu(t){let e=null;if(Mu(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new Fo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return Du(new ie({id:t??new Fo.default().toHexString(),fields:e}))}function Y(t){return t instanceof ie}var pe=Ou("TOGGLE_LINK_COMMAND");function $o(t){let e=Au();if(!Oo(e)&&(t===null||!t.selectedNodes?.length))return;let o=Oo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(i=>{let l=i.getParent();Y(l)&&(l.getChildren().forEach(c=>{l.insertBefore(c)}),l.remove())});return}if(o?.length===1){let i=o[0],l=Y(i)?i:Bu(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Ci(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||xi(i)&&!i.isInline())){if(Y(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Ci(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=be({fields:t.fields}),Y(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),Y(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();n.append(...s)}i.remove();return}n!==null&&n.append(i)}})}function Bu(t){return Hu(t,e=>Y(e))}function Hu(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Ao(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var bi={type:"text-match",dependencies:[ie],export:(t,e)=>{if(!Y(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=ju(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as Uu,$isElementNode as Gu}from"lexical";var _e=class t extends ie{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=pt({}).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 r=this.getParentOrThrow().insertNewAfter(e,o);if(Gu(r)){let n=pt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function pt({fields:t}){return Uu(new _e({id:"",fields:t}))}function Te(t){return t instanceof _e}import{c as Wu}from"react/compiler-runtime";import{useLexicalComposerContext as Vu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ku}from"@lexical/utils";import{$createTextNode as _i,$getSelection as Zu,$isElementNode as wi,$isLineBreakNode as Ei,$isNodeSelection as zu,$isRangeSelection as Yu,$isTextNode as ft,TextNode as Ju}from"lexical";import{useEffect as Xu}from"react";function Ti(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function ki(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var qu=/[.,;\s]/;function Kt(t){return t!==void 0&&qu.test(t)}function Ni(t){return Kt(t[t.length-1])}function Bo(t){return Kt(t[0])}function Qu(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Li(t){let e=t.getPreviousSibling();return wi(e)&&(e=e.getLastDescendant()),e===null||Ei(e)||ft(e)&&Ni(e.getTextContent())}function Si(t){let e=t.getNextSibling();return wi(e)&&(e=e.getFirstDescendant()),e===null||Ei(e)||ft(e)&&Bo(e.getTextContent())}function ed(t,e,o,r){return(t>0?Kt(o[t-1]):Li(r[0]))?e<o.length?Kt(o[e]):Si(r[r.length-1]):!1}function td(t,e,o){let r=[],n=[],i=[],l=0,s=0,c=[...t];for(;c.length>0;){let u=c[0],a=u.getTextContent().length,p=s;s+a<=e?(r.push(u),l+=a):p>=o?i.push(u):n.push(u),s+=a,c.shift()}return[l,r,n,i]}function od(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=pt({fields:n});if(t.length===1){let l=t[0],s;if(e===0?[s]=l.splitText(o):[,s]=l.splitText(e,o),s){let c=_i(r.text);c.setFormat(s.getFormat()),c.setDetail(s.getDetail()),c.setStyle(s.getStyle()),i.append(c),s.replace(i)}return l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,c;e===0?c=l:[,c]=l.splitText(e);let u=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)u.push(a);else{let[g,b]=a.splitText(o-f);g&&u.push(g),d=b}s+=m}),c){let a=Zu(),p=a?a.getNodes().find(ft):void 0,m=_i(c.getTextContent());return m.setFormat(c.getFormat()),m.setDetail(c.getDetail()),m.setStyle(c.getStyle()),i.append(m,...u),p&&p===c&&(Yu(a)?m.select(a.anchor.offset,a.focus.offset):zu(a)&&m.select(0,m.getTextContent().length)),c.replace(i),d}}}function rd(t,e,o){let r=[...t],n=r.map(c=>c.getTextContent()).join(""),i=n,l,s=0;for(;(l=ki(i,e))!=null&&l!==null;){let c=l.index,u=l.length,d=c+u;if(ed(s+c,s+d,n,r)){let[p,,m,f]=td(r,s+c,s+d),h=s+c-p,g=s+d-p,b=od(m,h,g,l);r=b?[b,...f]:f,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function Po(t,e,o){let r=t.getChildren(),n=r.length;for(let c=0;c<n;c++){let u=r[c];if(!ft(u)||!u.isSimpleText()){Vt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=ki(i,e);if(l===null||l.text!==i){Vt(t),o(null,t.getFields()?.url??null);return}if(!Li(t)||!Si(t)){Vt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let c=t.getFields();c.url=l?.url,t.setFields(c),o(l.url,s??null)}}function nd(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(Te(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Bo(i)||Qu(i,l))&&(r.append(t),Po(r,e,o),o(null,r.getFields()?.url??null))}Te(n)&&!Ni(i)&&(Vt(n),Po(n,e,o),o(null,n.getFields()?.url??null))}function Vt(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function id(t){let e=[t],o=t.getNextSibling();for(;o!==null&&ft(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function ld(t,e,o){let r=Wu(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([_e]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,c)=>{o?.(s,c)};return Ku(t.registerNodeTransform(Ju,s=>{let c=s.getParentOrThrow(),u=s.getPreviousSibling();if(Te(c))Po(c,e,l);else if(!Y(c)){if(s.isSimpleText()&&(Bo(s.getTextContent())||!Te(u))){let d=id(s);rd(d,e,l)}nd(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=i):(n=r[3],i=r[4]),Xu(n,i)}var sd=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,ad=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,cd=[Ti(sd,t=>t.startsWith("http")?t:`https://${t}`),Ti(ad,t=>`mailto:${t}`)],Ri=()=>{let[t]=Vu();return ld(t,cd),null};import{jsx as ud}from"react/jsx-runtime";import{ClickableLinkPlugin as dd}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ii=()=>ud(dd,{});import{jsx as Id}from"react/jsx-runtime";import"react";import{createPortal as yd}from"react-dom";import{jsx as we,jsxs as ht,Fragment as pd}from"react/jsx-runtime";import{useLexicalComposerContext as fd}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as yi,mergeRegister as vi}from"@lexical/utils";import{getTranslation as Ho}from"@payloadcms/translations";import{CloseMenuIcon as hd,EditIcon as gd,ExternalLinkIcon as Mi,formatDrawerSlug as Cd,useConfig as xd,useEditDepth as bd,useLocale as _d,useTranslation as Td}from"@payloadcms/ui";import{requests as wd}from"@payloadcms/ui/shared";import{$getSelection as Di,$isLineBreakNode as Ed,$isRangeSelection as Ai,COMMAND_PRIORITY_HIGH as kd,COMMAND_PRIORITY_LOW as Oi,getDOMSelection as Nd,KEY_ESCAPE_COMMAND as Ld,SELECTION_CHANGE_COMMAND as Sd}from"lexical";import Fi,{useCallback as $i,useEffect as Yt,useRef as Rd,useState as Fe}from"react";function Zt(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),c=i.getBoundingClientRect(),u=t.top-r,d=t.left-n;u<c.top&&(u+=l.height+t.height+r*2),d+l.width>c.right&&(d=c.right-l.width-n),u-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${u}px)`}import{createCommand as md}from"lexical";var zt=md("TOGGLE_LINK_WITH_MODAL_COMMAND");function Pi(t){t.preventDefault()}function Bi({anchorElem:t}){let[e]=fd(),[o,r]=Fe(),n=Rd(null),[i,l]=Fe(null),[s,c]=Fe(null),{fieldProps:{schemaPath:u},uuid:d}=H(),{config:a,getEntityConfig:p}=xd(),{i18n:m,t:f}=Td(),[h,g]=Fe(),b=bd(),[S,I]=Fe(!1),[_,T]=Fe([]),C=_d(),[w,M]=Fe(!1),A=Cd({slug:"lexical-rich-text-link-"+d,depth:b}),{toggleDrawer:$}=he(A),D=$i(()=>{I(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),M(!1),l(null),c(null),T([]),g(void 0)},[I,l,c,T]),N=$i(()=>{let x=Di(),E;if(!Ai(x)||!x){D();return}let y=Ke(x);E=e.getElementByKey(y.getKey())?.getBoundingClientRect();let k=yi(y,Y),v=x.getNodes().filter(G=>!Ed(G)).find(G=>{let U=yi(G,Y);return k&&!k.is(U)||U&&!U.is(k)});if(k==null||v){D();return}r(k);let L=k.getFields(),F={...L,id:k.getID(),text:k.getTextContent()};if(L?.linkType==="custom")l(L?.url??null),c(null);else{l(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${L?.doc?.relationTo}/${L?.doc?.value}`);let G=L?.doc?.relationTo?p({collectionSlug:L?.doc?.relationTo}):void 0;if(!G)c(L?.label?String(L?.label):null),l(L?.url?String(L?.url):null);else{let U=typeof L.doc?.value=="object"?L.doc.value.id:L.doc?.value,ee=L.doc?.relationTo;if(!U||!ee)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ae=f("fields:linkedTo",{label:`${Ho(G.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");c(ae),wd.get(`${a.serverURL}${a.routes.api}/${ee}/${U}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:C?.code}}).then(async J=>{if(!J.ok)throw new Error(`HTTP error! Status: ${J.status}`);let W=await J.json(),te=G?.admin?.useAsTitle||"id",oe=W[te],le=f("fields:linkedTo",{label:`${Ho(G.labels.singular,m)} - ${oe}`}).replace(/<[^>]*>?/g,"");c(le)}).catch(()=>{let J=f("fields:linkedTo",{label:`${Ho(G.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");c(J)})}}g(F),I(!0),T(x?x?.getNodes():[]),Te(k)?M(!0):M(!1);let B=n.current,K=Nd(e._window),{activeElement:re}=document;if(B===null)return;let je=e.getRootElement();return K!==null&&je!==null&&je.contains(K.anchorNode)?(E||(E=K.getRangeAt(0).getBoundingClientRect()),E!=null&&(E.y+=40,Zt(E,B,t))):(re==null||re.className!=="link-input")&&(je!==null&&Zt(null,B,t),l(null),c(null)),!0},[e,D,a.routes.admin,a.routes.api,a.serverURL,p,f,m,C?.code,t]);return Yt(()=>vi(e.registerCommand(zt,x=>(e.dispatchCommand(pe,x),N(),$(),!0),Oi)),[e,N,$,A]),Yt(()=>{let x=t.parentElement,E=()=>{e.getEditorState().read(()=>{N()})};return window.addEventListener("resize",E),x?.addEventListener("scroll",E),()=>{window.removeEventListener("resize",E),x?.removeEventListener("scroll",E)}},[t.parentElement,e,N]),Yt(()=>vi(e.registerUpdateListener(({editorState:x})=>{x.read(()=>{N()})}),e.registerCommand(Sd,()=>(N(),!0),Oi),e.registerCommand(Ld,()=>S?(D(),!0):!1,kd)),[e,N,S,D]),Yt(()=>{e.getEditorState().read(()=>{N()})},[e,N]),ht(Fi.Fragment,{children:[we("div",{className:"link-editor",ref:n,children:ht("div",{className:"link-input",children:[i&&i.length>0?ht("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?we(Mi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?ht(pd,{children:[o?.__fields.newTab?we(Mi,{}):null,we("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&ht(Fi.Fragment,{children:[we("button",{"aria-label":"Edit link",className:"link-edit",onClick:x=>{x.preventDefault(),$()},onMouseDown:Pi,tabIndex:0,type:"button",children:we(gd,{})}),!w&&we("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(pe,null)},onMouseDown:Pi,tabIndex:0,type:"button",children:we(hd,{})})]})]})}),we(ot,{className:"lexical-link-edit-drawer",data:h,drawerSlug:A,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(x,E)=>{let y=E,k={...y};delete k.text,e.update(()=>{let v=Di(),L=null;if(Ai(v)?L=Ke(v).getParent():_.length&&(L=_[0]?.getParent()??null),L&&Te(L)){let F=be({fields:k});L.replace(F,!0)}}),e.dispatchCommand(pe,{fields:k,selectedNodes:_,text:y.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Hi=t=>{let{anchorElem:e=document.body}=t;return yd(Id(Bi,{anchorElem:e}),e)};import{c as Dd}from"react/compiler-runtime";import{useLexicalComposerContext as Ad}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Od}from"@lexical/utils";import{$getSelection as Fd,$isElementNode as $d,$isRangeSelection as Pd,COMMAND_PRIORITY_LOW as Ui,PASTE_COMMAND as Bd}from"lexical";import{useEffect as Hd}from"react";var vd=/^(?:[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+)?$/,Md=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function ji(t){if(!t)return!1;if(t==="https://"||vd.test(t)||Md.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Gi=t=>{let e=Dd(5),{clientProps:o}=t,[r]=Ad(),n,i;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ie]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Od(r.registerCommand(pe,l=>l===null?($o(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),$o(l),!0),Ui),r.registerCommand(Bd,l=>{let s=Fd();if(!Pd(s)||s.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let c=l.clipboardData.getData("text");if(!ji(c))return!1;if(!s.getNodes().some(jd)){let u={doc:null,linkType:"custom",newTab:!1,url:c};return r.dispatchCommand(pe,{fields:u,text:null}),l.preventDefault(),!0}return!1},Ui))},i=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=i):(n=e[3],i=e[4]),Hd(n,i),null};function jd(t){return $d(t)}var Vi=[Do([{ChildComponent:hi,isActive:({selection:t})=>{if(Wi(t)){let e=Ke(t);return Ud(e,Y)!=null}return!1},isEnabled:({selection:t})=>!!(Wi(t)&&jo()?.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,r=[];if(t.getEditorState().read(()=>{o=jo()?.getTextContent(),r=jo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,newTab:!1};t.dispatchCommand(zt,{fields:n,selectedNodes:r,text:o})}},order:1}])],Gd=R(({props:t})=>({markdownTransformers:[bi],nodes:[ie,t?.disableAutoLinks===!0?null:_e].filter(Boolean),plugins:[{Component:Gi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Ri,position:"normal"},{Component:Ii,position:"normal"},{Component:Hi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Vi},toolbarInline:{groups:Vi}}));import{$isListNode as Wo,INSERT_CHECK_LIST_COMMAND as Xi,ListItemNode as tm,ListNode as om}from"@lexical/list";import{$isRangeSelection as rm}from"lexical";import{jsx as Ki,jsxs as Wd}from"react/jsx-runtime";import"react";var Uo=()=>Wd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ki("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ki("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Vd}from"react/jsx-runtime";import{ListPlugin as Kd}from"@lexical/react/LexicalListPlugin.js";import"react";var Ze=()=>Vd(Kd,{});function ze(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Jd,ListItemNode as Xd,ListNode as qd}from"@lexical/list";import{$createListItemNode as Zd,$createListNode as zd,$isListItemNode as Yd,$isListNode as Go}from"@lexical/list";var Zi=4,Ye=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Zd(t==="check"?r[3]==="x":void 0);if(Go(i)&&i.getListType()===t){let c=i.getFirstChild();c!==null?c.insertBefore(l):i.append(l),e.remove()}else if(Go(n)&&n.getListType()===t)n.append(l),e.remove();else{let c=zd(t,t==="number"?Number(r[2]):void 0);c.append(l),e.replace(c)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Zi);s&&l.setIndent(s)},$e=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(Yd(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(Go(d)){r.push($e(d,e,o+1));continue}}let s=" ".repeat(o*Zi),c=t.getListType(),u=c==="number"?`${t.getStart()+i}. `:c==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+u+e(l)),i++}return r.join(`
36
+ `)};var zi={type:"element",dependencies:[qd,Xd],export:(t,e)=>Jd(t)?$e(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Ye("check")};import{jsx as Qd}from"react/jsx-runtime";import{CheckListPlugin as em}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Yi=()=>Qd(em,{});var Ji=[ne([{ChildComponent:Uo,isActive:({selection:t})=>{if(!rm(t))return!1;for(let e of t.getNodes()){if(Wo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Wo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Wo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xi,void 0)},order:12}])],nm=R(({featureProviderMap:t})=>{let e=[{Component:Yi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ze,position:"normal"}),{markdownTransformers:[zi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[om,tm],plugins:e,slashMenu:{groups:[ze([{Icon:Uo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Xi,void 0)}}])]},toolbarFixed:{groups:Ji},toolbarInline:{groups:Ji}}});import{$isListNode as Ko,INSERT_ORDERED_LIST_COMMAND as el,ListItemNode as cm,ListNode as um}from"@lexical/list";import{$isRangeSelection as dm}from"lexical";import{jsx as gt,jsxs as im}from"react/jsx-runtime";import"react";var Vo=()=>im("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[gt("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),gt("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),gt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),gt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),gt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as lm,ListItemNode as sm,ListNode as am}from"@lexical/list";var qi={type:"element",dependencies:[am,sm],export:(t,e)=>lm(t)?$e(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Ye("number")};var Qi=[ne([{ChildComponent:Vo,isActive:({selection:t})=>{if(!dm(t))return!1;for(let e of t.getNodes()){if(Ko(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Ko(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Ko(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(el,void 0)},order:10}])],mm=R(({featureProviderMap:t})=>({markdownTransformers:[qi],nodes:t.has("orderedList")?[]:[um,cm],plugins:t.has("orderedList")?[]:[{Component:Ze,position:"normal"}],slashMenu:{groups:[ze([{Icon:Vo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(el,void 0)}}])]},toolbarFixed:{groups:Qi},toolbarInline:{groups:Qi}}));import{$isListNode as zo,INSERT_UNORDERED_LIST_COMMAND as rl,ListItemNode as Cm,ListNode as xm}from"@lexical/list";import{$isRangeSelection as bm}from"lexical";import{jsx as Je,jsxs as pm}from"react/jsx-runtime";import"react";var Zo=()=>pm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Je("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Je("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Je("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Je("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Je("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Je("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as fm,ListItemNode as hm,ListNode as gm}from"@lexical/list";var tl={type:"element",dependencies:[gm,hm],export:(t,e)=>fm(t)?$e(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ye("bullet")};var ol=[ne([{ChildComponent:Zo,isActive:({selection:t})=>{if(!bm(t))return!1;for(let e of t.getNodes()){if(zo(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(zo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(zo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(rl,void 0)},order:11}])],_m=R({markdownTransformers:[tl],nodes:[xm,Cm],plugins:[{Component:Ze,position:"normal"}],slashMenu:{groups:[ze([{Icon:Zo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(rl,void 0)}}])]},toolbarFixed:{groups:ol},toolbarInline:{groups:ol}});import{jsx as Tm}from"react/jsx-runtime";import{addClassNamesToElement as wm}from"@lexical/utils";import{DecoratorNode as Em}from"lexical";import*as nl from"react";var km=nl.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Ct=class t extends Em{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Nm({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return wm(o,"unknownConverted"),o}decorate(){return Tm(km,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Nm({data:t}){return new Ct({data:t})}var Lm=R(()=>({nodes:[Ct]}));import{jsx as Sm}from"react/jsx-runtime";import{addClassNamesToElement as Rm}from"@lexical/utils";import{DecoratorNode as Im}from"lexical";import*as il from"react";var ym=il.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),xt=class t extends Im{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return vm({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Rm(o,"unknownConverted"),o}decorate(){return Sm(ym,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function vm({data:t}){return new xt({data:t})}var Mm=R(()=>({nodes:[xt]}));import{$setBlocksType as al}from"@lexical/selection";import{$createParagraphNode as cl,$getSelection as ul,$isParagraphNode as ll,$isRangeSelection as Dm}from"lexical";var sl=[ne([{ChildComponent:nt,isActive:({selection:t})=>{if(!Dm(t))return!1;for(let e of t.getNodes())if(!ll(e)&&!ll(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ul();al(e,()=>cl())})},order:1}])],Am=R({slashMenu:{groups:[q([{Icon:nt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ul();al(e,()=>cl())})}}])]},toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{$isNodeSelection as xp}from"lexical";import{jsx as bt,jsxs as Om}from"react/jsx-runtime";import"react";var Yo=()=>Om("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[bt("g",{clipPath:"url(#clip0_4397_10817)",children:bt("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),bt("defs",{children:bt("clipPath",{id:"clip0_4397_10817",children:bt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Pm}from"react/jsx-runtime";import*as ml from"react";import{DecoratorBlockNode as Fm}from"@lexical/react/LexicalDecoratorBlockNode.js";function $m(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:dl({relationTo:o,value:e})}:null}var _t=class extends Fm{__data;constructor({data:e,format:o,key:r}){super(o,r),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:$m,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=dl(o);return r.setFormat(e.format),r}static isInline(){return!1}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 dl(t){return new _t({data:t})}var Bm=ml.lazy(()=>import("./RelationshipComponent-JPESGV4Q.js").then(t=>({default:t.RelationshipComponent})));function Hm(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Pe({relationTo:o,value:e})}:null}var Ee=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:Hm,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Pe(o);return r.setFormat(e.format),r}decorate(e,o){return Pm(Bm,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Pe(t){return new Ee({data:t})}function Jo(t){return t instanceof Ee}import{c as np}from"react/compiler-runtime";import{jsx as ip}from"react/jsx-runtime";import{useLexicalComposerContext as lp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as sp}from"@lexical/utils";import{useConfig as ap}from"@payloadcms/ui";import{$getPreviousSelection as cp,$getSelection as up,$isParagraphNode as xl,$isRangeSelection as dp,COMMAND_PRIORITY_EDITOR as mp,createCommand as pp}from"lexical";import{useEffect as fp}from"react";import{c as qm}from"react/compiler-runtime";import{jsx as Jt}from"react/jsx-runtime";import{useLexicalComposerContext as Qm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as ep,COMMAND_PRIORITY_EDITOR as tp}from"lexical";import{useEffect as op,useState as hl}from"react";import{c as jm}from"react/compiler-runtime";import{jsx as Um}from"react/jsx-runtime";import{useLexicalComposerContext as Gm}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Wm,useModal as Vm}from"@payloadcms/ui";import{$getNodeByKey as pl,$getPreviousSelection as Km,$getRoot as Zm,$getSelection as zm,$isRangeSelection as Ym,$setSelection as Jm}from"lexical";import{useEffect as Xm,useState as fl}from"react";var Tt=t=>{let e=jm(23),[o]=Gm(),[r,n]=fl(null),[i,l]=fl(!1),[s,c,u]=Wm(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=u,{modalState:f}=Vm(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let $=zm()??Km();n($)},e[0]=h):h=e[0];let g=h,b;e[1]!==o||e[2]!==r?(b=()=>{r&&o.update(()=>{if(Ym(r)){let{anchor:$,focus:D}=r;pl($.key)&&pl(D.key)&&Jm(r.clone())}else Zm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=b):b=e[3];let S=b,I;e[4]!==d?(I=()=>{d()},e[4]=d,e[5]=I):I=e[5];let _=I,T,C;e[6]!==a||e[7]!==f||e[8]!==S||e[9]!==i?(T=()=>{if(!i)return;let $=f[a];$&&!$?.isOpen&&(l(!1),setTimeout(()=>{S()},1))},C=[f,a,S,i],e[6]=a,e[7]=f,e[8]=S,e[9]=i,e[10]=T,e[11]=C):(T=e[10],C=e[11]),Xm(T,C);let w;e[12]!==c?(w=$=>Um(c,{...$,onClick:()=>{g()}}),e[12]=c,e[13]=w):w=e[13];let M;e[14]!==m?(M=()=>{g(),m(),l(!0)},e[14]=m,e[15]=M):M=e[15];let A;return e[16]!==s||e[17]!==_||e[18]!==p||e[19]!==a||e[20]!==w||e[21]!==M?(A={closeListDrawer:_,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:M},e[16]=s,e[17]=_,e[18]=p,e[19]=a,e[20]=w,e[21]=M,e[22]=A):A=e[22],A};var rp=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=ep(o);n&&n.replace(Pe({relationTo:e,value:r}))}):t.dispatchCommand(Xo,{relationTo:e,value:r})},gl=t=>{let e=qm(16),{enabledCollectionSlugs:o}=t,[r]=Qm(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i]=hl(n),[l,s]=hl(null),c=o||void 0,u;e[2]!==i||e[3]!==c?(u={collectionSlugs:c,selectedCollection:i},e[2]=i,e[3]=c,e[4]=u):u=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=Tt(u),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(rt,S=>(s(S?.replace?S?.replace.nodeKey:null),p(),!0),tp),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),op(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==l?(h=S=>{let{collectionSlug:I,doc:_}=S;rp({editor:r,relationTo:I,replaceNodeKey:l,value:_.id}),d()},e[9]=d,e[10]=r,e[11]=l,e[12]=h):h=e[12];let g=h,b;return e[13]!==a||e[14]!==g?(b=Jt(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=b):b=e[15],b},Cl=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Jt(gl,{...t}):Jt(It,{...t,children:Jt(gl,{...t})});var Xo=pp("INSERT_RELATIONSHIP_COMMAND"),bl=t=>{let e=np(10),{clientProps:o}=t,[r]=lp(),{config:n}=ap(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o?.disabledCollections||e[1]!==i){let a;e[3]!==o?.disabledCollections?(a=p=>{let{slug:m}=p;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=a):a=e[4],d=i.filter(a).map(hp),e[0]=o?.disabledCollections,e[1]=i,e[2]=d}else d=e[2];l=d}let s,c;e[5]!==r?(s=()=>{if(!r.hasNodes([Ee]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Xo,Cp,mp)},c=[r],e[5]=r,e[6]=s,e[7]=c):(s=e[6],c=e[7]),fp(s,c);let u;return e[8]!==l?(u=ip(Cl,{enabledCollectionSlugs:l}),e[8]=l,e[9]=u):u=e[9],u};function hp(t){let{slug:e}=t;return e}function gp(t){return xl(t)}function Cp(t){let e=up()||cp();if(dp(e)){let o=Pe(t);sp(o);let{focus:r}=e,n=r.getNode();xl(n)&&n.getTextContentSize()===0&&n.getParentOrThrow().getChildren().filter(gp).length>1&&n.remove()}return!0}var bp=R({nodes:[Ee],plugins:[{Component:bl,position:"normal"}],slashMenu:{groups:[q([{Icon:Yo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(rt,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Yo,isActive:({selection:t})=>{if(!xp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Jo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(rt,{replace:!1})}}])]}});import{c as Nl}from"react/compiler-runtime";import{jsx as ue,jsxs as Hp}from"react/jsx-runtime";import{useLexicalComposerContext as jp}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Up,useThrottledEffect as Gp,useTranslation as Wp}from"@payloadcms/ui";import*as ke from"react";import{useMemo as Vp}from"react";import{c as _p}from"react/compiler-runtime";import{jsx as Tp}from"react/jsx-runtime";import{mergeRegister as wp}from"@lexical/utils";import{$addUpdateTag as Ep,$getSelection as kp}from"lexical";import{useEffect as Xt,useState as qo}from"react";var Qo="toolbar-popup__button",wt=t=>{let e=_p(34),{children:o,editor:r,item:n}=t,[i,l]=qo(!0),[s,c]=qo(!1),[u,d]=qo(Qo),a=H(),p;e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==i||e[4]!==n?(p=()=>{r.getEditorState().read(()=>{let M=kp();if(M){if(n.isActive){let A=n.isActive({editor:r,editorConfigContext:a,selection:M});s!==A&&c(A)}if(n.isEnabled){let A=n.isEnabled({editor:r,editorConfigContext:a,selection:M});i!==A&&l(A)}}})},e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=n,e[5]=p):p=e[5];let m=p,f,h;e[6]!==m?(f=()=>{m()},h=[m],e[6]=m,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Xt(f,h);let g,b;e[9]!==m?(g=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),b=[m],e[9]=m,e[10]=g,e[11]=b):(g=e[10],b=e[11]),Xt(g,b);let S,I;e[12]!==r||e[13]!==m?(S=()=>wp(r.registerUpdateListener(()=>{m()})),I=[r,m],e[12]=r,e[13]=m,e[14]=S,e[15]=I):(S=e[14],I=e[15]),Xt(S,I);let _;e[16]!==s||e[17]!==i||e[18]!==n.key?(_=()=>{d([Qo,i===!1?"disabled":"",s?"active":"",n?.key?`${Qo}-`+n.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=n.key,e[19]=_):_=e[19];let T;e[20]!==s||e[21]!==u||e[22]!==i||e[23]!==n.key?(T=[i,s,u,n.key],e[20]=s,e[21]=u,e[22]=i,e[23]=n.key,e[24]=T):T=e[24],Xt(_,T);let C;e[25]!==s||e[26]!==r||e[27]!==i||e[28]!==n?(C=()=>{if(i!==!1)return r.focus(()=>{r.update(Np),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=i,e[28]=n,e[29]=C):C=e[29];let w;return e[30]!==o||e[31]!==u||e[32]!==C?(w=Tp("button",{className:u,onClick:C,onMouseDown:Lp,type:"button",children:o}),e[30]=o,e[31]=u,e[32]=C,e[33]=w):w=e[33],w};function Np(){Ep("toolbar")}function Lp(t){t.preventDefault()}import{c as Ap}from"react/compiler-runtime";import{jsx as Xe}from"react/jsx-runtime";import or,{useCallback as Op,useEffect as kl}from"react";import{mergeRegister as Fp}from"@lexical/utils";import{useTranslation as $p}from"@payloadcms/ui";import{$getSelection as Pp}from"lexical";import{jsx as ye,jsxs as _l}from"react/jsx-runtime";import{Button as Sp}from"@payloadcms/ui";import{$addUpdateTag as Rp,isDOMNode as Ip}from"lexical";import qt,{useCallback as yp,useEffect as Et,useMemo as vp,useRef as tr,useState as Qt}from"react";import{createPortal as Mp}from"react-dom";var er="toolbar-popup__dropdown-item",Tl=qt.createContext(null);function wl({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,c]=Qt(er);Et(()=>{c([er,r===!1?"disabled":"",t?"active":"",i?.key?`${er}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let u=tr(null),d=qt.useContext(Tl);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return Et(()=>{u?.current!=null&&a(u)},[u,a]),ye(Sp,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Rp("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:u,tooltip:l,type:"button",children:e})}function Dp({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=Qt(),[l,s]=Qt(),c=yp(a=>{i(p=>p!=null?[...p,a]:[a])},[i]),u=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=vp(()=>({registerItem:c}),[c]);return Et(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),ye(Tl.Provider,{value:d,children:ye("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:u,ref:e,children:t})})}function El({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let c=tr(null),u=tr(null),[d,a]=Qt(!1),p=()=>{a(!1),u?.current!=null&&u.current.focus()};Et(()=>{let f=u.current,h=c.current;if(d&&f!==null&&h!==null){let{left:g,top:b}=f.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;h.style.top=`${b+S+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[c,u,d]),Et(()=>{let f=u.current;if(f!==null&&d){let h=g=>{let b=g.target;Ip(b)&&(s&&c.current&&c.current.contains(b)||f.contains(b)||a(!1))};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[c,u,d,s]);let m=Mp(ye(Dp,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return _l(qt.Fragment,{children:[_l("button",{"aria-label":t,className:e+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),a(!d)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[n&&ye(n,{}),l&&ye("span",{className:"toolbar-popup__dropdown-label",children:l}),ye("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ye(qt.Fragment,{children:m})]})}var rr="toolbar-popup__dropdown",Bp=t=>{let e=Ap(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=$p(),{fieldProps:c}=H(),{featureClientSchemaMap:u,schemaPath:d}=c;if(l.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==l?(f=l?.Component&&Xe(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=o,e[1]=r,e[2]=n,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let a=l.key,p;if(l.label){let f;e[6]!==u||e[7]!==s||e[8]!==l||e[9]!==d?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:u,i18n:s,schemaPath:d}):l.label,e[6]=u,e[7]=s,e[8]=l,e[9]=d,e[10]=f):f=e[10],a=f}a.length>25?p=a.substring(0,25)+"...":p=a;let m;return e[11]!==o||e[12]!==p||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==a?(m=Xe(wl,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?Xe(l.ChildComponent,{}):void 0,item:l,tooltip:a,children:Xe("span",{className:"text",children:p})},l.key),e[11]=o,e[12]=p,e[13]=n,e[14]=i,e[15]=l,e[16]=a,e[17]=m):m=e[17],m},Be=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:i,label:l,maxActiveItems:s,onActiveChange:c})=>{let[u,d]=or.useState([]),[a,p]=or.useState([]),[m,f]=or.useState(!0),h=H(),{items:g,key:b}=r,S=Op(()=>{o.getEditorState().read(()=>{let I=Pp();if(!I)return;let _=[],T=[],C=[];for(let w of g)w.isActive&&(!s||_.length<s)&&w.isActive({editor:o,editorConfigContext:h,selection:I})&&(_.push(w.key),T.push(w)),w.isEnabled?w.isEnabled({editor:o,editorConfigContext:h,selection:I})&&C.push(w.key):C.push(w.key);r.isEnabled&&f(r.isEnabled({editor:o,editorConfigContext:h,selection:I})),d(_),p(C),c&&c({activeItems:T})})},[o,h,r,g,s,c]);return kl(()=>{S()},[S]),kl(()=>Fp(o.registerUpdateListener(()=>{S()})),[o,S]),Xe(El,{buttonAriaLabel:`${b} dropdown`,buttonClassName:[rr,`${rr}-${b}`,...e||[]].filter(Boolean).join(" "),disabled:!m,Icon:n,itemsContainerClassNames:[`${rr}-items`,...i||[]],label:l,children:g.length?g.map(I=>Xe(Bp,{active:u.includes(I.key),anchorElem:t,editor:o,enabled:a.includes(I.key),item:I},I.key)):null},b)};function Kp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ue(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ue(wt,{editor:e,item:o,children:ue(o.ChildComponent,{})},o.key):null}function Zp(t){let e=Nl(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=Wp(),{fieldProps:c}=H(),{featureClientSchemaMap:u,schemaPath:d}=c,[a,p]=ke.useState(void 0),[m,f]=ke.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let g;e[4]!==i?(g=[i],e[4]=i,e[5]=g):g=e[5],ke.useEffect(h,g);let b;e[6]!==u||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==d?(b=T=>{let{activeItems:C}=T;if(!C.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let w=C[0],M=w.key;w.label&&(M=typeof w.label=="function"?w.label({featureClientSchemaMap:u,i18n:s,schemaPath:d}):w.label),M.length>25&&(M=M.substring(0,25)+"..."),C.length===1?(p(M),f(()=>w.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:C.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=u,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=d,e[12]=b):b=e[12];let S=b,I=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,_;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==S||e[21]!==I?(_=Hp("div",{className:I,children:[i.type==="dropdown"&&i.items.length?m?ue(Be,{anchorElem:o,editor:r,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:S}):ue(Be,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:S}):null,i.type==="buttons"&&i.items.length?i.items.map(T=>ue(Kp,{anchorElem:o,editor:r,item:T},T.key)):null,l<n.features.toolbarFixed?.groups.length-1&&ue("div",{className:"divider"})]},i.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=S,e[21]=I,e[22]=_):_=e[22],_}function zp({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=ke.useRef(null),{y:l}=Up(),s=Vp(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Gp(()=>{if(!s)return;let c=i.current;if(!c)return;let u=c.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(u.bottom<d.top||u.top>d.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.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"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),ue("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:i,children:o.isEditable()&&ue(ke.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>ue(Zp,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Ll=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Ll(t.parentEditor)}return!1},Sl=t=>{let e=Nl(6),{clientProps:o}=t,[r]=jp(),n=H(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let d=Ll(n);if(o?.disableIfParentHasFixedToolbar&&d){u=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){u=null;break e}c=ue(zp,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var Yp=R({plugins:[{Component:Sl,position:"aboveContainer"}]});import{c as yl}from"react/compiler-runtime";import{jsx as fe,jsxs as vl}from"react/jsx-runtime";import{useLexicalComposerContext as Jp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ml}from"@lexical/utils";import{$getSelection as Dl,$isRangeSelection as Rl,$isTextNode as Xp,COMMAND_PRIORITY_LOW as qp,getDOMSelection as Al,SELECTION_CHANGE_COMMAND as Qp}from"lexical";import{useCallback as to,useEffect as kt,useRef as Il,useState as ef}from"react";import*as oo from"react";import{createPortal as tf}from"react-dom";function nr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function eo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:c,verticalGap:u=10}=t,d=o.parentElement;if(c===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=c.top-a.height-u,h=c.left-i;l==="center"&&(h=c.left+c.width/2-a.width/2);let g=0;return!e&&f<m.top&&!s&&(g=a.height+c.height+u*2,f+=g),l==="center"?h+a.width>m.right?h=m.right-a.width-i:h<m.left&&(h=m.left+i):h+a.width>m.right&&(h=m.right-a.width-i),h-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function of({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&fe(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?fe(wt,{editor:e,item:o,children:fe(o.ChildComponent,{})},o.key):null}function rf(t){let e=yl(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=H(),[s,c]=oo.useState(),u;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(u=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=u):u=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],oo.useEffect(u,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0);return}let b=g[0];c(()=>b?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==l.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==i||e[16]!==p||e[17]!==m?(f=vl("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?fe(Be,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):fe(Be,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>fe(of,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&fe("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=l.features.toolbarInline?.groups.length,e[14]=n,e[15]=i,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function nf({anchorElem:t,editor:e}){let o=Il(null),r=Il(null),{editorConfig:n}=H(),i=to(()=>{if(o?.current){let u=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=to(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=u.clientX,m=u.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||i()}}},[i]),s=to(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);kt(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let c=to(()=>{let u=Dl(),d=Al(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(u!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=nr(d,m),h=eo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&eo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return kt(()=>{let u=t.parentElement,d=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",d),u&&u.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),u&&u.removeEventListener("scroll",d)}},[e,c,t]),kt(()=>(e.getEditorState().read(()=>{c()}),Ml(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(Qp,()=>(c(),!1),qp))),[e,c]),vl("div",{className:"inline-toolbar-popup",ref:o,children:[fe("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,d)=>fe(rf,{anchorElem:t,editor:e,group:u,index:d},u.key))]})}function lf(t,e){let o=yl(12),[r,n]=ef(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Dl(),m=Al(t._window),f=t.getRootElement();if(m!==null&&(!Rl(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!Rl(p))return;if(p.getTextContent()!==""){let g=p.getNodes(),b=!1;for(let S of g)if(Xp(S)){n(!0),b=!0;break}b||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,c;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),c=[l],o[2]=l,o[3]=s,o[4]=c):(s=o[3],c=o[4]),kt(s,c);let u,d;if(o[5]!==t||o[6]!==l?(u=()=>Ml(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,l],o[5]=t,o[6]=l,o[7]=u,o[8]=d):(u=o[7],d=o[8]),kt(u,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=tf(fe(nf,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Ol=t=>{let{anchorElem:e}=t,[o]=Jp();return lf(o,e)};var sf=R({plugins:[{Component:Ol,position:"floatingAnchorElem"}]});import{TableCellNode as X1,TableNode as q1,TableRowNode as Q1}from"@lexical/table";import{jsx as Fl}from"react/jsx-runtime";import"react";var ir=()=>Fl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Fl("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as af,$createTableNode as cf,$createTableRowNode as uf,$isTableCellNode as $l,$isTableNode as lr,$isTableRowNode as sr,TableCellHeaderStates as ro,TableCellNode as df,TableNode as mf,TableRowNode as pf}from"@lexical/table";import{$isParagraphNode as ff,$isTextNode as hf}from"lexical";var Bl=/^\|(.+)\|\s?$/,gf=/^(\| ?:?-*:? ?)+\|\s?$/,Hl=({allTransformers:t})=>({type:"element",dependencies:[mf,pf,df],export:e=>{if(!lr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!sr(r))continue;let i=!1;for(let l of r.getChildren())$l(l)&&(n.push(vr(t,l).replace(/\n/g,"\\n").trim()),l.__headerState===ro.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
37
+ `)},regExp:Bl,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(gf.test(n)){let a=e.getPreviousSibling();if(!a||!lr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!sr(m))return;m.getChildren().forEach(f=>{$l(f)&&f.setHeaderStyles(ro.ROW,ro.ROW)}),e.remove();return}let i=Pl(n,t);if(i==null)return;let l=[i],s=e.getPreviousSibling(),c=i.length;for(;s&&!(!ff(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!hf(a))break;let p=Pl(a.getTextContent(),t);if(p==null)break;c=Math.max(c,p.length),l.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let u=cf();for(let a of l){let p=uf();u.append(p);for(let m=0;m<c;m++)p.append(m<a.length?a[m]:jl("",t))}let d=e.getPreviousSibling();lr(d)&&Cf(d)===c?(d.append(...u.getChildren()),e.remove()):e.replace(u),u.selectEnd()}});function Cf(t){let e=t.getFirstChild();return sr(e)?e.getChildrenSize():0}var jl=(t,e)=>{t=t.replace(/\\n/g,`
38
+ `);let o=af(ro.NO_STATUS);return yr(t,e,o),o},Pl=(t,e)=>{let o=t.match(Bl);return!o||!o[1]?null:o[1].split("|").map(r=>jl(r,e))};import{c as bf}from"react/compiler-runtime";import{jsx as P,jsxs as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as Vl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as _f}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as cr,$deleteTableColumn__EXPERIMENTAL as Tf,$deleteTableRow__EXPERIMENTAL as wf,$getNodeTriplet as Ef,$getTableCellNodeFromLexicalNode as Gl,$getTableColumnIndexFromTableCellNode as kf,$getTableNodeFromLexicalNodeOrThrow as Le,$getTableRowIndexFromTableCellNode as Nf,$insertTableColumn__EXPERIMENTAL as Lf,$insertTableRow__EXPERIMENTAL as Sf,$isTableCellNode as Kl,$isTableSelection as Nt,$unmergeCell as Rf,getTableElement as ur,getTableObserverFromTableElement as dr,TableCellHeaderStates as ve,TableCellNode as If}from"@lexical/table";import{mergeRegister as yf}from"@lexical/utils";import{useScrollInfo as vf}from"@payloadcms/ui";import{$createParagraphNode as Mf,$getRoot as Df,$getSelection as io,$isElementNode as Af,$isParagraphNode as Of,$isRangeSelection as mr,$isTextNode as Ff,COMMAND_PRIORITY_CRITICAL as $f,getDOMSelection as Pf,isDOMNode as Bf,SELECTION_CHANGE_COMMAND as Hf}from"lexical";import*as pr from"react";import{useCallback as de,useEffect as qe,useRef as no,useState as Qe}from"react";import{createPortal as Zl}from"react-dom";import{jsx as ar,jsxs as xf}from"react/jsx-runtime";import"react";var Ul=()=>xf("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[ar("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),ar("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),ar("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Wl(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function jf(){let t=io();if(mr(t)&&!t.isCollapsed()||Nt(t)&&!t.anchor.is(t.focus)||!mr(t)&&!Nt(t))return!1;let[e]=Ef(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Uf(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Of(e)||!e.isEmpty())}function Gf(t){let e=t.getLastDescendant();Ff(e)?e.select():Af(e)?e.selectEnd():e!==null&&e.selectNext()}function Wf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Vl(),l=no(null),[s,c]=Qe(n),[u,d]=Qe({columns:1,rows:1}),[a,p]=Qe(!1),[m,f]=Qe(!1),{y:h}=vf();qe(()=>i.registerMutationListener(If,x=>{x.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{c(s.getLatest())})},{skipInitialization:!0}),[i,s]),qe(()=>{i.getEditorState().read(()=>{let x=io();if(Nt(x)){let E=Wl(x);d(Wl(x)),p(E.columns>1||E.rows>1)}f(jf())})},[i]),qe(()=>{let x=e.current,E=l.current,y=i.getRootElement();if(x!=null&&E!=null&&y!=null){let k=y.getBoundingClientRect(),v=x.getBoundingClientRect();E.style.opacity="1";let L=E.getBoundingClientRect(),F=5,B=v.right+F;if(B+L.width>window.innerWidth||B+L.width>k.right){let re=v.left-L.width-F;B=(re<0?F:re)+window.pageXOffset}E.style.left=`${B+window.pageXOffset}px`;let K=v.top;if(K+L.height>window.innerHeight){let re=v.bottom-L.height;K=re<0?F:re}E.style.top=`${K}px`}},[e,l,i,h]),qe(()=>{function x(E){l.current!=null&&e.current!=null&&Bf(E.target)&&!l.current.contains(E.target)&&!e.current.contains(E.target)&&r(!1)}return window.addEventListener("click",x),()=>window.removeEventListener("click",x)},[r,e]);let g=de(()=>{i.update(()=>{if(s.isAttached()){let E=Le(s),y=ur(E,i.getElementByKey(E.getKey()));if(y===null)throw new Error("Expected to find tableElement in DOM");let k=dr(y);k!==null&&k.$clearHighlight(),E.markDirty(),c(s.getLatest())}Df().selectStart()})},[i,s]),b=()=>{i.update(()=>{let x=io();if(Nt(x)){let y=x.getNodes().filter(Kl);if(y.length===0)return;let k=Le(y[0]),[v]=cr(k,null,null),L=1/0,F=-1/0,B=1/0,K=-1/0,re=new Set;for(let J of v)for(let W of J){if(!W||!W.cell)continue;let te=W.cell.getKey();if(!re.has(te)&&y.some(oe=>oe.is(W.cell))){re.add(te);let oe=W.startRow,le=W.startColumn,Me=W.cell.__rowSpan||1,tt=W.cell.__colSpan||1;L=Math.min(L,oe),F=Math.max(F,oe+Me-1),B=Math.min(B,le),K=Math.max(K,le+tt-1)}}if(L===1/0||B===1/0)return;let je=F-L+1,G=K-B+1,U=v?.[L]?.[B];if(!U?.cell)return;let ee=U.cell;ee.setColSpan(G),ee.setRowSpan(je);let ae=new Set([ee.getKey()]);for(let J=L;J<=F;J++)for(let W=B;W<=K;W++){let te=v?.[J]?.[W];if(!te?.cell)continue;let oe=te.cell,le=oe.getKey();ae.has(le)||(ae.add(le),Uf(oe)||ee.append(...oe.getChildren()),oe.remove())}ee.getChildrenSize()===0&&ee.append(Mf()),Gf(ee),o()}})},S=()=>{i.update(()=>{Rf()})},I=de(x=>{i.update(()=>{for(let E=0;E<u.rows;E++)Sf(x);o()})},[i,o,u.rows]),_=de(x=>{i.update(()=>{for(let E=0;E<u.columns;E++)Lf(x);o()})},[i,o,u.columns]),T=de(()=>{i.update(()=>{wf(),o()})},[i,o]),C=de(()=>{i.update(()=>{Le(s).remove(),g(),o()})},[i,s,g,o]),w=de(()=>{i.update(()=>{Tf(),o()})},[i,o]),M=de(()=>{i.update(()=>{let x=Le(s),E=Nf(s),[y]=cr(x,null,null),k=new Set,v=s.getHeaderStyles()^ve.ROW;if(y[E])for(let L=0;L<y[E].length;L++){let F=y[E][L];F?.cell&&(k.has(F.cell)||(k.add(F.cell),F.cell.setHeaderStyles(v,ve.ROW)))}g(),o()})},[i,s,g,o]),A=de(()=>{i.update(()=>{let x=Le(s),E=kf(s),[y]=cr(x,null,null),k=new Set,v=s.getHeaderStyles()^ve.COLUMN;if(y)for(let L=0;L<y.length;L++){let F=y?.[L]?.[E];F?.cell&&(k.has(F.cell)||(k.add(F.cell),F.cell.setHeaderStyles(v,ve.COLUMN)))}g(),o()})},[i,s,g,o]),$=de(()=>{i.update(()=>{if(s.isAttached()){let x=Le(s);x&&x.setRowStriping(!x.getRowStriping())}g(),o()})},[i,s,g,o]),D=de(()=>{i.update(()=>{if(s.isAttached()){let x=Le(s);x&&x.setFrozenColumns(x.getFrozenColumns()===0?1:0)}g(),o()})},[i,s,g,o]),N=null;return t&&(a?N=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(N=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>S(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Zl(Ne("div",{className:"table-action-menu-dropdown",onClick:x=>{x.stopPropagation()},ref:l,children:[N?Ne(pr.Fragment,{children:[N,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>$(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>D(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>I(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>I(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>_(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>_(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:Ne("span",{className:"text",children:[(s.__headerState&ve.ROW)===ve.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>A(),type:"button",children:Ne("span",{className:"text",children:[(s.__headerState&ve.COLUMN)===ve.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Vf({anchorElem:t,cellMerge:e}){let[o]=Vl(),r=no(null),n=no(null),[i,l]=Qe(!1),[s,c]=Qe(null),u=de(()=>{let a=r.current,p=io(),m=Pf(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")),c(null)}if(p==null||a==null)return h();let g=o.getRootElement(),b=null,S=null;if(mr(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let _=Gl(p.anchor.getNode());if(_==null||(S=o.getElementByKey(_.getKey()),S==null||!_.isAttached()))return h();let T=Le(_),C=ur(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=dr(C),c(_)}else if(Nt(p)){let _=Gl(p.anchor.getNode());if(!Kl(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let T=Le(_),C=ur(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=dr(C),S=o.getElementByKey(_.getKey())}else if(!f)return h();if(b===null||S===null)return h();let I=!b||!b.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",I),a.classList.toggle("table-cell-action-button-container--inactive",!I),I){let _=S.getBoundingClientRect(),T=t.getBoundingClientRect(),C=_.top-T.top,w=_.right-T.left;a.style.transform=`translate(${w}px, ${C}px)`}},[o,t]);qe(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(u)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return yf(o.registerUpdateListener(m),o.registerCommand(Hf,m,$f),o.registerRootListener((f,h)=>{h&&h.removeEventListener("mouseup",m),f&&(f.addEventListener("mouseup",m),m())}),()=>clearTimeout(a))});let d=no(s);return qe(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Ne(pr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),l(!i)},ref:n,type:"button",children:P(Ul,{})}),i&&P(Wf,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var zl=t=>{let e=bf(3),{anchorElem:o}=t,r=_f(),n;return e[0]!==o||e[1]!==r?(n=Zl(r?P(Vf,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as Kf}from"react/compiler-runtime";import{jsx as so,jsxs as Zf}from"react/jsx-runtime";import{useLexicalComposerContext as zf}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Yf}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Jf,$getTableNodeFromLexicalNodeOrThrow as fr,$getTableRowIndexFromTableCellNode as Xf,$isTableCellNode as Yl,$isTableRowNode as qf,getDOMCellFromTarget as Qf,getTableElement as e1,TableNode as Jl}from"@lexical/table";import{calculateZoomLevel as Xl,mergeRegister as t1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as hr,isHTMLElement as o1}from"lexical";import*as Ql from"react";import{useCallback as Lt,useEffect as gr,useRef as lo,useState as et}from"react";import{createPortal as r1}from"react-dom";var n1=33,ql=92;function i1({editor:t}){let e=lo(null),o=lo(null),r=lo(null),[n,i]=et(!1),l=H(),s=lo(null),[c,u]=et(null),[d,a]=et(null),[p,m]=et(!1),[f,h]=et(null),g=Lt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),b=D=>(D.buttons&1)===1;gr(()=>{let D=new Set;return t1(t.registerMutationListener(Jl,N=>{for(let[x,E]of N)E==="destroyed"?D.delete(x):D.add(x);i(D.size>0)}),t.registerNodeTransform(Jl,N=>{if(N.getColWidths())return N;let x=N.getColumnCount(),E=ql;return N.setColWidths(Array(x).fill(E)),N}))},[t]),gr(()=>{if(!n)return;let D=y=>{let k=y.target;if(o1(k)){if(f){u({x:y.clientX,y:y.clientY});return}if(m(b(y)),!(o.current&&o.current.contains(k))&&e.current!==k){e.current=k;let v=Qf(k);v&&d!==v?t.getEditorState().read(()=>{let L=hr(v.elem);if(!L)throw new Error("TableCellResizer: Table cell node not found.");let F=fr(L),B=e1(F,t.getElementByKey(F.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=k,r.current=B.getBoundingClientRect(),a(v)},{editor:t}):v==null&&g()}}},N=y=>{m(!0)},x=y=>{m(!1)},E=t.registerRootListener((y,k)=>{k?.removeEventListener("mousemove",D),k?.removeEventListener("mousedown",N),k?.removeEventListener("mouseup",x),y?.addEventListener("mousemove",D),y?.addEventListener("mousedown",N),y?.addEventListener("mouseup",x)});return()=>{E()}},[d,f,t,n,g]);let S=D=>D==="bottom",I=Lt(D=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=hr(d.elem);if(!Yl(N))throw new Error("TableCellResizer: Table cell node not found.");let x=fr(N),E=Xf(N)+N.getRowSpan()-1,y=x.getChildren();if(E>=y.length||E<0)throw new Error("Expected table cell to be inside of table row.");let k=y[E];if(!qf(k))throw new Error("Expected table row");let v=k.getHeight();if(v===void 0){let F=k.getChildren();v=Math.min(...F.map(B=>_(B,t)??1/0))}let L=Math.max(v+D,n1);k.setHeight(L)},{tag:"skip-scroll-into-view"})},[d,t]),_=(D,N)=>N.getElementByKey(D.getKey())?.clientHeight,T=(D,N)=>{let x;return N.forEach(E=>{E.forEach((y,k)=>{y.cell===D&&(x=k)})}),x},C=Lt(D=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=hr(d.elem);if(!Yl(N))throw new Error("TableCellResizer: Table cell node not found.");let x=fr(N),[E]=Jf(x,null,null),y=T(N,E);if(y===void 0)throw new Error("TableCellResizer: Table column not found.");let k=x.getColWidths();if(!k)return;let v=k[y];if(v===void 0)return;let L=[...k],F=Math.max(v+D,ql);L[y]=F,x.setColWidths(L)},{tag:"skip-scroll-into-view"})},[d,t]),w=Lt(D=>{let N=x=>{if(x.preventDefault(),x.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:E,y}=s.current;if(d===null)return;let k=Xl(x.target);if(S(D)){let v=(x.clientY-y)/k;I(v)}else{let v=(x.clientX-E)/k;C(v)}g(),document.removeEventListener("mouseup",N)}};return N},[d,g,C,I]),M=Lt(D=>N=>{if(N.preventDefault(),N.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:N.clientX,y:N.clientY},u(s.current),h(D),document.addEventListener("mouseup",w(D))},[d,w]),[A,$]=et({bottom:null,left:null,right:null,top:null});return gr(()=>{if(d){let{height:D,left:N,top:x,width:E}=d.elem.getBoundingClientRect(),y=Xl(d.elem),k=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${k}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+x+D-k/2}px`,width:`${E}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${D}px`,left:`${window.scrollX+N+E-k/2}px`,top:`${window.scrollY+x}px`,width:`${k}px`}},L=r.current;f&&c&&L&&(S(f)?(v[f].left=`${window.scrollX+L.left}px`,v[f].top=`${window.scrollY+c.y/y}px`,v[f].height="3px",v[f].width=`${L.width}px`):(v[f].top=`${window.scrollY+L.top}px`,v[f].left=`${window.scrollX+c.x/y}px`,v[f].width="3px",v[f].height=`${L.height}px`),v[f].backgroundColor="#adf"),$(v)}else $({bottom:null,left:null,right:null,top:null})},[d,f,c]),so("div",{ref:o,children:d!=null&&!p&&Zf(Ql.Fragment,{children:[so("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:A.right||void 0}),so("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:A.bottom||void 0})]})})}var es=()=>{let t=Kf(3),[e]=zf(),o=Yf(),r,n;return t[0]!==e||t[1]!==o?(n=o?r1(so(i1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as p1}from"react/compiler-runtime";import{jsx as Cr,jsxs as f1,Fragment as h1}from"react/jsx-runtime";import{useLexicalComposerContext as as}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as g1,$getTableColumnIndexFromTableCellNode as C1,$getTableRowIndexFromTableCellNode as x1,$insertTableColumn__EXPERIMENTAL as b1,$insertTableRow__EXPERIMENTAL as _1,$isTableCellNode as T1,$isTableNode as rs,getTableElement as w1,TableNode as E1}from"@lexical/table";import{$findMatchingParent as k1,mergeRegister as N1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ns,isHTMLElement as L1}from"lexical";import{useEffect as is,useMemo as S1,useRef as ls,useState as ao}from"react";import"react";import{createPortal as R1}from"react-dom";import{c as u1}from"react/compiler-runtime";import{useEffect as d1,useRef as m1}from"react";var l1="Expected a function",s1=Math.max,a1=Math.min;function c1(t,e,o){let r,n,i=0,l,s=!1,c=!1,u,d,a,p=!0;if(typeof t!="function")throw new TypeError(l1);e=e||0,typeof o=="object"&&(s=!!o.leading,c="maxWait"in o,u=c?s1(o.maxWait||0,e):u,p="trailing"in o?!!o.trailing:p);function m(C){let w=r,M=l;return r=l=void 0,i=C,d=t.apply(M,w),d}function f(C){return i=C,a=setTimeout(b,e),s?m(C):d}function h(C){let w=C-n,M=C-i,A=e-w;return c?a1(A,u-M):A}function g(C){let w=C-n,M=C-i;return n===void 0||w>=e||w<0||c&&M>=u}function b(){let C=Date.now();if(g(C))return S(C);a=setTimeout(b,h(C))}function S(C){return a=void 0,p&&r?m(C):(r=l=void 0,d)}function I(){a!==void 0&&clearTimeout(a),i=0,r=n=l=a=void 0}function _(){return a===void 0?d:S(Date.now())}function T(){let C=Date.now(),w=g(C);if(r=arguments,l=this,n=C,w){if(a===void 0)return f(n);if(c)return clearTimeout(a),a=setTimeout(b,e),m(n)}return a===void 0&&(a=setTimeout(b,e)),d}return T.cancel=I,T.flush=_,T}var ts=c1;function os(t,e,o){let r=u1(6),n=m1(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=ts(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=i,r[4]=l):(i=r[3],l=r[4]),d1(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let d=u;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var ss=20;function I1({anchorElem:t}){let[e]=as(),o=H(),[r,n]=ao(!1),[i,l]=ao(!1),[s,c]=ao(!1),[u,d]=ao({}),a=ls(new Set),p=ls(null),m=os(g=>{let{isOutside:b,tableDOMNode:S}=y1(g,o.editorConfig?.lexical);if(b){n(!1),l(!1);return}if(!S)return;p.current=S;let I=null,_=null,T=null;if(e.getEditorState().read(()=>{let k=ns(S);if(T1(k)){let v=k1(k,L=>rs(L));if(!rs(v))return;if(T=w1(v,e.getElementByKey(v.getKey())),T){let L=v.getChildrenSize(),F=v.getChildAtIndex(0)?.getChildrenSize(),B=x1(k),K=C1(k);B===L-1?I=k:K===F-1&&(_=k)}}},{editor:e}),!T)return;let C=T.parentElement;if(!C)return;let{bottom:w,height:M,left:A,right:$,width:D,y:N}=T.getBoundingClientRect(),x=!1;C&&C.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(x=C.scrollWidth>C.clientWidth);let{left:E,y}=t.getBoundingClientRect();I?(l(!1),n(!0),d({height:ss,left:x&&C?C.offsetLeft:A-E,top:w-y+5,width:x&&C?C.offsetWidth:D})):_&&(l(!0),n(!1),d({height:M,left:$-E+5,top:N-y,width:ss}))},50,250),f=S1(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);is(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),l(!1),document.removeEventListener("mousemove",m)}},[s,m]),is(()=>N1(e.registerMutationListener(E1,g=>{e.getEditorState().read(()=>{let b=!1;for(let[S,I]of g)switch(I){case"created":{a.current.add(S),b=!0;break}case"destroyed":{a.current.delete(S),b=!0;break}default:break}if(b){f.disconnect();for(let S of a.current){let{tableElement:I}=g1(S);f.observe(I)}c(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{p.current&&(ns(p.current)?.selectEnd(),g?(_1(),n(!1)):(b1(),l(!1)))})};return e?.isEditable()?f1(h1,{children:[r&&Cr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&Cr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function y1(t,e){let o=t.target;if(L1(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function cs(t){let e=p1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=as();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=R1(Cr(I1,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as v1}from"react/compiler-runtime";import{jsx as xr,jsxs as M1}from"react/jsx-runtime";import{useLexicalComposerContext as D1}from"@lexical/react/LexicalComposerContext";import{TablePlugin as A1}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as O1,TableCellNode as F1,TableNode as $1,TableRowNode as P1}from"@lexical/table";import{mergeRegister as B1}from"@lexical/utils";import{formatDrawerSlug as H1,useEditDepth as j1}from"@payloadcms/ui";import{$getSelection as U1,$isRangeSelection as G1,COMMAND_PRIORITY_EDITOR as W1,createCommand as V1}from"lexical";import{createContext as K1,useContext as Z1,useEffect as z1,useMemo as Y1,useState as J1}from"react";import*as us from"react";var co=V1("OPEN_EMBED_DRAWER_COMMAND"),ds=K1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ms({children:t}){let[e,o]=J1({cellEditorConfig:null,cellEditorPlugins:null});return xr(ds.Provider,{value:Y1(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ps=()=>{let t=v1(16),[e]=D1(),o=Z1(ds),r=j1(),{fieldProps:n,uuid:i}=H(),{schemaPath:l}=n,s="lexical-table-create-"+i,c;t[0]!==r||t[1]!==s?(c=H1({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=c):c=t[2];let u=c,{toggleDrawer:d}=he(u,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([$1,P1,F1]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return B1(e.registerCommand(co,()=>{let h;return h=null,e.getEditorState().read(()=>{let g=U1();G1(g)&&(h=g)}),h&&d(),!0},W1))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],z1(a,p);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(O1,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==m?(f=M1(us.Fragment,{children:[xr(ot,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:l,schemaPathSuffix:"fields"}),xr(A1,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=u,t[13]=l,t[14]=m,t[15]=f):f=t[15],f};var eh=R({markdownTransformers:[Hl],nodes:[q1,X1,Q1],plugins:[{Component:ps,position:"normal"},{Component:es,position:"normal"},{Component:zl,position:"floatingAnchorElem"},{Component:cs,position:"floatingAnchorElem"}],providers:[ms],slashMenu:{groups:[q([{Icon:ir,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(co,{})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:ir,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(co,{})}}])]}});import{$isNodeSelection as vh}from"lexical";import{jsx as br,jsxs as th}from"react/jsx-runtime";import"react";var _r=()=>th("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[br("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),br("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),br("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as lh}from"react/jsx-runtime";import gs from"bson-objectid";import{$applyNodeReplacement as sh}from"lexical";import*as Cs from"react";import{jsx as oh}from"react/jsx-runtime";import{DecoratorBlockNode as rh}from"@lexical/react/LexicalDecoratorBlockNode.js";import fs from"bson-objectid";import{$applyNodeReplacement as nh}from"lexical";import"react";function Tr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function ih(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:hs({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Tr(e),null}var St=class extends rh{__data;constructor({data:e,format:o,key:r}){super(o,r),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:ih,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new fs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=hs({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return oh(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.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 hs({data:t}){return t?.id||(t.id=new fs.default().toHexString()),nh(new St({data:t}))}var ah=Cs.lazy(()=>import("./component-P5K7Z5NW.js").then(t=>({default:t.UploadComponent})));function ch(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:He({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Tr(e),null}var Se=class extends St{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:ch,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new gs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=He({data:o});return r.setFormat(e.format),r}decorate(){return lh(ah,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function He({data:t}){return t?.id||(t.id=new gs.default().toHexString()),sh(new Se({data:t}))}function wr(t){return t instanceof Se}import{c as Ch}from"react/compiler-runtime";import{jsx as xh}from"react/jsx-runtime";import{useLexicalComposerContext as bh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as _h,mergeRegister as Th}from"@lexical/utils";import{useConfig as wh}from"@payloadcms/ui";import{$getPreviousSelection as Eh,$getSelection as kh,$isParagraphNode as Nh,$isRangeSelection as Lh,COMMAND_PRIORITY_EDITOR as Sh,createCommand as Rh}from"lexical";import{useEffect as Ih}from"react";import{c as xs}from"react/compiler-runtime";import{jsx as Er}from"react/jsx-runtime";import{useLexicalComposerContext as bs}from"@lexical/react/LexicalComposerContext.js";import{toast as uh}from"@payloadcms/ui";import{$getNodeByKey as dh,COMMAND_PRIORITY_EDITOR as _s}from"lexical";import{useEffect as Ts,useState as mh}from"react";var ph=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=dh(o);n&&n.replace(He({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(kr,{fields:null,relationTo:e,value:r})},fh=t=>{let e=xs(13),{enabledCollectionSlugs:o}=t,[r]=bs(),[n,i]=mh(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:c,openListDrawer:u}=Tt(l),d,a;e[2]!==r||e[3]!==u?(d=()=>r.registerCommand(Ge,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),_s),a=[r,u],e[2]=r,e[3]=u,e[4]=d,e[5]=a):(d=e[4],a=e[5]),Ts(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:g,doc:b}=h;s(),ph({editor:r,relationTo:g,replaceNodeKey:n,value:b.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==c||e[11]!==m?(f=Er(c,{onSelect:m}),e[10]=c,e[11]=m,e[12]=f):f=e[12],f},hh=()=>{let t=xs(3),[e]=bs(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ge,gh,_s),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ts(o,r),null},ws=t=>Er(It,{...t,FallbackComponent:hh,uploads:!0,children:Er(fh,{...t})});function gh(){return uh.error("No upload collections enabled"),!0}var kr=Rh("INSERT_UPLOAD_COMMAND"),Es=t=>{let e=Ch(5),[o]=bh(),{config:r}=wh(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Se]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Th(o.registerCommand(kr,c=>(o.update(()=>{let u=kh()||Eh();if(Lh(u)){let d=He({data:{id:c.id,fields:c.fields,relationTo:c.relationTo,value:c.value}});_h(d);let{focus:a}=u,p=a.getNode();Nh(p)&&!p.__first&&(p.__prev||p.__next)&&p.remove()}}),!0),Sh))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Ih(i,l);let s;return e[3]!==n?(s=xh(ws,{enabledCollectionSlugs:n.map(yh)}),e[3]=n,e[4]=s):s=e[4],s};function yh(t){let{slug:e}=t;return e}var Mh=R({nodes:[Se],plugins:[{Component:Es,position:"normal"}],slashMenu:{groups:[q([{Icon:_r,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:_r,isActive:({selection:t})=>{if(!vh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]}});import{c as Dh}from"react/compiler-runtime";import{jsx as Lr}from"react/jsx-runtime";import{ShimmerEffect as Ah,useConfig as Oh}from"@payloadcms/ui";import{lazy as Fh,Suspense as $h,useEffect as Ph,useState as Bh}from"react";var ks={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",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",inlineImage:"LexicalEditor__inline-image",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",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",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:"editor-upload"};var uo={namespace:"lexical",theme:ks};function Ns({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:i}){for(let u of i.features)if(!u?.clientFeatureProps?.featureKey||u?.clientFeatureProps?.order===void 0||u?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");i.features=i.features.sort((u,d)=>u.clientFeatureProps.order-d.clientFeatureProps.order);let l=new Map;for(let u of i.features)l.set(u.clientFeatureProps.featureKey,u);let s=new Map,c=0;for(let u of i.features){let d=typeof u.feature=="function"?u.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:l,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:i}):u.feature;d.key=u.clientFeatureProps.featureKey,d.order=c,s.set(u.clientFeatureProps.featureKey,d),c++}return s}var Ls=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function Nr(t,e,o){return{admin:o,features:Ls(t),lexical:e,resolvedFeatureMap:t}}var Hh=Fh(()=>import("./Field-FLAQN6LU.js").then(t=>({default:t.RichText}))),jh=t=>{let e=Dh(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:i,field:l,lexicalEditorConfig:s,schemaPath:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let d=u,a=s===void 0?uo:s,{config:p}=Oh(),[m,f]=Bh(null),h,g;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==m||e[9]!==a||e[10]!==c?(h=()=>{if(m)return;let S=[];for(let[T,C]of Object.entries(r))C.clientFeatureProvider&&S.push(C.clientFeatureProvider(C.clientFeatureProps));let I=a||uo,_=Ns({config:p,featureClientImportMap:n,featureClientSchemaMap:i,field:l,schemaPath:c??l.name,unSanitizedEditorConfig:{features:S,lexical:I}});f(Nr(_,I,d))},g=[a,d,m,r,n,i,l,p,c],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=i,e[7]=l,e[8]=m,e[9]=a,e[10]=c,e[11]=h,e[12]=g):(h=e[11],g=e[12]),Ph(h,g);let b;return e[13]!==m||e[14]!==t?(b=Lr($h,{fallback:Lr(Ah,{height:"35vh"}),children:m&&Lr(Hh,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=b):b=e[15],b};function Uh(t){return t instanceof HTMLElement}function Gh(...t){return t.filter(Boolean).join(" ")}var mo=new WeakMap;function Ss(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function po(t,e){let o=mo.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=Ss(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let c=Ss(l);for(let u of r)c!==null&&u([c[0]-s[0],c[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},mo.set(t,o)}return o.listeners.add(e),()=>{Wh(t,e)}}function Wh(t,e){let o=mo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(mo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Vh(t,e){return po(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function Kh(t,e){return po(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function Zh(t,e){return po(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function zh(t,e){return po(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}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},Yh=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,Jh="\xA0",Xh=`
39
39
 
40
- `,vs="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Ms="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",tg=new RegExp("^[^"+Ms+"]*["+vs+"]"),og=new RegExp("^[^"+vs+"]*["+Ms+"]"),rg={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},ng={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},ig={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},lg={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},sg={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},ag={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};import{c as cg}from"react/compiler-runtime";import{jsx as ug}from"react/jsx-runtime";import"react";var dg=()=>{let t=cg(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?ug(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as mg}from"react/compiler-runtime";import{jsx as pg}from"react/jsx-runtime";import"react";var fg=()=>{let t=mg(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?pg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as hg}from"react/compiler-runtime";import{jsx as gg}from"react/jsx-runtime";import"react";var Cg=()=>{let t=hg(2),{Label:e}=ge(),o;return t[0]!==e?(o=e?gg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as xg}from"react/compiler-runtime";import{jsx as bg}from"react/jsx-runtime";import"react";var _g=t=>{let e=xg(3),{children:o}=t,{InlineBlockContainer:r}=ge(),n;return e[0]!==r||e[1]!==o?(n=r?bg(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Tg}from"react/compiler-runtime";import{jsx as wg}from"react/jsx-runtime";import"react";var Eg=t=>{let e=Tg(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=De(),s;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(s=l?wg(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=s):s=e[5],s};import{c as kg}from"react/compiler-runtime";import{jsx as Ng}from"react/jsx-runtime";import"react";var Lg=()=>{let t=kg(2),{EditButton:e}=De(),o;return t[0]!==e?(o=e?Ng(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Sg}from"react/compiler-runtime";import{jsx as Rg}from"react/jsx-runtime";import"react";var Ig=()=>{let t=Sg(2),{RemoveButton:e}=De(),o;return t[0]!==e?(o=e?Rg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as yg}from"qs-esm";var vg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:i,collectionSlug:l,select:s})=>{let c=yg({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${l}/${i}${c}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};export{pt as $createAutoLinkNode,Bt as $createBlockNode,ho as $createInlineBlockNode,be as $createLinkNode,Pe as $createRelationshipNode,He as $createUploadNode,Te as $isAutoLinkNode,ct as $isBlockNode,go as $isInlineBlockNode,Y as $isLinkNode,Jo as $isRelationshipNode,wr as $isUploadNode,Ks as AlignFeatureClient,_e as AutoLinkNode,Eg as BlockCollapsible,Lg as BlockEditButton,Ce as BlockNode,Ig as BlockRemoveButton,Xs as BlockquoteFeatureClient,za as BlocksFeatureClient,hc as BoldFeatureClient,Os as CAN_USE_DOM,sm as ChecklistFeatureClient,ng as DETAIL_TYPE_TO_DETAIL,eg as DOUBLE_LINE_BREAK,lg as ELEMENT_FORMAT_TO_TYPE,ig as ELEMENT_TYPE_TO_FORMAT,Bs as ENABLE_SLASH_MENU_COMMAND,As as EditorConfigProvider,ot as FieldsDrawer,qp as FixedToolbarFeatureClient,Xc as HeadingFeatureClient,fu as HorizontalRuleFeatureClient,We as INSERT_BLOCK_COMMAND,Ve as INSERT_INLINE_BLOCK_COMMAND,qh as IS_ALL_FORMATTING,Du as IndentFeatureClient,_g as InlineBlockContainer,dg as InlineBlockEditButton,Cg as InlineBlockLabel,fo as InlineBlockNode,fg as InlineBlockRemoveButton,_c as InlineCodeFeatureClient,uf as InlineToolbarFeatureClient,kc as ItalicFeatureClient,og as LTR_REGEX,Im as LexicalPluginToLexicalFeatureClient,Kd as LinkFeatureClient,ie as LinkNode,Qh as NON_BREAKING_SPACE,F as NodeFormat,hm as OrderedListFeatureClient,$m as ParagraphFeatureClient,$s as Point,tg as RTL_REGEX,Hs as Rect,wp as RelationshipFeatureClient,Ee as RelationshipNode,Wh as RichTextField,Om as SlateToLexicalFeatureClient,Ic as StrikethroughFeatureClient,Dc as SubscriptFeatureClient,$c as SuperscriptFeatureClient,sg as TEXT_MODE_TO_TYPE,rg as TEXT_TYPE_TO_FORMAT,ag as TEXT_TYPE_TO_MODE,pe as TOGGLE_LINK_COMMAND,rh as TableFeatureClient,lc as TestRecorderFeatureClient,wt as ToolbarButton,Be as ToolbarDropdown,dc as TreeViewFeatureClient,Uc as UnderlineFeatureClient,Em as UnorderedListFeatureClient,Oh as UploadFeatureClient,Se as UploadNode,Xh as addSwipeDownListener,zh as addSwipeLeftListener,Yh as addSwipeRightListener,Jh as addSwipeUpListener,vo as createBlockNode,R as createClientFeature,uo as defaultEditorLexicalConfig,nr as getDOMRangeRect,js as getEnabledNodes,vg as getRestPopulateFn,Ke as getSelectedNode,Vh as isHTMLElement,Ps as isPoint,Kh as joinClasses,Nr as sanitizeClientEditorConfig,Is as sanitizeClientFeatures,eo as setFloatingElemPosition,Zt as setFloatingElemPositionForLinkEditor,Q as slashMenuBasicGroupWithItems,xe as toolbarAddDropdownGroupWithItems,Do as toolbarFeatureButtonsGroupWithItems,ee as toolbarFormatGroupWithItems,ne as toolbarTextDropdownGroupWithItems,De as useBlockComponentContext,H as useEditorConfigContext,ge as useInlineBlockComponentContext,Fs as useLexicalDocumentDrawer,he as useLexicalDrawer,Tt as useLexicalListDrawer};
40
+ `,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",qh=new RegExp("^[^"+Is+"]*["+Rs+"]"),Qh=new RegExp("^[^"+Rs+"]*["+Is+"]"),eg={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},tg={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},og={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},rg={[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"},ng={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},ig={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};import{c as lg}from"react/compiler-runtime";import{jsx as sg}from"react/jsx-runtime";import"react";var ag=()=>{let t=lg(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?sg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as cg}from"react/compiler-runtime";import{jsx as ug}from"react/jsx-runtime";import"react";var dg=()=>{let t=cg(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?ug(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as mg}from"react/compiler-runtime";import{jsx as pg}from"react/jsx-runtime";import"react";var fg=()=>{let t=mg(2),{Label:e}=ge(),o;return t[0]!==e?(o=e?pg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as hg}from"react/compiler-runtime";import{jsx as gg}from"react/jsx-runtime";import"react";var Cg=t=>{let e=hg(3),{children:o}=t,{InlineBlockContainer:r}=ge(),n;return e[0]!==r||e[1]!==o?(n=r?gg(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as xg}from"react/compiler-runtime";import{jsx as bg}from"react/jsx-runtime";import"react";var _g=t=>{let e=xg(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=De(),s;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(s=l?bg(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=s):s=e[5],s};import{c as Tg}from"react/compiler-runtime";import{jsx as wg}from"react/jsx-runtime";import"react";var Eg=()=>{let t=Tg(2),{EditButton:e}=De(),o;return t[0]!==e?(o=e?wg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as kg}from"react/compiler-runtime";import{jsx as Ng}from"react/jsx-runtime";import"react";var Lg=()=>{let t=kg(2),{RemoveButton:e}=De(),o;return t[0]!==e?(o=e?Ng(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Sg}from"qs-esm";var Rg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:i,collectionSlug:l,select:s})=>{let c=Sg({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${l}/${i}${c}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};export{pt as $createAutoLinkNode,Bt as $createBlockNode,ho as $createInlineBlockNode,be as $createLinkNode,Pe as $createRelationshipNode,He as $createUploadNode,Te as $isAutoLinkNode,ct as $isBlockNode,go as $isInlineBlockNode,Y as $isLinkNode,Jo as $isRelationshipNode,wr as $isUploadNode,Gs as AlignFeatureClient,_e as AutoLinkNode,_g as BlockCollapsible,Eg as BlockEditButton,Ce as BlockNode,Lg as BlockRemoveButton,zs as BlockquoteFeatureClient,Va as BlocksFeatureClient,mc as BoldFeatureClient,Ms as CAN_USE_DOM,nm as ChecklistFeatureClient,tg as DETAIL_TYPE_TO_DETAIL,Xh as DOUBLE_LINE_BREAK,rg as ELEMENT_FORMAT_TO_TYPE,og as ELEMENT_TYPE_TO_FORMAT,Fs as ENABLE_SLASH_MENU_COMMAND,vs as EditorConfigProvider,ot as FieldsDrawer,Yp as FixedToolbarFeatureClient,zc as HeadingFeatureClient,du as HorizontalRuleFeatureClient,We as INSERT_BLOCK_COMMAND,Ve as INSERT_INLINE_BLOCK_COMMAND,Yh as IS_ALL_FORMATTING,yu as IndentFeatureClient,Cg as InlineBlockContainer,ag as InlineBlockEditButton,fg as InlineBlockLabel,fo as InlineBlockNode,dg as InlineBlockRemoveButton,Cc as InlineCodeFeatureClient,sf as InlineToolbarFeatureClient,Tc as ItalicFeatureClient,Qh as LTR_REGEX,Lm as LexicalPluginToLexicalFeatureClient,Gd as LinkFeatureClient,ie as LinkNode,Jh as NON_BREAKING_SPACE,O as NodeFormat,mm as OrderedListFeatureClient,Am as ParagraphFeatureClient,As as Point,qh as RTL_REGEX,$s as Rect,bp as RelationshipFeatureClient,Ee as RelationshipNode,jh as RichTextField,Mm as SlateToLexicalFeatureClient,Lc as StrikethroughFeatureClient,yc as SubscriptFeatureClient,Ac as SuperscriptFeatureClient,ng as TEXT_MODE_TO_TYPE,eg as TEXT_TYPE_TO_FORMAT,ig as TEXT_TYPE_TO_MODE,pe as TOGGLE_LINK_COMMAND,eh as TableFeatureClient,rc as TestRecorderFeatureClient,wt as ToolbarButton,Be as ToolbarDropdown,ac as TreeViewFeatureClient,Bc as UnderlineFeatureClient,_m as UnorderedListFeatureClient,Mh as UploadFeatureClient,Se as UploadNode,zh as addSwipeDownListener,Vh as addSwipeLeftListener,Kh as addSwipeRightListener,Zh as addSwipeUpListener,vo as createBlockNode,R as createClientFeature,uo as defaultEditorLexicalConfig,nr as getDOMRangeRect,Ps as getEnabledNodes,Rg as getRestPopulateFn,Ke as getSelectedNode,Uh as isHTMLElement,Os as isPoint,Gh as joinClasses,Nr as sanitizeClientEditorConfig,Ls as sanitizeClientFeatures,eo as setFloatingElemPosition,Zt as setFloatingElemPositionForLinkEditor,q as slashMenuBasicGroupWithItems,xe as toolbarAddDropdownGroupWithItems,Do as toolbarFeatureButtonsGroupWithItems,Q as toolbarFormatGroupWithItems,ne as toolbarTextDropdownGroupWithItems,De as useBlockComponentContext,H as useEditorConfigContext,ge as useInlineBlockComponentContext,Ds as useLexicalDocumentDrawer,he as useLexicalDrawer,Tt as useLexicalListDrawer};
41
41
  //# sourceMappingURL=index.js.map