@payloadcms/richtext-lexical 4.0.0-internal.c3ac604 → 4.0.0-internal.cb69780

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 (341) hide show
  1. package/dist/exports/client/Field-TS5CRYHE.js +2 -0
  2. package/dist/exports/client/Field-TS5CRYHE.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  5. package/dist/exports/client/{chunk-SSMQFWCQ.js.map → chunk-3LRZDIIG.js.map} +4 -4
  6. package/dist/exports/client/{chunk-ESITTE3C.js → chunk-ZFGDYZDE.js} +2 -2
  7. package/dist/exports/client/{chunk-ESITTE3C.js.map → chunk-ZFGDYZDE.js.map} +2 -2
  8. package/dist/exports/client/componentInline-55HZXGUS.js +2 -0
  9. package/dist/exports/client/index.d.ts +1 -1
  10. package/dist/exports/client/index.d.ts.map +1 -1
  11. package/dist/exports/client/index.js +26 -26
  12. package/dist/exports/client/index.js.map +4 -4
  13. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  14. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  15. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  16. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  17. package/dist/features/blocks/client/component/index.d.ts +0 -6
  18. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  19. package/dist/features/blocks/client/component/index.js +133 -76
  20. package/dist/features/blocks/client/component/index.js.map +1 -1
  21. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  22. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  23. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  24. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  25. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  26. package/dist/features/blocks/client/componentInline/index.js +2 -2
  27. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  28. package/dist/features/blocks/server/index.js +2 -2
  29. package/dist/features/blocks/server/index.js.map +1 -1
  30. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  31. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  32. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  33. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  34. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  35. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  36. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  37. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  38. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  39. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  40. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  41. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  42. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  43. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  44. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  45. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  46. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  47. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  48. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  49. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  50. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  51. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  52. package/dist/features/heading/constants.d.ts +2 -0
  53. package/dist/features/heading/constants.d.ts.map +1 -0
  54. package/dist/features/heading/constants.js +2 -0
  55. package/dist/features/heading/constants.js.map +1 -0
  56. package/dist/features/heading/server/index.d.ts.map +1 -1
  57. package/dist/features/heading/server/index.js +5 -1
  58. package/dist/features/heading/server/index.js.map +1 -1
  59. package/dist/features/heading/server/validate.d.ts +6 -0
  60. package/dist/features/heading/server/validate.d.ts.map +1 -0
  61. package/dist/features/heading/server/validate.js +15 -0
  62. package/dist/features/heading/server/validate.js.map +1 -0
  63. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  64. package/dist/features/indent/client/IndentPlugin.js +122 -1
  65. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  66. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  67. package/dist/features/indent/server/i18n.js +74 -37
  68. package/dist/features/indent/server/i18n.js.map +1 -1
  69. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  70. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +6 -3
  71. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  72. package/dist/features/link/server/index.js +2 -2
  73. package/dist/features/link/server/index.js.map +1 -1
  74. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  75. package/dist/features/lists/checklist/server/index.js +5 -2
  76. package/dist/features/lists/checklist/server/index.js.map +1 -1
  77. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  78. package/dist/features/lists/orderedList/server/index.js +5 -2
  79. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  80. package/dist/features/lists/shared/constants.d.ts +2 -0
  81. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  82. package/dist/features/lists/shared/constants.js +2 -0
  83. package/dist/features/lists/shared/constants.js.map +1 -0
  84. package/dist/features/lists/shared/validate.d.ts +5 -0
  85. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  86. package/dist/features/lists/shared/validate.js +15 -0
  87. package/dist/features/lists/shared/validate.js.map +1 -0
  88. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  89. package/dist/features/lists/unorderedList/server/index.js +5 -2
  90. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  91. package/dist/features/relationship/client/index.d.ts +2 -2
  92. package/dist/features/relationship/client/index.d.ts.map +1 -1
  93. package/dist/features/relationship/client/index.js.map +1 -1
  94. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  95. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  96. package/dist/features/relationship/client/plugins/index.js +27 -31
  97. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  98. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  99. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  100. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  101. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  102. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  103. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  104. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  105. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  106. package/dist/features/relationship/server/index.d.ts +8 -1
  107. package/dist/features/relationship/server/index.d.ts.map +1 -1
  108. package/dist/features/relationship/server/index.js +28 -11
  109. package/dist/features/relationship/server/index.js.map +1 -1
  110. package/dist/features/relationship/server/schema.d.ts +2 -2
  111. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  112. package/dist/features/relationship/server/schema.js +5 -10
  113. package/dist/features/relationship/server/schema.js.map +1 -1
  114. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  115. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  116. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  117. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  118. package/dist/features/table/client/index.d.ts.map +1 -0
  119. package/dist/features/table/client/index.js.map +1 -0
  120. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  121. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  122. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  123. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  124. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  125. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
  126. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  127. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  128. package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +41 -18
  129. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  130. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  131. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  132. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  133. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  134. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  135. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  136. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  137. package/dist/features/table/client/utils/debounce.js.map +1 -0
  138. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  139. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  140. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  141. package/dist/features/table/markdownTransformer.js.map +1 -0
  142. package/dist/features/table/server/index.d.ts +3 -0
  143. package/dist/features/table/server/index.d.ts.map +1 -0
  144. package/dist/features/{experimental_table → table}/server/index.js +4 -4
  145. package/dist/features/table/server/index.js.map +1 -0
  146. package/dist/features/table/server/schema.d.ts.map +1 -0
  147. package/dist/features/table/server/schema.js.map +1 -0
  148. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  149. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  150. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  151. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  152. package/dist/features/toolbars/fixed/client/Toolbar/index.css +77 -3
  153. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  154. package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
  155. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  156. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  157. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  158. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  159. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  160. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  161. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  162. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -11
  163. package/dist/features/typesServer.d.ts +1 -1
  164. package/dist/features/typesServer.d.ts.map +1 -1
  165. package/dist/features/typesServer.js.map +1 -1
  166. package/dist/features/upload/client/index.d.ts +3 -2
  167. package/dist/features/upload/client/index.d.ts.map +1 -1
  168. package/dist/features/upload/client/index.js.map +1 -1
  169. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  170. package/dist/features/upload/client/plugin/index.js +47 -52
  171. package/dist/features/upload/client/plugin/index.js.map +1 -1
  172. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  173. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  174. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  175. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  176. package/dist/features/upload/server/index.d.ts +6 -2
  177. package/dist/features/upload/server/index.d.ts.map +1 -1
  178. package/dist/features/upload/server/index.js +20 -16
  179. package/dist/features/upload/server/index.js.map +1 -1
  180. package/dist/features/upload/server/schema.d.ts +2 -2
  181. package/dist/features/upload/server/schema.d.ts.map +1 -1
  182. package/dist/features/upload/server/schema.js +4 -8
  183. package/dist/features/upload/server/schema.js.map +1 -1
  184. package/dist/features/upload/server/validate.d.ts +2 -2
  185. package/dist/features/upload/server/validate.d.ts.map +1 -1
  186. package/dist/features/upload/server/validate.js +3 -0
  187. package/dist/features/upload/server/validate.js.map +1 -1
  188. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  189. package/dist/field/Diff/converters/listitem/index.js +2 -1
  190. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  191. package/dist/field/Diff/index.d.ts +3 -2
  192. package/dist/field/Diff/index.d.ts.map +1 -1
  193. package/dist/field/Diff/index.js +1 -0
  194. package/dist/field/Diff/index.js.map +1 -1
  195. package/dist/field/RenderLexical/index.d.ts +3 -1
  196. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  197. package/dist/field/RenderLexical/index.js +23 -23
  198. package/dist/field/RenderLexical/index.js.map +1 -1
  199. package/dist/field/ViewSelector.d.ts.map +1 -1
  200. package/dist/field/ViewSelector.js +1 -0
  201. package/dist/field/ViewSelector.js.map +1 -1
  202. package/dist/field/bundled.css +1 -1
  203. package/dist/field/index.css +10 -10
  204. package/dist/i18n.d.ts.map +1 -1
  205. package/dist/i18n.js +68 -0
  206. package/dist/i18n.js.map +1 -1
  207. package/dist/index.d.ts +2 -2
  208. package/dist/index.d.ts.map +1 -1
  209. package/dist/index.js +5 -5
  210. package/dist/index.js.map +1 -1
  211. package/dist/lexical/LexicalEditor.css +20 -9
  212. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  213. package/dist/lexical/LexicalEditor.js +61 -64
  214. package/dist/lexical/LexicalEditor.js.map +1 -1
  215. package/dist/lexical/config/server/loader.d.ts +1 -1
  216. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  217. package/dist/lexical/config/server/loader.js +2 -2
  218. package/dist/lexical/config/server/loader.js.map +1 -1
  219. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  220. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  221. package/dist/lexical/config/server/sanitize.js +2 -2
  222. package/dist/lexical/config/server/sanitize.js.map +1 -1
  223. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +18 -24
  224. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  225. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  226. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  227. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -1
  228. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  229. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  230. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  231. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  232. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +1 -0
  233. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  234. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
  235. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  236. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  237. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  238. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  239. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  240. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  241. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  242. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  243. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  244. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  245. package/dist/lexical/ui/ContentEditable.js +9 -6
  246. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  247. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  248. package/dist/lexical/ui/icons/H3/index.js +13 -6
  249. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  250. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  251. package/dist/lexical/ui/icons/H4/index.js +13 -6
  252. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  253. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  254. package/dist/lexical/ui/icons/H5/index.js +13 -6
  255. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  256. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  257. package/dist/lexical/ui/icons/H6/index.js +13 -6
  258. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  259. package/dist/types/index.d.ts +1 -1
  260. package/dist/types/index.d.ts.map +1 -1
  261. package/dist/types/index.js.map +1 -1
  262. package/dist/types/nodeTypes.d.ts +1 -1
  263. package/dist/types/nodeTypes.d.ts.map +1 -1
  264. package/dist/types/nodeTypes.js.map +1 -1
  265. package/dist/utilities/createServerFeature.d.ts +1 -1
  266. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  267. package/dist/utilities/createServerFeature.js +2 -2
  268. package/dist/utilities/createServerFeature.js.map +1 -1
  269. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  270. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  271. package/dist/utilities/editorConfigFactory.js +9 -9
  272. package/dist/utilities/editorConfigFactory.js.map +1 -1
  273. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  274. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  275. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  276. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  277. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  278. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  279. package/package.json +22 -22
  280. package/dist/dependencyChecker.spec.js +0 -16
  281. package/dist/dependencyChecker.spec.js.map +0 -1
  282. package/dist/exports/client/Field-IZKDIUJY.js +0 -2
  283. package/dist/exports/client/Field-IZKDIUJY.js.map +0 -7
  284. package/dist/exports/client/chunk-SSMQFWCQ.js +0 -2
  285. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  286. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  287. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  288. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  289. package/dist/features/experimental_table/client/index.js.map +0 -1
  290. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  291. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  292. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  293. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  294. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  295. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  296. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  297. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  298. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  299. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  300. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  301. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  302. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  303. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  304. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  305. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  306. package/dist/features/experimental_table/server/index.d.ts +0 -3
  307. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  308. package/dist/features/experimental_table/server/index.js.map +0 -1
  309. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  310. package/dist/features/experimental_table/server/schema.js.map +0 -1
  311. package/dist/features/link/markdownTransformer.spec.js +0 -195
  312. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  313. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  314. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  315. package/dist/lexical/utils/url.spec.js +0 -114
  316. package/dist/lexical/utils/url.spec.js.map +0 -1
  317. package/dist/utilities/jsx/jsx.spec.js +0 -178
  318. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  319. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-55HZXGUS.js.map} +0 -0
  320. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  321. /package/dist/features/{experimental_table → table}/client/index.js +0 -0
  322. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -0
  323. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  324. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  325. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  326. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  327. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  328. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -0
  329. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  330. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  331. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  332. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  333. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  334. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  335. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  336. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  337. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  338. /package/dist/features/{experimental_table → table}/markdownTransformer.d.ts +0 -0
  339. /package/dist/features/{experimental_table → table}/markdownTransformer.js +0 -0
  340. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  341. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -1,26 +1,26 @@
1
- "use client";import{a as Ce,c as Ct,d as xt,e as bt}from"./chunk-ESITTE3C.js";import{a as Ye}from"./chunk-DBWINSQN.js";import{a as $o,b as qe,c as Qe,d as ye,e as et}from"./chunk-43E5QYAA.js";import{a as pr,b as fr,c as De}from"./chunk-5VIL27GI.js";import{a as jc}from"./chunk-WSAPGI3Z.js";import{a as se,b as hr,c as Do,d as Oo,e as Hc,f as Gc,h as Uc,j as Vc,m as zc}from"./chunk-SSMQFWCQ.js";import{a as Pc,b as U}from"./chunk-RJ5MAOKZ.js";function J(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Zc}from"react/compiler-runtime";import{useLexicalComposerContext as Yc}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as xe}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as qc}from"@lexical/utils";import{$getSelection as Qc,$isElementNode as me,$isNodeSelection as eu,$isRangeSelection as kt,COMMAND_PRIORITY_LOW as tu,FORMAT_ELEMENT_COMMAND as _t}from"lexical";import{useEffect as ou}from"react";import{jsx as gr}from"react/jsx-runtime";import"react";var Wc="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m3 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 15a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Cr=({className:t})=>gr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:gr("path",{clipRule:"evenodd",d:Wc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as xr}from"react/jsx-runtime";import"react";var Kc="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",br=({className:t})=>xr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:xr("path",{clipRule:"evenodd",d:Kc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as kr}from"react/jsx-runtime";import"react";var Xc="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Gt=({className:t})=>kr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:kr("path",{clipRule:"evenodd",d:Xc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as _r}from"react/jsx-runtime";import"react";var Jc="M19 7.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5m0 4a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 .5-.5m-.5 3.5a.5.5 0 0 1 0 1h-9a.5.5 0 0 1 0-1z",Tr=({className:t})=>_r("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:_r("path",{clipRule:"evenodd",d:Jc,fill:"currentColor",fillRule:"evenodd"})});var A=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a})=>{let m=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,props:o,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var wr=t=>({type:"dropdown",ChildComponent:Gt,iconOnly:!0,items:t,key:"align",order:30});var ve=t=>me(t)?t.getFormatType():t.__format,Er=[wr([{ChildComponent:Gt,isActive:({selection:t})=>{if(!kt(t))return!1;for(let e of t.getNodes()){if((me(e)||xe(e))&&ve(e)==="left")continue;let o=e.getParent();if(!((me(o)||xe(o))&&ve(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(_t,"left")},order:1},{ChildComponent:Cr,isActive:({selection:t})=>{if(!kt(t))return!1;for(let e of t.getNodes()){if((me(e)||xe(e))&&ve(e)==="center")continue;let o=e.getParent();if(!((me(o)||xe(o))&&ve(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(_t,"center")},order:2},{ChildComponent:Tr,isActive:({selection:t})=>{if(!kt(t))return!1;for(let e of t.getNodes()){if((me(e)||xe(e))&&ve(e)==="right")continue;let o=e.getParent();if(!((me(o)||xe(o))&&ve(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(_t,"right")},order:3},{ChildComponent:br,isActive:({selection:t})=>{if(!kt(t))return!1;for(let e of t.getNodes()){if((me(e)||xe(e))&&ve(e)==="justify")continue;let o=e.getParent();if(!((me(o)||xe(o))&&ve(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(_t,"justify")},order:4}])],nu=()=>{let t=Zc(3),[e]=Yc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(_t,iu,tu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ou(o,n),null},ru=A({plugins:[{Component:nu,position:"normal"}],toolbarFixed:{groups:Er},toolbarInline:{groups:Er}});function lu(t){return(me(t)||xe(t))&&!t.isInline()}function iu(t){let e=Qc();if(!kt(e)&&!eu(e))return!1;let o=e.getNodes();for(let n of o){let r=qc(n,lu);r!==null&&r.setFormat(t)}return!0}import{QUOTE as cu}from"@lexical/markdown";import{$createQuoteNode as yr,$isQuoteNode as Lr,QuoteNode as uu}from"@lexical/rich-text";import{$setBlocksType as vr}from"@lexical/selection";import{$getSelection as Ir,$isRangeSelection as du}from"lexical";import{jsx as Sr}from"react/jsx-runtime";import"react";var su="M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",Fo=({className:t})=>Sr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Sr("path",{d:su,fill:"currentColor"})});import{jsx as Nr}from"react/jsx-runtime";import"react";var au={16:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-1 0V4H8.5v8h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1V4H4v1a.5.5 0 0 1-1 0z",24:"M6 6.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V9a.5.5 0 0 1-1 0V7h-4.5v10h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2V7H7v2a.5.5 0 0 1-1 0z"},Tt=({className:t,size:e=24})=>Nr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Nr("path",{clipRule:"evenodd",d:au[e],fill:"currentColor",fillRule:"evenodd"})});var te=t=>({type:"dropdown",ChildComponent:Tt,items:t,key:"text",order:25});var Rr=[te([{ChildComponent:Fo,isActive:({selection:t})=>{if(!du(t))return!1;for(let e of t.getNodes())if(!Lr(e)&&!Lr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ir();vr(e,()=>yr())})},order:20}])],mu=A({markdownTransformers:[cu],nodes:[uu],slashMenu:{groups:[J([{Icon:Fo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ir();vr(e,()=>yr())})}}])]},toolbarFixed:{groups:Rr},toolbarInline:{groups:Rr}});import{getTranslation as Yt}from"@payloadcms/translations";import{jsx as Mr}from"react/jsx-runtime";import"react";var pu="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",Bo=({className:t})=>Mr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Mr("path",{d:pu,fill:"currentColor"})});import{jsx as Ar}from"react/jsx-runtime";import"react";var fu="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Po=({className:t})=>Ar("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ar("path",{clipRule:"evenodd",d:fu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as hu}from"react/jsx-runtime";import"react";function $r(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let u=i??"Block Image";return()=>hu("img",{alt:u,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as qr}from"lexical";import{JSOX as jo}from"jsox";function Ut({propsString:t}){let e={},o="",n=!0;for(let r=0;r<t.length;r++){let l=t[r];if(n)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):n=!1):o+=l;else{let s=gu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function gu(t,e){let o=t[e];return o==='"'?Dr(t,e):o==="'"?Dr(t,e,!0):o==="{"?xu(t,e):o==="["?Cu(t,e):ku(t,e)}function Cu(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="["?o++:t[r]==="]"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:jo.parse(`[${n}]`)}}function Dr(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function xu(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:bu(n)}}function bu(t){return t[0]!=="{"?jo.parse(t):jo.parse(t.replace(/(\w+):/g,'"$1":'))}function ku(t,e){let o="",n=e;for(;n<t.length&&t[n]!==" ";)o+=t[n],n++;return{newIndex:n-1,value:o}}function wt({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${_u(n)}"`):typeof n=="number"?e.push(`${o}={${n}}`):typeof n=="boolean"?n&&e.push(`${o}`):n!==null&&typeof n=="object"&&(Array.isArray(n)?e.push(`${o}={[${n.map(r=>JSON.stringify(r,Or)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Or)}}`));return e.join(" ")}function _u(t){return t.replace(/"/g,"&quot;")}function Or(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Vt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",u=e.slice(n),d=!1,c=0,a=0,m=null,p=!1,h=0,f=u[0].slice(0,r.index),g=0,_=n;e:for(let[v,b]of u.entries()){let C=l?b.trim():b,x=0;if(l)for(let T=0;T<b.length&&b[T]===" ";T++)x++;let k=0;for(v===0&&(k=(r.index??0)+r[0].length-x);k<C.length;){let T=C[k],I=C[k+1];if(d){if(T==="`"&&h++,h%2===0)if(T==="<"&&I==="/"){if(c--,c<0){i[i.length-1]===`
2
- `&&(i=i.slice(0,-1)),_=v;for(let N=k;N<C.length;N++)if(C[N]===">"){g=N+1;break}break e}}else if(T==="/"&&I===">"){if(c--,c<0){i[i.length-1]===`
3
- `&&(i=i.slice(0,-1)),_=v,g=k+2;break e}}else T==="<"&&I!=="/"&&c++;i+=T}else{if(T==="{"&&!m?a++:T==="}"&&!m?a--:(T==='"'||T==="'")&&!m?m=T:T===m&&(m=null),T==="/"&&I===">"&&a===0&&!m){p=!0,_=v,g=k+2;break e}else if(T===">"&&a===0&&!m){d=!0,k++;continue}s+=T}k++}if(d?i?.length>0&&v>0&&(i+=`
1
+ "use client";import{a as xe,c as bt,d as kt,e as _t}from"./chunk-ZFGDYZDE.js";import{a as qe}from"./chunk-DBWINSQN.js";import{a as Ho,b as Qe,c as et,d as ye,e as tt}from"./chunk-43E5QYAA.js";import{a as Nr,b as Lr,c as $e}from"./chunk-5VIL27GI.js";import{a as au}from"./chunk-WSAPGI3Z.js";import{a as se,b as yr,c as Rr,d as Go,e as Uo,f as cu,g as uu,i as du,k as mu,n as fu}from"./chunk-3LRZDIIG.js";import{a as su,b as W}from"./chunk-RJ5MAOKZ.js";function Q(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Cu}from"react/compiler-runtime";import{useLexicalComposerContext as bu}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as Ce}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as ku}from"@lexical/utils";import{$getSelection as _u,$isElementNode as pe,$isNodeSelection as Tu,$isRangeSelection as Tt,COMMAND_PRIORITY_LOW as Eu,FORMAT_ELEMENT_COMMAND as Et}from"lexical";import{useEffect as wu}from"react";import{jsx as vr}from"react/jsx-runtime";import"react";var pu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m3 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 15a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Ir=({className:t})=>vr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:vr("path",{clipRule:"evenodd",d:pu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Mr}from"react/jsx-runtime";import"react";var hu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Ar=({className:t})=>Mr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Mr("path",{clipRule:"evenodd",d:hu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Dr}from"react/jsx-runtime";import"react";var gu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",zt=({className:t})=>Dr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Dr("path",{clipRule:"evenodd",d:gu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as $r}from"react/jsx-runtime";import"react";var xu="M19 7.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5m0 4a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 .5-.5m-.5 3.5a.5.5 0 0 1 0 1h-9a.5.5 0 0 1 0-1z",Or=({className:t})=>$r("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:$r("path",{clipRule:"evenodd",d:xu,fill:"currentColor",fillRule:"evenodd"})});var A=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a})=>{let m=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,props:o,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Fr=t=>({type:"dropdown",ChildComponent:zt,iconOnly:!0,items:t,key:"align",order:30});var Re=t=>pe(t)?t.getFormatType():t.__format,Pr=[Fr([{ChildComponent:zt,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||Ce(e))&&Re(e)==="left")continue;let o=e.getParent();if(!((pe(o)||Ce(o))&&Re(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"left")},order:1},{ChildComponent:Ir,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||Ce(e))&&Re(e)==="center")continue;let o=e.getParent();if(!((pe(o)||Ce(o))&&Re(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"center")},order:2},{ChildComponent:Or,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||Ce(e))&&Re(e)==="right")continue;let o=e.getParent();if(!((pe(o)||Ce(o))&&Re(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"right")},order:3},{ChildComponent:Ar,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||Ce(e))&&Re(e)==="justify")continue;let o=e.getParent();if(!((pe(o)||Ce(o))&&Re(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"justify")},order:4}])],Su=()=>{let t=Cu(3),[e]=bu(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Et,yu,Eu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),wu(o,n),null},Nu=A({plugins:[{Component:Su,position:"normal"}],toolbarFixed:{groups:Pr},toolbarInline:{groups:Pr}});function Lu(t){return(pe(t)||Ce(t))&&!t.isInline()}function yu(t){let e=_u();if(!Tt(e)&&!Tu(e))return!1;let o=e.getNodes();for(let n of o){let r=ku(n,Lu);r!==null&&r.setFormat(t)}return!0}import{QUOTE as Iu}from"@lexical/markdown";import{$createQuoteNode as Ur,$isQuoteNode as Hr,QuoteNode as Mu}from"@lexical/rich-text";import{$setBlocksType as zr}from"@lexical/selection";import{$getSelection as Wr,$isRangeSelection as Au}from"lexical";import{jsx as Br}from"react/jsx-runtime";import"react";var Ru="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",zo=({className:t})=>Br("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Br("path",{d:Ru,fill:"currentColor"})});import{jsx as jr}from"react/jsx-runtime";import"react";var vu={16:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-1 0V4H8.5v8h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1V4H4v1a.5.5 0 0 1-1 0z",24:"M6 6.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V9a.5.5 0 0 1-1 0V7h-4.5v10h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2V7H7v2a.5.5 0 0 1-1 0z"},wt=({className:t,size:e=24})=>jr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:jr("path",{clipRule:"evenodd",d:vu[e],fill:"currentColor",fillRule:"evenodd"})});var oe=t=>({type:"dropdown",ChildComponent:wt,items:t,key:"text",order:25});var Gr=[oe([{ChildComponent:zo,isActive:({selection:t})=>{if(!Au(t))return!1;for(let e of t.getNodes())if(!Hr(e)&&!Hr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Wr();zr(e,()=>Ur())})},order:20}])],Du=A({markdownTransformers:[Iu],nodes:[Mu],slashMenu:{groups:[Q([{Icon:zo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Wr();zr(e,()=>Ur())})}}])]},toolbarFixed:{groups:Gr},toolbarInline:{groups:Gr}});import{getTranslation as eo}from"@payloadcms/translations";import{jsx as Vr}from"react/jsx-runtime";import"react";var $u="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",Wo=({className:t})=>Vr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Vr("path",{d:$u,fill:"currentColor"})});import{jsx as Kr}from"react/jsx-runtime";import"react";var Ou="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Vo=({className:t})=>Kr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Kr("path",{clipRule:"evenodd",d:Ou,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Fu}from"react/jsx-runtime";import"react";function Jr(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let u=i??"Block Image";return()=>Fu("img",{alt:u,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as hl}from"lexical";import{JSOX as Ko}from"jsox";function Wt({propsString:t}){let e={},o="",n=!0;for(let r=0;r<t.length;r++){let l=t[r];if(n)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):n=!1):o+=l;else{let s=Pu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function Pu(t,e){let o=t[e];return o==='"'?Xr(t,e):o==="'"?Xr(t,e,!0):o==="{"?ju(t,e):o==="["?Bu(t,e):Gu(t,e)}function Bu(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="["?o++:t[r]==="]"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Ko.parse(`[${n}]`)}}function Xr(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function ju(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Hu(n)}}function Hu(t){return t[0]!=="{"?Ko.parse(t):Ko.parse(t.replace(/(\w+):/g,'"$1":'))}function Gu(t,e){let o="",n=e;for(;n<t.length&&t[n]!==" ";)o+=t[n],n++;return{newIndex:n-1,value:o}}function St({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${Uu(n)}"`):typeof n=="number"?e.push(`${o}={${n}}`):typeof n=="boolean"?n&&e.push(`${o}`):n!==null&&typeof n=="object"&&(Array.isArray(n)?e.push(`${o}={[${n.map(r=>JSON.stringify(r,Yr)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Yr)}}`));return e.join(" ")}function Uu(t){return t.replace(/"/g,"&quot;")}function Yr(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Vt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",u=e.slice(n),d=!1,c=0,a=0,m=null,f=!1,h=0,p=u[0].slice(0,r.index),g=0,C=n;e:for(let[w,x]of u.entries()){let b=l?x.trim():x,k=0;if(l)for(let T=0;T<x.length&&x[T]===" ";T++)k++;let _=0;for(w===0&&(_=(r.index??0)+r[0].length-k);_<b.length;){let T=b[_],I=b[_+1];if(d){if(T==="`"&&h++,h%2===0)if(T==="<"&&I==="/"){if(c--,c<0){i[i.length-1]===`
2
+ `&&(i=i.slice(0,-1)),C=w;for(let N=_;N<b.length;N++)if(b[N]===">"){g=N+1;break}break e}}else if(T==="/"&&I===">"){if(c--,c<0){i[i.length-1]===`
3
+ `&&(i=i.slice(0,-1)),C=w,g=_+2;break e}}else T==="<"&&I!=="/"&&c++;i+=T}else{if(T==="{"&&!m?a++:T==="}"&&!m?a--:(T==='"'||T==="'")&&!m?m=T:T===m&&(m=null),T==="/"&&I===">"&&a===0&&!m){f=!0,C=w,g=_+2;break e}else if(T===">"&&a===0&&!m){d=!0,_++;continue}s+=T}_++}if(d?i?.length>0&&w>0&&(i+=`
4
4
  `):s+=`
5
- `,o&&c<0){let T=C.match(o);if(T?.index!==void 0){_=v,g=T.index+T[0].length-1;break}}if(v===u.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
5
+ `,o&&c<0){let T=b.match(o);if(T?.index!==void 0){C=w,g=T.index+T[0].length-1;break}}if(w===u.length-1&&!t&&!f)throw new Error("End match not found for lines "+e.join(`
6
6
  `)+`
7
7
 
8
- . Start match: `+JSON.stringify(r))}return{afterEndLine:u[_].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:n+_,endlineLastCharIndex:g,propsString:s}}import{jsx as nd}from"react/jsx-runtime";import rd from"bson-objectid";import{$applyNodeReplacement as ld}from"lexical";import"react";import{DecoratorBlockNode as Tu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as wu}from"@lexical/utils";import Eu from"bson-objectid";import{$applyNodeReplacement as Su}from"lexical";var Et=class extends Tu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Nu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return wu(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function Nu(t){return Su(new Et({fields:{...t,id:t?.id||new Eu.default().toHexString()}}))}import{jsx as V,jsxs as St}from"react/jsx-runtime";import{useLexicalComposerContext as $u}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Du}from"@lexical/react/useLexicalEditable";import{getTranslation as Ou}from"@payloadcms/translations";import{Button as jr,Collapsible as Fu,Drawer as Bu,EditDepthProvider as Pu,ErrorPill as ju,Form as Hu,formatDrawerSlug as Gu,MoreIcon as Uu,Pill as Vu,Popup as zu,PopupList as Ho,RenderFields as Wu,SectionTitle as Ku,useConfig as Xu,useDocumentForm as Ju,useDocumentInfo as Hr,useEditDepth as Zu,useFormSubmitted as Yu,useServerFunctions as qu,useTranslation as Qu,XIcon as ed}from"@payloadcms/ui";import{abortAndIgnore as Go}from"@payloadcms/ui/shared";import{$getNodeByKey as Wt,$getRoot as td,SKIP_DOM_SELECTION_TAG as Uo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as Kt,reduceFieldsToValues as Gr}from"payload/shared";import Oe,{useCallback as Vo,useEffect as Xt,useMemo as Fe,useRef as zo}from"react";import{v4 as od}from"uuid";import{c as Lu}from"react/compiler-runtime";import{jsx as zt,jsxs as Ru}from"react/jsx-runtime";import{useLexicalEditable as yu}from"@lexical/react/useLexicalEditable";import{RenderFields as vu,useFormSubmitted as Iu}from"@payloadcms/ui";import Mu,{createContext as Au}from"react";var Fr=Au({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>Mu.use(Fr),Br=t=>{let e=Lu(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:u}=l,c=Iu()&&i>0,a=yu(),m;e[0]!==o||e[1]!==i||e[2]!==c?(m=f=>{let{children:g,..._}=f;return zt(o,{errorCount:i,fieldHasErrors:c,..._,children:g})},e[0]=o,e[1]=i,e[2]=c,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return n?Ru(Fr,{value:h,children:[n,zt(s,{})]}):zt(p,{children:zt(vu,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function Pr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Ur=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=Yu(),{id:u,collectionSlug:d,globalSlug:c}=Hr(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=U(),{fields:g}=Ju(),_=zo(new AbortController),L=Zu(),[v,b]=Oe.useState(0),{config:C}=Xu(),x=Gu({slug:`lexical-blocks-create-${f}-${l.id}`,depth:L}),{toggleDrawer:k}=De(x),{getDocPreferences:T,setDocFieldPreferences:I}=Hr(),[N]=$u(),E=Du(),S=l.blockType,{getFormState:w}=qu(),y=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}.fields`,[R,M]=Oe.useState(()=>{let P=p?.[l.id]?.formState;if(!P)return!1;let q=Object.fromEntries(Object.entries(P).map(([G,z])=>[G,G in l?{...z,initialValue:l[G],value:l[G]}:z]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),$=zo(!1),D=zo(e);Xt(()=>{$.current?(D.current!==e&&M(!1),D.current=e):$.current=!0},[e]);let[F]=Oe.useState(()=>od()),[B,Y]=Oe.useState(()=>{if(!r)return R?._components?.customComponents?.BlockLabel??void 0}),[X,Ke]=Oe.useState(()=>{if(!n)return R?._components?.customComponents?.Block??void 0}),Re=Fe(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):X,[n,o,l,s,X]),he=Fe(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):B,[r,o,l,s,B]);Xt(()=>{let P=new AbortController;return l&&!R&&(async()=>{let{state:G}=await w({id:u,collectionSlug:d,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Kt(g,{excludeFiles:!0}),globalSlug:c,initialBlockData:l,operation:"update",readOnly:!E,renderAllFields:!0,schemaPath:y,signal:P.signal});if(G){G.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let z=Gr(Kt(G,{excludeFiles:!0}),!0);N.update(()=>{let W=Wt(s);if(W&&Ie(W)){let ie=z;ie.blockType=S,W.setFields(ie,!0)}},{tag:Uo}),M(G),r||Y(G._components?.customComponents?.BlockLabel??void 0),n||Ke(G._components?.customComponents?.Block??void 0)}})(),()=>{Go(P)}},[w,y,E,u,r,n,l,N,s,R,d,c,T,g,S]);let[le,ge]=Oe.useState(p?.[l.id]?.collapsed??!1),jt=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}`,ft=a.blocks?.[jt]?.[0]?.blocks?.[0],ee=typeof ft=="string"?C.blocksMap[ft]:ft,{i18n:ht,t:de}=Qu(),Io=Vo(async({formState:P,submit:q})=>{Go(_.current);let G=new AbortController;_.current=G;let{state:z}=await w({id:u,collectionSlug:d,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Kt(g,{excludeFiles:!0}),formState:P,globalSlug:c,initialBlockFormState:P,operation:"update",readOnly:!E,renderAllFields:!!q,schemaPath:y,signal:G.signal});if(!z)return P;P.blockName&&(z.blockName=P.blockName);let W=Gr(Pr({fields:Kt(z,{excludeFiles:!0})}),!0);if(setTimeout(()=>{N.update(()=>{let ie=Wt(s);if(ie&&Ie(ie)){let Ze=W;Ze.blockType=S,ie.setFields(Ze,!0)}},{tag:Uo})},0),q){r||Y(z._components?.customComponents?.BlockLabel??void 0),n||Ke(z._components?.customComponents?.Block??void 0);let ie=0;for(let Ze of Object.values(z))Ze?.valid===!1&&ie++;b(ie)}return z},[w,u,d,T,c,y,S,g,E,N,s,n,r]);Xt(()=>()=>{Go(_.current)},[]);let Ht=Vo(()=>{N.update(()=>{Wt(s)?.remove()})},[N,s]),[nr,$c]=Oe.useState(0);Xt(()=>{let P=()=>{N.getEditorState().read(()=>{let G=td().getChildren(),z=0;for(let W of G)if(Ie(W)){if(W.getKey()===s){$c(z);return}z++}})};return P(),N.registerUpdateListener(()=>{P()})},[N,s]);let Je=ee?.labels?.singular?Ou(ee.labels.singular,ht):ee?.slug,rr=Vo(P=>{T().then(q=>{let z=q?.fields?.[m.name]?.collapsed,W=z&&z?.length?z:[];P?W.includes(l.id)||W.push(l.id):W.includes(l.id)&&W.splice(W.indexOf(l.id),1),I(m.name,{collapsed:W,hello:"hi"})})},[T,m.name,I,l.id]),lr=Fe(()=>()=>V(jr,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!E,el:"button",icon:"edit",onClick:P=>(P.preventDefault(),P.stopPropagation(),k(),!1),onMouseDown:P=>{P.preventDefault()},round:!0,size:"medium",tooltip:de("lexical:blocks:inlineBlocks:edit",{label:Je})}),[o,E,de,Je,k]),ir=Fe(()=>()=>V(jr,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!E,icon:"x",onClick:P=>{P.preventDefault(),Ht()},round:!0,tooltip:"Remove Block"}),[o,E,Ht]),Mo=Fe(()=>({Actions:P,children:q,className:G,collapsibleProps:z,disableBlockName:W,editButton:ie,errorCount:Ze,fieldHasErrors:Ao,Label:dr,Pill:mr,removeButton:Oc,showDragHandle:Fc=!0,showRowNumber:Bc=!0})=>V("div",{className:`${o}__container ${o}-${S}`,children:V(Fu,{actions:typeof P<"u"?P:E?V(zu,{button:V(Uu,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",render:({close:gt})=>St(Ho.ButtonGroup,{buttonSize:"medium",children:[(Re&&ie!==!1||!Re&&ie)&&V(Ho.Button,{onClick:()=>{k(),gt()},children:de("general:edit")}),Oc!==!1&&St(Ho.Button,{onClick:()=>{Ht(),gt()},children:[V(ed,{}),de("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Ao?`${o}__row--has-errors`:`${o}__row--no-errors`,G].filter(Boolean).join(" "),collapsibleStyle:Ao?"error":"default",dragHandleProps:Fc?{id:s,attributes:{role:"button",tabIndex:0},listeners:{}}:void 0,header:V("div",{className:`${o}__block-header`,children:typeof dr<"u"?dr:typeof he<"u"?he:St("div",{className:`${o}__block-label`,children:[Bc&&V("span",{className:`${o}__block-number`,children:String(nr+1).padStart(2,"0")}),typeof mr<"u"?mr:V(Vu,{className:`${o}__block-pill ${o}__block-pill-${S}`,pillStyle:"white",size:"small",children:Je??S}),!W&&!ee?.admin?.disableBlockName&&V(Ku,{path:"blockName",readOnly:!E}),Ao&&V(ju,{count:Ze??0,i18n:ht,withMessage:!0})]})}),isCollapsed:le,onToggle:gt=>{rr(gt),ge(gt)},...z||{},children:q},0)}),[Re,he,Je,o,ee?.admin?.disableBlockName,S,ht,le,rr,E,s,Ht,nr,de,k]),sr=l?.id,{headerActions:ar,submitRef:cr}=pr(),ur=Fe(()=>()=>V(Pu,{children:V(Bu,{className:"",headerActions:ar,slug:x,title:de(`lexical:blocks:inlineBlocks:${sr?"edit":"create"}`,{label:Je??de("lexical:blocks:inlineBlocks:label")}),children:R?St("div",{className:"fields-drawer",children:[V(Wu,{fields:ee?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:y,permissions:!0,readOnly:!E}),V(fr,{submitRef:cr})]}):null})}),[R,x,sr,Je,de,E,ee?.fields,y,ar,cr]),Dc=Fe(()=>R?V("div",{"data-block-drawer-slug":x,style:{display:"contents"},children:V(Hu,{beforeSubmit:[async({formState:P})=>await Io({formState:P,submit:!0})],el:"div",fields:ee?.fields??[],initialState:R,onChange:[Io],onSubmit:(P,q)=>{q.blockType=S,N.update(()=>{let G=Wt(s);G&&Ie(G)&&G.setFields(q,!0)},{tag:Uo}),k()},submitted:i,uuid:F,children:V(Br,{baseClass:o,BlockDrawer:ur,Collapsible:Mo,CustomBlock:Re,CustomLabel:he,EditButton:lr,errorCount:v,formSchema:ee?.fields??[],initialState:R,nodeKey:s,RemoveButton:ir})})}):null,[Mo,ur,Re,he,S,x,ir,lr,o,N,v,k,ee?.fields,F,R,s,Io,i]);return ee?Dc:V(Mo,{disableBlockName:!0,fieldHasErrors:!0,children:St("div",{className:`${o}-not-found`,children:["Error: Block '",S,"' not found in the config but exists in the lexical data"]})})};var ce=class extends Et{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Be(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return nd(Ur,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return ld(new ce({fields:{...t,id:t?.id||new rd.default().toHexString()}}))}function Ie(t){return t instanceof ce}import{createHeadlessEditor as id}from"@lexical/headless";import{$convertToMarkdownString as sd}from"@lexical/markdown";function Wo(t,e){return({editorState:n})=>{let r=id({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=sd(e)}),l}}import{createHeadlessEditor as Cd}from"@lexical/headless";import{$convertFromMarkdownString as Yr,TRANSFORMERS as gd}from"@lexical/markdown";var Vr=/^[\t ]*$/,ad=/^(\s*)(\d+)\.\s/,cd=/^(\s*)[-*+]\s/,ud=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,zr=/^(#{1,6})\s/,dd=/^>\s/,md=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,Wr=/[ \t]*(\\`\\`\\`|```)$/,pd=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,fd=/^\|(.+)\|\s?$/,hd=/^(\| ?:?-*:? ?)+\|\s?$/,Kr=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Xr=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function Jr(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];let e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function Zr(t,e){let o=t.split(`
9
- `),n=!1,r=[],l=0;for(let s=0;s<o.length;s++){let i=o[s],u=r[r.length-1],d=s<o.length-1?Jr(i):null,c=u!==void 0&&Jr(u)!==null;if(pd.test(i)){r.push(i);continue}if(Wr.test(i)){l===0&&(n=!0),l===1&&(n=!1),l>0&&l--,r.push(i);continue}if(md.test(i)){n=!0,l++,r.push(i);continue}if(n){r.push(i);continue}Vr.test(i)||Vr.test(u)||!u||zr.test(u)||zr.test(i)||dd.test(i)||ad.test(i)||cd.test(i)||ud.test(i)||fd.test(i)||hd.test(i)||c||!e||Kr.test(i)||Xr.test(i)||Kr.test(u)||Xr.test(u)||Wr.test(u)?r.push(i):r[r.length-1]=u+" "+(d===null?i.trim():i.trimStart())}return r.join(`
10
- `)}function Jt(t,e=gd,o,n=!1,r=!1){if(n)return Yr(t,e,o,!0);let l=Zr(t,r);return Yr(l,e,o,!1,!1)}function Zt(t,e){return({markdown:n})=>{let r=Cd({nodes:t});return r.update(()=>{Jt(n,e,void 0,!1,!0)},{discrete:!0}),r.getEditorState().toJSON()}}function xd(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var el=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=Qr(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=Qr(n,!0);r&&(o=o.concat(r))}return o};function Qr(t,e){if(!t.jsx)return null;let o=xd(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[Ct],export:s=>{if(!bt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=Wo(r,l),d=t.jsx.export({fields:i,lexicalToMarkdown:u});if(d===!1)return null;if(typeof d=="string")return d;let c=d.props&&Object.keys(d.props)?.length>0,a=d.props??{};return d?.children?.length?`<${i.blockType}${c?" "+wt({props:a}):""}>${d.children}</${i.blockType}>`:`<${i.blockType}${c?" "+wt({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:u}=Vt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return u},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:u,propsString:d}=Vt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let c=Zt(r,l),a=t.jsx.import({children:u,closeMatch:null,htmlToLexical:null,markdownToLexical:c,openMatch:i,props:d?Ut({propsString:d}):{}});if(a===!1)return;let m=xt({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[ce],export:s=>{if(!Ie(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=Wo(r,l),d=t.jsx.export({fields:i,lexicalToMarkdown:u});if(d===!1)return null;if(typeof d=="string")return d;let c=d.props&&Object.keys(d.props)?.length>0,a=d.props??{};if(d?.children?.length){let m=d.children,p="";if(m.includes(`
8
+ . Start match: `+JSON.stringify(r))}return{afterEndLine:u[C].trim().slice(g),beforeStartLine:p,content:i,endLineIndex:n+C,endlineLastCharIndex:g,propsString:s}}import{jsx as Md}from"react/jsx-runtime";import Ad from"bson-objectid";import{$applyNodeReplacement as Dd}from"lexical";import"react";import{DecoratorBlockNode as zu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Wu}from"@lexical/utils";import Vu from"bson-objectid";import{$applyNodeReplacement as Ku}from"lexical";var Nt=class extends zu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Ju(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Wu(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function Ju(t){return Ku(new Nt({fields:{...t,id:t?.id||new Vu.default().toHexString()}}))}import{jsx as G,jsxs as ve,Fragment as ad}from"react/jsx-runtime";import{useLexicalComposerContext as cd}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ud}from"@lexical/react/useLexicalEditable";import{getTranslation as dd}from"@payloadcms/translations";import{Button as nl,Collapsible as md,Drawer as fd,EditDepthProvider as pd,ErrorPill as hd,Form as gd,formatDrawerSlug as xd,MoreIcon as Cd,Pill as bd,Popup as kd,PopupList as Lt,RenderFields as _d,SectionTitle as Td,useConfig as Ed,useDocumentForm as wd,useDocumentInfo as rl,useEditDepth as Sd,useFormSubmitted as Nd,useServerFunctions as Ld,useTranslation as yd,XIcon as Rd}from"@payloadcms/ui";import{abortAndIgnore as Yo}from"@payloadcms/ui/shared";import{$getNodeByKey as Xt,$getRoot as vd,SKIP_DOM_SELECTION_TAG as Zo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as Yt,reduceFieldsToValues as ll}from"payload/shared";import Oe,{useCallback as qo,useEffect as Zt,useMemo as Fe,useRef as Qo}from"react";import{v4 as Id}from"uuid";import{c as Xu}from"react/compiler-runtime";import{jsx as Kt,jsxs as Yu}from"react/jsx-runtime";import{useLexicalEditable as Zu}from"@lexical/react/useLexicalEditable";import{RenderFields as qu,useFormSubmitted as Qu}from"@payloadcms/ui";import ed,{createContext as td}from"react";var Zr=td({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>ed.use(Zr),qr=t=>{let e=Xu(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:u}=l,c=Qu()&&i>0,a=Zu(),m;e[0]!==o||e[1]!==i||e[2]!==c?(m=p=>{let{children:g,...C}=p;return Kt(o,{errorCount:i,fieldHasErrors:c,...C,children:g})},e[0]=o,e[1]=i,e[2]=c,e[3]=m):m=e[3];let f=m,h={...l,BlockCollapsible:f};return n?Yu(Zr,{value:h,children:[n,Kt(s,{})]}):Kt(f,{children:Kt(qu,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};import{useId as sd}from"react";import{$getNodeByKey as Jt,COMMAND_PRIORITY_HIGH as od,KEY_DOWN_COMMAND as nd,SKIP_DOM_SELECTION_TAG as rd}from"lexical";import{useCallback as Jo,useEffect as Qr,useLayoutEffect as ld,useRef as Xo,useState as id}from"react";function el({editor:t,nodeKey:e}){let[o,n]=id(null),r=Xo(null),l=Xo(!1),s=Xo(!1),i=o!==null;Qr(()=>t.registerCommand(nd,a=>{let m=a?.target;return m instanceof HTMLElement&&!!t.getElementByKey(e)?.contains(m)&&!!m.closest(".collapsible__actions button")},od),[t,e]),Qr(()=>{if(!i)return;let a,m=()=>{l.current=!0},f=()=>{l.current=!1,s.current&&(a=setTimeout(()=>{r.current=null,n(null)},0))};return document.addEventListener("pointerdown",m,!0),document.addEventListener("pointerup",f,!0),document.addEventListener("pointercancel",f,!0),()=>{document.removeEventListener("pointerdown",m,!0),document.removeEventListener("pointerup",f,!0),document.removeEventListener("pointercancel",f,!0),clearTimeout(a),l.current=!1,s.current=!1}},[i]),ld(()=>{if(o===null)return;let a=[];return t.getEditorState().read(()=>{let m=Jt(e),f=m?.getParent()?.getChildren(),h=m?.getIndexWithinParent();if(!f||h===void 0||h===o)return;let p=f.map(I=>t.getElementByKey(I.getKey())),g=p[h],C=p[o],E=p[h+(o>h?1:-1)];if(!g||!C||!E)return;let w=g.getBoundingClientRect(),x=C.getBoundingClientRect(),b=E.getBoundingClientRect(),k=o>h,_=k?x.bottom-w.bottom:x.top-w.top,T=k?w.top-b.top:w.bottom-b.bottom;for(let I=Math.min(h,o);I<=Math.max(h,o);I++){let N=p[I];if(N){let S=N.style.translate;a.push(()=>{N.style.translate=S}),N.style.translate=`0 ${I===h?_:T}px`}}g.querySelector(".collapsible__drag")?.scrollIntoView({block:"nearest"})}),()=>a.forEach(m=>m())},[t,e,o]);let u=Jo(({direction:a,index:m})=>{t.isEditable()&&t.update(()=>{let f=Jt(e),h=f?.getParent()?.getChildren();if(!f||!h)return;let p=f.getIndexWithinParent(),g=m??p+(a??0),C=h[g];C&&C!==f&&(g<p?C.insertBefore(f):C.insertAfter(f))},{onUpdate:()=>{requestAnimationFrame(()=>{let f=t.getElementByKey(e)?.querySelector(".collapsible__toggle-wrap");(f?.querySelector(".collapsible__drag")??f?.querySelector(".LexicalEditorTheme__block__actions-button"))?.focus()})},tag:rd})},[t,e]),d=Jo(a=>{t.isEditable()&&(a.key===" "||a.key==="Enter"?(a.preventDefault(),a.stopPropagation(),r.current===null?(t.getEditorState().read(()=>{r.current=Jt(e)?.getIndexWithinParent()??null}),n(r.current)):(u({index:r.current}),r.current=null,n(null))):r.current!==null&&(a.key==="Escape"||a.key==="Tab"?(r.current=null,n(null),a.key==="Escape"&&(a.preventDefault(),a.stopPropagation())):(a.key==="ArrowUp"||a.key==="ArrowDown")&&(a.preventDefault(),a.stopPropagation(),t.getEditorState().read(()=>{let m=Jt(e)?.getParent()?.getChildrenSize()??0;r.current=Math.max(0,Math.min(m-1,(r.current??0)+(a.key==="ArrowDown"?1:-1)))}),n(r.current))))},[t,u,e]),c=Jo(()=>{if(l.current){s.current=!0;return}r.current=null,n(null)},[]);return{isReordering:i,move:u,onBlur:c,onKeyDown:d,targetIndex:o}}function tl({children:t,editor:e,nodeKey:o}){let n=el({editor:e,nodeKey:o}),r=sd();return t({...n,reorderInstructionsID:r})}function ol({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var il=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=Nd(),{id:u,collectionSlug:d,globalSlug:c}=rl(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:f,schemaPath:h},uuid:p}=W(),{fields:g}=wd(),C=Qo(new AbortController),E=Sd(),[w,x]=Oe.useState(0),{config:b}=Ed(),k=xd({slug:`lexical-blocks-create-${p}-${l.id}`,depth:E}),{toggleDrawer:_}=$e(k),{getDocPreferences:T,setDocFieldPreferences:I}=rl(),[N]=cd(),S=ud(),y=l.blockType,L=`${h}.lexical_internal_feature.blocks.lexical_blocks.${y}`,D=a.blocks?.[L]?.[0]?.blocks?.[0],M=typeof D=="string"?b.blocksMap[D]:D,{getFormState:O}=Ld(),P=`${h}.lexical_internal_feature.blocks.lexical_blocks.${y}.fields`,[$,U]=Oe.useState(()=>{let H=f?.[l.id]?.formState;if(!H)return!1;let q=Object.fromEntries(Object.entries(H).map(([z,K])=>[z,z in l?{...K,initialValue:l[z],value:l[z]}:K]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),V=Qo(!1),Xe=Qo(e);Zt(()=>{V.current?(Xe.current!==e&&U(!1),Xe.current=e):V.current=!0},[e]);let[gt]=Oe.useState(()=>Id()),[Ye,ie]=Oe.useState(()=>{if(!r)return $?._components?.customComponents?.BlockLabel??void 0}),[fe,xt]=Oe.useState(()=>{if(!n)return $?._components?.customComponents?.Block??void 0}),Ae=Fe(()=>n?G(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):fe,[n,o,l,s,fe]),ce=Fe(()=>r?G(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):Ye,[r,o,l,s,Ye]);Zt(()=>{let H=new AbortController;return M&&l&&!$&&(async()=>{let{state:z}=await O({id:u,collectionSlug:d,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Yt(g,{excludeFiles:!0}),globalSlug:c,initialBlockData:l,operation:"update",readOnly:!S,renderAllFields:!0,schemaPath:P,signal:H.signal});if(z){z.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let K=ll(Yt(z,{excludeFiles:!0}),!0);N.update(()=>{let X=Xt(s);if(X&&Ie(X)){let ue=K;ue.blockType=y,X.setFields(ue,!0)}},{tag:Zo}),U(z),r||ie(z._components?.customComponents?.BlockLabel??void 0),n||xt(z._components?.customComponents?.Block??void 0)}})(),()=>{Yo(H)}},[O,P,S,u,r,n,l,N,s,$,d,c,T,g,y,M]);let[Gt,$o]=Oe.useState(f?.[l.id]?.collapsed??!1),{i18n:Ct,t:Y}=yd(),Oo=qo(async({formState:H,submit:q})=>{Yo(C.current);let z=new AbortController;C.current=z;let{state:K}=await O({id:u,collectionSlug:d,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Yt(g,{excludeFiles:!0}),formState:H,globalSlug:c,initialBlockFormState:H,operation:"update",readOnly:!S,renderAllFields:!!q,schemaPath:P,signal:z.signal});if(!K)return H;H.blockName&&(K.blockName=H.blockName);let X=ll(ol({fields:Yt(K,{excludeFiles:!0})}),!0);if(setTimeout(()=>{N.update(()=>{let ue=Xt(s);if(ue&&Ie(ue)){let De=X;De.blockType=y,ue.setFields(De,!0)}},{tag:Zo})},0),q){r||ie(K._components?.customComponents?.BlockLabel??void 0),n||xt(K._components?.customComponents?.Block??void 0);let ue=0;for(let De of Object.values(K))De?.valid===!1&&ue++;x(ue)}return K},[O,u,d,T,c,P,y,g,S,N,s,n,r]);Zt(()=>()=>{Yo(C.current)},[]);let Ut=qo(()=>{N.update(()=>{Xt(s)?.remove()})},[N,s]),[pr,qc]=Oe.useState(0);Zt(()=>{let H=()=>{N.getEditorState().read(()=>{let z=vd().getChildren(),K=0;for(let X of z)if(Ie(X)){if(X.getKey()===s){qc(K);return}K++}})};return H(),N.registerUpdateListener(()=>{H()})},[N,s]);let Ze=M?.labels?.singular?dd(M.labels.singular,Ct):M?.slug,hr=qo(H=>{T().then(q=>{let K=q?.fields?.[m.name]?.collapsed,X=K&&K?.length?K:[];H?X.includes(l.id)||X.push(l.id):X.includes(l.id)&&X.splice(X.indexOf(l.id),1),I(m.name,{collapsed:X,hello:"hi"})})},[T,m.name,I,l.id]),gr=Fe(()=>()=>G(nl,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!S,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),_(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"medium",tooltip:Y("lexical:blocks:inlineBlocks:edit",{label:Ze})}),[o,S,Y,Ze,_]),xr=Fe(()=>()=>G(nl,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!S,icon:"x",onClick:H=>{H.preventDefault(),Ut()},round:!0,tooltip:"Remove Block"}),[o,S,Ut]),Fo=Fe(()=>function({Actions:q,children:z,className:K,collapsibleProps:X,disableBlockName:ue,editButton:De,errorCount:eu,fieldHasErrors:Po,Label:Tr,Pill:Er,removeButton:tu,showDragHandle:ou=!0,showRowNumber:nu=!0}){return G(tl,{editor:N,nodeKey:s,children:({isReordering:Bo,move:wr,onBlur:ru,onKeyDown:lu,reorderInstructionsID:Sr,targetIndex:iu})=>G("div",{className:`${o}__container ${o}-${y}`,onKeyDownCapture:J=>{let jo=J.target;J.altKey||J.ctrlKey||J.metaKey||jo.closest(".collapsible")?.parentElement!==J.currentTarget||(jo.matches(".collapsible__drag")&&(J.key!=="Escape"||Bo)&&[" ","ArrowDown","ArrowUp","Enter","Escape","Tab"].includes(J.key)?(lu(J),J.stopPropagation()):J.key==="Tab"&&jo.matches(".collapsible__toggle")&&J.stopPropagation())},children:ve(md,{actions:typeof q<"u"?q:S?G(kd,{button:G(Cd,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",popupType:"menu",render:({close:J})=>ve(Lt.ButtonGroup,{buttonSize:"medium",children:[G(Lt.Button,{onClick:()=>{J(),wr({direction:-1})},children:Y("general:moveUp")}),G(Lt.Button,{onClick:()=>{J(),wr({direction:1})},children:Y("general:moveDown")}),(Ae&&De!==!1||!Ae&&De)&&G(Lt.Button,{onClick:()=>{_(),J()},children:Y("general:edit")}),tu!==!1&&ve(Lt.Button,{onClick:()=>{Ut(),J()},children:[G(Rd,{}),Y("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Po?`${o}__row--has-errors`:`${o}__row--no-errors`,K].filter(Boolean).join(" "),collapsibleStyle:Po?"error":"default",dragHandleProps:ou&&S?{id:s,attributes:{"aria-describedby":Sr,"aria-pressed":Bo,role:"button",tabIndex:0},listeners:{onBlur:ru}}:void 0,header:G("div",{className:`${o}__block-header`,children:typeof Tr<"u"?Tr:typeof ce<"u"?ce:ve("div",{className:`${o}__block-label`,children:[nu&&G("span",{className:`${o}__block-number`,children:String(pr+1).padStart(2,"0")}),typeof Er<"u"?Er:G(bd,{className:`${o}__block-pill ${o}__block-pill-${y}`,pillStyle:"white",size:"small",children:Ze??y}),!ue&&!M?.admin?.disableBlockName&&G(Td,{path:"blockName",readOnly:!S}),Po&&G(hd,{count:eu??0,i18n:Ct,withMessage:!0})]})}),isCollapsed:Gt,onToggle:J=>{hr(J),$o(J)},...X||{},AfterCollapsible:ve(ad,{children:[X?.AfterCollapsible,G("span",{className:"sr-only",role:"status",children:Bo?`${Y("general:order")}: ${(iu??0)+1}`:""})]}),children:[ve("span",{className:"sr-only",id:Sr,children:["Space / Enter \xB7 ",Y("general:moveUp")," \u2191 \xB7 ",Y("general:moveDown")," \u2193 \xB7"," ",Y("general:cancel")," Escape"]}),z]},0)})})},[N,Ae,ce,Ze,o,M?.admin?.disableBlockName,y,Ct,Gt,hr,S,s,Ut,pr,Y,_]),Cr=l?.id,{headerActions:br,submitRef:kr}=Nr(),_r=Fe(()=>()=>G(pd,{children:G(fd,{className:"",headerActions:br,slug:k,title:Y(`lexical:blocks:inlineBlocks:${Cr?"edit":"create"}`,{label:Ze??Y("lexical:blocks:inlineBlocks:label")}),children:$?ve("div",{className:"fields-drawer",children:[G(_d,{fields:M?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:P,permissions:!0,readOnly:!S}),G(Lr,{submitRef:kr})]}):null})}),[$,k,Cr,Ze,Y,S,M?.fields,P,br,kr]),Qc=Fe(()=>$?G("div",{"data-block-drawer-slug":k,style:{display:"contents"},children:G(gd,{beforeSubmit:[async({formState:H})=>await Oo({formState:H,submit:!0})],el:"div",fields:M?.fields??[],initialState:$,onChange:[Oo],onSubmit:(H,q)=>{q.blockType=y,N.update(()=>{let z=Xt(s);z&&Ie(z)&&z.setFields(q,!0)},{tag:Zo}),_()},submitted:i,uuid:gt,children:G(qr,{baseClass:o,BlockDrawer:_r,Collapsible:Fo,CustomBlock:Ae,CustomLabel:ce,EditButton:gr,errorCount:w,formSchema:M?.fields??[],initialState:$,nodeKey:s,RemoveButton:xr})})}):null,[Fo,_r,Ae,ce,y,k,xr,gr,o,N,w,_,M?.fields,gt,$,s,Oo,i]);return M?Qc:G(Fo,{disableBlockName:!0,fieldHasErrors:!0,children:ve("div",{className:`${o}-not-found`,children:["Error: Block '",y,"' not found in the config but exists in the lexical data"]})})};var de=class extends Nt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Pe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return Md(il,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Pe(t){return Dd(new de({fields:{...t,id:t?.id||new Ad.default().toHexString()}}))}function Ie(t){return t instanceof de}import{createHeadlessEditor as $d}from"@lexical/headless";import{$convertToMarkdownString as Od}from"@lexical/markdown";function en(t,e){return({editorState:n})=>{let r=$d({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=Od(e)}),l}}import{createHeadlessEditor as Vd}from"@lexical/headless";import{$convertFromMarkdownString as pl,TRANSFORMERS as Wd}from"@lexical/markdown";var sl=/^[\t ]*$/,Fd=/^(\s*)(\d+)\.\s/,Pd=/^(\s*)[-*+]\s/,Bd=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,al=/^(#{1,6})\s/,jd=/^>\s/,Hd=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,cl=/[ \t]*(\\`\\`\\`|```)$/,Gd=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Ud=/^\|(.+)\|\s?$/,zd=/^(\| ?:?-*:? ?)+\|\s?$/,ul=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,dl=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function ml(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];let e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function fl(t,e){let o=t.split(`
9
+ `),n=!1,r=[],l=0;for(let s=0;s<o.length;s++){let i=o[s],u=r[r.length-1],d=s<o.length-1?ml(i):null,c=u!==void 0&&ml(u)!==null;if(Gd.test(i)){r.push(i);continue}if(cl.test(i)){l===0&&(n=!0),l===1&&(n=!1),l>0&&l--,r.push(i);continue}if(Hd.test(i)){n=!0,l++,r.push(i);continue}if(n){r.push(i);continue}sl.test(i)||sl.test(u)||!u||al.test(u)||al.test(i)||jd.test(i)||Fd.test(i)||Pd.test(i)||Bd.test(i)||Ud.test(i)||zd.test(i)||c||!e||ul.test(i)||dl.test(i)||ul.test(u)||dl.test(u)||cl.test(u)?r.push(i):r[r.length-1]=u+" "+(d===null?i.trim():i.trimStart())}return r.join(`
10
+ `)}function qt(t,e=Wd,o,n=!1,r=!1){if(n)return pl(t,e,o,!0);let l=fl(t,r);return pl(l,e,o,!1,!1)}function Qt(t,e){return({markdown:n})=>{let r=Vd({nodes:t});return r.update(()=>{qt(n,e,void 0,!1,!0)},{discrete:!0}),r.getEditorState().toJSON()}}function Kd(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var xl=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=gl(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=gl(n,!0);r&&(o=o.concat(r))}return o};function gl(t,e){if(!t.jsx)return null;let o=Kd(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[bt],export:s=>{if(!_t(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=en(r,l),d=t.jsx.export({fields:i,lexicalToMarkdown:u});if(d===!1)return null;if(typeof d=="string")return d;let c=d.props&&Object.keys(d.props)?.length>0,a=d.props??{};return d?.children?.length?`<${i.blockType}${c?" "+St({props:a}):""}>${d.children}</${i.blockType}>`:`<${i.blockType}${c?" "+St({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:u}=Vt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return u},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:u,propsString:d}=Vt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let c=Qt(r,l),a=t.jsx.import({children:u,closeMatch:null,htmlToLexical:null,markdownToLexical:c,openMatch:i,props:d?Wt({propsString:d}):{}});if(a===!1)return;let m=kt({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[de],export:s=>{if(!Ie(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=en(r,l),d=t.jsx.export({fields:i,lexicalToMarkdown:u});if(d===!1)return null;if(typeof d=="string")return d;let c=d.props&&Object.keys(d.props)?.length>0,a=d.props??{};if(d?.children?.length){let m=d.children,f="";if(m.includes(`
11
11
  `))for(let h of m.split(`
12
- `)){let f="";!t?.jsx?.doNotTrimChildren&&h!==""&&(f=" "),f+=h+`
13
- `,p+=f}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
- `;return`<${i.blockType}${c?" "+wt({props:a}):""}>
15
- ${p}</${i.blockType}>`}return`<${i.blockType}${c?" "+wt({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:u,startMatch:d,transformer:c})=>{let a=typeof c.regExpEnd=="object"&&"regExp"in c.regExpEnd?c.regExpEnd.regExp:c.regExpEnd,m=c.regExpEnd&&typeof c.regExpEnd=="object"&&"optional"in c.regExpEnd?c.regExpEnd.optional:!c.regExpEnd,{afterEndLine:p,beforeStartLine:h,content:f,endLineIndex:g,propsString:_}=Vt({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:u,startMatch:d,trimChildren:!1}),L="";if(t?.jsx?.doNotTrimChildren)L=f.endsWith(`
16
- `)?f.slice(0,-1):f;else if(f.includes(`
17
- `)){let x=f.split(`
18
- `),k=0;for(let T of x){if(k++,T.startsWith(" "))L+=T.slice(2);else if(T==="")L+=T;else{L=f.endsWith(`
19
- `)?f.slice(0,-1):f;break}L+=k===x.length?"":`
20
- `}}else L=(f.startsWith(" ")?f.slice(2):f)+`
21
- `;if(!t?.jsx?.import)return[!1,u];let v=Zt(r,l),b=t.jsx.import({children:L,closeMatch:null,htmlToLexical:null,markdownToLexical:v,openMatch:d,props:_?Ut({propsString:_}):{}});if(b===!1)return[!1,u];let C=Be({...b,blockType:t.slug});if(C){let x=null,k=null;if(h?.length){x=v({markdown:h})?.root?.children??[];let T=x?.[0];T&&i.append(qr(T))}if(i.append(C),p?.length){k=v({markdown:p})?.root?.children;let T=i.getChildren()[i.getChildren().length-1],I=qr(k[0])?.getChildren();if(I?.length)for(let N of I)T.append(N)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,u,d,c)=>{if(t?.jsx?.import){if(!c){let g="";if(i)for(let _ of i)g+=_.getTextContent();c=[g]}let a="";t?.jsx?.doNotTrimChildren?a=c.join(`
12
+ `)){let p="";!t?.jsx?.doNotTrimChildren&&h!==""&&(p=" "),p+=h+`
13
+ `,f+=p}else f=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
+ `;return`<${i.blockType}${c?" "+St({props:a}):""}>
15
+ ${f}</${i.blockType}>`}return`<${i.blockType}${c?" "+St({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:u,startMatch:d,transformer:c})=>{let a=typeof c.regExpEnd=="object"&&"regExp"in c.regExpEnd?c.regExpEnd.regExp:c.regExpEnd,m=c.regExpEnd&&typeof c.regExpEnd=="object"&&"optional"in c.regExpEnd?c.regExpEnd.optional:!c.regExpEnd,{afterEndLine:f,beforeStartLine:h,content:p,endLineIndex:g,propsString:C}=Vt({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:u,startMatch:d,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=p.endsWith(`
16
+ `)?p.slice(0,-1):p;else if(p.includes(`
17
+ `)){let k=p.split(`
18
+ `),_=0;for(let T of k){if(_++,T.startsWith(" "))E+=T.slice(2);else if(T==="")E+=T;else{E=p.endsWith(`
19
+ `)?p.slice(0,-1):p;break}E+=_===k.length?"":`
20
+ `}}else E=(p.startsWith(" ")?p.slice(2):p)+`
21
+ `;if(!t?.jsx?.import)return[!1,u];let w=Qt(r,l),x=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:w,openMatch:d,props:C?Wt({propsString:C}):{}});if(x===!1)return[!1,u];let b=Pe({...x,blockType:t.slug});if(b){let k=null,_=null;if(h?.length){k=w({markdown:h})?.root?.children??[];let T=k?.[0];T&&i.append(hl(T))}if(i.append(b),f?.length){_=w({markdown:f})?.root?.children;let T=i.getChildren()[i.getChildren().length-1],I=hl(_[0])?.getChildren();if(I?.length)for(let N of I)T.append(N)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,u,d,c)=>{if(t?.jsx?.import){if(!c){let g="";if(i)for(let C of i)g+=C.getTextContent();c=[g]}let a="";t?.jsx?.doNotTrimChildren?a=c.join(`
22
22
  `):a=c.join(`
23
- `).trim();let m=u[1]?.trim(),p=Zt(r,l),h=t.jsx.import({children:a,closeMatch:d,htmlToLexical:null,markdownToLexical:p,openMatch:u,props:m?Ut({propsString:m}):{}});if(h===!1)return!1;let f=Be({...h,blockType:t.slug});f&&s.append(f);return}return!1}})),n)}import{createCommand as tl}from"lexical";var tt=tl("INSERT_BLOCK_COMMAND"),ot=tl("INSERT_INLINE_BLOCK_COMMAND");import{c as bd}from"react/compiler-runtime";import{useLexicalComposerContext as kd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as _d,$wrapNodeInElement as Td,mergeRegister as wd}from"@lexical/utils";import{formatDrawerSlug as Ed,useEditDepth as Sd}from"@payloadcms/ui";import{$createParagraphNode as Nd,$getNodeByKey as Ld,$getPreviousSelection as Rd,$getSelection as yd,$insertNodes as vd,$isParagraphNode as Id,$isRangeSelection as Md,$isRootOrShadowRoot as Ad,COMMAND_PRIORITY_EDITOR as ol}from"lexical";import{useEffect as $d,useState as Dd}from"react";var nl=()=>{let t=bd(12),[e]=kd(),[o,n]=Dd(null),{setCreatedInlineBlock:r,uuid:l}=U(),s=Sd(),i="lexical-inlineBlocks-create-"+l,u;t[0]!==s||t[1]!==i?(u=Ed({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=u):u=t[2];let d=u,{toggleDrawer:c}=De(d,!0),a;t[3]!==e||t[4]!==r||t[5]!==o?(a=()=>{if(!e.hasNodes([ce]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return wd(e.registerCommand(tt,p=>(e.update(()=>{let h=yd()||Rd();if(Md(h)){let f=Be(p),{focus:g}=h,_=g.getNode();_d(f),Id(_)&&!_.__first&&_.remove()}}),!0),ol),e.registerCommand(ot,p=>{if(o){let f=Ld(o);return!f||!bt(f)?!1:(f.setFields(p),n(null),!0)}let h=xt(p);return r?.(h),vd([h]),Ad(h.getParentOrThrow())&&Td(h,Nd).selectEnd(),!0},ol))},t[3]=e,t[4]=r,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==r||t[9]!==o||t[10]!==c?(m=[e,r,o,c],t[7]=e,t[8]=r,t[9]=o,t[10]=c,t[11]=m):m=t[11],$d(a,m),null};var Od=A(({config:t,featureClientSchemaMap:e,props:o,schemaPath:n})=>{let r=`${n}.lexical_internal_feature.blocks.lexical_blocks`,l=`${n}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(r+".")&&!a.replace(r+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),d=i.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0),c=u.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0);return{markdownTransformers:el({blocks:d,inlineBlocks:c}),nodes:[ce,Ct],plugins:[{Component:nl,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[d?.length?{items:d.map(a=>({Icon:$r(a,Bo),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?Yt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(tt,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,c?.length?{items:c.map(a=>({Icon:Po,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?Yt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ot,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[d.length?{type:"dropdown",ChildComponent:Bo,items:d.map((a,m)=>({isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?Yt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(tt,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,c?.length?{type:"dropdown",ChildComponent:Po,items:c.map((a,m)=>({isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?Yt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(ot,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Pd}from"react/compiler-runtime";import{jsx as je,jsxs as Zo}from"react/jsx-runtime";import{useLexicalComposerContext as jd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Hd,$createTextNode as Gd,$getRoot as Ud,getDOMSelection as Ko}from"lexical";import*as al from"react";import{useCallback as Pe,useEffect as Xo,useLayoutEffect as ll,useRef as Jo,useState as qt}from"react";var Fd=se&&"documentMode"in document?document.documentMode:null,rl=se&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),F6=se&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),B6=se&&"InputEvent"in window&&!Fd?"getTargetRanges"in new window.InputEvent("input"):!1,P6=se&&/Version\/[\d.].*Safari/.test(navigator.userAgent),j6=se&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,H6=se&&/Android/.test(navigator.userAgent),G6=se&&/Win/.test(navigator.platform),Bd=se&&/^(?=.*Chrome).*/i.test(navigator.userAgent),U6=se&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Bd;var Vd=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)},zd=(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)},Wd=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
23
+ `).trim();let m=u[1]?.trim(),f=Qt(r,l),h=t.jsx.import({children:a,closeMatch:d,htmlToLexical:null,markdownToLexical:f,openMatch:u,props:m?Wt({propsString:m}):{}});if(h===!1)return!1;let p=Pe({...h,blockType:t.slug});p&&s.append(p);return}return!1}})),n)}import{createCommand as Cl}from"lexical";var ot=Cl("INSERT_BLOCK_COMMAND"),nt=Cl("INSERT_INLINE_BLOCK_COMMAND");import{c as Jd}from"react/compiler-runtime";import{useLexicalComposerContext as Xd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Yd,$wrapNodeInElement as Zd,mergeRegister as qd}from"@lexical/utils";import{formatDrawerSlug as Qd,useEditDepth as em}from"@payloadcms/ui";import{$createParagraphNode as tm,$getNodeByKey as om,$getPreviousSelection as nm,$getSelection as rm,$insertNodes as lm,$isParagraphNode as im,$isRangeSelection as sm,$isRootOrShadowRoot as am,COMMAND_PRIORITY_EDITOR as bl}from"lexical";import{useEffect as cm,useState as um}from"react";var kl=()=>{let t=Jd(12),[e]=Xd(),[o,n]=um(null),{setCreatedInlineBlock:r,uuid:l}=W(),s=em(),i="lexical-inlineBlocks-create-"+l,u;t[0]!==s||t[1]!==i?(u=Qd({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=u):u=t[2];let d=u,{toggleDrawer:c}=$e(d,!0),a;t[3]!==e||t[4]!==r||t[5]!==o?(a=()=>{if(!e.hasNodes([de]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return qd(e.registerCommand(ot,f=>(e.update(()=>{let h=rm()||nm();if(sm(h)){let p=Pe(f),{focus:g}=h,C=g.getNode();Yd(p),im(C)&&!C.__first&&C.remove()}}),!0),bl),e.registerCommand(nt,f=>{if(o){let p=om(o);return!p||!_t(p)?!1:(p.setFields(f),n(null),!0)}let h=kt(f);return r?.(h),lm([h]),am(h.getParentOrThrow())&&Zd(h,tm).selectEnd(),!0},bl))},t[3]=e,t[4]=r,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==r||t[9]!==o||t[10]!==c?(m=[e,r,o,c],t[7]=e,t[8]=r,t[9]=o,t[10]=c,t[11]=m):m=t[11],cm(a,m),null};var dm=A(({config:t,featureClientSchemaMap:e,props:o,schemaPath:n})=>{let r=`${n}.lexical_internal_feature.blocks.lexical_blocks`,l=`${n}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(r+".")&&!a.replace(r+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),d=i.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0),c=u.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0);return{markdownTransformers:xl({blocks:d,inlineBlocks:c}),nodes:[de,bt],plugins:[{Component:kl,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[d?.length?{items:d.map(a=>({Icon:Jr(a,Wo),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?eo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ot,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,c?.length?{items:c.map(a=>({Icon:Vo,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?eo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(nt,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[d.length?{type:"dropdown",ChildComponent:Wo,items:d.map((a,m)=>({isActive:void 0,key:"block-"+a.slug,label:({i18n:f})=>a?.labels?.singular?eo(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(ot,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,c?.length?{type:"dropdown",ChildComponent:Vo,items:c.map((a,m)=>({isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:f})=>a?.labels?.singular?eo(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(nt,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as pm}from"react/compiler-runtime";import{jsx as je,jsxs as rn}from"react/jsx-runtime";import{useLexicalComposerContext as hm}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as gm,$createTextNode as xm,$getRoot as Cm,getDOMSelection as tn}from"lexical";import*as Sl from"react";import{useCallback as Be,useEffect as on,useLayoutEffect as Tl,useRef as nn,useState as to}from"react";var mm=se&&"documentMode"in document?document.documentMode:null,_l=se&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),H7=se&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),G7=se&&"InputEvent"in window&&!mm?"getTargetRanges"in new window.InputEvent("input"):!1,U7=se&&/Version\/[\d.].*Safari/.test(navigator.userAgent),z7=se&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,W7=se&&/Android/.test(navigator.userAgent),V7=se&&/Win/.test(navigator.platform),fm=se&&/^(?=.*Chrome).*/i.test(navigator.userAgent),K7=se&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!fm;var bm=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)},km=(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)},_m=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
24
24
  await assertSelection(page, {
25
25
  anchorPath: [${r.anchorPath.toString()}],
26
26
  anchorOffset: ${r.anchorOffset},
@@ -30,7 +30,7 @@ ${p}</${i.blockType}>`}return`<${i.blockType}${c?" "+wt({props:a}):""}/>`},handl
30
30
  `;case"type":return` await page.keyboard.type('${r}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
31
31
  `);default:return` await repeat(${t.count}, async () => {
32
32
  ${o}
33
- );`}};function Kd(t){return t.key.toLowerCase()==="a"&&(rl?t.metaKey:t.ctrlKey)}function Xd(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:n,focusOffset:r}=t;return n!==0&&n--,r!==0&&r--,{anchorNode:e,anchorOffset:n,focusNode:o,focusOffset:r}}function il(t,e){let o=t,n=[];for(;o!==e;)o!=null&&n.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return n}var sl=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Jd(t){let[e,o]=qt([]),[n,r]=qt(!1),[,l]=qt(""),[s,i]=qt(""),u=Jo(null),d=Jo(!1),c=Jo(null),a=Pe(()=>t,[t]),m=Pe(()=>{let b=t.getRootElement(),C=Ko(t._window);return b==null||C==null||C.anchorNode==null||C.focusNode==null||!b.contains(C.anchorNode)||!b.contains(C.focusNode)?null:`
33
+ );`}};function Tm(t){return t.key.toLowerCase()==="a"&&(_l?t.metaKey:t.ctrlKey)}function Em(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:n,focusOffset:r}=t;return n!==0&&n--,r!==0&&r--,{anchorNode:e,anchorOffset:n,focusNode:o,focusOffset:r}}function El(t,e){let o=t,n=[];for(;o!==e;)o!=null&&n.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return n}var wl=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function wm(t){let[e,o]=to([]),[n,r]=to(!1),[,l]=to(""),[s,i]=to(""),u=nn(null),d=nn(!1),c=nn(null),a=Be(()=>t,[t]),m=Be(()=>{let x=t.getRootElement(),b=tn(t._window);return x==null||b==null||b.anchorNode==null||b.focusNode==null||!x.contains(b.anchorNode)||!x.contains(b.focusNode)?null:`
34
34
  import {
35
35
  initializeE2E,
36
36
  assertHTMLSnapshot,
@@ -47,19 +47,19 @@ describe('Test case', () => {
47
47
  const {page} = e2e;
48
48
 
49
49
  await page.focus('div[contenteditable="true"]');
50
- ${e.map(Wd).join(`
50
+ ${e.map(_m).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=Pe((b,C)=>{o(x=>{let k=e.length-1,T=e[k];if(T&&T.name===b){if(b==="type")return[...e.slice(0,k),{...T,value:T.value+C}];if(T.value===C)return[...e.slice(0,k),{...T,count:T.count+1}]}return[...x,{name:b,count:1,value:C}]})},[e,o]);ll(()=>{let b=x=>{if(!n)return;let k=x.key;Kd(x)?p("selectAll",""):sl.has(k)?p("press",x.key):[...k].length>1?p("keydown",x.key):p("type",x.key)},C=x=>{if(!n)return;let k=x.key;!sl.has(k)&&[...k].length>1&&p("keyup",x.key)};return t.registerRootListener((x,k)=>{k!==null&&(k.removeEventListener("keydown",b),k.removeEventListener("keyup",C)),x!==null&&(x.addEventListener("keydown",b),x.addEventListener("keyup",C))})},[t,n,p]),ll(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),Xo(()=>{if(e){let b=m();b!==null&&i(b),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),Xo(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:x,editorState:k})=>{if(!n)return;let T=k._selection,I=u.current,N=d.current;if(I!==T){if(x.size===0&&C.size===0&&!N){let S=Ko(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}u.current=T}d.current=!1;let E=m();E!==null&&i(E)}),[t,m,n,p]),Xo(()=>n?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,n]);let h=Pe(b=>{n||(b.update(()=>{let C=Ud();C.clear();let x=Gd();C.append(Hd().append(x)),x.select()}),o([])),r(C=>!C)},[n]),f=Pe(()=>{if(!n)return;let b=Ko(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:C,anchorOffset:x,focusNode:k,focusOffset:T}=Xd(b),I=a().getRootElement(),N;C!==null&&(N=il(C,I));let E;k!==null&&(E=il(k,I)),p("snapshot",{anchorNode:C,anchorOffset:x,anchorPath:N,focusNode:k,focusOffset:T,focusPath:E})},[p,n,a]),g=Pe(()=>{Vd(m())},[m]),_=Pe(()=>{zd("test.js",m())},[m]);return[je("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:b=>{h(a()),b.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?Zo("div",{className:"test-recorder-output",children:[Zo("div",{className:"test-recorder-toolbar",children:[je("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{f(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),je("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),je("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{_(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),je("pre",{id:"test-recorder",ref:c,children:s})]}):null]}var cl=()=>{let t=Pd(3),[e]=jd(),[o,n]=Jd(e),r;return t[0]!==o||t[1]!==n?(r=Zo(al.Fragment,{children:[je("p",{children:"HI"}),o,n,je("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var Zd=A({plugins:[{Component:cl,position:"bottom"}]});import{c as Yd}from"react/compiler-runtime";import{jsx as qd}from"react/jsx-runtime";import{useLexicalComposerContext as Qd}from"@lexical/react/LexicalComposerContext.js";import{TreeView as e1}from"@lexical/react/LexicalTreeView.js";import"react";var ul=()=>{let t=Yd(2),[e]=Qd(),o;return t[0]!==e?(o=qd(e1,{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 t1=A({plugins:[{Component:ul,position:"bottom"}]});import{BOLD_ITALIC_STAR as n1,BOLD_ITALIC_UNDERSCORE as r1,BOLD_STAR as l1,BOLD_UNDERSCORE as i1}from"@lexical/markdown";import{$isTableSelection as s1}from"@lexical/table";import{$isRangeSelection as a1,FORMAT_TEXT_COMMAND as c1}from"lexical";import{jsx as dl}from"react/jsx-runtime";import"react";var o1="M14.5 9.25A1.75 1.75 0 0 1 12.75 11H9.5V7.5h3.25c.966 0 1.75.784 1.75 1.75M8 11V7.5A1.5 1.5 0 0 1 9.5 6h3.25a3.25 3.25 0 0 1 2.418 5.422A3.5 3.5 0 0 1 13.5 18h-4A1.5 1.5 0 0 1 8 16.5zm1.5 1.5v4h4a2 2 0 1 0 0-4z",ml=({className:t})=>dl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:dl("path",{clipRule:"evenodd",d:o1,fill:"currentColor",fillRule:"evenodd"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var pl=[Z([{ChildComponent:ml,isActive:({selection:t})=>a1(t)||s1(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(c1,"bold")},order:1}])],u1=A(({featureProviderMap:t})=>{let e=[l1,i1];return t.get("italic")&&e.push(r1,n1),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:pl},toolbarInline:{groups:pl}}});import{INLINE_CODE as m1}from"@lexical/markdown";import{$isTableSelection as p1}from"@lexical/table";import{$isRangeSelection as f1,FORMAT_TEXT_COMMAND as h1}from"lexical";import{jsx as fl}from"react/jsx-runtime";import"react";var d1="M9.64645 8.14645C9.84171 7.95118 10.1582 7.95118 10.3535 8.14645C10.5487 8.34171 10.5487 8.65822 10.3535 8.85348L7.20699 12L10.3535 15.1464C10.5487 15.3417 10.5487 15.6582 10.3535 15.8535C10.1582 16.0487 9.84171 16.0487 9.64645 15.8535L6.14645 12.3535C5.95118 12.1582 5.95118 11.8417 6.14645 11.6464L9.64645 8.14645ZM13.6464 8.14645C13.8417 7.95118 14.1582 7.95118 14.3535 8.14645L17.8535 11.6464C18.0487 11.8417 18.0487 12.1582 17.8535 12.3535L14.3535 15.8535C14.1582 16.0487 13.8417 16.0487 13.6464 15.8535C13.4512 15.6582 13.4512 15.3417 13.6464 15.1464L16.7929 12L13.6464 8.85348C13.4512 8.65822 13.4512 8.34171 13.6464 8.14645Z",hl=({className:t})=>fl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:fl("path",{clipRule:"evenodd",d:d1,fill:"currentColor",fillRule:"evenodd"})});var gl=[Z([{ChildComponent:hl,isActive:({selection:t})=>f1(t)||p1(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(h1,"code")},order:7}])],g1=A({enableFormats:["code"],markdownTransformers:[m1],toolbarFixed:{groups:gl},toolbarInline:{groups:gl}});import{ITALIC_STAR as x1,ITALIC_UNDERSCORE as b1}from"@lexical/markdown";import{$isTableSelection as k1}from"@lexical/table";import{$isRangeSelection as _1,FORMAT_TEXT_COMMAND as T1}from"lexical";import{jsx as Cl}from"react/jsx-runtime";import"react";var C1="M10 6.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-2.083L11.6 17h1.9a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2.083L12.4 7h-1.9a.5.5 0 0 1-.5-.5",xl=({className:t})=>Cl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Cl("path",{clipRule:"evenodd",d:C1,fill:"currentColor",fillRule:"evenodd"})});var bl=[Z([{ChildComponent:xl,isActive:({selection:t})=>_1(t)||k1(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(T1,"italic")},order:2}])],w1=A({enableFormats:["italic"],markdownTransformers:[x1,b1],toolbarFixed:{groups:bl},toolbarInline:{groups:bl}});import{STRIKETHROUGH as S1}from"@lexical/markdown";import{$isTableSelection as N1}from"@lexical/table";import{$isRangeSelection as L1,FORMAT_TEXT_COMMAND as R1}from"lexical";import{jsx as kl}from"react/jsx-runtime";import"react";var E1="M15.835 13.5a.27.27 0 0 1 .24.138q.306.554.306 1.316 0 1.01-.543 1.816-.543.8-1.554 1.268-1.01.462-2.409.462-1.323 0-2.295-.419-.972-.424-1.534-1.175a3.2 3.2 0 0 1-.533-1.135c-.082-.326.187-.614.522-.614.299 0 .539.233.625.519q.13.43.415.768.448.524 1.17.8.73.271 1.63.272.996 0 1.764-.32.773-.327 1.215-.906a2.16 2.16 0 0 0 .44-1.348q0-.645-.345-1.09c-.1-.132-.016-.352.15-.352zm-3.846-8q1.215 0 2.142.438.933.43 1.476 1.187.38.518.519 1.134c.07.31-.19.577-.507.577-.286 0-.518-.22-.6-.493q-.22-.738-.875-1.224-.864-.646-2.18-.646-.92 0-1.63.313-.703.308-1.1.85a2.04 2.04 0 0 0-.395 1.237q0 .492.217.874.216.376.588.652.376.278.843.475.474.197.972.338l1.052.288H18.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1h3.94a4.4 4.4 0 0 1-.844-.602q-.844-.781-.844-1.982 0-1.009.562-1.778t1.522-1.2q.959-.438 2.153-.438",_l=({className:t})=>kl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:kl("path",{d:E1,fill:"currentColor"})});var Tl=[Z([{ChildComponent:_l,isActive:({selection:t})=>L1(t)||N1(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(R1,"strikethrough")},order:4}])],y1=A({enableFormats:["strikethrough"],markdownTransformers:[S1],toolbarFixed:{groups:Tl},toolbarInline:{groups:Tl}});import{$isTableSelection as I1}from"@lexical/table";import{$isRangeSelection as M1,FORMAT_TEXT_COMMAND as A1}from"lexical";import{jsx as wl}from"react/jsx-runtime";import"react";var v1="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652 3.925a.436.436 0 0 1-.287-.765l1.64-1.431q.259-.228.433-.407.175-.178.266-.345a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.195-.4 0-.643.21a.7.7 0 0 0-.133.151c-.127.197-.3.403-.534.403s-.432-.194-.367-.418q.11-.378.434-.642.494-.402 1.257-.403.513 0 .897.183.387.181.604.501.217.316.217.714 0 .316-.13.586-.125.27-.395.555a9 9 0 0 1-.695.634l-.927.798a.023.023 0 0 0 .016.042h1.895a.357.357 0 0 1 0 .714z",El=({className:t})=>wl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:wl("path",{d:v1,fill:"currentColor"})});var Sl=[Z([{ChildComponent:El,isActive:({selection:t})=>M1(t)||I1(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(A1,"subscript")},order:5}])],$1=A({enableFormats:["subscript"],toolbarFixed:{groups:Sl},toolbarInline:{groups:Sl}});import{$isTableSelection as O1}from"@lexical/table";import{$isRangeSelection as F1,FORMAT_TEXT_COMMAND as B1}from"lexical";import{jsx as Nl}from"react/jsx-runtime";import"react";var D1="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652-1.303a.436.436 0 0 1-.287-.765l1.64-1.432q.259-.228.433-.406.175-.179.266-.346a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.194-.4 0-.643.209a.7.7 0 0 0-.133.152c-.127.196-.3.403-.534.403s-.432-.194-.367-.419q.11-.378.434-.641.494-.403 1.257-.403.513 0 .897.182.387.183.604.502.217.315.217.714 0 .315-.13.585-.125.27-.395.555a9 9 0 0 1-.695.635l-.927.798a.023.023 0 0 0 .016.041h1.895a.357.357 0 1 1 0 .715z",Ll=({className:t})=>Nl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Nl("path",{d:D1,fill:"currentColor"})});var Rl=[Z([{ChildComponent:Ll,isActive:({selection:t})=>F1(t)||O1(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(B1,"superscript")},order:6}])],P1=A({enableFormats:["superscript"],toolbarFixed:{groups:Rl},toolbarInline:{groups:Rl}});import{$isTableSelection as H1}from"@lexical/table";import{$isRangeSelection as G1,FORMAT_TEXT_COMMAND as U1}from"lexical";import{jsx as yl}from"react/jsx-runtime";import"react";var j1="M9 7.5a.5.5 0 0 0-1 0V12a4 4 0 0 0 8 0V7.5a.5.5 0 0 0-1 0V12a3 3 0 1 1-6 0zM16.5 19a.5.5 0 0 0 0-1h-9a.5.5 0 0 0 0 1z",vl=({className:t})=>yl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:yl("path",{clipRule:"evenodd",d:j1,fill:"currentColor",fillRule:"evenodd"})});var Il=[Z([{ChildComponent:vl,isActive:({selection:t})=>G1(t)||H1(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(U1,"underline")},order:3}])],V1=A({enableFormats:["underline"],toolbarFixed:{groups:Il},toolbarInline:{groups:Il}});import{jsx as qo}from"react/jsx-runtime";import{jsx as z1}from"react/jsx-runtime";function W1(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var Qt=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[W1(o),n])):{};return z1("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as K1}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as X1}from"@lexical/selection";import{$getNodeByKey as J1,$getState as Z1,$setState as Y1,createState as q1,TextNode as Q1}from"lexical";import{useEffect as em}from"react";function Ml(t){let e=new Map;for(let o in t){let n=t[o],r=q1(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function Yo(t,e,o,n){t.update(()=>{X1(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);Y1(r,l.stateConfig,n)})})}function Al({stateMap:t}){let[e]=K1();return em(()=>e.registerMutationListener(Q1,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=J1(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((u,d)=>{let c=Z1(l,u.stateConfig);if(!c){delete s.dataset[d];return}s.dataset[d]=c;let a=u.stateValues[c]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var $l=(t,e)=>{let o=[];for(let r in t.state){let l=t.state[r];for(let s in l){let i=l[s];o.push({ChildComponent:()=>qo(Qt,{css:i.css}),key:s,label:i.label,onSelect:({editor:u})=>{Yo(u,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>qo(Qt,{css:{color:"var(--color-icon-secondary)"}}),items:[...[{ChildComponent:()=>qo(Qt,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)Yo(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},tm=A(({props:t})=>{let e=Ml(t.state);return{plugins:[{Component:()=>Al({stateMap:e}),position:"normal"}],toolbarFixed:{groups:$l(t,e)},toolbarInline:{groups:$l(t,e)}}});import{c as cm}from"react/compiler-runtime";import{useLexicalComposerContext as um}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as dm,$isHeadingNode as Xl,HeadingNode as Yl}from"@lexical/rich-text";import{$setBlocksType as mm}from"@lexical/selection";import{$getSelection as pm,$isRangeSelection as fm}from"lexical";import{useEffect as hm}from"react";import{jsx as Dl}from"react/jsx-runtime";import"react";var om="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm11 6a.5.5 0 0 0-.777-.416l-1.5 1a.5.5 0 1 0 .554.832l.723-.482V17.5a.5.5 0 0 0 1 0z",Ol=({className:t})=>Dl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Dl("path",{d:om,fill:"currentColor"})});import{jsx as Fl}from"react/jsx-runtime";import"react";var nm="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm9.034 10.952c0 .303.245.548.548.548h2.97a.448.448 0 0 0 0-.896H17.48v-.04l.997-1.038q.562-.555.873-.945.314-.39.438-.711t.124-.653q0-.497-.245-.885a1.7 1.7 0 0 0-.684-.61A2.24 2.24 0 0 0 17.96 12a2.2 2.2 0 0 0-1.017.228 1.71 1.71 0 0 0-.888 1.13c-.064.268.168.495.444.495.275 0 .479-.236.595-.485l.019-.039q.12-.22.333-.338a1 1 0 0 1 .5-.121q.278 0 .495.11a.83.83 0 0 1 .341.312.9.9 0 0 1 .125.48q0 .245-.096.462t-.288.448-.48.529l-1.85 1.854a.55.55 0 0 0-.16.387",Bl=({className:t})=>Fl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Fl("path",{d:nm,fill:"currentColor"})});import{jsx as Pl}from"react/jsx-runtime";import"react";var rm="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",jl=({className:t})=>Pl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Pl("path",{d:rm,fill:"currentColor"})});import{jsx as Hl}from"react/jsx-runtime";import"react";var lm="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",Gl=({className:t})=>Hl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Hl("path",{d:lm,fill:"currentColor"})});import{jsx as Ul}from"react/jsx-runtime";import"react";var im="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",Vl=({className:t})=>Ul("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ul("path",{d:im,fill:"currentColor"})});import{jsx as zl}from"react/jsx-runtime";import"react";var sm="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",Wl=({className:t})=>zl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:zl("path",{d:sm,fill:"currentColor"})});import{HEADING as am}from"@lexical/markdown";var Kl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`;return{...am,regExp:new RegExp(o)}};var Jl=t=>{let e=pm();mm(e,()=>dm(t))},Zl={h1:Ol,h2:Bl,h3:jl,h4:Gl,h5:Vl,h6:Wl},gm=A(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((n,r)=>({ChildComponent:Zl[n],isActive:({selection:l})=>{if(!fm(l))return!1;for(let s of l.getNodes()){if(Xl(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(Xl(i)&&i.getTag()===n))return!1}return!0},key:n,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Jl(n)})},order:r+2})))];return{markdownTransformers:[Kl(e)],nodes:[Yl],plugins:[{Component:Cm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[J(e.map(n=>({Icon:Zl[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{Jl(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),Cm=t=>{let e=cm(9),{clientProps:o}=t,{enabledHeadingSizes:n}=o,r;e[0]!==n?(r=n===void 0?["h1","h2","h3","h4","h5","h6"]:n,e[0]=n,e[1]=r):r=e[1];let l=r,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[u]=um(),d,c;return e[4]!==u||e[5]!==l||e[6]!==i?(d=()=>{if(!(!i||l.length===6))return u.registerNodeTransform(Yl,a=>{l.includes(a.getTag())||a.setTag(i)})},c=[u,l,i],e[4]=u,e[5]=l,e[6]=i,e[7]=d,e[8]=c):(d=e[7],c=e[8]),hm(d,c),null};import{$isNodeSelection as Dm}from"lexical";import{jsx as ql}from"react/jsx-runtime";import"react";var xm="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",Qo=({className:t})=>ql("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ql("path",{d:xm,fill:"currentColor"})});import{jsx as Ql}from"react/jsx-runtime";import"react";var bm={16:"M8.5 3.5a.5.5 0 0 0-1 0v4h-4a.5.5 0 0 0 0 1h4v4a.5.5 0 0 0 1 0v-4h4a.5.5 0 0 0 0-1h-4z",24:"M12 6a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 12 6"},ei=({className:t,size:e=24})=>Ql("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ql("path",{clipRule:"evenodd",d:bm[e],fill:"currentColor",fillRule:"evenodd"})});var be=t=>({type:"dropdown",ChildComponent:ei,items:t,key:"add",order:10});import{addClassNamesToElement as km}from"@lexical/utils";import{$applyNodeReplacement as _m,createCommand as Tm,DecoratorNode as wm}from"lexical";var Lt=Tm("INSERT_HORIZONTAL_RULE_COMMAND"),Nt=class extends wm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Em,priority:0})}}static importJSON(e){return ti()}createDOM(e){let o=document.createElement("hr");return km(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
- `}isInline(){return!1}updateDOM(){return!1}};function Em(){return{node:ti()}}function ti(){return _m(new Nt)}import{$applyNodeReplacement as Sm}from"lexical";import"react";var ke=class extends Nt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return nt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function nt(){return Sm(new ke)}function He(t){return t instanceof ke}var oi={type:"element",dependencies:[ke],export:(t,e)=>He(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=nt();e&&t.replace(e)}};import{c as Nm}from"react/compiler-runtime";import{useLexicalComposerContext as Lm}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as ni,$insertNodeToNearestRoot as Rm}from"@lexical/utils";import{$getRoot as ym,$getSelection as ri,$isRangeSelection as li,$isRootOrShadowRoot as ii,COMMAND_PRIORITY_EDITOR as vm}from"lexical";import{useEffect as Im}from"react";var en="LexicalEditorTheme__hrSelected",si=()=>{let t=Nm(3),[e]=Lm(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(Lt,Mm,vm),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let d=ym().getChildren(),c=ri(),a=[];for(let b=0;b<d.length;b++){let C=d[b];if(He(C)){let x=e.getElementByKey(C.getKey());x&&a.push({element:x,index:b})}}if(a.length===0)return;if(!li(c)||c.isCollapsed()){for(let{element:b}of a)b.classList.remove(en);return}let m=c.anchor.getNode(),p=c.focus.getNode(),h=ni(m,Am)||m,f=ni(p,$m)||p,g=d.indexOf(h),_=d.indexOf(f);if(g===-1||_===-1)return;let L=Math.min(g,_),v=Math.max(g,_);for(let{element:b,index:C}of a)C>=L&&C<=v?b.classList.add(en):b.classList.remove(en)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Im(o,n),null};function Mm(t){let e=ri();if(!li(e))return!1;if(e.focus.getNode()!==null){let n=nt();Rm(n)}return!0}function Am(t){return ii(t.getParent())}function $m(t){return ii(t.getParent())}var Om=A({markdownTransformers:[oi],nodes:[ke],plugins:[{Component:si,position:"normal"}],slashMenu:{groups:[J([{Icon:Qo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:Qo,isActive:({selection:t})=>{if(!Dm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return He(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,void 0)}}])]}});import{$findMatchingParent as xi}from"@lexical/utils";import{$isElementNode as Jm,INDENT_CONTENT_COMMAND as Zm,OUTDENT_CONTENT_COMMAND as Ym}from"lexical";import{jsx as tn}from"react/jsx-runtime";import"react";var Fm="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",ai=({className:t})=>tn("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:tn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:tn("path",{clipRule:"evenodd",d:Fm,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as ci}from"react/jsx-runtime";import"react";var Bm="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",ui=({className:t})=>ci("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ci("path",{clipRule:"evenodd",d:Bm,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Pm}from"react/jsx-runtime";import{useLexicalComposerContext as jm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Hm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Gm,mergeRegister as di}from"@lexical/utils";import{$getSelection as Um,$isElementNode as hi,$isRangeSelection as Vm,COMMAND_PRIORITY_LOW as mi,INDENT_CONTENT_COMMAND as pi,KEY_TAB_COMMAND as zm,OUTDENT_CONTENT_COMMAND as Wm,TabNode as Km}from"lexical";import{useEffect as fi}from"react";var gi=({clientProps:t})=>{let[e]=jm(),{disabledNodes:o,disableTabNode:n}=t;return fi(()=>{if(!(!e||!o?.length))return di(e.registerCommand(pi,()=>Xm(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),mi),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);hi(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),fi(()=>{if(!(!e||!n))return di(e.registerCommand(zm,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?Wm:pi,void 0)),mi),e.registerNodeTransform(Km,r=>{r.remove()}))},[e,n]),Pm(Hm,{})};function Xm(t){let e=Um();if(!Vm(e))return!1;let o=new Set,n=e.getNodes();for(let r=0;r<n.length;r++){let l=n[r],s=l.getKey();if(o.has(s))continue;let i=Gm(l,d=>hi(d)&&!d.isInline());if(i===null)continue;let u=i.getKey();i.canIndent()&&!o.has(u)&&(o.add(u),t(i))}return o.size>0}var Ci=t=>({type:"buttons",items:t,key:"indent",order:35});var bi=({disabledNodes:t})=>[Ci([{ChildComponent:ai,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>ki(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!xi(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ym,void 0)},order:1},{ChildComponent:ui,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>ki(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!xi(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Zm,void 0)},order:2}])],qm=A(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:gi,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:bi({disabledNodes:e})},toolbarInline:{groups:bi({disabledNodes:e})}}}),ki=t=>Jm(t)&&t.canIndent();import{$findMatchingParent as gf}from"@lexical/utils";import{$getSelection as pn,$isRangeSelection as ts}from"lexical";import{jsx as _i}from"react/jsx-runtime";import"react";var Qm={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4436 10.3708C12.6861 10.5041 12.9148 10.6721 13.1204 10.8776C14.2919 12.0492 14.2918 13.9482 13.1204 15.1198L11.1204 17.1198C9.94879 18.2914 8.04975 18.2914 6.87817 17.1198C5.70664 15.9482 5.70661 14.0492 6.87817 12.8776L8.1477 11.6071C8.4098 11.345 8.89329 11.5392 8.97388 11.9011C9.00617 12.0462 8.96861 12.2012 8.86353 12.3063L7.5852 13.5847C6.80417 14.3657 6.80419 15.6317 7.5852 16.4128C8.36625 17.1938 9.63228 17.1938 10.4133 16.4128L12.4133 14.4128C13.1942 13.6317 13.1943 12.3657 12.4133 11.5847C12.4042 11.5755 12.3953 11.5662 12.386 11.5573C12.2925 11.468 12.1984 11.3736 12.1614 11.2497C12.0724 10.9515 12.1448 10.6149 12.3801 10.3796C12.397 10.3628 12.4228 10.3594 12.4436 10.3708ZM12.8782 6.87764C14.0497 5.70615 15.9488 5.70616 17.1204 6.87764C18.2919 8.04919 18.2919 9.94825 17.1204 11.1198L15.8508 12.3903C15.5887 12.6522 15.1053 12.4581 15.0247 12.0964C14.9924 11.9512 15.0308 11.7963 15.136 11.6911L16.4133 10.4128C17.1943 9.63175 17.1943 8.3657 16.4133 7.58467C15.6323 6.80371 14.3662 6.8037 13.5852 7.58467L11.5852 9.58467C10.8046 10.3657 10.8044 11.6319 11.5852 12.4128C11.5943 12.4219 11.6042 12.4303 11.6135 12.4392C11.7064 12.5278 11.7999 12.622 11.8372 12.7448C11.9276 13.044 11.8545 13.3827 11.6184 13.6188C11.6023 13.6347 11.5778 13.6383 11.5579 13.6276C11.3146 13.4942 11.0843 13.3259 10.8782 13.1198C9.7068 11.9484 9.707 10.0492 10.8782 8.87764L12.8782 6.87764Z"},eo=({className:t,size:e=24})=>_i("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:_i("path",{d:Qm[e],fill:"currentColor"})});import{$isAtNodeEnd as Ti}from"@lexical/selection";function rt(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?Ti(o)?n:r:Ti(e)?n:r}var on=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as mp}from"lexical";function nn(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var ep=/^(?:[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+)?$/,tp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function wi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||ep.test(t)||tp.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as op,isHTMLAnchorElement as np}from"@lexical/utils";import sn from"bson-objectid";import{$applyNodeReplacement as rp,$createTextNode as Ei,$getSelection as lp,$isElementNode as Si,$isRangeSelection as ln,createCommand as ip,ElementNode as sp}from"lexical";var ap=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends sp{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:cp,priority:1})}}static importJSON(e){let o=_e({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new sn.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=rn(o.rel,"add","noopener")),op(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!ln(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Si(n)){let r=_e({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!ap.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,n){let r=this.__fields?.url,l=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=rn(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=rn(o.rel,"remove","noopener"))),!1}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields).setID(o.id)}};function cp(t){let e=null;if(np(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new sn.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function _e({id:t,fields:e}){return rp(new oe({id:t??new sn.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var pe=ip("TOGGLE_LINK_COMMAND");function an(t){let e=lp();if(!ln(e)&&(t===null||!t.selectedNodes?.length))return;let o=ln(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();K(s)&&(s.getChildren().forEach(u=>{s.insertBefore(u)}),s.remove())});return}if(o?.length===1){let l=o[0],s=K(l)?l:up(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ei(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let n=null,r=null;o?.forEach(l=>{let s=l.getParent();if(!(s===r||s===null||Si(l)&&!l.isInline())){if(K(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ei(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=_e({fields:t.fields}),K(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),K(l)){if(l.is(r))return;if(r!==null){let i=l.getChildren();r.append(...i)}l.remove();return}r!==null&&r.append(l)}})}function up(t){return dp(t,e=>K(e))}function dp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function rn(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let l=new RegExp(o,"g");r=r.replace(l,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let l=new RegExp(o,"g");n=r.replace(l,"").trim()}return n}var pp=(t,e)=>{let[,o,n]=e,r=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=mp(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},fp=t=>({type:"text-match",dependencies:[oe],export:(e,o)=>{if(!K(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=nn(t.internalDocToHref({linkNode:n.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=nn(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:pp,trigger:")"}),Ni=fp();import{$applyNodeReplacement as hp,$isElementNode as gp}from"lexical";var Te=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Rt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(gp(n)){let r=Rt({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields)}};function Rt({fields:t}){return hp(new Te({id:"",fields:t}))}function we(t){return t instanceof Te}import{c as Cp}from"react/compiler-runtime";import{useLexicalComposerContext as xp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as bp}from"@lexical/utils";import{$createTextNode as Li,$getSelection as kp,$isElementNode as yi,$isLineBreakNode as vi,$isNodeSelection as _p,$isRangeSelection as Tp,$isTextNode as yt,TextNode as wp}from"lexical";import{useEffect as Ep}from"react";function Ri(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function Ii(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var Sp=/[.,;\s]/;function oo(t){return t!==void 0&&Sp.test(t)}function Mi(t){return oo(t[t.length-1])}function un(t){return oo(t[0])}function Np(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ai(t){let e=t.getPreviousSibling();return yi(e)&&(e=e.getLastDescendant()),e===null||vi(e)||yt(e)&&Mi(e.getTextContent())}function $i(t){let e=t.getNextSibling();return yi(e)&&(e=e.getFirstDescendant()),e===null||vi(e)||yt(e)&&un(e.getTextContent())}function Lp(t,e,o,n){return(t>0?oo(o[t-1]):Ai(n[0]))?e<o.length?oo(o[e]):$i(n[n.length-1]):!1}function Rp(t,e,o){let n=[],r=[],l=[],s=0,i=0,u=[...t];for(;u.length>0;){let d=u[0],a=d.getTextContent().length,m=i;i+a<=e?(n.push(d),s+=a):m>=o?l.push(d):r.push(d),i+=a,u.shift()}return[s,n,r,l]}function yp(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=Rt({fields:r});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let u=Li(n.text);u.setFormat(i.getFormat()),u.setDetail(i.getDetail()),u.setStyle(i.getStyle()),l.append(u),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,u;e===0?u=s:[,u]=s.splitText(e);let d=[],c;if(t.forEach(a=>{let p=a.getTextContent().length,h=i,f=i+p;if(h<o)if(f<=o)d.push(a);else{let[g,_]=a.splitText(o-h);g&&d.push(g),c=_}i+=p}),u){let a=kp(),m=a?a.getNodes().find(yt):void 0,p=Li(u.getTextContent());return p.setFormat(u.getFormat()),p.setDetail(u.getDetail()),p.setStyle(u.getStyle()),l.append(p,...d),m&&m===u&&(Tp(a)?p.select(a.anchor.offset,a.focus.offset):_p(a)&&p.select(0,p.getTextContent().length)),u.replace(l),c}}}function vp(t,e,o){let n=[...t],r=n.map(u=>u.getTextContent()).join(""),l=r,s,i=0;for(;(s=Ii(l,e))!=null&&s!==null;){let u=s.index,d=s.length,c=u+d;if(Lp(i+u,i+c,r,n)){let[m,,p,h]=Rp(n,i+u,i+c),f=i+u-m,g=i+c-m,_=yp(p,f,g,s);n=_?[_,...h]:h,o(s.url,null),i=0}else i+=c;l=l.substring(c)}}function cn(t,e,o){let n=t.getChildren(),r=n.length;for(let u=0;u<r;u++){let d=n[u];if(!yt(d)||!d.isSimpleText()){to(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Ii(l,e);if(s===null||s.text!==l){to(t),o(null,t.getFields()?.url??null);return}if(!Ai(t)||!$i(t)){to(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let u=t.getFields();u.url=s?.url,t.setFields(u),o(s.url,i??null)}}function Ip(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),l=t.getTextContent();if(we(n)){let s=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:")??!1:!1;(!un(l)||Np(l,s))&&(n.append(t),cn(n,e,o),o(null,n.getFields()?.url??null))}we(r)&&!Mi(l)&&(to(r),cn(r,e,o),o(null,r.getFields()?.url??null))}function to(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function Mp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&yt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Ap(t,e,o){let n=Cp(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([Te]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,u)=>{o?.(i,u)};return bp(t.registerNodeTransform(wp,i=>{let u=i.getParentOrThrow(),d=i.getPreviousSibling();if(we(u))cn(u,e,s);else if(!K(u)){if(i.isSimpleText()&&(un(i.getTextContent())||!we(d))){let c=Mp(i);vp(c,e,s)}Ip(i,e,s)}}))},l=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=l):(r=n[3],l=n[4]),Ep(r,l)}var $p=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Dp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Op=[Ri($p,t=>t.startsWith("http")?t:`https://${t}`),Ri(Dp,t=>`mailto:${t}`)],Di=()=>{let[t]=xp();return Ap(t,Op),null};import{jsx as Fp}from"react/jsx-runtime";import{ClickableLinkPlugin as Bp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Oi=()=>Fp(Bp,{});import{jsx as rf}from"react/jsx-runtime";import"react";import{createPortal as lf}from"react-dom";import{jsx as ne,jsxs as Ge,Fragment as dn}from"react/jsx-runtime";import{useLexicalComposerContext as Hp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Gp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Gi,mergeRegister as Ui}from"@lexical/utils";import{getTranslation as mn}from"@payloadcms/translations";import{formatDrawerSlug as Up,NewTabIcon as Vi,useConfig as Vp,useEditDepth as zp,useLocale as Wp,useTranslation as Kp,WriteIcon as Xp}from"@payloadcms/ui";import{requests as Jp}from"@payloadcms/ui/shared";import{$getSelection as zi,$isLineBreakNode as Zp,$isRangeSelection as Wi,COMMAND_PRIORITY_HIGH as Yp,COMMAND_PRIORITY_LOW as Ki,getDOMSelection as qp,KEY_ESCAPE_COMMAND as Qp,SELECTION_CHANGE_COMMAND as ef}from"lexical";import{formatAdminURL as tf}from"payload/shared";import of,{useCallback as Xi,useEffect as lo,useLayoutEffect as nf,useRef as Ji,useState as Ue}from"react";import{jsx as Fi}from"react/jsx-runtime";import"react";var Pp="M12.5 5C12.6326 5 12.7597 5.05272 12.8535 5.14648L16.8535 9.14648C16.9965 9.28948 17.0393 9.50457 16.9619 9.69141C16.8845 9.87821 16.7022 10 16.5 10H12.5C12.2239 10 12 9.77614 12 9.5V6H8.5C8.22386 6 8 6.22386 8 6.5V17.5C8 17.7761 8.22386 18 8.5 18H15.5C15.7761 18 16 17.7761 16 17.5V11.5C16 11.2239 16.2239 11 16.5 11C16.7761 11 17 11.2239 17 11.5V17.5C17 18.3284 16.3284 19 15.5 19H8.5C7.67157 19 7 18.3284 7 17.5V6.5C7 5.67157 7.67157 5 8.5 5H12.5ZM13 9H15.293L13 6.70703V9Z",Bi=({className:t})=>Fi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Fi("path",{d:Pp,fill:"currentColor"})});import{jsx as Pi}from"react/jsx-runtime";import"react";var ji={default:"M6 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .496.5h12.008a.5.5 0 0 0 .496-.5v-1A.5.5 0 0 0 18 5zM4.5 6.5a1.5 1.5 0 0 0 1.037 1.427L5.725 10H5a.5.5 0 0 0 0 1h.816l.653 7.181A2 2 0 0 0 8.46 20h7.078a2 2 0 0 0 1.992-1.819L18.184 11H19a.5.5 0 0 0 0-1h-.725l.188-2.073A1.5 1.5 0 0 0 19.5 6.5v-1A1.5 1.5 0 0 0 18 4H6a1.5 1.5 0 0 0-1.5 1.5zm2.965 11.59L6.548 8h10.905l-.918 10.09a1 1 0 0 1-.996.91H8.461a1 1 0 0 1-.996-.91M11 10.5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"},Hi=({className:t,small:e})=>Pi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Pi("path",{clipRule:"evenodd",d:e?ji.small:ji.default,fill:"currentColor",fillRule:"evenodd"})});function no(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),u=t.top-n,d=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let c=e.scrollWidth,a=i.right-d,m=d-i.left,p;if(c<=a)p=e.getBoundingClientRect();else{let h=m+t.width,f=m>a,_=Math.min(c,f?h:a);_<c&&(e.style.width=`${_}px`,e.style.maxWidth=`${_}px`,e.offsetHeight),f&&(d=t.right-_),p=e.getBoundingClientRect()}u<i.top&&(u+=p.height+t.height+n*2),d+p.width>i.right&&(d=i.right-p.width-r),u-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${u}px)`}import{createCommand as jp}from"lexical";var ro=jp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Zi(t){t.preventDefault()}function Yi({anchorElem:t}){let[e]=Hp(),[o,n]=Ue(),r=Ji(null),l=Ji(null),[s,i]=Ue(null),[u,d]=Ue(null),{fieldProps:{schemaPath:c},uuid:a}=U(),m=Gp(),{config:p,getEntityConfig:h}=Vp(),{i18n:f,t:g}=Kp(),[_,L]=Ue(),v=zp(),[b,C]=Ue(!1),[x,k]=Ue([]),T=Wp(),[I,N]=Ue(!1),E=Up({slug:"lexical-rich-text-link-"+a,depth:v}),{toggleDrawer:S}=De(E),w=Xi(()=>{C(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),d(null),k([]),L(void 0)},[C,i,d,k]),y=Xi(()=>{let R=zi(),M;if(!Wi(R)||!R){w();return}let $=rt(R);M=e.getElementByKey($.getKey())?.getBoundingClientRect();let D=Gi($,K),F=R.getNodes().filter(le=>!Zp(le)).find(le=>{let ge=Gi(le,K);return D&&!D.is(ge)||ge&&!ge.is(D)});if(D==null||F){w();return}n(D);let B=D.getFields(),Y={...B,id:D.getID(),text:D.getTextContent()};if(B?.linkType==="custom")i(B?.url??null),d(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${B?.doc?.relationTo}/${B?.doc?.value}`);let le=B?.doc?.relationTo?h({collectionSlug:B?.doc?.relationTo}):void 0;if(!le)d(B?.label?String(B?.label):null),i(B?.url?String(B?.url):null);else{let ge=typeof B.doc?.value=="object"?B.doc.value.id:B.doc?.value,jt=B.doc?.relationTo;if(!ge||!jt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let or=g("fields:linkedTo",{label:`${mn(le.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(or),Jp.get(tf({apiRoute:p.routes.api,path:`/${jt}/${ge}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:T?.code}}).then(async Xe=>{if(!Xe.ok)throw new Error(`HTTP error! Status: ${Xe.status}`);let ft=await Xe.json(),ee=le?.admin?.useAsTitle||"id",ht=ft[ee],de=g("fields:linkedTo",{label:`${mn(le.labels.singular,f)} - ${ht}`}).replace(/<[^>]*>?/g,"");d(de)}).catch(()=>{let Xe=g("fields:linkedTo",{label:`${mn(le.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${ge}`}).replace(/<[^>]*>?/g,"");d(Xe)})}}L(Y),C(!0),k(R?R?.getNodes():[]),we(D)?N(!0):N(!1);let X=r.current,Ke=qp(e._window),{activeElement:Re}=document;if(X===null)return;let he=e.getRootElement();return Ke!==null&&he!==null&&he.contains(Ke.anchorNode)?(M||(M=Ke.getRangeAt(0).getBoundingClientRect()),M!=null&&(M.y+=40,l.current=M)):(Re==null||Re.className!=="link-input")&&(he!==null&&no(null,X,t),i(null),d(null)),!0},[e,w,p.routes.admin,p.routes.api,p.serverURL,h,g,f,T?.code,t]);return lo(()=>Ui(e.registerCommand(ro,R=>(e.dispatchCommand(pe,R),y(),S(),!0),Ki)),[e,y,S,E]),lo(()=>{let R=t.parentElement,M=()=>{e.getEditorState().read(()=>{y()})};return window.addEventListener("resize",M),R?.addEventListener("scroll",M),()=>{window.removeEventListener("resize",M),R?.removeEventListener("scroll",M)}},[t.parentElement,e,y]),lo(()=>Ui(e.registerUpdateListener(({editorState:R})=>{R.read(()=>{y()})}),e.registerCommand(ef,()=>(y(),!0),Ki),e.registerCommand(Qp,()=>b?(w(),!0):!1,Yp)),[e,y,b,w]),lo(()=>{e.getEditorState().read(()=>{y()})},[e,y]),nf(()=>{!b||!r.current||!t||!l.current||no(l.current,r.current,t)},[s,u,b,t,o]),Ge(of.Fragment,{children:[ne("div",{className:"link-editor","data-theme":"dark",ref:r,children:Ge("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?ne(eo,{}):ne(Bi,{}),s&&s.length>0?Ge("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[u!=null&&u.length>0?u:s,o?.__fields.newTab?Ge(dn,{children:[ne(Vi,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):u!=null&&u.length>0?Ge(dn,{children:[ne("span",{className:"link-input__label-pure",children:u}),o?.__fields.newTab?Ge(dn,{children:[ne(Vi,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):null,m&&Ge("div",{className:"link-input__actions",children:[ne("button",{"aria-label":"Edit link",className:"link-edit",onClick:R=>{R.preventDefault(),S()},onMouseDown:Zi,tabIndex:0,type:"button",children:ne(Xp,{})}),!I&&ne("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(pe,null)},onMouseDown:Zi,tabIndex:0,type:"button",children:ne(Hi,{small:!0})})]})]})}),ne($o,{className:"lexical-link-edit-drawer",data:_,drawerSlug:E,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(R,M)=>{let $=M,D={...$};delete D.text,e.update(()=>{let F=zi(),B=null;if(Wi(F)?B=rt(F).getParent():x.length&&(B=x[0]?.getParent()??null),B&&we(B)){let Y=_e({fields:D});B.replace(Y,!0)}}),e.dispatchCommand(pe,{fields:D,selectedNodes:x,text:$.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var qi=t=>{let{anchorElem:e=document.body}=t;return lf(rf(Yi,{anchorElem:e}),e)};import{c as sf}from"react/compiler-runtime";import{useLexicalComposerContext as af}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as cf}from"@lexical/utils";import{$getSelection as uf,$isElementNode as df,$isRangeSelection as mf,COMMAND_PRIORITY_LOW as Qi,PASTE_COMMAND as pf}from"lexical";import{useEffect as ff}from"react";var es=t=>{let e=sf(5),{clientProps:o}=t,[n]=af(),r,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==n?(r=()=>{if(!n.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return cf(n.registerCommand(pe,s=>s===null?(an(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),an(s),!0),Qi),n.registerCommand(pf,s=>{let i=uf();if(!mf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let u=s.clipboardData.getData("text");if(!wi(u))return!1;if(!i.getNodes().some(hf)){let d={doc:null,linkType:"custom",newTab:!1,url:u};return n.dispatchCommand(pe,{fields:d,text:null}),s.preventDefault(),!0}return!1},Qi))},l=[o.defaultLinkType,o.defaultLinkURL,n],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=n,e[3]=r,e[4]=l):(r=e[3],l=e[4]),ff(r,l),null};function hf(t){return df(t)}var os=[on([{ChildComponent:eo,isActive:({selection:t})=>{if(ts(t)){let e=rt(t);return gf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(ts(t)&&pn()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(pe,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=pn()?.getTextContent(),n=pn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(ro,{fields:r,selectedNodes:n,text:o})}},order:1}])],Cf=A(({props:t})=>({markdownTransformers:[Ni],nodes:[oe,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:es,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Di,position:"normal"},{Component:Oi,position:"normal"},{Component:qi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:os},toolbarInline:{groups:os}}));import{$isListNode as hn,INSERT_CHECK_LIST_COMMAND as is,ListItemNode as wf,ListNode as Ef}from"@lexical/list";import{CHECK_LIST as Sf}from"@lexical/markdown";import{$isRangeSelection as Nf}from"lexical";import{jsx as ns}from"react/jsx-runtime";import"react";var xf={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},fn=({className:t,size:e=24})=>ns("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ns("path",{d:xf[e],fill:"currentColor"})});import{jsx as bf}from"react/jsx-runtime";import{ListPlugin as kf}from"@lexical/react/LexicalListPlugin.js";import"react";var lt=()=>bf(kf,{});function io(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function it(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{jsx as _f}from"react/jsx-runtime";import{CheckListPlugin as Tf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var rs=()=>_f(Tf,{});var ls=[te([{ChildComponent:fn,isActive:({selection:t})=>{if(!Nf(t))return!1;for(let e of t.getNodes()){if(hn(e)&&e.getListType()==="check")continue;let o=e.getParent();if(hn(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(hn(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(is,void 0)},order:12}])],Lf=A(({featureProviderMap:t})=>{let e=[{Component:rs,position:"normal"}],o=io("checklist",t);return o&&e.push({Component:lt,position:"normal"}),{markdownTransformers:[Sf],nodes:o?[Ef,wf]:[],plugins:e,slashMenu:{groups:[it([{Icon:fn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(is,void 0)}}])]},toolbarFixed:{groups:ls},toolbarInline:{groups:ls}}});import{$isListNode as Cn,INSERT_ORDERED_LIST_COMMAND as cs,ListItemNode as yf,ListNode as vf}from"@lexical/list";import{ORDERED_LIST as If}from"@lexical/markdown";import{$isRangeSelection as Mf}from"lexical";import{jsx as ss}from"react/jsx-runtime";import"react";var Rf={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},gn=({className:t,size:e=24})=>ss("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ss("path",{clipRule:"evenodd",d:Rf[e],fill:"currentColor",fillRule:"evenodd"})});var as=[te([{ChildComponent:gn,isActive:({selection:t})=>{if(!Mf(t))return!1;for(let e of t.getNodes()){if(Cn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Cn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(Cn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(cs,void 0)},order:10}])],Af=A(({featureProviderMap:t})=>{let e=io("ordered",t);return{markdownTransformers:[If],nodes:e?[vf,yf]:[],plugins:e?[{Component:lt,position:"normal"}]:[],slashMenu:{groups:[it([{Icon:gn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(cs,void 0)}}])]},toolbarFixed:{groups:as},toolbarInline:{groups:as}}});import{$isListNode as bn,INSERT_UNORDERED_LIST_COMMAND as ms,ListItemNode as Df,ListNode as Of}from"@lexical/list";import{UNORDERED_LIST as Ff}from"@lexical/markdown";import{$isRangeSelection as Bf}from"lexical";import{jsx as us}from"react/jsx-runtime";import"react";var $f="M7 16C7.55228 16 8 16.4477 8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16ZM17.5 16.5C17.7761 16.5 18 16.7239 18 17C18 17.2761 17.7761 17.5 17.5 17.5H10.5C10.2239 17.5 10 17.2761 10 17C10 16.7239 10.2239 16.5 10.5 16.5H17.5ZM7 11C7.55228 11 8 11.4477 8 12C8 12.5523 7.55228 13 7 13C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11ZM17.5 11.5C17.7761 11.5 18 11.7239 18 12C18 12.2761 17.7761 12.5 17.5 12.5H10.5C10.2239 12.5 10 12.2761 10 12C10 11.7239 10.2239 11.5 10.5 11.5H17.5ZM7 6C7.55228 6 8 6.44772 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7C6 6.44772 6.44772 6 7 6ZM17.5 6.5C17.7761 6.5 18 6.72386 18 7C18 7.27614 17.7761 7.5 17.5 7.5H10.5C10.2239 7.5 10 7.27614 10 7C10 6.72386 10.2239 6.5 10.5 6.5H17.5Z",xn=({className:t})=>us("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:us("path",{d:$f,fill:"currentColor"})});var ds=[te([{ChildComponent:xn,isActive:({selection:t})=>{if(!Bf(t))return!1;for(let e of t.getNodes()){if(bn(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(bn(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(bn(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ms,void 0)},order:11}])],Pf=A({markdownTransformers:[Ff],nodes:[Of,Df],plugins:[{Component:lt,position:"normal"}],slashMenu:{groups:[it([{Icon:xn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ms,void 0)}}])]},toolbarFixed:{groups:ds},toolbarInline:{groups:ds}});import{$setBlocksType as hs}from"@lexical/selection";import{$createParagraphNode as gs,$getSelection as Cs,$isParagraphNode as ps,$isRangeSelection as jf}from"lexical";var fs=[te([{ChildComponent:Tt,isActive:({selection:t})=>{if(!jf(t))return!1;for(let e of t.getNodes())if(!ps(e)&&!ps(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Cs();hs(e,()=>gs())})},order:1}])],Hf=A({slashMenu:{groups:[J([{Icon:Tt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Cs();hs(e,()=>gs())})}}])]},toolbarFixed:{groups:fs},toolbarInline:{groups:fs}});import{c as u0}from"react/compiler-runtime";import{jsx as Fs}from"react/jsx-runtime";import{useLexicalComposerContext as d0}from"@lexical/react/LexicalComposerContext";import{useEffect as m0,useState as p0}from"react";import{jsx as Os,Fragment as c0}from"react/jsx-runtime";import"react";import{jsx as Gf}from"react/jsx-runtime";var xs={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Gf("blockquote",{children:o})}};import{jsx as Uf}from"react/jsx-runtime";var bs={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return Uf(n,{children:o})}};import{jsx as Vf}from"react/jsx-runtime";var ks={horizontalrule:Vf("hr",{})};import{jsx as zf}from"react/jsx-runtime";var _s={linebreak:zf("br",{})};import{jsx as Ts}from"react/jsx-runtime";var ws=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Ts("a",{href:e.fields.url,rel:r,target:l,children:n})},link:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),Ts("a",{href:s,rel:r,target:l,children:n})}});import{jsx as st,jsxs as Wf,Fragment as Kf}from"react/jsx-runtime";import{v4 as Xf}from"uuid";var Es={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return st(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Xf();return st("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:Wf(Kf,{children:[st("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),st("label",{htmlFor:l,children:r}),st("br",{})]})})}else return st("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as kn}from"react/jsx-runtime";var Ss={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?kn("p",{children:o}):kn("p",{children:kn("br",{})})}};var Ns={tab:" "};import{jsx as vt}from"react/jsx-runtime";var Ls={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return vt("div",{className:"lexical-table-container",children:vt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:vt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return vt(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return vt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ve}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Jf=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,Zf="\xA0",Yf=`
54
+ `},[t,e]),f=Be((x,b)=>{o(k=>{let _=e.length-1,T=e[_];if(T&&T.name===x){if(x==="type")return[...e.slice(0,_),{...T,value:T.value+b}];if(T.value===b)return[...e.slice(0,_),{...T,count:T.count+1}]}return[...k,{name:x,count:1,value:b}]})},[e,o]);Tl(()=>{let x=k=>{if(!n)return;let _=k.key;Tm(k)?f("selectAll",""):wl.has(_)?f("press",k.key):[..._].length>1?f("keydown",k.key):f("type",k.key)},b=k=>{if(!n)return;let _=k.key;!wl.has(_)&&[..._].length>1&&f("keyup",k.key)};return t.registerRootListener((k,_)=>{_!==null&&(_.removeEventListener("keydown",x),_.removeEventListener("keyup",b)),k!==null&&(k.addEventListener("keydown",x),k.addEventListener("keyup",b))})},[t,n,f]),Tl(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),on(()=>{if(e){let x=m();x!==null&&i(x),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),on(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:k,editorState:_})=>{if(!n)return;let T=_._selection,I=u.current,N=d.current;if(I!==T){if(k.size===0&&b.size===0&&!N){let y=tn(t._window);if(y&&(y.anchorNode==null||y.focusNode==null))return}u.current=T}d.current=!1;let S=m();S!==null&&i(S)}),[t,m,n,f]),on(()=>n?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,n]);let h=Be(x=>{n||(x.update(()=>{let b=Cm();b.clear();let k=xm();b.append(gm().append(k)),k.select()}),o([])),r(b=>!b)},[n]),p=Be(()=>{if(!n)return;let x=tn(t._window);if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:b,anchorOffset:k,focusNode:_,focusOffset:T}=Em(x),I=a().getRootElement(),N;b!==null&&(N=El(b,I));let S;_!==null&&(S=El(_,I)),f("snapshot",{anchorNode:b,anchorOffset:k,anchorPath:N,focusNode:_,focusOffset:T,focusPath:S})},[f,n,a]),g=Be(()=>{bm(m())},[m]),C=Be(()=>{km("test.js",m())},[m]);return[je("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:x=>{h(a()),x.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?rn("div",{className:"test-recorder-output",children:[rn("div",{className:"test-recorder-toolbar",children:[je("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{p(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),je("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{g(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),je("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{C(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),je("pre",{id:"test-recorder",ref:c,children:s})]}):null]}var Nl=()=>{let t=pm(3),[e]=hm(),[o,n]=wm(e),r;return t[0]!==o||t[1]!==n?(r=rn(Sl.Fragment,{children:[je("p",{children:"HI"}),o,n,je("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var Sm=A({plugins:[{Component:Nl,position:"bottom"}]});import{c as Nm}from"react/compiler-runtime";import{jsx as Lm}from"react/jsx-runtime";import{useLexicalComposerContext as ym}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Rm}from"@lexical/react/LexicalTreeView.js";import"react";var Ll=()=>{let t=Nm(2),[e]=ym(),o;return t[0]!==e?(o=Lm(Rm,{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 vm=A({plugins:[{Component:Ll,position:"bottom"}]});import{BOLD_ITALIC_STAR as Mm,BOLD_ITALIC_UNDERSCORE as Am,BOLD_STAR as Dm,BOLD_UNDERSCORE as $m}from"@lexical/markdown";import{$isTableSelection as Om}from"@lexical/table";import{$isRangeSelection as Fm,FORMAT_TEXT_COMMAND as Pm}from"lexical";import{jsx as yl}from"react/jsx-runtime";import"react";var Im="M14.5 9.25A1.75 1.75 0 0 1 12.75 11H9.5V7.5h3.25c.966 0 1.75.784 1.75 1.75M8 11V7.5A1.5 1.5 0 0 1 9.5 6h3.25a3.25 3.25 0 0 1 2.418 5.422A3.5 3.5 0 0 1 13.5 18h-4A1.5 1.5 0 0 1 8 16.5zm1.5 1.5v4h4a2 2 0 1 0 0-4z",Rl=({className:t})=>yl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:yl("path",{clipRule:"evenodd",d:Im,fill:"currentColor",fillRule:"evenodd"})});var ee=t=>({type:"buttons",items:t,key:"format",order:40});var vl=[ee([{ChildComponent:Rl,isActive:({selection:t})=>Fm(t)||Om(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Pm,"bold")},order:1}])],Bm=A(({featureProviderMap:t})=>{let e=[Dm,$m];return t.get("italic")&&e.push(Am,Mm),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:vl},toolbarInline:{groups:vl}}});import{INLINE_CODE as Hm}from"@lexical/markdown";import{$isTableSelection as Gm}from"@lexical/table";import{$isRangeSelection as Um,FORMAT_TEXT_COMMAND as zm}from"lexical";import{jsx as Il}from"react/jsx-runtime";import"react";var jm="M9.64645 8.14645C9.84171 7.95118 10.1582 7.95118 10.3535 8.14645C10.5487 8.34171 10.5487 8.65822 10.3535 8.85348L7.20699 12L10.3535 15.1464C10.5487 15.3417 10.5487 15.6582 10.3535 15.8535C10.1582 16.0487 9.84171 16.0487 9.64645 15.8535L6.14645 12.3535C5.95118 12.1582 5.95118 11.8417 6.14645 11.6464L9.64645 8.14645ZM13.6464 8.14645C13.8417 7.95118 14.1582 7.95118 14.3535 8.14645L17.8535 11.6464C18.0487 11.8417 18.0487 12.1582 17.8535 12.3535L14.3535 15.8535C14.1582 16.0487 13.8417 16.0487 13.6464 15.8535C13.4512 15.6582 13.4512 15.3417 13.6464 15.1464L16.7929 12L13.6464 8.85348C13.4512 8.65822 13.4512 8.34171 13.6464 8.14645Z",Ml=({className:t})=>Il("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Il("path",{clipRule:"evenodd",d:jm,fill:"currentColor",fillRule:"evenodd"})});var Al=[ee([{ChildComponent:Ml,isActive:({selection:t})=>Um(t)||Gm(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(zm,"code")},order:7}])],Wm=A({enableFormats:["code"],markdownTransformers:[Hm],toolbarFixed:{groups:Al},toolbarInline:{groups:Al}});import{ITALIC_STAR as Km,ITALIC_UNDERSCORE as Jm}from"@lexical/markdown";import{$isTableSelection as Xm}from"@lexical/table";import{$isRangeSelection as Ym,FORMAT_TEXT_COMMAND as Zm}from"lexical";import{jsx as Dl}from"react/jsx-runtime";import"react";var Vm="M10 6.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-2.083L11.6 17h1.9a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2.083L12.4 7h-1.9a.5.5 0 0 1-.5-.5",$l=({className:t})=>Dl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Dl("path",{clipRule:"evenodd",d:Vm,fill:"currentColor",fillRule:"evenodd"})});var Ol=[ee([{ChildComponent:$l,isActive:({selection:t})=>Ym(t)||Xm(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Zm,"italic")},order:2}])],qm=A({enableFormats:["italic"],markdownTransformers:[Km,Jm],toolbarFixed:{groups:Ol},toolbarInline:{groups:Ol}});import{STRIKETHROUGH as ef}from"@lexical/markdown";import{$isTableSelection as tf}from"@lexical/table";import{$isRangeSelection as of,FORMAT_TEXT_COMMAND as nf}from"lexical";import{jsx as Fl}from"react/jsx-runtime";import"react";var Qm="M15.835 13.5a.27.27 0 0 1 .24.138q.306.554.306 1.316 0 1.01-.543 1.816-.543.8-1.554 1.268-1.01.462-2.409.462-1.323 0-2.295-.419-.972-.424-1.534-1.175a3.2 3.2 0 0 1-.533-1.135c-.082-.326.187-.614.522-.614.299 0 .539.233.625.519q.13.43.415.768.448.524 1.17.8.73.271 1.63.272.996 0 1.764-.32.773-.327 1.215-.906a2.16 2.16 0 0 0 .44-1.348q0-.645-.345-1.09c-.1-.132-.016-.352.15-.352zm-3.846-8q1.215 0 2.142.438.933.43 1.476 1.187.38.518.519 1.134c.07.31-.19.577-.507.577-.286 0-.518-.22-.6-.493q-.22-.738-.875-1.224-.864-.646-2.18-.646-.92 0-1.63.313-.703.308-1.1.85a2.04 2.04 0 0 0-.395 1.237q0 .492.217.874.216.376.588.652.376.278.843.475.474.197.972.338l1.052.288H18.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1h3.94a4.4 4.4 0 0 1-.844-.602q-.844-.781-.844-1.982 0-1.009.562-1.778t1.522-1.2q.959-.438 2.153-.438",Pl=({className:t})=>Fl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Fl("path",{d:Qm,fill:"currentColor"})});var Bl=[ee([{ChildComponent:Pl,isActive:({selection:t})=>of(t)||tf(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(nf,"strikethrough")},order:4}])],rf=A({enableFormats:["strikethrough"],markdownTransformers:[ef],toolbarFixed:{groups:Bl},toolbarInline:{groups:Bl}});import{$isTableSelection as sf}from"@lexical/table";import{$isRangeSelection as af,FORMAT_TEXT_COMMAND as cf}from"lexical";import{jsx as jl}from"react/jsx-runtime";import"react";var lf="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652 3.925a.436.436 0 0 1-.287-.765l1.64-1.431q.259-.228.433-.407.175-.178.266-.345a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.195-.4 0-.643.21a.7.7 0 0 0-.133.151c-.127.197-.3.403-.534.403s-.432-.194-.367-.418q.11-.378.434-.642.494-.402 1.257-.403.513 0 .897.183.387.181.604.501.217.316.217.714 0 .316-.13.586-.125.27-.395.555a9 9 0 0 1-.695.634l-.927.798a.023.023 0 0 0 .016.042h1.895a.357.357 0 0 1 0 .714z",Hl=({className:t})=>jl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:jl("path",{d:lf,fill:"currentColor"})});var Gl=[ee([{ChildComponent:Hl,isActive:({selection:t})=>af(t)||sf(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(cf,"subscript")},order:5}])],uf=A({enableFormats:["subscript"],toolbarFixed:{groups:Gl},toolbarInline:{groups:Gl}});import{$isTableSelection as mf}from"@lexical/table";import{$isRangeSelection as ff,FORMAT_TEXT_COMMAND as pf}from"lexical";import{jsx as Ul}from"react/jsx-runtime";import"react";var df="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652-1.303a.436.436 0 0 1-.287-.765l1.64-1.432q.259-.228.433-.406.175-.179.266-.346a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.194-.4 0-.643.209a.7.7 0 0 0-.133.152c-.127.196-.3.403-.534.403s-.432-.194-.367-.419q.11-.378.434-.641.494-.403 1.257-.403.513 0 .897.182.387.183.604.502.217.315.217.714 0 .315-.13.585-.125.27-.395.555a9 9 0 0 1-.695.635l-.927.798a.023.023 0 0 0 .016.041h1.895a.357.357 0 1 1 0 .715z",zl=({className:t})=>Ul("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ul("path",{d:df,fill:"currentColor"})});var Wl=[ee([{ChildComponent:zl,isActive:({selection:t})=>ff(t)||mf(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(pf,"superscript")},order:6}])],hf=A({enableFormats:["superscript"],toolbarFixed:{groups:Wl},toolbarInline:{groups:Wl}});import{$isTableSelection as xf}from"@lexical/table";import{$isRangeSelection as Cf,FORMAT_TEXT_COMMAND as bf}from"lexical";import{jsx as Vl}from"react/jsx-runtime";import"react";var gf="M9 7.5a.5.5 0 0 0-1 0V12a4 4 0 0 0 8 0V7.5a.5.5 0 0 0-1 0V12a3 3 0 1 1-6 0zM16.5 19a.5.5 0 0 0 0-1h-9a.5.5 0 0 0 0 1z",Kl=({className:t})=>Vl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Vl("path",{clipRule:"evenodd",d:gf,fill:"currentColor",fillRule:"evenodd"})});var Jl=[ee([{ChildComponent:Kl,isActive:({selection:t})=>Cf(t)||xf(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(bf,"underline")},order:3}])],kf=A({enableFormats:["underline"],toolbarFixed:{groups:Jl},toolbarInline:{groups:Jl}});import{jsx as sn}from"react/jsx-runtime";import{jsx as _f}from"react/jsx-runtime";function Tf(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var oo=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[Tf(o),n])):{};return _f("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Ef}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as wf}from"@lexical/selection";import{$getNodeByKey as Sf,$getState as Nf,$setState as Lf,createState as yf,TextNode as Rf}from"lexical";import{useEffect as vf}from"react";function Xl(t){let e=new Map;for(let o in t){let n=t[o],r=yf(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function ln(t,e,o,n){t.update(()=>{wf(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);Lf(r,l.stateConfig,n)})})}function Yl({stateMap:t}){let[e]=Ef();return vf(()=>e.registerMutationListener(Rf,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=Sf(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((u,d)=>{let c=Nf(l,u.stateConfig);if(!c){delete s.dataset[d];return}s.dataset[d]=c;let a=u.stateValues[c]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var Zl=(t,e)=>{let o=[];for(let r in t.state){let l=t.state[r];for(let s in l){let i=l[s];o.push({ChildComponent:()=>sn(oo,{css:i.css}),key:s,label:i.label,onSelect:({editor:u})=>{ln(u,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>sn(oo,{css:{color:"var(--color-icon-secondary)"}}),items:[...[{ChildComponent:()=>sn(oo,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)ln(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},If=A(({props:t})=>{let e=Xl(t.state);return{plugins:[{Component:()=>Yl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Zl(t,e)},toolbarInline:{groups:Zl(t,e)}}});import{c as Kf}from"react/compiler-runtime";import{useLexicalComposerContext as Jf}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Xf,$isHeadingNode as di,HeadingNode as pi}from"@lexical/rich-text";import{$setBlocksType as Yf}from"@lexical/selection";import{$getSelection as Zf,$isRangeSelection as qf}from"lexical";import{useEffect as Qf}from"react";import{jsx as ql}from"react/jsx-runtime";import"react";var Mf="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm11 6a.5.5 0 0 0-.777-.416l-1.5 1a.5.5 0 1 0 .554.832l.723-.482V17.5a.5.5 0 0 0 1 0z",Ql=({className:t})=>ql("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ql("path",{d:Mf,fill:"currentColor"})});import{jsx as ei}from"react/jsx-runtime";import"react";var Af="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm9.034 10.952c0 .303.245.548.548.548h2.97a.448.448 0 0 0 0-.896H17.48v-.04l.997-1.038q.562-.555.873-.945.314-.39.438-.711t.124-.653q0-.497-.245-.885a1.7 1.7 0 0 0-.684-.61A2.24 2.24 0 0 0 17.96 12a2.2 2.2 0 0 0-1.017.228 1.71 1.71 0 0 0-.888 1.13c-.064.268.168.495.444.495.275 0 .479-.236.595-.485l.019-.039q.12-.22.333-.338a1 1 0 0 1 .5-.121q.278 0 .495.11a.83.83 0 0 1 .341.312.9.9 0 0 1 .125.48q0 .245-.096.462t-.288.448-.48.529l-1.85 1.854a.55.55 0 0 0-.16.387",ti=({className:t})=>ei("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ei("path",{d:Af,fill:"currentColor"})});import{jsx as oi,jsxs as Df}from"react/jsx-runtime";import"react";var $f="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Of="M16.59 13.32 A1.5 1.25 0 1 1 18 15 A1.5 1.25 0 1 1 16.59 16.68",ni=({className:t})=>Df("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[oi("path",{d:$f,fill:"currentColor"}),oi("path",{d:Of,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ri,jsxs as Ff}from"react/jsx-runtime";import"react";var Pf="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Bf="M18.85 17.5 V12.5 L16.5 15.85 H19.5",li=({className:t})=>Ff("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[ri("path",{d:Pf,fill:"currentColor"}),ri("path",{d:Bf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ii,jsxs as jf}from"react/jsx-runtime";import"react";var Hf="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Gf="M19.2 12.5 H16.8 V14.9 A1.5 1.5 0 1 1 16.7 16.9",si=({className:t})=>jf("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[ii("path",{d:Hf,fill:"currentColor"}),ii("path",{d:Gf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ai,jsxs as Uf}from"react/jsx-runtime";import"react";var zf="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Wf="M18.85 12.55 C17.45 13.05 16.5 14.25 16.5 16 A1.5 1.5 0 1 1 19.5 16 A1.5 1.5 0 1 1 16.5 16",ci=({className:t})=>Uf("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[ai("path",{d:zf,fill:"currentColor"}),ai("path",{d:Wf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{HEADING as Vf}from"@lexical/markdown";var ui=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`;return{...Vf,regExp:new RegExp(o)}};var mi=t=>{let e=Zf();Yf(e,()=>Xf(t))},fi={h1:Ql,h2:ti,h3:ni,h4:li,h5:si,h6:ci},ep=A(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[oe(e.map((n,r)=>({ChildComponent:fi[n],isActive:({selection:l})=>{if(!qf(l))return!1;for(let s of l.getNodes()){if(di(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(di(i)&&i.getTag()===n))return!1}return!0},key:n,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{mi(n)})},order:r+2})))];return{markdownTransformers:[ui(e)],nodes:[pi],plugins:[{Component:tp,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Q(e.map(n=>({Icon:fi[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{mi(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),tp=t=>{let e=Kf(9),{clientProps:o}=t,{enabledHeadingSizes:n}=o,r;e[0]!==n?(r=n===void 0?["h1","h2","h3","h4","h5","h6"]:n,e[0]=n,e[1]=r):r=e[1];let l=r,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[u]=Jf(),d,c;return e[4]!==u||e[5]!==l||e[6]!==i?(d=()=>{if(!(!i||l.length===6))return u.registerNodeTransform(pi,a=>{l.includes(a.getTag())||a.setTag(i)})},c=[u,l,i],e[4]=u,e[5]=l,e[6]=i,e[7]=d,e[8]=c):(d=e[7],c=e[8]),Qf(d,c),null};import{$isNodeSelection as Cp}from"lexical";import{jsx as hi}from"react/jsx-runtime";import"react";var op="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",an=({className:t})=>hi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:hi("path",{d:op,fill:"currentColor"})});var be=t=>({type:"dropdown",ChildComponent:yr,items:t,key:"add",order:10});import{addClassNamesToElement as np}from"@lexical/utils";import{$applyNodeReplacement as rp,createCommand as lp,DecoratorNode as ip}from"lexical";var Rt=lp("INSERT_HORIZONTAL_RULE_COMMAND"),yt=class extends ip{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:sp,priority:0})}}static importJSON(e){return gi()}createDOM(e){let o=document.createElement("hr");return np(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function sp(){return{node:gi()}}function gi(){return rp(new yt)}import{$applyNodeReplacement as ap}from"lexical";import"react";var ke=class extends yt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return rt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function rt(){return ap(new ke)}function He(t){return t instanceof ke}var xi={type:"element",dependencies:[ke],export:(t,e)=>He(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=rt();e&&t.replace(e)}};import{c as cp}from"react/compiler-runtime";import{useLexicalComposerContext as up}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Ci,$insertNodeToNearestRoot as dp}from"@lexical/utils";import{$getRoot as mp,$getSelection as bi,$isRangeSelection as ki,$isRootOrShadowRoot as _i,COMMAND_PRIORITY_EDITOR as fp}from"lexical";import{useEffect as pp}from"react";var cn="LexicalEditorTheme__hrSelected",Ti=()=>{let t=cp(3),[e]=up(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(Rt,hp,fp),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let d=mp().getChildren(),c=bi(),a=[];for(let x=0;x<d.length;x++){let b=d[x];if(He(b)){let k=e.getElementByKey(b.getKey());k&&a.push({element:k,index:x})}}if(a.length===0)return;if(!ki(c)||c.isCollapsed()){for(let{element:x}of a)x.classList.remove(cn);return}let m=c.anchor.getNode(),f=c.focus.getNode(),h=Ci(m,gp)||m,p=Ci(f,xp)||f,g=d.indexOf(h),C=d.indexOf(p);if(g===-1||C===-1)return;let E=Math.min(g,C),w=Math.max(g,C);for(let{element:x,index:b}of a)b>=E&&b<=w?x.classList.add(cn):x.classList.remove(cn)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),pp(o,n),null};function hp(t){let e=bi();if(!ki(e))return!1;if(e.focus.getNode()!==null){let n=rt();dp(n)}return!0}function gp(t){return _i(t.getParent())}function xp(t){return _i(t.getParent())}var bp=A({markdownTransformers:[xi],nodes:[ke],plugins:[{Component:Ti,position:"normal"}],slashMenu:{groups:[Q([{Icon:an,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Rt,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:an,isActive:({selection:t})=>{if(!Cp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return He(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Rt,void 0)}}])]}});import{$findMatchingParent as Ai}from"@lexical/utils";import{$isElementNode as Dp,INDENT_CONTENT_COMMAND as $p,OUTDENT_CONTENT_COMMAND as Op}from"lexical";import{jsx as un}from"react/jsx-runtime";import"react";var kp="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Ei=({className:t})=>un("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:un("g",{transform:"scale(-1, 1) translate(-24, 0)",children:un("path",{clipRule:"evenodd",d:kp,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as wi}from"react/jsx-runtime";import"react";var _p="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Si=({className:t})=>wi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:wi("path",{clipRule:"evenodd",d:_p,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Tp}from"react/jsx-runtime";import{useLexicalComposerContext as Ep}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as wp}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Sp,mergeRegister as dn}from"@lexical/utils";import{$addUpdateTag as mn,$getSelection as yi,$isElementNode as Ri,$isRangeSelection as vi,$isRootOrShadowRoot as Np,BLUR_COMMAND as Lp,COMMAND_PRIORITY_HIGH as no,COMMAND_PRIORITY_LOW as fn,FOCUS_COMMAND as yp,INDENT_CONTENT_COMMAND as Ni,KEY_ESCAPE_COMMAND as Rp,KEY_TAB_COMMAND as Li,OUTDENT_CONTENT_COMMAND as vp,SELECTION_CHANGE_COMMAND as Ip,SKIP_DOM_SELECTION_TAG as pn,TabNode as Mp}from"lexical";import{useEffect as hn}from"react";var Ii=({clientProps:t})=>{let[e]=Ep(),{disabledNodes:o,disableTabNode:n}=t;return hn(()=>{let r=!1,l=!1,s=()=>{r=!1},i,u,d;function c(){s(),l=!1}function a(p){if(p.key!=="Tab"||!r){["Escape","Shift","Tab"].includes(p.key)||s();return}let g=e.getRootElement();if(!g)return;s(),l=!0,p.stopPropagation(),i?.(),clearTimeout(u);let C=g.closest(".rich-text-lexical")??g,E=new Set([g,...C.querySelectorAll('[tabindex], [contenteditable="true"], a[href], button, input, select, textarea, summary, iframe, audio[controls], video[controls]')]),w=new Map;for(let x of E)w.set(x,x.getAttribute("tabindex")),x.setAttribute("tabindex","-1");i=()=>{for(let[x,b]of w)b===null?x.removeAttribute("tabindex"):x.setAttribute("tabindex",b);i=void 0},u=setTimeout(()=>i?.(),0),e.update(()=>mn(pn))}function m(p){if(p.key==="Escape"&&!p.defaultPrevented&&e.isEditable()){if(r&&!p.repeat)return;p.preventDefault(),p.stopPropagation(),r=!0}}let f=e.registerRootListener(p=>{d?.abort(),d=new AbortController;let{signal:g}=d;p?.addEventListener("pointerdown",c,{signal:g}),p?.addEventListener("keydown",a,{capture:!0,signal:g}),p?.addEventListener("keydown",m,{signal:g})}),h=dn(e.registerCommand(Rp,p=>e.isEditable()?(m(p),!0):!1,fn),e.registerCommand(Li,()=>{let p=yi();return vi(p)&&p.isCollapsed()&&Np(p.anchor.getNode())?(s(),l=!0,mn(pn),!0):!1},no),e.registerCommand(Lp,()=>(s(),!1),no),e.registerCommand(yp,()=>(c(),!1),no),e.registerCommand(Ip,()=>{let p=e.getRootElement();return l&&p?.ownerDocument.activeElement!==p&&mn(pn),!1},no));return()=>{h(),f(),d?.abort(),clearTimeout(u),i?.()}},[e]),hn(()=>{if(!(!e||!o?.length))return dn(e.registerCommand(Ni,()=>Ap(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),fn),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);Ri(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),hn(()=>{if(!(!e||!n))return dn(e.registerCommand(Li,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?vp:Ni,void 0)),fn),e.registerNodeTransform(Mp,r=>{r.remove()}))},[e,n]),Tp(wp,{})};function Ap(t){let e=yi();if(!vi(e))return!1;let o=new Set,n=e.getNodes();for(let r=0;r<n.length;r++){let l=n[r],s=l.getKey();if(o.has(s))continue;let i=Sp(l,d=>Ri(d)&&!d.isInline());if(i===null)continue;let u=i.getKey();i.canIndent()&&!o.has(u)&&(o.add(u),t(i))}return o.size>0}var Mi=t=>({type:"buttons",items:t,key:"indent",order:35});var Di=({disabledNodes:t})=>[Mi([{ChildComponent:Ei,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>$i(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!Ai(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Op,void 0)},order:1},{ChildComponent:Si,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>$i(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!Ai(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand($p,void 0)},order:2}])],Fp=A(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Ii,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Di({disabledNodes:e})},toolbarInline:{groups:Di({disabledNodes:e})}}}),$i=t=>Dp(t)&&t.canIndent();import{$findMatchingParent as e0}from"@lexical/utils";import{$getSelection as Nn,$isRangeSelection as gs}from"lexical";import{jsx as Oi}from"react/jsx-runtime";import"react";var Pp={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4436 10.3708C12.6861 10.5041 12.9148 10.6721 13.1204 10.8776C14.2919 12.0492 14.2918 13.9482 13.1204 15.1198L11.1204 17.1198C9.94879 18.2914 8.04975 18.2914 6.87817 17.1198C5.70664 15.9482 5.70661 14.0492 6.87817 12.8776L8.1477 11.6071C8.4098 11.345 8.89329 11.5392 8.97388 11.9011C9.00617 12.0462 8.96861 12.2012 8.86353 12.3063L7.5852 13.5847C6.80417 14.3657 6.80419 15.6317 7.5852 16.4128C8.36625 17.1938 9.63228 17.1938 10.4133 16.4128L12.4133 14.4128C13.1942 13.6317 13.1943 12.3657 12.4133 11.5847C12.4042 11.5755 12.3953 11.5662 12.386 11.5573C12.2925 11.468 12.1984 11.3736 12.1614 11.2497C12.0724 10.9515 12.1448 10.6149 12.3801 10.3796C12.397 10.3628 12.4228 10.3594 12.4436 10.3708ZM12.8782 6.87764C14.0497 5.70615 15.9488 5.70616 17.1204 6.87764C18.2919 8.04919 18.2919 9.94825 17.1204 11.1198L15.8508 12.3903C15.5887 12.6522 15.1053 12.4581 15.0247 12.0964C14.9924 11.9512 15.0308 11.7963 15.136 11.6911L16.4133 10.4128C17.1943 9.63175 17.1943 8.3657 16.4133 7.58467C15.6323 6.80371 14.3662 6.8037 13.5852 7.58467L11.5852 9.58467C10.8046 10.3657 10.8044 11.6319 11.5852 12.4128C11.5943 12.4219 11.6042 12.4303 11.6135 12.4392C11.7064 12.5278 11.7999 12.622 11.8372 12.7448C11.9276 13.044 11.8545 13.3827 11.6184 13.6188C11.6023 13.6347 11.5778 13.6383 11.5579 13.6276C11.3146 13.4942 11.0843 13.3259 10.8782 13.1198C9.7068 11.9484 9.707 10.0492 10.8782 8.87764L12.8782 6.87764Z"},ro=({className:t,size:e=24})=>Oi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Oi("path",{d:Pp[e],fill:"currentColor"})});import{$isAtNodeEnd as Fi}from"@lexical/selection";function lt(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?Fi(o)?n:r:Fi(e)?n:r}var gn=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Zp}from"lexical";function xn(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var Bp=/^(?:[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+)?$/,jp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Pi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||Bp.test(t)||jp.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as Hp,isHTMLAnchorElement as Gp}from"@lexical/utils";import kn from"bson-objectid";import{$applyNodeReplacement as Up,$createTextNode as Bi,$getSelection as zp,$isElementNode as ji,$isRangeSelection as bn,createCommand as Wp,ElementNode as Vp}from"lexical";var Kp=new Set(["http:","https:","mailto:","sms:","tel:"]),ne=class extends Vp{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Jp,priority:1})}}static importJSON(e){let o=_e({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new kn.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=Cn(o.rel,"add","noopener")),Hp(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!bn(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(ji(n)){let r=_e({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Kp.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,n){let r=this.__fields?.url,l=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Cn(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Cn(o.rel,"remove","noopener"))),!1}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields).setID(o.id)}};function Jp(t){let e=null;if(Gp(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new kn.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function _e({id:t,fields:e}){return Up(new ne({id:t??new kn.default().toHexString(),fields:e}))}function Z(t){return t instanceof ne}var he=Wp("TOGGLE_LINK_COMMAND");function _n(t){let e=zp();if(!bn(e)&&(t===null||!t.selectedNodes?.length))return;let o=bn(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();Z(s)&&(s.getChildren().forEach(u=>{s.insertBefore(u)}),s.remove())});return}if(o?.length===1){let l=o[0],s=Z(l)?l:Xp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Bi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let n=null,r=null;o?.forEach(l=>{let s=l.getParent();if(!(s===r||s===null||ji(l)&&!l.isInline())){if(Z(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Bi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=_e({fields:t.fields}),Z(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),Z(l)){if(l.is(r))return;if(r!==null){let i=l.getChildren();r.append(...i)}l.remove();return}r!==null&&r.append(l)}})}function Xp(t){return Yp(t,e=>Z(e))}function Yp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Cn(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let l=new RegExp(o,"g");r=r.replace(l,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let l=new RegExp(o,"g");n=r.replace(l,"").trim()}return n}var qp=(t,e)=>{let[,o,n]=e,r=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=Zp(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},Qp=t=>({type:"text-match",dependencies:[ne],export:(e,o)=>{if(!Z(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=xn(t.internalDocToHref({linkNode:n.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=xn(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:qp,trigger:")"}),Hi=Qp();import{$applyNodeReplacement as e1,$isElementNode as t1}from"lexical";var Te=class extends ne{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=vt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(t1(n)){let r=vt({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields)}};function vt({fields:t}){return e1(new Te({id:"",fields:t}))}function Ee(t){return t instanceof Te}import{c as o1}from"react/compiler-runtime";import{useLexicalComposerContext as n1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as r1}from"@lexical/utils";import{$createTextNode as Gi,$getSelection as l1,$isElementNode as zi,$isLineBreakNode as Wi,$isNodeSelection as i1,$isRangeSelection as s1,$isTextNode as It,TextNode as a1}from"lexical";import{useEffect as c1}from"react";function Ui(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function Vi(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var u1=/[.,;\s]/;function io(t){return t!==void 0&&u1.test(t)}function Ki(t){return io(t[t.length-1])}function En(t){return io(t[0])}function d1(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ji(t){let e=t.getPreviousSibling();return zi(e)&&(e=e.getLastDescendant()),e===null||Wi(e)||It(e)&&Ki(e.getTextContent())}function Xi(t){let e=t.getNextSibling();return zi(e)&&(e=e.getFirstDescendant()),e===null||Wi(e)||It(e)&&En(e.getTextContent())}function m1(t,e,o,n){return(t>0?io(o[t-1]):Ji(n[0]))?e<o.length?io(o[e]):Xi(n[n.length-1]):!1}function f1(t,e,o){let n=[],r=[],l=[],s=0,i=0,u=[...t];for(;u.length>0;){let d=u[0],a=d.getTextContent().length,m=i;i+a<=e?(n.push(d),s+=a):m>=o?l.push(d):r.push(d),i+=a,u.shift()}return[s,n,r,l]}function p1(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=vt({fields:r});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let u=Gi(n.text);u.setFormat(i.getFormat()),u.setDetail(i.getDetail()),u.setStyle(i.getStyle()),l.append(u),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,u;e===0?u=s:[,u]=s.splitText(e);let d=[],c;if(t.forEach(a=>{let f=a.getTextContent().length,h=i,p=i+f;if(h<o)if(p<=o)d.push(a);else{let[g,C]=a.splitText(o-h);g&&d.push(g),c=C}i+=f}),u){let a=l1(),m=a?a.getNodes().find(It):void 0,f=Gi(u.getTextContent());return f.setFormat(u.getFormat()),f.setDetail(u.getDetail()),f.setStyle(u.getStyle()),l.append(f,...d),m&&m===u&&(s1(a)?f.select(a.anchor.offset,a.focus.offset):i1(a)&&f.select(0,f.getTextContent().length)),u.replace(l),c}}}function h1(t,e,o){let n=[...t],r=n.map(u=>u.getTextContent()).join(""),l=r,s,i=0;for(;(s=Vi(l,e))!=null&&s!==null;){let u=s.index,d=s.length,c=u+d;if(m1(i+u,i+c,r,n)){let[m,,f,h]=f1(n,i+u,i+c),p=i+u-m,g=i+c-m,C=p1(f,p,g,s);n=C?[C,...h]:h,o(s.url,null),i=0}else i+=c;l=l.substring(c)}}function Tn(t,e,o){let n=t.getChildren(),r=n.length;for(let u=0;u<r;u++){let d=n[u];if(!It(d)||!d.isSimpleText()){lo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Vi(l,e);if(s===null||s.text!==l){lo(t),o(null,t.getFields()?.url??null);return}if(!Ji(t)||!Xi(t)){lo(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let u=t.getFields();u.url=s?.url,t.setFields(u),o(s.url,i??null)}}function g1(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),l=t.getTextContent();if(Ee(n)){let s=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:")??!1:!1;(!En(l)||d1(l,s))&&(n.append(t),Tn(n,e,o),o(null,n.getFields()?.url??null))}Ee(r)&&!Ki(l)&&(lo(r),Tn(r,e,o),o(null,r.getFields()?.url??null))}function lo(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function x1(t){let e=[t],o=t.getNextSibling();for(;o!==null&&It(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function C1(t,e,o){let n=o1(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([Te]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,u)=>{o?.(i,u)};return r1(t.registerNodeTransform(a1,i=>{let u=i.getParentOrThrow(),d=i.getPreviousSibling();if(Ee(u))Tn(u,e,s);else if(!Z(u)){if(i.isSimpleText()&&(En(i.getTextContent())||!Ee(d))){let c=x1(i);h1(c,e,s)}g1(i,e,s)}}))},l=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=l):(r=n[3],l=n[4]),c1(r,l)}var b1=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,k1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,_1=[Ui(b1,t=>t.startsWith("http")?t:`https://${t}`),Ui(k1,t=>`mailto:${t}`)],Yi=()=>{let[t]=n1();return C1(t,_1),null};import{jsx as T1}from"react/jsx-runtime";import{ClickableLinkPlugin as E1}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Zi=()=>T1(E1,{});import{jsx as U1}from"react/jsx-runtime";import"react";import{createPortal as z1}from"react-dom";import{jsx as re,jsxs as Ge,Fragment as wn}from"react/jsx-runtime";import{useLexicalComposerContext as N1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as L1}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as ns,mergeRegister as rs}from"@lexical/utils";import{getTranslation as Sn}from"@payloadcms/translations";import{formatDrawerSlug as y1,NewTabIcon as ls,useConfig as R1,useEditDepth as v1,useLocale as I1,useTranslation as M1,WriteIcon as A1}from"@payloadcms/ui";import{requests as D1}from"@payloadcms/ui/shared";import{$getSelection as is,$isLineBreakNode as $1,$isRangeSelection as ss,COMMAND_PRIORITY_HIGH as O1,COMMAND_PRIORITY_LOW as as,getDOMSelection as F1,KEY_ESCAPE_COMMAND as P1,SELECTION_CHANGE_COMMAND as B1}from"lexical";import{formatAdminURL as j1}from"payload/shared";import H1,{useCallback as cs,useEffect as co,useLayoutEffect as G1,useRef as us,useState as Ue}from"react";import{jsx as qi}from"react/jsx-runtime";import"react";var w1="M12.5 5C12.6326 5 12.7597 5.05272 12.8535 5.14648L16.8535 9.14648C16.9965 9.28948 17.0393 9.50457 16.9619 9.69141C16.8845 9.87821 16.7022 10 16.5 10H12.5C12.2239 10 12 9.77614 12 9.5V6H8.5C8.22386 6 8 6.22386 8 6.5V17.5C8 17.7761 8.22386 18 8.5 18H15.5C15.7761 18 16 17.7761 16 17.5V11.5C16 11.2239 16.2239 11 16.5 11C16.7761 11 17 11.2239 17 11.5V17.5C17 18.3284 16.3284 19 15.5 19H8.5C7.67157 19 7 18.3284 7 17.5V6.5C7 5.67157 7.67157 5 8.5 5H12.5ZM13 9H15.293L13 6.70703V9Z",Qi=({className:t})=>qi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:qi("path",{d:w1,fill:"currentColor"})});import{jsx as es}from"react/jsx-runtime";import"react";var ts={default:"M6 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .496.5h12.008a.5.5 0 0 0 .496-.5v-1A.5.5 0 0 0 18 5zM4.5 6.5a1.5 1.5 0 0 0 1.037 1.427L5.725 10H5a.5.5 0 0 0 0 1h.816l.653 7.181A2 2 0 0 0 8.46 20h7.078a2 2 0 0 0 1.992-1.819L18.184 11H19a.5.5 0 0 0 0-1h-.725l.188-2.073A1.5 1.5 0 0 0 19.5 6.5v-1A1.5 1.5 0 0 0 18 4H6a1.5 1.5 0 0 0-1.5 1.5zm2.965 11.59L6.548 8h10.905l-.918 10.09a1 1 0 0 1-.996.91H8.461a1 1 0 0 1-.996-.91M11 10.5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"},os=({className:t,small:e})=>es("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:es("path",{clipRule:"evenodd",d:e?ts.small:ts.default,fill:"currentColor",fillRule:"evenodd"})});function so(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),u=t.top-n,d=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let c=e.scrollWidth,a=i.right-d,m=d-i.left,f;if(c<=a)f=e.getBoundingClientRect();else{let h=m+t.width,p=m>a,C=Math.min(c,p?h:a);C<c&&(e.style.width=`${C}px`,e.style.maxWidth=`${C}px`,e.offsetHeight),p&&(d=t.right-C),f=e.getBoundingClientRect()}u<i.top&&(u+=f.height+t.height+n*2),d+f.width>i.right&&(d=i.right-f.width-r),u-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${u}px)`}import{createCommand as S1}from"lexical";var ao=S1("TOGGLE_LINK_WITH_MODAL_COMMAND");function ds(t){t.preventDefault()}function ms({anchorElem:t}){let[e]=N1(),[o,n]=Ue(),r=us(null),l=us(null),[s,i]=Ue(null),[u,d]=Ue(null),{fieldProps:{schemaPath:c},uuid:a}=W(),m=L1(),{config:f,getEntityConfig:h}=R1(),{i18n:p,t:g}=M1(),[C,E]=Ue(),w=v1(),[x,b]=Ue(!1),[k,_]=Ue([]),T=I1(),[I,N]=Ue(!1),S=y1({slug:"lexical-rich-text-link-"+a,depth:w}),{toggleDrawer:y}=$e(S),L=cs(()=>{b(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),d(null),_([]),E(void 0)},[b,i,d,_]),R=cs(()=>{let v=is(),D;if(!ss(v)||!v){L();return}let M=lt(v);D=e.getElementByKey(M.getKey())?.getBoundingClientRect();let O=ns(M,Z),P=v.getNodes().filter(ie=>!$1(ie)).find(ie=>{let fe=ns(ie,Z);return O&&!O.is(fe)||fe&&!fe.is(O)});if(O==null||P){L();return}n(O);let $=O.getFields(),U={...$,id:O.getID(),text:O.getTextContent()};if($?.linkType==="custom")i($?.url??null),d(null);else{i(`${f.routes.admin==="/"?"":f.routes.admin}/collections/${$?.doc?.relationTo}/${$?.doc?.value}`);let ie=$?.doc?.relationTo?h({collectionSlug:$?.doc?.relationTo}):void 0;if(!ie)d($?.label?String($?.label):null),i($?.url?String($?.url):null);else{let fe=typeof $.doc?.value=="object"?$.doc.value.id:$.doc?.value,xt=$.doc?.relationTo;if(!fe||!xt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Ae=g("fields:linkedTo",{label:`${Sn(ie.labels.singular,p)} - ${g("lexical:link:loadingWithEllipsis",p)}`}).replace(/<[^>]*>?/g,"");d(Ae),D1.get(j1({apiRoute:f.routes.api,path:`/${xt}/${fe}`,serverURL:f.serverURL}),{headers:{"Accept-Language":p.language},params:{depth:0,locale:T?.code}}).then(async ce=>{if(!ce.ok)throw new Error(`HTTP error! Status: ${ce.status}`);let Gt=await ce.json(),$o=ie?.admin?.useAsTitle||"id",Ct=Gt[$o],Y=g("fields:linkedTo",{label:`${Sn(ie.labels.singular,p)} - ${Ct}`}).replace(/<[^>]*>?/g,"");d(Y)}).catch(()=>{let ce=g("fields:linkedTo",{label:`${Sn(ie.labels.singular,p)} - ${g("general:untitled",p)} - ID: ${fe}`}).replace(/<[^>]*>?/g,"");d(ce)})}}E(U),b(!0),_(v?v?.getNodes():[]),Ee(O)?N(!0):N(!1);let V=r.current,Xe=F1(e._window),{activeElement:gt}=document;if(V===null)return;let Ye=e.getRootElement();return Xe!==null&&Ye!==null&&Ye.contains(Xe.anchorNode)?(D||(D=Xe.getRangeAt(0).getBoundingClientRect()),D!=null&&(D.y+=40,l.current=D)):(gt==null||gt.className!=="link-input")&&(Ye!==null&&so(null,V,t),i(null),d(null)),!0},[e,L,f.routes.admin,f.routes.api,f.serverURL,h,g,p,T?.code,t]);return co(()=>rs(e.registerCommand(ao,v=>(e.dispatchCommand(he,v),R(),y(),!0),as)),[e,R,y,S]),co(()=>{let v=t.parentElement,D=()=>{e.getEditorState().read(()=>{R()})};return window.addEventListener("resize",D),v?.addEventListener("scroll",D),()=>{window.removeEventListener("resize",D),v?.removeEventListener("scroll",D)}},[t.parentElement,e,R]),co(()=>rs(e.registerUpdateListener(({editorState:v})=>{v.read(()=>{R()})}),e.registerCommand(B1,()=>(R(),!0),as),e.registerCommand(P1,v=>x?(v.preventDefault(),v.stopImmediatePropagation(),L(),!0):!1,O1)),[e,R,x,L]),co(()=>{e.getEditorState().read(()=>{R()})},[e,R]),G1(()=>{!x||!r.current||!t||!l.current||so(l.current,r.current,t)},[s,u,x,t,o]),Ge(H1.Fragment,{children:[re("div",{className:"link-editor","data-theme":"dark",hidden:!x,ref:r,children:Ge("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?re(ro,{}):re(Qi,{}),s&&s.length>0?Ge("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[u!=null&&u.length>0?u:s,o?.__fields.newTab?Ge(wn,{children:[re(ls,{size:16})," ",re("div",{className:"link-input__divider"})," "]}):null]}):u!=null&&u.length>0?Ge(wn,{children:[re("span",{className:"link-input__label-pure",children:u}),o?.__fields.newTab?Ge(wn,{children:[re(ls,{size:16})," ",re("div",{className:"link-input__divider"})," "]}):null]}):null,m&&Ge("div",{className:"link-input__actions",children:[re("button",{"aria-label":"Edit link",className:"link-edit",onClick:v=>{v.preventDefault(),y()},onMouseDown:ds,tabIndex:0,type:"button",children:re(A1,{})}),!I&&re("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(he,null)},onMouseDown:ds,tabIndex:0,type:"button",children:re(os,{small:!0})})]})]})}),re(Ho,{className:"lexical-link-edit-drawer",data:C,drawerSlug:S,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(v,D)=>{let M=D,O={...M};delete O.text,e.update(()=>{let P=is(),$=null;if(ss(P)?$=lt(P).getParent():k.length&&($=k[0]?.getParent()??null),$&&Ee($)){let U=_e({fields:O});$.replace(U,!0)}}),e.dispatchCommand(he,{fields:O,selectedNodes:k,text:M.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var fs=t=>{let{anchorElem:e=document.body}=t;return z1(U1(ms,{anchorElem:e}),e)};import{c as W1}from"react/compiler-runtime";import{useLexicalComposerContext as V1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as K1}from"@lexical/utils";import{$getSelection as J1,$isElementNode as X1,$isRangeSelection as Y1,COMMAND_PRIORITY_LOW as ps,PASTE_COMMAND as Z1}from"lexical";import{useEffect as q1}from"react";var hs=t=>{let e=W1(5),{clientProps:o}=t,[n]=V1(),r,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==n?(r=()=>{if(!n.hasNodes([ne]))throw new Error("LinkPlugin: LinkNode not registered on editor");return K1(n.registerCommand(he,s=>s===null?(_n(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),_n(s),!0),ps),n.registerCommand(Z1,s=>{let i=J1();if(!Y1(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let u=s.clipboardData.getData("text");if(!Pi(u))return!1;if(!i.getNodes().some(Q1)){let d={doc:null,linkType:"custom",newTab:!1,url:u};return n.dispatchCommand(he,{fields:d,text:null}),s.preventDefault(),!0}return!1},ps))},l=[o.defaultLinkType,o.defaultLinkURL,n],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=n,e[3]=r,e[4]=l):(r=e[3],l=e[4]),q1(r,l),null};function Q1(t){return X1(t)}var xs=[gn([{ChildComponent:ro,isActive:({selection:t})=>{if(gs(t)){let e=lt(t);return e0(e,Z)!=null}return!1},isEnabled:({selection:t})=>!!(gs(t)&&Nn()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(he,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=Nn()?.getTextContent(),n=Nn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(ao,{fields:r,selectedNodes:n,text:o})}},order:1}])],t0=A(({props:t})=>({markdownTransformers:[Hi],nodes:[ne,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:hs,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Yi,position:"normal"},{Component:Zi,position:"normal"},{Component:fs,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:xs},toolbarInline:{groups:xs}}));import{$isListNode as yn,INSERT_CHECK_LIST_COMMAND as _s,ListItemNode as s0,ListNode as a0}from"@lexical/list";import{CHECK_LIST as c0}from"@lexical/markdown";import{$isRangeSelection as u0}from"lexical";import{jsx as Cs}from"react/jsx-runtime";import"react";var o0={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},Ln=({className:t,size:e=24})=>Cs("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Cs("path",{d:o0[e],fill:"currentColor"})});import{jsx as n0}from"react/jsx-runtime";import{ListPlugin as r0}from"@lexical/react/LexicalListPlugin.js";import"react";var it=()=>n0(r0,{});function uo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function st(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{jsx as l0}from"react/jsx-runtime";import{CheckListPlugin as i0}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var bs=()=>l0(i0,{});var ks=[oe([{ChildComponent:Ln,isActive:({selection:t})=>{if(!u0(t))return!1;for(let e of t.getNodes()){if(yn(e)&&e.getListType()==="check")continue;let o=e.getParent();if(yn(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(yn(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(_s,void 0)},order:12}])],d0=A(({featureProviderMap:t})=>{let e=[{Component:bs,position:"normal"}],o=uo("checklist",t);return o&&e.push({Component:it,position:"normal"}),{markdownTransformers:[c0],nodes:o?[a0,s0]:[],plugins:e,slashMenu:{groups:[st([{Icon:Ln,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(_s,void 0)}}])]},toolbarFixed:{groups:ks},toolbarInline:{groups:ks}}});import{$isListNode as vn,INSERT_ORDERED_LIST_COMMAND as ws,ListItemNode as f0,ListNode as p0}from"@lexical/list";import{ORDERED_LIST as h0}from"@lexical/markdown";import{$isRangeSelection as g0}from"lexical";import{jsx as Ts}from"react/jsx-runtime";import"react";var m0={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},Rn=({className:t,size:e=24})=>Ts("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ts("path",{clipRule:"evenodd",d:m0[e],fill:"currentColor",fillRule:"evenodd"})});var Es=[oe([{ChildComponent:Rn,isActive:({selection:t})=>{if(!g0(t))return!1;for(let e of t.getNodes()){if(vn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(vn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(vn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ws,void 0)},order:10}])],x0=A(({featureProviderMap:t})=>{let e=uo("ordered",t);return{markdownTransformers:[h0],nodes:e?[p0,f0]:[],plugins:e?[{Component:it,position:"normal"}]:[],slashMenu:{groups:[st([{Icon:Rn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(ws,void 0)}}])]},toolbarFixed:{groups:Es},toolbarInline:{groups:Es}}});import{$isListNode as Mn,INSERT_UNORDERED_LIST_COMMAND as Ls,ListItemNode as b0,ListNode as k0}from"@lexical/list";import{UNORDERED_LIST as _0}from"@lexical/markdown";import{$isRangeSelection as T0}from"lexical";import{jsx as Ss}from"react/jsx-runtime";import"react";var C0="M7 16C7.55228 16 8 16.4477 8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16ZM17.5 16.5C17.7761 16.5 18 16.7239 18 17C18 17.2761 17.7761 17.5 17.5 17.5H10.5C10.2239 17.5 10 17.2761 10 17C10 16.7239 10.2239 16.5 10.5 16.5H17.5ZM7 11C7.55228 11 8 11.4477 8 12C8 12.5523 7.55228 13 7 13C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11ZM17.5 11.5C17.7761 11.5 18 11.7239 18 12C18 12.2761 17.7761 12.5 17.5 12.5H10.5C10.2239 12.5 10 12.2761 10 12C10 11.7239 10.2239 11.5 10.5 11.5H17.5ZM7 6C7.55228 6 8 6.44772 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7C6 6.44772 6.44772 6 7 6ZM17.5 6.5C17.7761 6.5 18 6.72386 18 7C18 7.27614 17.7761 7.5 17.5 7.5H10.5C10.2239 7.5 10 7.27614 10 7C10 6.72386 10.2239 6.5 10.5 6.5H17.5Z",In=({className:t})=>Ss("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ss("path",{d:C0,fill:"currentColor"})});var Ns=[oe([{ChildComponent:In,isActive:({selection:t})=>{if(!T0(t))return!1;for(let e of t.getNodes()){if(Mn(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Mn(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(Mn(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ls,void 0)},order:11}])],E0=A({markdownTransformers:[_0],nodes:[k0,b0],plugins:[{Component:it,position:"normal"}],slashMenu:{groups:[st([{Icon:In,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ls,void 0)}}])]},toolbarFixed:{groups:Ns},toolbarInline:{groups:Ns}});import{$setBlocksType as vs}from"@lexical/selection";import{$createParagraphNode as Is,$getSelection as Ms,$isParagraphNode as ys,$isRangeSelection as w0}from"lexical";var Rs=[oe([{ChildComponent:wt,isActive:({selection:t})=>{if(!w0(t))return!1;for(let e of t.getNodes())if(!ys(e)&&!ys(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ms();vs(e,()=>Is())})},order:1}])],S0=A({slashMenu:{groups:[Q([{Icon:wt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ms();vs(e,()=>Is())})}}])]},toolbarFixed:{groups:Rs},toolbarInline:{groups:Rs}});import{c as J0}from"react/compiler-runtime";import{jsx as ea}from"react/jsx-runtime";import{useLexicalComposerContext as X0}from"@lexical/react/LexicalComposerContext";import{useEffect as Y0,useState as Z0}from"react";import{jsx as Qs,Fragment as K0}from"react/jsx-runtime";import"react";import{jsx as N0}from"react/jsx-runtime";var As={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return N0("blockquote",{children:o})}};import{jsx as L0}from"react/jsx-runtime";var Ds=new Set(["h1","h2","h3","h4","h5","h6"]);var $s={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=Ds.has(t.tag)?t.tag:"h1";return L0(n,{children:o})}};import{jsx as y0}from"react/jsx-runtime";var Os={horizontalrule:y0("hr",{})};import{jsx as R0}from"react/jsx-runtime";var Fs={linebreak:R0("br",{})};import{jsx as Ps}from"react/jsx-runtime";var Bs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Ps("a",{href:e.fields.url,rel:r,target:l,children:n})},link:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),Ps("a",{href:s,rel:r,target:l,children:n})}});import{jsx as at,jsxs as v0,Fragment as I0}from"react/jsx-runtime";import{v4 as M0}from"uuid";var js=new Set(["ol","ul"]);var Hs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=js.has(t.tag)?t.tag:"ul";return at(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=M0();return at("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:v0(I0,{children:[at("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),at("label",{htmlFor:l,children:r}),at("br",{})]})})}else return at("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as An}from"react/jsx-runtime";var Gs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?An("p",{children:o}):An("p",{children:An("br",{})})}};var Us={tab:" "};import{jsx as Mt}from"react/jsx-runtime";var zs={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("div",{className:"lexical-table-container",children:Mt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Mt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return Mt(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("tr",{className:"lexical-table-row",children:o})}};import{jsx as ze}from"react/jsx-runtime";import"react";var 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},A0=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,D0="\xA0",$0=`
56
56
 
57
- `,Rs="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ys="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",qf=new RegExp("^[^"+ys+"]*["+Rs+"]"),Qf=new RegExp("^[^"+Rs+"]*["+ys+"]"),e0={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},t0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},o0={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},n0={[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"},r0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},l0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var vs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ve("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ve("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ve("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ve("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ve("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ve("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ve("sup",{children:e})),e}};import{jsx as It}from"react/jsx-runtime";var Is={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return It("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return It("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let u=i?.url;l.push(It("source",{media:`(max-width: ${i.width}px)`,srcSet:u,type:i.mimeType},s))}return l.push(It("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),It("picture",{children:l})}};var at={...Ss,...vs,..._s,...xs,...Ls,...bs,...ks,...Es,...ws({}),...Is,...Ns};import{jsx as ao,Fragment as i0}from"react/jsx-runtime";import so from"react";function Ms(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function s0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return ao("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function As(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return so.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return ao("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function a0(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=As(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=As(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=s0(r))}return e}function $s({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(Ms(e)){let l=r?a0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Ds({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return ao(i0,{})}function Ds({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,u)=>{let d;i.type==="block"?(d=t?.blocks?.[i?.fields?.blockType],!d&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(d=t?.inlineBlocks?.[i?.fields?.blockType],!d&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):d=t[i.type];try{!d&&l&&(d=l);let c;d?c=typeof d=="function"?d({childIndex:u,converters:t,node:i,nodesToJSX:p=>Ds({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:r}}),parent:r}):d:c=ao("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),so.isValidElement(c)){if(a.textAlign||a.paddingInlineStart){let m={...a,...c?.props?.style??{}};return so.cloneElement(c,{key:u,style:m})}return so.cloneElement(c,{key:u})}return c}catch(c){return console.error("Error converting lexical node to JSX:",c,"node:",i),null}}).filter(Boolean)}function _n({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i=e,u={};i?typeof i=="function"?u=i({defaultConverters:at}):u=i:u=at;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&$s({converters:u,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Os(c0,{children:d}):Os("div",{className:t??"payload-richtext",children:d})}function Bs(){let t=u0(7),[e]=d0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=p0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:d}=u;r(d.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),m0(l,s);let i;return t[5]!==n?(i=Fs("div",{className:"debug-jsx-converter",children:Fs(_n,{converters:at,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var f0=A({plugins:[{Component:Bs,position:"bottom"}]});var H={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},h0={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as nh}from"lexical";import{jsx as Ps}from"react/jsx-runtime";import"react";var g0="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",Tn=({className:t})=>Ps("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ps("path",{d:g0,fill:"currentColor"})});import{jsx as _0}from"react/jsx-runtime";import{$applyNodeReplacement as T0}from"lexical";import*as Hs from"react";import{DecoratorBlockNode as C0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as x0}from"@lexical/utils";import{$applyNodeReplacement as b0}from"lexical";function k0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:js({relationTo:o,value:e})}:null}var Mt=class extends C0{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:k0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=js(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return x0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function js(t){return b0(new Mt({data:t}))}var w0=Hs.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function E0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:ze({relationTo:o,value:e})}:null}var Ee=class extends Mt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:E0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=ze(o);return n.setFormat(e.format),n}decorate(e,o){return _0(w0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function ze(t){return T0(new Ee({data:t}))}function wn(t){return t instanceof Ee}import{c as z0}from"react/compiler-runtime";import{jsx as W0}from"react/jsx-runtime";import{useLexicalComposerContext as K0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as X0}from"@lexical/utils";import{$getPreviousSelection as J0,$getSelection as Z0,$isParagraphNode as Y0,$isRangeSelection as q0,COMMAND_PRIORITY_EDITOR as Q0,createCommand as eh}from"lexical";import{useEffect as th}from"react";import{c as Vs}from"react/compiler-runtime";import{jsx as En}from"react/jsx-runtime";import{useLexicalComposerContext as zs}from"@lexical/react/LexicalComposerContext.js";import{toast as O0}from"@payloadcms/ui";import{$getNodeByKey as F0,COMMAND_PRIORITY_EDITOR as Ws}from"lexical";import{useEffect as Ks,useState as B0}from"react";import{c as S0}from"react/compiler-runtime";import{jsx as N0}from"react/jsx-runtime";import{useLexicalComposerContext as L0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as R0,useModal as y0}from"@payloadcms/ui";import{$getNodeByKey as Gs,$getPreviousSelection as v0,$getRoot as I0,$getSelection as M0,$isRangeSelection as A0,$setSelection as $0}from"lexical";import{useEffect as D0,useState as Us}from"react";var At=t=>{let e=S0(23),[o]=L0(),[n,r]=Us(null),[l,s]=Us(!1),[i,u,d]=R0(t),{closeDrawer:c,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=d,{modalState:h}=y0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let N=M0()??v0();r(N)},e[0]=f):f=e[0];let g=f,_;e[1]!==o||e[2]!==n?(_=()=>{n&&o.update(()=>{if(A0(n)){let{anchor:N,focus:E}=n;Gs(N.key)&&Gs(E.key)&&$0(n.clone())}else I0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=_):_=e[3];let L=_,v;e[4]!==c?(v=()=>{c()},e[4]=c,e[5]=v):v=e[5];let b=v,C,x;e[6]!==a||e[7]!==h||e[8]!==L||e[9]!==l?(C=()=>{if(!l)return;let N=h[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{L()},1))},x=[h,a,L,l],e[6]=a,e[7]=h,e[8]=L,e[9]=l,e[10]=C,e[11]=x):(C=e[10],x=e[11]),D0(C,x);let k;e[12]!==u?(k=N=>N0(u,{...N,onClick:()=>{g()}}),e[12]=u,e[13]=k):k=e[13];let T;e[14]!==p?(T=()=>{g(),p(),s(!0)},e[14]=p,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==b||e[18]!==m||e[19]!==a||e[20]!==k||e[21]!==T?(I={closeListDrawer:b,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:T},e[16]=i,e[17]=b,e[18]=m,e[19]=a,e[20]=k,e[21]=T,e[22]=I):I=e[22],I};var P0=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=F0(o);r&&r.replace(ze({relationTo:e,value:n}))}):t.dispatchCommand(Sn,{relationTo:e,value:n})},j0=t=>{let e=Vs(14),{enabledCollectionSlugs:o}=t,[n]=zs(),[r,l]=B0(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:u,ListDrawer:d,openListDrawer:c}=At(i),a,m;e[3]!==n||e[4]!==c?(a=()=>n.registerCommand(Ye,g=>(l(g?.replace?g?.replace.nodeKey:null),c(),!0),Ws),m=[n,c],e[3]=n,e[4]=c,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Ks(a,m);let p;e[7]!==u||e[8]!==n||e[9]!==r?(p=g=>{let{collectionSlug:_,doc:L}=g;P0({editor:n,relationTo:_,replaceNodeKey:r,value:L.id}),u()},e[7]=u,e[8]=n,e[9]=r,e[10]=p):p=e[10];let h=p,f;return e[11]!==d||e[12]!==h?(f=En(d,{onSelect:h}),e[11]=d,e[12]=h,e[13]=f):f=e[13],f},H0=()=>{let t=Vs(3),[e]=zs(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Ye,G0,Ws),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Ks(o,n),null},Xs=({enabledCollectionSlugs:t})=>t?.length?En(j0,{enabledCollectionSlugs:t}):En(H0,{});function G0(){return O0.error("No relationship collections enabled"),!0}import{useConfig as U0,useEntityVisibility as V0}from"@payloadcms/ui";import*as Zs from"react";var Js=(t,{disabledCollections:e,enabledCollections:o,uploads:n,visibleSlugs:r})=>{let l=o?.length?new Set(o):null,s=e?.length?new Set(e):null;return t.filter(i=>{let{slug:u,admin:d,upload:c}=i;if(r&&!r.includes(u))return!1;if(n){if(!d?.enableRichTextRelationship||!c)return!1}else if(c||!d?.enableRichTextRelationship)return!1;return!(l&&!l.has(u)||s&&s.has(u))})};var co=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:n=!1}=t||{},{config:{collections:r}}=U0(),{visibleEntities:l}=V0();return Zs.useMemo(()=>{let s=Js(r,{disabledCollections:e,enabledCollections:o,uploads:n,visibleSlugs:l?.collections});return{enabledCollections:s,enabledCollectionSlugs:s.map(i=>i.slug)}},[r,l,n,o,e])};var Sn=eh("INSERT_RELATIONSHIP_COMMAND"),Ys=t=>{let e=z0(8),{clientProps:o}=t,[n]=K0(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=co(s),u,d;e[3]!==n?(u=()=>{if(!n.hasNodes([Ee]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Sn,oh,Q0)},d=[n],e[3]=n,e[4]=u,e[5]=d):(u=e[4],d=e[5]),th(u,d);let c;return e[6]!==i?(c=W0(Xs,{enabledCollectionSlugs:i}),e[6]=i,e[7]=c):c=e[7],c};function oh(t){let e=Z0()||J0();if(q0(e)){let o=ze(t),{focus:n}=e,r=n.getNode();X0(o),Y0(r)&&!r.__first&&r.remove()}return!0}var rh=A({nodes:[Ee],plugins:[{Component:Ys,position:"normal"}],slashMenu:{groups:[J([{Icon:Tn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ye,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Tn,isActive:({selection:t})=>{if(!nh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ye,{replace:!1})}}])]}});import{c as Mh}from"react/compiler-runtime";import{jsx as fe,jsxs as Ah}from"react/jsx-runtime";import{useLexicalComposerContext as $h}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as sa}from"@lexical/react/useLexicalEditable";import{useScrollInfo as Dh,useThrottledEffect as Oh,useTranslation as Fh}from"@payloadcms/ui";import*as fo from"react";import{useMemo as vn}from"react";import{jsx as lh,jsxs as ih}from"react/jsx-runtime";import{Tooltip as sh,useTranslation as ah}from"@payloadcms/ui";import{$addUpdateTag as ch}from"lexical";import{useCallback as qs,useEffect as uh,useMemo as Qs,useRef as dh,useState as mh}from"react";var Nn="toolbar-popup__button",$t=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=ah(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=U(),[u,d]=mh(!1),c=dh(null);uh(()=>{c.current?.removeAttribute("data-pressing")},[t]);let a=Qs(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,f=>f.toUpperCase()),[s,l,i,r]),m=Qs(()=>[Nn,n?"":"disabled",t?"active":"",r.key?`${Nn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),p=qs(()=>{n&&o.focus(()=>{o.update(()=>{ch("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=qs(f=>{f.preventDefault(),f.currentTarget.setAttribute("data-pressing","")},[]);return ih("button",{"aria-label":a,className:m,"data-button-key":r.key,disabled:!n,onClick:p,onMouseDown:h,onPointerEnter:()=>d(!0),onPointerLeave:()=>{d(!1),c.current?.removeAttribute("data-pressing")},ref:c,type:"button",children:[lh(sh,{className:`${Nn}__tooltip`,show:u,children:a}),e]})};import{c as bh}from"react/compiler-runtime";import{jsx as ct}from"react/jsx-runtime";import kh,{useMemo as _h}from"react";import{useTranslation as Th}from"@payloadcms/ui";import{jsx as Me,jsxs as ea}from"react/jsx-runtime";import{Button as ph}from"@payloadcms/ui";import{$addUpdateTag as fh,isDOMNode as hh}from"lexical";import uo,{useCallback as gh,useEffect as mo,useMemo as oa,useRef as Ln,useState as Rn}from"react";import{createPortal as Ch}from"react-dom";var ta="toolbar-popup__dropdown-item",na=uo.createContext(null);function ra({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let u=oa(()=>[ta,n===!1?"disabled":"",t?"active":"",l?.key?`${ta}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),d=Ln(null),c=uo.use(na);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=c;return mo(()=>{d?.current!=null&&a(d)},[d,a]),Me(ph,{"aria-label":i,buttonStyle:"ghost",className:u,disabled:n===!1,extraButtonProps:{"data-item-key":s},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{fh("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:i,type:"button",children:e})}function xh({children:t,dropdownKey:e,dropDownRef:o,itemsContainerClassNames:n,onClose:r}){let[l,s]=Rn(),[i,u]=Rn(),d=gh(m=>{s(p=>p!=null?[...p,m]:[m])},[s]),c=m=>{if(l==null)return;let{key:p}=m;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&m.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?u(h=>{if(h==null)return l[0];let f=l.indexOf(h)-1;return l[f===-1?l.length-1:f]}):p==="ArrowDown"&&u(h=>h==null?l[0]:l[l.indexOf(h)+1])},a=oa(()=>({registerItem:d}),[d]);return mo(()=>{l!=null&&i==null&&u(l[0]),i!=null&&i?.current!=null&&i.current.focus()},[l,i]),Me(na,{value:a,children:Me("div",{className:(n??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":e,"data-theme":"dark",onKeyDown:c,ref:o,children:t})})}function la({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:u}){let d=Ln(null),c=Ln(null),[a,m]=Rn(!1),p=()=>{m(!1),c?.current!=null&&c.current.focus()};mo(()=>{let f=c.current,g=d.current;if(a&&f!==null&&g!==null){let{left:_,top:L}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;g.style.top=`${L+v+f.offsetHeight+5}px`,g.style.left=`${Math.min(_-5,window.innerWidth-g.offsetWidth-20)}px`}},[d,c,a]),mo(()=>{let f=c.current;if(f!==null&&a){let g=_=>{let L=_.target;hh(L)&&(u&&d.current&&d.current.contains(L)||f.contains(L)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[d,c,a,u]);let h=Ch(Me(xh,{dropdownKey:r,dropDownRef:d,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return ea(uo.Fragment,{children:[ea("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":r,disabled:n,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[l&&Me(l,{}),i&&Me("span",{className:"toolbar-popup__dropdown-label",children:i}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Me(uo.Fragment,{children:h})]})}var yn="toolbar-popup__dropdown",wh=t=>{let e=bh(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:u}=Th(),{fieldProps:d}=U(),{featureClientSchemaMap:c,schemaPath:a}=d;if(i.Component){let p;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(p=i?.Component&&ct(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=p):p=e[5],p}let m;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==u||e[11]!==s||e[12]!==i||e[13]!==a){let p=i.key,h;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:u,schemaPath:a}):i.label),p.length>25?h=p.substring(0,25)+"...":h=p,m=ct(ra,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?ct(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?p:void 0,children:ct("span",{className:"text",children:h})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=c,e[10]=u,e[11]=s,e[12]=i,e[13]=a,e[14]=m}else m=e[14];return m},Eh=kh.memo(wh),Dt=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:u,key:d}=n,c=_h(()=>u?.length?u.map(a=>ct(Eh,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[u,r.activeItemKeys,r.enabledItemKeys,t,o]);return ct(la,{buttonAriaLabel:`${d} dropdown`,buttonClassName:[yn,`${yn}-${d}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:d,Icon:l,itemsContainerClassNames:[`${yn}-items`,...s||[]],label:i,children:c},d)};import{mergeRegister as Sh}from"@lexical/utils";import{$getSelection as Nh}from"lexical";import{useCallback as Lh,useDeferredValue as Rh,useEffect as yh,useRef as ia,useState as vh}from"react";function Ih(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function po(t,e){let[o,n]=vh(()=>Ih(e)),r=Rh(o),l=U(),s=ia(l);s.current=l;let i=ia(e);i.current=e;let u=hr(),d=Lh(()=>{t.getEditorState().read(()=>{let c=Nh();if(!c)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,h=new Map;for(let f of a){let g=[],_=[],L=[],v=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let C of f.items){let x=C.isActive?(!v||g.length<v)&&C.isActive({editor:t,editorConfigContext:m,selection:c}):!1,k=C.isEnabled?C.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;x&&(g.push(C.key),_.push(C)),k&&L.push(C.key),p.set(C.key,{active:x,enabled:k})}let b=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;h.set(f.key,{activeItemKeys:g,activeItems:_,enabledGroup:b,enabledItemKeys:L})}n({groupStates:h,itemStates:p})})},[t]);return yh(()=>{u(d);let c=()=>{u(d)},a=Sh(t.registerUpdateListener(c));return document.addEventListener("mouseup",c),()=>{a(),document.removeEventListener("mouseup",c)}},[t,u,d]),r}function Bh({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&fe(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?fe($t,{active:t,editor:o,enabled:n,item:r,children:fe(r.ChildComponent,{})},r.key):null}function Ph({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=Fh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:u}}=U(),d=l.groupStates.get(n.key),c=vn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,d?.activeItems]),a=vn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:u}):p.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,d?.activeItems,s,i,u]);return Ah("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&d?fe(Dt,{anchorElem:t,editor:e,group:n,groupState:d,Icon:c,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let p=l.itemStates.get(m.key);return fe(Bh,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&fe("div",{className:"divider"})]},n.key)}function jh({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=fo.useRef(null),s=sa(),{y:i}=Dh(),u=po(o,n?.features?.toolbarFixed?.groups),d=vn(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return Oh(()=>{if(!d)return;let c=l.current;if(!c)return;let a=c.getBoundingClientRect(),m=d.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,i]),fe("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&fe(fo.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((c,a)=>fe(Ph,{anchorElem:t,editor:o,editorConfig:n,group:c,index:a,toolbarStates:u},c.key))})})}var aa=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return aa(t.parentEditor)}return!1},ca=t=>{let e=Mh(6),{clientProps:o}=t,[n]=$h(),r=U();if(!sa())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,u=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,d,c;if(e[0]!==o||e[1]!==i||e[2]!==u||e[3]!==r){c=Symbol.for("react.early_return_sentinel");e:{let a=aa(r);if(o?.disableIfParentHasFixedToolbar&&a){c=null;break e}if(!u?.features?.toolbarFixed?.groups?.length){c=null;break e}d=fe(jh,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:u,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=u,e[3]=r,e[4]=d,e[5]=c}else d=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:d};var Hh=A({plugins:[{Component:ca,position:"aboveContainer"}]});import{c as Gh}from"react/compiler-runtime";import{jsx as Se,jsxs as ma}from"react/jsx-runtime";import{useLexicalComposerContext as Uh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Vh}from"@lexical/react/useLexicalEditable";import{mergeRegister as pa}from"@lexical/utils";import{$getSelection as fa,$isRangeSelection as ua,$isTextNode as zh,COMMAND_PRIORITY_LOW as Wh,getDOMSelection as ha,SELECTION_CHANGE_COMMAND as Kh}from"lexical";import{useCallback as go,useEffect as Ot,useMemo as Xh,useRef as da,useState as Jh}from"react";import"react";import{createPortal as Zh}from"react-dom";function In(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function ho(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:u,verticalGap:d=10}=t,c=o.parentElement;if(u===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),h=u.top-a.height-d,f=u.left-l;s==="center"&&(f=u.left+u.width/2-a.width/2);let g=0;return!e&&h<p.top&&!i&&(g=a.height+u.height+d*2,h+=g),s==="center"?f+a.width>p.right?f=p.right-a.width-l:f<p.left&&(f=p.left+l):f+a.width>p.right&&(f=p.right-a.width-l),f-=m.left,r.style.opacity="1",i&&n!==0?(h-=m.bottom-n+a.height-3,r.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,r.style.transform=`translate(${f}px, ${h}px)`),g}function Yh({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&Se(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?Se($t,{active:t,editor:o,enabled:n,item:r,children:Se(r.ChildComponent,{})},r.key):null}function qh({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=U(),s=r.groupStates.get(o.key),i=Xh(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return ma("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Se(Dt,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(u=>{let d=r.itemStates.get(u.key);return Se(Yh,{active:d?.active??!1,anchorElem:t,editor:e,enabled:d?.enabled??!0,item:u},u.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Se("div",{className:"divider"})]},o.key)}function Qh({anchorElem:t,editor:e}){let o=da(null),n=da(null),{editorConfig:r}=U(),l=po(e,r?.features?.toolbarInline?.groups),s=go(()=>{if(o?.current){let c=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=go(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=c.clientX,h=c.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),u=go(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ot(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",u)}),[o,i,u]);let d=go(()=>{let c=fa(),a=ha(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(c!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=In(a,h),g=ho({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&ho({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Ot(()=>{let c=t.parentElement,a=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",a),c&&c.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),c&&c.removeEventListener("scroll",a)}},[e,d,t]),Ot(()=>(e.getEditorState().read(()=>{d()}),pa(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(Kh,()=>(d(),!1),Wh))),[e,d]),ma("div",{className:"inline-toolbar-popup",ref:o,children:[Se("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,a)=>Se(qh,{anchorElem:t,editor:e,group:c,index:a,toolbarStates:l},c.key))]})}function e5(t,e){let o=Gh(12),[n,r]=Jh(!1),l=Vh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=fa(),h=ha(t._window),f=t.getRootElement();if(h!==null&&(!ua(p)||f===null||!f.contains(h.anchorNode))){r(!1);return}if(!ua(p))return;if(p.getTextContent()!==""){let _=p.getNodes(),L=!1;for(let v of _)if(zh(v)){r(!0),L=!0;break}L||r(!1)}else r(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,u,d;o[2]!==i?(u=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),d=[i],o[2]=i,o[3]=u,o[4]=d):(u=o[3],d=o[4]),Ot(u,d);let c,a;if(o[5]!==t||o[6]!==i?(c=()=>pa(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=a):(c=o[7],a=o[8]),Ot(c,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=Zh(Se(Qh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var ga=t=>{let{anchorElem:e}=t,[o]=Uh();return e5(o,e)};var t5=A({plugins:[{Component:ga,position:"floatingAnchorElem"}]});import{TableCellNode as Wg,TableNode as Kg,TableRowNode as Xg}from"@lexical/table";import{jsx as Ca}from"react/jsx-runtime";import"react";var o5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Mn=({className:t,size:e=24})=>Ca("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ca("path",{clipRule:"evenodd",d:o5[e],fill:"currentColor",fillRule:"evenodd"})});import{$convertToMarkdownString as n5}from"@lexical/markdown";import{$createTableCellNode as r5,$createTableNode as l5,$createTableRowNode as i5,$isTableCellNode as xa,$isTableNode as An,$isTableRowNode as $n,TableCellHeaderStates as Co,TableCellNode as s5,TableNode as a5,TableRowNode as c5}from"@lexical/table";import{$isParagraphNode as u5,$isTextNode as d5}from"lexical";var ka=/^\|(.+)\|\s?$/,m5=/^(\| ?:?-*:? ?)+\|\s?$/,_a=({allTransformers:t})=>({type:"element",dependencies:[a5,c5,s5],export:e=>{if(!An(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!$n(n))continue;let l=!1;for(let s of n.getChildren())xa(s)&&(r.push(n5(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===Co.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
58
- `)},regExp:ka,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(m5.test(r)){let a=e.getPreviousSibling();if(!a||!An(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!$n(p))return;p.getChildren().forEach(h=>{xa(h)&&h.setHeaderStyles(Co.ROW,Co.ROW)}),e.remove();return}let l=ba(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),u=l.length;for(;i&&!(!u5(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!d5(a))break;let m=ba(a.getTextContent(),t);if(m==null)break;u=Math.max(u,m.length),s.unshift(m);let p=i.getPreviousSibling();i.remove(),i=p}let d=l5();for(let a of s){let m=i5();d.append(m);for(let p=0;p<u;p++)m.append(p<a.length?a[p]:Ta("",t))}let c=e.getPreviousSibling();An(c)&&p5(c)===u?(c.append(...d.getChildren()),e.remove()):e.replace(d),d.selectEnd()}});function p5(t){let e=t.getFirstChild();return $n(e)?e.getChildrenSize():0}var Ta=(t,e)=>{t=t.replace(/\\n/g,`
59
- `);let o=r5(Co.NO_STATUS);return Jt(t,e,o,!1,!0),o},ba=(t,e)=>{let o=t.match(ka);return!o||!o[1]?null:o[1].split("|").map(n=>Ta(n,e))};import{c as h5}from"react/compiler-runtime";import{jsx as j,jsxs as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as Ra}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as g5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Sa,$deleteTableColumnAtSelection as C5,$deleteTableRowAtSelection as x5,$getNodeTriplet as b5,$getTableCellNodeFromLexicalNode as Na,$getTableColumnIndexFromTableCellNode as k5,$getTableNodeFromLexicalNodeOrThrow as $e,$getTableRowIndexFromTableCellNode as _5,$insertTableColumnAtSelection as T5,$insertTableRowAtSelection as w5,$isTableCellNode as ya,$isTableSelection as Ft,$mergeCells as E5,$unmergeCell as S5,getTableElement as Dn,getTableObserverFromTableElement as On,TableCellHeaderStates as Ae,TableCellNode as N5}from"@lexical/table";import{mergeRegister as L5}from"@lexical/utils";import{useScrollInfo as R5}from"@payloadcms/ui";import{$getSelection as bo,$isElementNode as y5,$isRangeSelection as Fn,$isTextNode as v5,$setSelection as I5,COMMAND_PRIORITY_CRITICAL as M5,getDOMSelection as A5,isDOMNode as $5,SELECTION_CHANGE_COMMAND as D5}from"lexical";import*as Bn from"react";import{useCallback as ue,useEffect as ut,useRef as xo,useState as dt}from"react";import{createPortal as va}from"react-dom";import{jsx as wa}from"react/jsx-runtime";import"react";var f5={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},Ea=({className:t,size:e=24})=>wa("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:wa("path",{clipRule:"evenodd",d:f5[e],fill:"currentColor",fillRule:"evenodd"})});function La(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function O5(){let t=bo();if(Fn(t)&&!t.isCollapsed()||Ft(t)&&!t.anchor.is(t.focus)||!Fn(t)&&!Ft(t))return!1;let[e]=b5(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function F5(t){let e=t.getLastDescendant();v5(e)?e.select():y5(e)?e.selectEnd():e!==null&&e.selectNext()}function B5({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Ra(),s=xo(null),[i,u]=dt(r),[d,c]=dt({columns:1,rows:1}),[a,m]=dt(!1),[p,h]=dt(!1),{y:f}=R5();ut(()=>l.registerMutationListener(N5,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{u(i.getLatest())})},{skipInitialization:!0}),[l,i]),ut(()=>{l.getEditorState().read(()=>{let w=bo();if(Ft(w)){let y=La(w);c(La(w)),m(y.columns>1||y.rows>1)}h(O5())})},[l]),ut(()=>{let w=e.current,y=s.current,R=l.getRootElement();if(w!=null&&y!=null&&R!=null){let M=R.getBoundingClientRect(),$=w.getBoundingClientRect();y.style.opacity="1";let D=y.getBoundingClientRect(),F=5,B=$.right+F;if(B+D.width>window.innerWidth||B+D.width>M.right){let X=$.left-D.width-F;B=(X<0?F:X)+window.pageXOffset}y.style.left=`${B+window.pageXOffset}px`;let Y=$.top;if(Y+D.height>window.innerHeight){let X=$.bottom-D.height;Y=X<0?F:X}y.style.top=`${Y}px`}},[e,s,l,f]),ut(()=>{function w(y){s.current!=null&&e.current!=null&&$5(y.target)&&!s.current.contains(y.target)&&!e.current.contains(y.target)&&n(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[n,e]);let g=ue(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i),y=Dn(w,l.getElementByKey(w.getKey()));if(y===null)throw new Error("Expected to find tableElement in DOM");let R=On(y);R!==null&&R.$clearHighlight(),w.markDirty(),u(i.getLatest())}I5(null)})},[l,i]),_=()=>{l.update(()=>{let w=bo();if(!Ft(w))return;let R=w.getNodes().filter(ya),M=E5(R);M&&(F5(M),o())})},L=()=>{l.update(()=>{S5()})},v=ue(w=>{l.update(()=>{for(let y=0;y<d.rows;y++)w5(w);o()})},[l,o,d.rows]),b=ue(w=>{l.update(()=>{for(let y=0;y<d.columns;y++)T5(w);o()})},[l,o,d.columns]),C=ue(()=>{l.update(()=>{x5(),o()})},[l,o]),x=ue(()=>{l.update(()=>{$e(i).remove(),g(),o()})},[l,i,g,o]),k=ue(()=>{l.update(()=>{C5(),o()})},[l,o]),T=ue(()=>{l.update(()=>{let w=$e(i),y=_5(i),[R]=Sa(w,null,null),M=new Set,$=i.getHeaderStyles()^Ae.ROW;if(R[y])for(let D=0;D<R[y].length;D++){let F=R[y][D];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles($,Ae.ROW)))}g(),o()})},[l,i,g,o]),I=ue(()=>{l.update(()=>{let w=$e(i),y=k5(i),[R]=Sa(w,null,null),M=new Set,$=i.getHeaderStyles()^Ae.COLUMN;if(R)for(let D=0;D<R.length;D++){let F=R?.[D]?.[y];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles($,Ae.COLUMN)))}g(),o()})},[l,i,g,o]),N=ue(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),E=ue(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),S=null;return t&&(a?S=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):p&&(S=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>L(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),va(Ne("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[S?Ne(Bn.Fragment,{children:[S,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:j("span",{className:"text",children:"Toggle row striping"})}),j("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>E(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>v(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>v(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&Ae.ROW)===Ae.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&Ae.COLUMN)===Ae.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function P5({anchorElem:t,cellMerge:e}){let[o]=Ra(),n=xo(null),r=xo(null),[l,s]=dt(!1),[i,u]=dt(null),d=ue(()=>{let a=n.current,m=bo(),p=A5(o._window),h=document.activeElement;function f(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(m==null||a==null)return f();let g=o.getRootElement(),_=null,L=null;if(Fn(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let b=Na(m.anchor.getNode());if(b==null||(L=o.getElementByKey(b.getKey()),L==null||!b.isAttached()))return f();let C=$e(b),x=Dn(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=On(x),u(b)}else if(Ft(m)){let b=Na(m.anchor.getNode());if(!ya(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=$e(b),x=Dn(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=On(x),L=o.getElementByKey(b.getKey())}else if(!h)return f();if(_===null||L===null)return f();let v=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",v),a.classList.toggle("table-cell-action-button-container--inactive",!v),v){let b=L.getBoundingClientRect(),C=t.getBoundingClientRect(),x=b.top-C.top,k=b.right-C.left;a.style.transform=`translate(${k}px, ${x}px)`}},[o,t]);ut(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(d)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return L5(o.registerUpdateListener(p),o.registerCommand(D5,p,M5),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let c=xo(i);return ut(()=>{c.current!==i&&s(!1),c.current=i},[c,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Ne(Bn.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(Ea,{})}),l&&j(B5,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Ia=t=>{let e=h5(3),{anchorElem:o}=t,n=g5(),r;return e[0]!==o||e[1]!==n?(r=va(n?j(P5,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as j5}from"react/compiler-runtime";import{jsx as _o,jsxs as H5}from"react/jsx-runtime";import{useLexicalComposerContext as G5}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as U5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as V5,$getTableNodeFromLexicalNodeOrThrow as Pn,$getTableRowIndexFromTableCellNode as z5,$isTableCellNode as Ma,$isTableRowNode as W5,getDOMCellFromTarget as K5,getTableElement as X5,TableNode as Aa}from"@lexical/table";import{calculateZoomLevel as $a,mergeRegister as J5}from"@lexical/utils";import{$getNearestNodeFromDOMNode as jn,isHTMLElement as Z5,SKIP_SCROLL_INTO_VIEW_TAG as Da}from"lexical";import*as Fa from"react";import{useCallback as Bt,useEffect as Hn,useRef as ko,useState as mt}from"react";import{createPortal as Y5}from"react-dom";var q5=33,Oa=92;function Q5({editor:t}){let e=ko(null),o=ko(null),n=ko(null),[r,l]=mt(!1),s=U(),i=ko(null),[u,d]=mt(null),[c,a]=mt(null),[m,p]=mt(!1),[h,f]=mt(null),g=Bt(()=>{a(null),e.current=null,f(null),i.current=null,n.current=null},[]),_=E=>(E.buttons&1)===1;Hn(()=>{let E=new Set;return J5(t.registerMutationListener(Aa,S=>{for(let[w,y]of S)y==="destroyed"?E.delete(w):E.add(w);l(E.size>0)}),t.registerNodeTransform(Aa,S=>{if(S.getColWidths())return S;let w=S.getColumnCount(),y=Oa;return S.setColWidths(Array(w).fill(y)),S}))},[t]),Hn(()=>{if(!r)return;let E=R=>{let M=R.target;if(Z5(M)){if(h){d({x:R.clientX,y:R.clientY});return}if(p(_(R)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let $=K5(M);$&&c!==$?t.getEditorState().read(()=>{let D=jn($.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let F=Pn(D),B=X5(F,t.getElementByKey(F.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=M,n.current=B.getBoundingClientRect(),a($)},{editor:t}):$==null&&g()}}},S=R=>{p(!0)},w=R=>{p(!1)},y=t.registerRootListener((R,M)=>{M?.removeEventListener("mousemove",E),M?.removeEventListener("mousedown",S),M?.removeEventListener("mouseup",w),R?.addEventListener("mousemove",E),R?.addEventListener("mousedown",S),R?.addEventListener("mouseup",w)});return()=>{y()}},[c,h,t,r,g]);let L=E=>E==="bottom",v=Bt(E=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=jn(c.elem);if(!Ma(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Pn(S),y=z5(S),R=w.getChildren(),$=S.getColSpan()===w.getColumnCount()?y:y+S.getRowSpan()-1;if($>=R.length||$<0)throw new Error("Expected table cell to be inside of table row.");let D=R[$];if(!W5(D))throw new Error("Expected table row");let F=D.getHeight();if(F===void 0){let Y=D.getChildren();F=Math.min(...Y.map(X=>b(X,t)??1/0))}let B=Math.max(F+E,q5);D.setHeight(B)},{tag:Da})},[c,t]),b=(E,S)=>S.getElementByKey(E.getKey())?.clientHeight,C=(E,S)=>{let w;return S.forEach(y=>{y.forEach((R,M)=>{R.cell===E&&(w=M)})}),w},x=Bt(E=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=jn(c.elem);if(!Ma(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Pn(S),[y]=V5(w,null,null),R=C(S,y);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");let M=w.getColWidths();if(!M)return;let $=M[R];if($===void 0)return;let D=[...M],F=Math.max($+E,Oa);D[R]=F,w.setColWidths(D)},{tag:Da})},[c,t]),k=Bt(E=>{let S=w=>{if(w.preventDefault(),w.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:y,y:R}=i.current;if(c===null)return;let M=$a(w.target);if(L(E)){let $=(w.clientY-R)/M;v($)}else{let $=(w.clientX-y)/M;x($)}g(),document.removeEventListener("mouseup",S)}};return S},[c,g,x,v]),T=Bt(E=>S=>{if(S.preventDefault(),S.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},d(i.current),f(E),document.addEventListener("mouseup",k(E))},[c,k]),[I,N]=mt({bottom:null,left:null,right:null,top:null});return Hn(()=>{if(c){let{height:E,left:S,top:w,width:y}=c.elem.getBoundingClientRect(),R=$a(c.elem),M=10,$={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${M}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+w+E-M/2}px`,width:`${y}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${E}px`,left:`${window.scrollX+S+y-M/2}px`,top:`${window.scrollY+w}px`,width:`${M}px`}},D=n.current;h&&u&&D&&(L(h)?($[h].left=`${window.scrollX+D.left}px`,$[h].top=`${window.scrollY+u.y/R}px`,$[h].height="3px",$[h].width=`${D.width}px`):($[h].top=`${window.scrollY+D.top}px`,$[h].left=`${window.scrollX+u.x/R}px`,$[h].width="3px",$[h].height=`${D.height}px`),$[h].backgroundColor="#adf"),N($)}else N({bottom:null,left:null,right:null,top:null})},[c,h,u]),_o("div",{ref:o,children:c!=null&&!m&&H5(Fa.Fragment,{children:[_o("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),_o("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var Ba=()=>{let t=j5(3),[e]=G5(),o=U5(),n;return t[0]!==e||t[1]!==o?(n=o?Y5(_o(Q5,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],n};import{c as sg}from"react/compiler-runtime";import{jsx as Gn,jsxs as ag,Fragment as cg}from"react/jsx-runtime";import{useLexicalComposerContext as ug}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Wa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as dg,$getTableColumnIndexFromTableCellNode as mg,$getTableRowIndexFromTableCellNode as pg,$insertTableColumnAtSelection as fg,$insertTableRowAtSelection as hg,$isTableCellNode as gg,$isTableNode as Ha,getTableElement as Cg,TableNode as xg}from"@lexical/table";import{$findMatchingParent as bg,mergeRegister as kg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ga,isHTMLElement as _g}from"lexical";import{useEffect as Ua,useMemo as Tg,useRef as Va,useState as To}from"react";import"react";import{createPortal as wg}from"react-dom";import{c as rg}from"react/compiler-runtime";import{useEffect as lg,useRef as ig}from"react";var eg="Expected a function",tg=Math.max,og=Math.min;function ng(t,e,o){let n,r,l=0,s,i=!1,u=!1,d,c,a,m=!0;if(typeof t!="function")throw new TypeError(eg);e=e||0,typeof o=="object"&&(i=!!o.leading,u="maxWait"in o,d=u?tg(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function p(x){let k=n,T=s;return n=s=void 0,l=x,c=t.apply(T,k),c}function h(x){return l=x,a=setTimeout(_,e),i?p(x):c}function f(x){let k=x-r,T=x-l,I=e-k;return u?og(I,d-T):I}function g(x){let k=x-r,T=x-l;return r===void 0||k>=e||k<0||u&&T>=d}function _(){let x=Date.now();if(g(x))return L(x);a=setTimeout(_,f(x))}function L(x){return a=void 0,m&&n?p(x):(n=s=void 0,c)}function v(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function b(){return a===void 0?c:L(Date.now())}function C(){let x=Date.now(),k=g(x);if(n=arguments,s=this,r=x,k){if(a===void 0)return h(r);if(u)return clearTimeout(a),a=setTimeout(_,e),p(r)}return a===void 0&&(a=setTimeout(_,e)),c}return C.cancel=v,C.flush=b,C}var Pa=ng;function ja(t,e,o){let n=rg(6),r=ig(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=Pa(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),lg(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...d)=>{let c=d;r.current&&r.current(...c)},n[5]=i):i=n[5],i}var za=16;function Eg({anchorElem:t}){let[e]=ug(),o=Wa(),n=U(),[r,l]=To(!1),[s,i]=To(!1),[u,d]=To(!1),[c,a]=To({}),m=Va(new Set),p=Va(null),h=ja(_=>{let{isOutside:L,tableDOMNode:v}=Sg(_,n.editorConfig?.lexical);if(L){l(!1),i(!1);return}if(!v)return;p.current=v;let b=null,C=null,x=null;if(e.getEditorState().read(()=>{let $=Ga(v);if(gg($)){let D=bg($,F=>Ha(F));if(!Ha(D))return;if(x=Cg(D,e.getElementByKey(D.getKey())),x){let F=D.getChildrenSize(),B=D.getChildAtIndex(0)?.getChildrenSize(),Y=pg($),X=mg($);Y===F-1?b=$:X===B-1&&(C=$)}}},{editor:e}),!x)return;let k=x.parentElement;if(!k)return;let{bottom:T,height:I,left:N,right:E,width:S,y:w}=x.getBoundingClientRect(),y=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(y=k.scrollWidth>k.clientWidth);let{left:R,y:M}=t.getBoundingClientRect();b?(i(!1),l(!0),a({height:za,left:y&&k?k.offsetLeft:N-R,top:T-M+5,width:y&&k?k.offsetWidth:S})):C&&(i(!0),l(!1),a({height:I,left:E-R+5,top:w-M,width:za}))},50,250),f=Tg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Ua(()=>{if(u)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[u,h]),Ua(()=>kg(e.registerMutationListener(xg,_=>{e.getEditorState().read(()=>{let L=!1;for(let[v,b]of _)switch(b){case"created":{m.current.add(v),L=!0;break}case"destroyed":{m.current.delete(v),L=!0;break}default:break}if(L){f.disconnect();for(let v of m.current){let{tableElement:b}=dg(v);f.observe(b)}d(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=_=>{e.update(()=>{p.current&&(Ga(p.current)?.selectEnd(),_?(hg(),l(!1)):(fg(),i(!1)))})};return o?ag(cg,{children:[r&&Gn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...c},type:"button"}),s&&Gn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...c},type:"button"})]}):null}function Sg(t,e){let o=t.target;if(_g(o)){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function Ka(t){let e=sg(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!Wa())return null;let l;return e[0]!==n?(l=wg(Gn(Eg,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as zn,jsxs as yg}from"react/jsx-runtime";import{useLexicalComposerContext as vg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Ig}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Mg,TableCellNode as Ag,TableNode as $g,TableRowNode as Dg}from"@lexical/table";import{mergeRegister as Og}from"@lexical/utils";import{$getSelection as Fg,$isRangeSelection as Bg,$setSelection as Pg,COMMAND_PRIORITY_EDITOR as jg,createCommand as Hg}from"lexical";import{createContext as Gg,use as Ug,useCallback as Qa,useEffect as ec,useMemo as Vg,useRef as zg,useState as wo}from"react";import*as tc from"react";import{jsx as Q,jsxs as Le}from"react/jsx-runtime";import{useCallback as Un,useEffect as Xa,useRef as Vn,useState as Pt}from"react";import*as Ya from"react";import{createPortal as Ng}from"react-dom";var Ja=10,Za=7;function Lg(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),Q("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function Rg(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function qa({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Pt(0),[u,d]=Pt(0),[c,a]=Pt(""),[m,p]=Pt(""),[h,f]=Pt(null),g=Vn(null),_=Vn(null),L=Vn(null),v=s>0?s:c?parseInt(c,10)||0:5,b=u>0?u:m?parseInt(m,10)||0:5;Xa(()=>{o||(i(0),d(0),a(""),p(""),f(null))},[o]),Xa(()=>{if(!o)return;let N=E=>{if(E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),n()),E.key==="Enter"&&h){E.preventDefault();let S=parseInt(c,10),w=parseInt(m,10);S>0&&w>0&&r(S,w)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,h,c,m]);let C=Un((N,E)=>{N>0&&E>0&&r(N,E)},[r]),x=Un((N,E)=>{i(N),d(E)},[]),k=Un(()=>{i(0),d(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=Za;N++)for(let E=1;E<=Ja;E++){let S=E<=v&&N<=b,w=E<=s&&N<=u,y="table-grid-popup__cell";S&&w?y+=" table-grid-popup__cell--hover":S&&(y+=" table-grid-popup__cell--selected"),T.push(Q("div",{"aria-label":`${E} columns, ${N} rows`,className:y,onClick:()=>C(E,N),onKeyDown:R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),C(E,N))},onMouseEnter:()=>x(E,N),role:"button",tabIndex:-1},`${N}-${E}`))}let I=s>0&&u>0;return Ng(Le(Ya.Fragment,{children:[Q("div",{className:"table-grid-popup__backdrop",onClick:n}),Q("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:Le("div",{className:"table-grid-popup__content",children:[Le("div",{className:"table-grid-popup__header",children:[Le("div",{className:`table-grid-popup__input-group${h==="cols"?" table-grid-popup__input-group--focused":""}`,children:[Q("div",{className:"table-grid-popup__input-icon",children:Q(Lg,{})}),Q("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:N=>a(N.target.value),onFocus:()=>f("cols"),placeholder:s>0?String(s):"5",ref:_,type:"number",value:c})]}),Q("span",{className:"table-grid-popup__separator",children:"\xD7"}),Le("div",{className:`table-grid-popup__input-group${h==="rows"?" table-grid-popup__input-group--focused":""}`,children:[Q("div",{className:"table-grid-popup__input-icon",children:Q(Rg,{})}),Q("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:N=>p(N.target.value),onFocus:()=>f("rows"),placeholder:u>0?String(u):"5",ref:L,type:"number",value:m})]})]}),Le("div",{className:"table-grid-popup__grid",onMouseLeave:k,children:[T,I&&Le("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/Ja*100}%)`,top:`calc(${(u-1)/Za*100}%)`},children:[v," \xD7 ",b]})]})]})})]}),t)}var Eo=Hg("OPEN_EMBED_DRAWER_COMMAND"),oc=Gg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function nc({children:t}){let[e,o]=wo({cellEditorConfig:null,cellEditorPlugins:null});return zn(oc,{value:Vg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var rc=()=>{let[t]=vg(),e=Ug(oc),[o,n]=wo(!1),[r,l]=wo(null),s=zg(null),[i,u]=wo(null);ec(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;u(m??a.parentElement)}},[t]),ec(()=>{if(!t.hasNodes([$g,Dg,Ag]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Og(t.registerCommand(Eo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),p=null;t.getEditorState().read(()=>{let f=Fg();if(Bg(f)){s.current=f.clone();let g=f.anchor.getNode(),_=t.getElementByKey(g.getKey());if(_){let L=_.getBoundingClientRect();L.height>0&&(p={left:L.left-m.left,top:L.bottom-m.top+8})}}});let h=window.getSelection();if(h&&h.rangeCount>0){let g=h.getRangeAt(0).getBoundingClientRect();g.height>0&&(p={left:g.left-m.left,top:g.bottom-m.top+8})}return p||(p={left:0,top:40}),l(p),n(!0),!0},jg))},[e,t,i]);let d=Qa(()=>{n(!1)},[]),c=Qa((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&Pg(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(Mg,{columns:String(a),rows:String(m)})},1)},[t]);return yg(tc.Fragment,{children:[zn(qa,{anchorElem:i,editor:t,isOpen:o,onClose:d,onInsert:c,position:r}),zn(Ig,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var Jg=A({markdownTransformers:[_a],nodes:[Kg,Wg,Xg],plugins:[{Component:rc,position:"normal"},{Component:Ba,position:"normal"},{Component:Ia,position:"floatingAnchorElem"},{Component:Ka,position:"floatingAnchorElem"}],providers:[nc],slashMenu:{groups:[J([{Icon:Mn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Eo,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Mn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Eo,{})}}])]}});import{$isNodeSelection as E2}from"lexical";import{jsx as lc}from"react/jsx-runtime";import"react";var Zg="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",Wn=({className:t})=>lc("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:lc("path",{clipRule:"evenodd",d:Zg,fill:"currentColor",fillRule:"evenodd"})});import{c as r2}from"react/compiler-runtime";import{jsx as l2}from"react/jsx-runtime";import{useLexicalComposerContext as i2}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as gc,$insertNodeToNearestRoot as Jn,mergeRegister as s2}from"@lexical/utils";import{useBulkUpload as a2,useEffectEvent as c2,useModal as u2}from"@payloadcms/ui";import Zn from"bson-objectid";import{$createRangeSelection as d2,$getPreviousSelection as dc,$getSelection as mc,$isParagraphNode as Yn,$isRangeSelection as pc,$setSelection as m2,COMMAND_PRIORITY_EDITOR as p2,COMMAND_PRIORITY_LOW as fc,createCommand as f2,DROP_COMMAND as h2,getDOMSelectionFromTarget as g2,isHTMLElement as hc,PASTE_COMMAND as C2}from"lexical";import{useEffect as x2}from"react";import{c as ic}from"react/compiler-runtime";import{jsx as Kn}from"react/jsx-runtime";import{useLexicalComposerContext as sc}from"@lexical/react/LexicalComposerContext.js";import{toast as Yg}from"@payloadcms/ui";import{$getNodeByKey as qg,COMMAND_PRIORITY_EDITOR as ac}from"lexical";import{useEffect as cc,useState as Qg}from"react";var e2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=qg(o);r&&r.replace(ye({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(Xn,{fields:null,relationTo:e,value:n})},t2=t=>{let e=ic(13),{enabledCollectionSlugs:o}=t,[n]=sc(),[r,l]=Qg(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:u,openListDrawer:d}=At(s),c,a;e[2]!==n||e[3]!==d?(c=()=>n.registerCommand(qe,f=>(l(f?.replace?f?.replace.nodeKey:null),d(),!0),ac),a=[n,d],e[2]=n,e[3]=d,e[4]=c,e[5]=a):(c=e[4],a=e[5]),cc(c,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=f=>{let{collectionSlug:g,doc:_}=f;i(),e2({editor:n,relationTo:g,replaceNodeKey:r,value:_.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,h;return e[10]!==u||e[11]!==p?(h=Kn(u,{onSelect:p}),e[10]=u,e[11]=p,e[12]=h):h=e[12],h},o2=()=>{let t=ic(3),[e]=sc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(qe,n2,ac),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),cc(o,n),null},uc=({enabledCollectionSlugs:t})=>t?.length?Kn(t2,{enabledCollectionSlugs:t}):Kn(o2,{});function n2(){return Yg.error("No upload collections enabled"),!0}function b2(t){let e=t.target;return!!(hc(e)&&!e.closest("code, span.editor-image")&&hc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function k2(t){let e,o=g2(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Xn=f2("INSERT_UPLOAD_COMMAND"),Cc=t=>{let e=r2(21),{clientProps:o}=t,[n]=i2(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l,uploads:!0},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=co(s),{modalSlug:u,setCollectionSlug:d,setInitialForms:c,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=a2(),{isModalOpen:h,openModal:f}=u2(),g;e[3]!==u||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==d||e[9]!==c||e[10]!==a||e[11]!==m||e[12]!==p?(g=C=>{let{files:x}=C;if(x?.length!==0&&(c(k=>[...k??[],...x.map(_2)]),!h(u))){if(!i.length||!i[0])return;d(i[0]),p(i),a(()=>{n.update(T2)}),m(k=>{let T=new Map(k.map(w2));n.update(()=>{for(let I of gc()){let N=I.node;if(et(N)){let E=N.getData();if(E?.pending){let S=T.get(E.pending?.formID);S&&N.replace(ye({data:{id:new Zn.default().toHexString(),fields:{},relationTo:S.collectionSlug,value:S.doc.id}}))}}}})}),f(u)}},e[3]=u,e[4]=n,e[5]=i,e[6]=h,e[7]=f,e[8]=d,e[9]=c,e[10]=a,e[11]=m,e[12]=p,e[13]=g):g=e[13];let _=c2(g),L;e[14]!==n||e[15]!==_?(L=()=>{if(!n.hasNodes([Qe]))throw new Error("UploadPlugin: UploadNode not registered on editor");return s2(n.registerNodeTransform(Qe,C=>{let x=C.getData();if(!x?.pending)return;(async function(){let I=null,N=x?.pending?.src,E=x?.pending?.formID;if(N?.startsWith("data:")){let S=N.match(/data:(image\/[a-zA-Z]+);base64,/),w=S?S[1]:"image/png",y=N.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob(y),M=new Array(R.length);for(let F=0;F<R.length;F++)M[F]=R.charCodeAt(F);let $=new Uint8Array(M);I={alt:void 0,file:new File([$],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:E}}else if(N?.startsWith("http")||N?.startsWith("https")){let w=await(await fetch(N)).blob(),y=N.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];I={alt:void 0,file:new File([w],y,{type:w.type}),formID:E}}I&&_({files:[I]})})()}),n.registerCommand(Xn,C=>(n.update(()=>{let x=mc()||dc();if(pc(x)){let k=ye({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:T}=x,I=T.getNode();Jn(k),Yn(I)&&!I.__first&&I.remove()}}),!0),p2),n.registerCommand(C2,C=>{if(!(C instanceof ClipboardEvent))return!1;let x=C.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let k=[];return x?.files?.length&&Array.from(x.files).forEach(T=>{k.push({alt:"",file:T,formID:new Zn.default().toHexString()})}),k.length?(n.update(()=>{let T=mc()||dc();if(pc(T))for(let I of k){let N=ye({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:E}=T,S=E.getNode();Jn(N),Yn(S)&&!S.__first&&S.remove()}}),_({files:k}),!0):!1},fc),n.registerCommand(h2,C=>{if(!(C instanceof DragEvent))return!1;let x=C.dataTransfer;if(!x?.types?.length)return!1;let k=[];return x?.files?.length&&Array.from(x.files).forEach(T=>{k.push({alt:"",file:T,formID:new Zn.default().toHexString()})}),k.length?(C.preventDefault(),C.stopPropagation(),n.update(()=>{if(b2(C)){let T=k2(C),I=d2();T!=null&&I.applyDOMRange(T),m2(I);for(let N of k){let E=ye({data:{pending:{formID:N.formID,src:URL.createObjectURL(N.file)}}}),{focus:S}=I,w=S.getNode();Jn(E),Yn(w)&&!w.__first&&w.remove()}}}),_({files:k}),!0):!1},fc))},e[14]=n,e[15]=_,e[16]=L):L=e[16];let v;e[17]!==n?(v=[n],e[17]=n,e[18]=v):v=e[18],x2(L,v);let b;return e[19]!==i?(b=l2(uc,{enabledCollectionSlugs:i}),e[19]=i,e[20]=b):b=e[20],b};function _2(t){return{file:t.file,formID:t.formID}}function T2(){for(let t of gc()){let e=t.node;et(e)&&e.getData()?.pending&&e.remove()}}function w2(t){return[t.formID,t]}var S2=A({nodes:[Qe],plugins:[{Component:Cc,position:"normal"}],slashMenu:{groups:[J([{Icon:Wn,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(qe,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Wn,isActive:({selection:t})=>{if(!E2(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return et(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(qe,{replace:!1})}}])]}});import{c as L2}from"react/compiler-runtime";import{jsx as So}from"react/jsx-runtime";import{createElement as R2}from"react";import{ShimmerEffect as y2,useConfig as v2}from"@payloadcms/ui";import{lazy as I2,Suspense as M2,useEffect as A2,useState as $2}from"react";var xc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var qn={namespace:"lexical",theme:xc};function bc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map,i=[];for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null){console.warn("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected. Skipping feature.");continue}s.set(c.clientFeatureProps.featureKey,c),i.push(c)}l.features=i,l.features=l.features.sort((c,a)=>c.clientFeatureProps.order-a.clientFeatureProps.order);let u=new Map,d=0;for(let c of l.features){let a=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:u,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;a.key=c.clientFeatureProps.featureKey,a.order=d,u.set(c.clientFeatureProps.featureKey,a),d++}return u}import{deepMerge as N2}from"payload/shared";var kc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?N2(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function Qn(t,e,o,n){return{admin:o,features:kc(t),lexical:e,resolvedFeatureMap:t,view:n}}var D2=I2(()=>import("./Field-IZKDIUJY.js").then(t=>({default:t.RichText}))),O2=t=>So(Do,{inheritable:!0,views:t.views,children:So(F2,{...t})}),F2=t=>{let e=L2(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:u,views:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let a=c,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let p=m,h=i===void 0?qn:i,{currentView:f}=Oo(),g=d?.[f]?.admin??a,_=d?.[f]?.lexical,L;e[4]!==h||e[5]!==_?(L=typeof _=="function"?_(h):_??h,e[4]=h,e[5]=_,e[6]=L):L=e[6];let v=L,{config:b}=v2(),[C,x]=$2(null),k,T;e[7]!==n||e[8]!==b||e[9]!==f||e[10]!==g||e[11]!==v||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==C||e[16]!==u||e[17]!==d?(k=()=>{if(C&&C.view===f)return;let N=d?.[f],E=N?.filterFeatures?N.filterFeatures(n):n,S=[];for(let y of Object.values(E))!y.clientFeatureProvider||!y.clientFeatureProps||S.push(y.clientFeatureProvider(y.clientFeatureProps));let w=bc({config:b,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:u??s.name,unSanitizedEditorConfig:{features:S,lexical:v}});x(Qn(w,v,g,f))},T=[g,n,b,p,l,s,C,v,u,f,d],e[7]=n,e[8]=b,e[9]=f,e[10]=g,e[11]=v,e[12]=p,e[13]=l,e[14]=s,e[15]=C,e[16]=u,e[17]=d,e[18]=k,e[19]=T):(k=e[18],T=e[19]),A2(k,T);let I;return e[20]!==C||e[21]!==t?(I=So(M2,{fallback:So(y2,{height:"35vh"}),children:C&&R2(D2,{...t,editorConfig:C,key:C.view})}),e[20]=C,e[21]=t,e[22]=I):I=e[22],I};function B2(...t){return t.filter(Boolean).join(" ")}var P2=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var No=new WeakMap;function _c(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Lo(t,e){let o=No.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=_c(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let u=_c(s);for(let d of n)u!==null&&d([u[0]-i[0],u[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},No.set(t,o)}return o.listeners.add(e),()=>{j2(t,e)}}function j2(t,e){let o=No.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(No.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function H2(t,e){return Lo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function G2(t,e){return Lo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function U2(t,e){return Lo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function V2(t,e){return Lo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as z2}from"react/compiler-runtime";import{jsx as W2}from"react/jsx-runtime";import"react";var K2=()=>{let t=z2(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?W2(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as X2}from"react/compiler-runtime";import{jsx as J2}from"react/jsx-runtime";import"react";var Z2=()=>{let t=X2(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?J2(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Y2}from"react/compiler-runtime";import{jsx as q2}from"react/jsx-runtime";import"react";var Q2=()=>{let t=Y2(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?q2(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as eC}from"react/compiler-runtime";import{jsx as tC}from"react/jsx-runtime";import"react";var oC=t=>{let e=eC(3),{children:o}=t,{InlineBlockContainer:n}=Ce(),r;return e[0]!==n||e[1]!==o?(r=n?tC(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as nC}from"react/jsx-runtime";import"react";var rC=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?nC(n,{...o,children:e}):null};import{c as lC}from"react/compiler-runtime";import{jsx as iC}from"react/jsx-runtime";import"react";var sC=()=>{let t=lC(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?iC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as aC}from"react/compiler-runtime";import{jsx as cC}from"react/jsx-runtime";import"react";var uC=()=>{let t=aC(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?cC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as dC}from"qs-esm";var mC=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let u=dC({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(c=>c.json())};var Tc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
57
+ `,Ws="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Vs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",O0=new RegExp("^[^"+Vs+"]*["+Ws+"]"),F0=new RegExp("^[^"+Ws+"]*["+Vs+"]"),P0={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},B0={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},j0={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},H0={[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"},G0={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},U0={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};var Ks={text:({node:t})=>{let e=t.text;return t.format&F.IS_BOLD&&(e=ze("strong",{children:e})),t.format&F.IS_ITALIC&&(e=ze("em",{children:e})),t.format&F.IS_STRIKETHROUGH&&(e=ze("span",{style:{textDecoration:"line-through"},children:e})),t.format&F.IS_UNDERLINE&&(e=ze("span",{style:{textDecoration:"underline"},children:e})),t.format&F.IS_CODE&&(e=ze("code",{children:e})),t.format&F.IS_SUBSCRIPT&&(e=ze("sub",{children:e})),t.format&F.IS_SUPERSCRIPT&&(e=ze("sup",{children:e})),e}};import{jsx as At}from"react/jsx-runtime";var Js={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return At("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return At("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let u=i?.url;l.push(At("source",{media:`(max-width: ${i.width}px)`,srcSet:u,type:i.mimeType},s))}return l.push(At("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),At("picture",{children:l})}};var ct={...Gs,...Ks,...Fs,...As,...zs,...$s,...Os,...Hs,...Bs({}),...Js,...Us};import{jsx as fo,Fragment as z0}from"react/jsx-runtime";import mo from"react";function Xs(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function W0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return fo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function Ys(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return mo.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return fo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function V0(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Ys(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Ys(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=W0(r))}return e}function Zs({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(Xs(e)){let l=r?V0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return qs({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return fo(z0,{})}function qs({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,u)=>{let d;i.type==="block"?(d=t?.blocks?.[i?.fields?.blockType],!d&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(d=t?.inlineBlocks?.[i?.fields?.blockType],!d&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):d=t[i.type];try{!d&&l&&(d=l);let c;d?c=typeof d=="function"?d({childIndex:u,converters:t,node:i,nodesToJSX:f=>qs({converters:f.converters??t,disableIndent:f.disableIndent??e,disableTextAlign:f.disableTextAlign??o,nodes:f.nodes,parent:f.parent??{...i,parent:r}}),parent:r}):d:c=fo("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),mo.isValidElement(c)){if(a.textAlign||a.paddingInlineStart){let m={...a,...c?.props?.style??{}};return mo.cloneElement(c,{key:u,style:m})}return mo.cloneElement(c,{key:u})}return c}catch(c){return console.error("Error converting lexical node to JSX:",c,"node:",i),null}}).filter(Boolean)}function Dn({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i=e,u={};i?typeof i=="function"?u=i({defaultConverters:ct}):u=i:u=ct;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Zs({converters:u,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Qs(K0,{children:d}):Qs("div",{className:t??"payload-richtext",children:d})}function ta(){let t=J0(7),[e]=X0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=Z0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:d}=u;r(d.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),Y0(l,s);let i;return t[5]!==n?(i=ea("div",{className:"debug-jsx-converter",children:ea(Dn,{converters:ct,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var q0=A({plugins:[{Component:ta,position:"bottom"}]});var j={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},Q0={text:{"text-red":{css:{color:`light-dark(${j.red[600]}, ${j.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${j.orange[600]}, ${j.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${j.yellow[700]}, ${j.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${j.green[700]}, ${j.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${j.blue[600]}, ${j.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${j.purple[600]}, ${j.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${j.pink[600]}, ${j.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${j.red[400]}, ${j.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${j.orange[400]}, ${j.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${j.yellow[300]}, ${j.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${j.green[400]}, ${j.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${j.blue[400]}, ${j.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${j.purple[400]}, ${j.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${j.pink[400]}, ${j.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Uh}from"lexical";import{jsx as oa}from"react/jsx-runtime";import"react";var eh="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",$n=({className:t})=>oa("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:oa("path",{d:eh,fill:"currentColor"})});import{jsx as lh}from"react/jsx-runtime";import{$applyNodeReplacement as ih}from"lexical";import*as ra from"react";import{DecoratorBlockNode as th}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as oh}from"@lexical/utils";import{$applyNodeReplacement as nh}from"lexical";function rh(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:na({relationTo:o,value:e})}:null}var Dt=class extends th{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:rh,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=na(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return oh(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function na(t){return nh(new Dt({data:t}))}var sh=ra.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function ah(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:We({relationTo:o,value:e})}:null}var we=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:ah,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=We(o);return n.setFormat(e.format),n}decorate(e,o){return lh(sh,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function We(t){return ih(new we({data:t}))}function On(t){return t instanceof we}import{c as Ih}from"react/compiler-runtime";import{jsx as Mh}from"react/jsx-runtime";import{useLexicalComposerContext as Ah}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Dh}from"@lexical/utils";import{$getPreviousSelection as $h,$getSelection as Oh,$isParagraphNode as Fh,$isRangeSelection as Ph,COMMAND_PRIORITY_EDITOR as Bh,createCommand as jh}from"lexical";import{useEffect as Hh}from"react";import{c as sa}from"react/compiler-runtime";import{jsx as Fn}from"react/jsx-runtime";import{useLexicalComposerContext as aa}from"@lexical/react/LexicalComposerContext.js";import{toast as kh}from"@payloadcms/ui";import{$getNodeByKey as _h,COMMAND_PRIORITY_EDITOR as ca}from"lexical";import{useEffect as ua,useState as Th}from"react";import{c as ch}from"react/compiler-runtime";import{jsx as uh}from"react/jsx-runtime";import{useLexicalComposerContext as dh}from"@lexical/react/LexicalComposerContext";import{useListDrawer as mh,useModal as fh}from"@payloadcms/ui";import{$getNodeByKey as la,$getPreviousSelection as ph,$getRoot as hh,$getSelection as gh,$isRangeSelection as xh,$setSelection as Ch}from"lexical";import{useEffect as bh,useState as ia}from"react";var $t=t=>{let e=ch(23),[o]=dh(),[n,r]=ia(null),[l,s]=ia(!1),[i,u,d]=mh(t),{closeDrawer:c,drawerSlug:a,isDrawerOpen:m,openDrawer:f}=d,{modalState:h}=fh(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{let N=gh()??ph();r(N)},e[0]=p):p=e[0];let g=p,C;e[1]!==o||e[2]!==n?(C=()=>{n&&o.update(()=>{if(xh(n)){let{anchor:N,focus:S}=n;la(N.key)&&la(S.key)&&Ch(n.clone())}else hh().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=C):C=e[3];let E=C,w;e[4]!==c?(w=()=>{c()},e[4]=c,e[5]=w):w=e[5];let x=w,b,k;e[6]!==a||e[7]!==h||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let N=h[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},k=[h,a,E,l],e[6]=a,e[7]=h,e[8]=E,e[9]=l,e[10]=b,e[11]=k):(b=e[10],k=e[11]),bh(b,k);let _;e[12]!==u?(_=N=>uh(u,{...N,onClick:()=>{g()}}),e[12]=u,e[13]=_):_=e[13];let T;e[14]!==f?(T=()=>{g(),f(),s(!0)},e[14]=f,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==x||e[18]!==m||e[19]!==a||e[20]!==_||e[21]!==T?(I={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:_,openListDrawer:T},e[16]=i,e[17]=x,e[18]=m,e[19]=a,e[20]=_,e[21]=T,e[22]=I):I=e[22],I};var Eh=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=_h(o);r&&r.replace(We({relationTo:e,value:n}))}):t.dispatchCommand(Pn,{relationTo:e,value:n})},wh=t=>{let e=sa(14),{enabledCollectionSlugs:o}=t,[n]=aa(),[r,l]=Th(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:u,ListDrawer:d,openListDrawer:c}=$t(i),a,m;e[3]!==n||e[4]!==c?(a=()=>n.registerCommand(qe,g=>(l(g?.replace?g?.replace.nodeKey:null),c(),!0),ca),m=[n,c],e[3]=n,e[4]=c,e[5]=a,e[6]=m):(a=e[5],m=e[6]),ua(a,m);let f;e[7]!==u||e[8]!==n||e[9]!==r?(f=g=>{let{collectionSlug:C,doc:E}=g;Eh({editor:n,relationTo:C,replaceNodeKey:r,value:E.id}),u()},e[7]=u,e[8]=n,e[9]=r,e[10]=f):f=e[10];let h=f,p;return e[11]!==d||e[12]!==h?(p=Fn(d,{onSelect:h}),e[11]=d,e[12]=h,e[13]=p):p=e[13],p},Sh=()=>{let t=sa(3),[e]=aa(),o,n;return t[0]!==e?(o=()=>e.registerCommand(qe,Nh,ca),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ua(o,n),null},da=({enabledCollectionSlugs:t})=>t?.length?Fn(wh,{enabledCollectionSlugs:t}):Fn(Sh,{});function Nh(){return kh.error("No relationship collections enabled"),!0}import{c as Lh}from"react/compiler-runtime";import{useConfig as yh,useEntityVisibility as Rh}from"@payloadcms/ui";import"react";var po=t=>{let e=Lh(11),{enabledCollectionSlugs:o}=t,{config:n}=yh(),{collections:r}=n,{visibleEntities:l}=Rh(),s,i;if(e[0]!==r||e[1]!==o||e[2]!==l){let d;e[5]!==o||e[6]!==l?(d=a=>{let{slug:m}=a;return o.includes(m)&&(!l?.collections||l.collections.includes(m))},e[5]=o,e[6]=l,e[7]=d):d=e[7];let c=r.filter(d);s=c,i=c.map(vh),e[0]=r,e[1]=o,e[2]=l,e[3]=s,e[4]=i}else s=e[3],i=e[4];let u;return e[8]!==s||e[9]!==i?(u={enabledCollections:s,enabledCollectionSlugs:i},e[8]=s,e[9]=i,e[10]=u):u=e[10],u};function vh(t){return t.slug}var Pn=jh("INSERT_RELATIONSHIP_COMMAND"),ma=t=>{let e=Ih(7),{clientProps:o}=t,[n]=Ah(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=po(r),s,i;e[2]!==n?(s=()=>{if(!n.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Pn,Gh,Bh)},i=[n],e[2]=n,e[3]=s,e[4]=i):(s=e[3],i=e[4]),Hh(s,i);let u;return e[5]!==l?(u=Mh(da,{enabledCollectionSlugs:l}),e[5]=l,e[6]=u):u=e[6],u};function Gh(t){let e=Oh()||$h();if(Ph(e)){let o=We(t),{focus:n}=e,r=n.getNode();Dh(o),Fh(r)&&!r.__first&&r.remove()}return!0}var zh=A({nodes:[we],plugins:[{Component:ma,position:"normal"}],slashMenu:{groups:[Q([{Icon:$n,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(qe,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:$n,isActive:({selection:t})=>{if(!Uh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return On(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(qe,{replace:!1})}}])]}});import{c as S5}from"react/compiler-runtime";import{jsx as ge,jsxs as N5}from"react/jsx-runtime";import{useLexicalComposerContext as L5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as wa}from"@lexical/react/useLexicalEditable";import{useScrollInfo as y5,useThrottledEffect as R5,useTranslation as v5}from"@payloadcms/ui";import*as Sa from"react";import{useMemo as Un}from"react";import{jsx as Wh,jsxs as Vh}from"react/jsx-runtime";import{Tooltip as Kh,useTranslation as Jh}from"@payloadcms/ui";import{$addUpdateTag as Xh}from"lexical";import{useCallback as fa,useEffect as Yh,useMemo as pa,useRef as Zh,useState as qh}from"react";var Bn="toolbar-popup__button",Ot=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=Jh(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=W(),[u,d]=qh(!1),c=Zh(null);Yh(()=>{c.current?.removeAttribute("data-pressing")},[t]);let a=pa(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,p=>p.toUpperCase()),[s,l,i,r]),m=pa(()=>[Bn,n?"":"disabled",t?"active":"",r.key?`${Bn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),f=fa(()=>{n&&o.focus(()=>{o.update(()=>{Xh("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=fa(p=>{p.preventDefault(),p.currentTarget.setAttribute("data-pressing","")},[]);return Vh("button",{"aria-label":a,"aria-pressed":r.isActive?t:void 0,className:m,"data-button-key":r.key,disabled:!n,onClick:f,onMouseDown:h,onPointerEnter:()=>d(!0),onPointerLeave:()=>{d(!1),c.current?.removeAttribute("data-pressing")},ref:c,type:"button",children:[Wh(Kh,{className:`${Bn}__tooltip`,show:u,children:a}),e]})};import{c as l5}from"react/compiler-runtime";import{jsx as ut}from"react/jsx-runtime";import i5,{useMemo as s5}from"react";import{useTranslation as a5}from"@payloadcms/ui";import{jsx as Ve,jsxs as ha}from"react/jsx-runtime";import{Button as Qh}from"@payloadcms/ui";import{$addUpdateTag as e5,isDOMNode as t5}from"lexical";import Hn,{useCallback as o5,useEffect as go,useId as n5,useMemo as xa,useRef as ho,useState as jn}from"react";var ga="toolbar-popup__dropdown-item",Ca=Hn.createContext(null);function ba({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let u=xa(()=>[ga,n===!1?"disabled":"",t?"active":"",l?.key?`${ga}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),d=ho(null),c=Hn.use(Ca);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=c;return go(()=>{d?.current!=null&&a(d)},[d,a]),Ve(Qh,{"aria-label":i,buttonStyle:"ghost",className:u,disabled:n===!1,extraButtonProps:{"aria-checked":l.isActive?!!t:void 0,"data-item-key":s,role:l.isActive?"menuitemcheckbox":"menuitem",tabIndex:-1},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{e5("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:i,type:"button",children:e})}function r5({id:t,children:e,dropdownKey:o,dropDownRef:n,itemsContainerClassNames:r,onClose:l,shouldAutoFocus:s}){let[i,u]=jn(),[d,c]=jn(),a=o5(h=>{u(p=>p!=null?[...p,h]:[h])},[u]),m=h=>{if(i==null)return;let{key:p}=h,g=i.filter(C=>!C.current?.disabled);["ArrowDown","ArrowUp","Escape"].includes(p)&&h.preventDefault(),p==="Escape"?l():p==="Tab"?setTimeout(()=>l({restoreFocus:!1})):p==="ArrowUp"?c(C=>{if(C==null)return g[0];let E=g.indexOf(C)-1;return g[E===-1?g.length-1:E]}):p==="ArrowDown"&&c(C=>{if(C==null)return g[0];let E=g.indexOf(C);return g[E===g.length-1?0:E+1]})},f=xa(()=>({registerItem:a}),[a]);return go(()=>{s&&i!=null&&d==null&&c(i.find(h=>!h.current?.disabled)),d!=null&&d?.current!=null&&d.current.focus()},[i,d,s]),Ve(Ca,{value:f,children:Ve("div",{className:(r??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":o,"data-theme":"dark",id:t,onKeyDown:m,popover:"manual",ref:n,role:"menu",tabIndex:-1,children:e})})}function ka({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:u}){let d=ho(null),c=ho(null),a=ho(!1),m=n5(),f=`toolbar-dropdown-${r}-${m}`,[h,p]=jn(!1),g=({restoreFocus:C=!0}={})=>{p(!1),C&&c?.current!=null&&c.current.focus()};return go(()=>{let C=c.current,E=d.current;if(h&&C!==null&&E!==null){E.matches(":popover-open")||E.showPopover();let w=()=>{let{bottom:x,left:b,top:k}=C.getBoundingClientRect(),_=8,T=5,I=x+T,N=k-E.offsetHeight-T,S=Math.max(_,window.innerHeight-E.offsetHeight-_),y=I+E.offsetHeight+_<=window.innerHeight?I:N>=_?N:I;E.style.position="fixed",E.style.top=`${Math.max(_,Math.min(y,S))}px`,E.style.left=`${Math.max(8,Math.min(b-5,window.innerWidth-E.offsetWidth-20))}px`};return w(),window.addEventListener("resize",w),window.addEventListener("scroll",w,{capture:!0,passive:!0}),()=>{window.removeEventListener("resize",w),window.removeEventListener("scroll",w,{capture:!0})}}},[d,c,h]),go(()=>{let C=c.current;if(C!==null&&h){let E=w=>{let x=w.target;t5(x)&&(u&&d.current&&d.current.contains(x)||C.contains(x)||p(!1))};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}}},[d,c,h,u]),ha(Hn.Fragment,{children:[ha("button",{"aria-controls":f,"aria-expanded":h,"aria-haspopup":"menu","aria-label":t,className:e+(h?" active":""),"data-dropdown-key":r,disabled:n,onClick:C=>{C.preventDefault(),a.current=!1,p(!h)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),a.current=!0,p(!h))},onMouseDown:C=>{C.preventDefault()},ref:c,type:"button",children:[l&&Ve(l,{}),i&&Ve("span",{className:"toolbar-popup__dropdown-label",children:i}),Ve("i",{className:"toolbar-popup__dropdown-caret"})]}),h&&Ve(r5,{dropdownKey:r,dropDownRef:d,id:f,itemsContainerClassNames:s,onClose:g,shouldAutoFocus:a.current,children:o})]})}var Gn="toolbar-popup__dropdown",c5=t=>{let e=l5(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:u}=a5(),{fieldProps:d}=W(),{featureClientSchemaMap:c,schemaPath:a}=d;if(i.Component){let f;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(f=i?.Component&&ut(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=f):f=e[5],f}let m;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==u||e[11]!==s||e[12]!==i||e[13]!==a){let f=i.key,h;i.label&&(f=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:u,schemaPath:a}):i.label),f.length>25?h=f.substring(0,25)+"...":h=f,m=ut(ba,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?ut(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?f:void 0,children:ut("span",{className:"text",children:h})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=c,e[10]=u,e[11]=s,e[12]=i,e[13]=a,e[14]=m}else m=e[14];return m},u5=i5.memo(c5),Ft=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:u,key:d}=n,c=s5(()=>u?.length?u.map(a=>ut(u5,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[u,r.activeItemKeys,r.enabledItemKeys,t,o]);return ut(ka,{buttonAriaLabel:`${d} dropdown`,buttonClassName:[Gn,`${Gn}-${d}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:d,Icon:l,itemsContainerClassNames:[`${Gn}-items`,...s||[]],label:i,children:c},d)};import{mergeRegister as d5}from"@lexical/utils";import{$getSelection as m5}from"lexical";import{useCallback as f5,useDeferredValue as p5,useEffect as h5,useRef as _a,useState as g5}from"react";function x5(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function xo(t,e){let[o,n]=g5(()=>x5(e)),r=p5(o),l=W(),s=_a(l);s.current=l;let i=_a(e);i.current=e;let u=Rr(),d=f5(()=>{t.getEditorState().read(()=>{let c=m5();if(!c)return;let a=i.current;if(!a?.length)return;let m=s.current,f=new Map,h=new Map;for(let p of a){let g=[],C=[],E=[],w=p.type==="dropdown"?p.maxActiveItems??1:void 0;for(let b of p.items){let k=b.isActive?(!w||g.length<w)&&b.isActive({editor:t,editorConfigContext:m,selection:c}):!1,_=b.isEnabled?b.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;k&&(g.push(b.key),C.push(b)),_&&E.push(b.key),f.set(b.key,{active:k,enabled:_})}let x=p.type==="dropdown"&&p.isEnabled?p.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;h.set(p.key,{activeItemKeys:g,activeItems:C,enabledGroup:x,enabledItemKeys:E})}n({groupStates:h,itemStates:f})})},[t]);return h5(()=>{u(d);let c=()=>{u(d)},a=d5(t.registerUpdateListener(c));return document.addEventListener("mouseup",c),()=>{a(),document.removeEventListener("mouseup",c)}},[t,u,d]),r}import{c as C5}from"react/compiler-runtime";import{useEffect as b5}from"react";var k5=".fixed-toolbar__scroll",_5=40;function T5({clientWidth:t,deltaMode:e,deltaY:o,isRightToLeft:n}){let r=e===1?o*_5:e===2?o*t:o;return n?-r:r}function Ta(t){if(!(Math.abs(t.deltaY)>Math.abs(t.deltaX)))return;let o=t.target;if(!(o instanceof Element))return;let n=o.closest(k5);!n||!(n.scrollWidth>n.clientWidth)||(t.preventDefault(),n.scrollLeft+=T5({clientWidth:n.clientWidth,deltaMode:t.deltaMode,deltaY:t.deltaY,isRightToLeft:getComputedStyle(n).direction==="rtl"}))}var dt=0;function Ea(){let t=C5(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],b5(E5,e)}function E5(){return dt===0&&document.addEventListener("wheel",Ta,{passive:!1}),dt=dt+1,w5}function w5(){dt=dt-1,dt===0&&document.removeEventListener("wheel",Ta)}function I5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&ge(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?ge(Ot,{active:t,editor:o,enabled:n,item:r,children:ge(r.ChildComponent,{})},r.key):null}function M5({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=v5(),{fieldProps:{featureClientSchemaMap:i,schemaPath:u}}=W(),d=l.groupStates.get(n.key),c=Un(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,d?.activeItems]),a=Un(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let f=m[0],h=f.key;return f.label&&(h=typeof f.label=="function"?f.label({featureClientSchemaMap:i,i18n:s,schemaPath:u}):f.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,d?.activeItems,s,i,u]);return N5("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&d?ge(Ft,{anchorElem:t,editor:e,group:n,groupState:d,Icon:c,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let f=l.itemStates.get(m.key);return ge(I5,{active:f?.active??!1,anchorElem:t,editor:e,enabled:f?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&ge("div",{className:"divider"})]},n.key)}function A5({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=Sa.useRef(null),s=wa(),{y:i}=y5();Ea();let u=xo(o,n?.features?.toolbarFixed?.groups),d=Un(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return R5(()=>{if(!d)return;let c=l.current;if(!c)return;let a=c.getBoundingClientRect(),m=d.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,i]),ge("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&ge("div",{className:"fixed-toolbar__scroll",children:n?.features&&n.features?.toolbarFixed?.groups.map((c,a)=>ge(M5,{anchorElem:t,editor:o,editorConfig:n,group:c,index:a,toolbarStates:u},c.key))})})}var Na=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Na(t.parentEditor)}return!1},La=t=>{let e=S5(6),{clientProps:o}=t,[n]=L5(),r=W();if(!wa())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,u=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,d,c;if(e[0]!==o||e[1]!==i||e[2]!==u||e[3]!==r){c=Symbol.for("react.early_return_sentinel");e:{let a=Na(r);if(o?.disableIfParentHasFixedToolbar&&a){c=null;break e}if(!u?.features?.toolbarFixed?.groups?.length){c=null;break e}d=ge(A5,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:u,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=u,e[3]=r,e[4]=d,e[5]=c}else d=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:d};var D5=A({plugins:[{Component:La,position:"aboveContainer"}]});import{c as $5}from"react/compiler-runtime";import{jsx as Se,jsxs as va}from"react/jsx-runtime";import{useLexicalComposerContext as O5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as F5}from"@lexical/react/useLexicalEditable";import{mergeRegister as Ia}from"@lexical/utils";import{$getSelection as Ma,$isRangeSelection as ya,$isTextNode as P5,COMMAND_PRIORITY_LOW as B5,getDOMSelection as Aa,SELECTION_CHANGE_COMMAND as j5}from"lexical";import{useCallback as bo,useEffect as Pt,useMemo as H5,useRef as Ra,useState as G5}from"react";import"react";import{createPortal as U5}from"react-dom";function zn(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function Co(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:u,verticalGap:d=10}=t,c=o.parentElement;if(u===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),f=c.getBoundingClientRect(),h=u.top-a.height-d,p=u.left-l;s==="center"&&(p=u.left+u.width/2-a.width/2);let g=0;return!e&&h<f.top&&!i&&(g=a.height+u.height+d*2,h+=g),s==="center"?p+a.width>f.right?p=f.right-a.width-l:p<f.left&&(p=f.left+l):p+a.width>f.right&&(p=f.right-a.width-l),p-=m.left,r.style.opacity="1",i&&n!==0?(h-=m.bottom-n+a.height-3,r.style.transform=`translate(${p}px, ${h}px) rotate(180deg)`):(h-=m.top,r.style.transform=`translate(${p}px, ${h}px)`),g}function z5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&Se(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?Se(Ot,{active:t,editor:o,enabled:n,item:r,children:Se(r.ChildComponent,{})},r.key):null}function W5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=W(),s=r.groupStates.get(o.key),i=H5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return va("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Se(Ft,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(u=>{let d=r.itemStates.get(u.key);return Se(z5,{active:d?.active??!1,anchorElem:t,editor:e,enabled:d?.enabled??!0,item:u},u.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Se("div",{className:"divider"})]},o.key)}function V5({anchorElem:t,editor:e}){let o=Ra(null),n=Ra(null),{editorConfig:r}=W(),l=xo(e,r?.features?.toolbarInline?.groups),s=bo(()=>{if(o?.current){let c=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=bo(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let f=c.clientX,h=c.clientY,p=document.elementFromPoint(f,h);o.current.contains(p)||s()}}},[s]),u=bo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Pt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",u)}),[o,i,u]);let d=bo(()=>{let c=Ma(),a=Aa(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),f=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(c!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let p=zn(a,h),g=Co({alwaysDisplayOnTop:f,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:p});n.current&&Co({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:p,verticalGap:8})}else s()},[e,s,t]);return Pt(()=>{let c=t.parentElement,a=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",a),c&&c.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),c&&c.removeEventListener("scroll",a)}},[e,d,t]),Pt(()=>(e.getEditorState().read(()=>{d()}),Ia(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(j5,()=>(d(),!1),B5))),[e,d]),va("div",{className:"inline-toolbar-popup",ref:o,children:[Se("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,a)=>Se(W5,{anchorElem:t,editor:e,group:c,index:a,toolbarStates:l},c.key))]})}function K5(t,e){let o=$5(12),[n,r]=G5(!1),l=F5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let f=Ma(),h=Aa(t._window),p=t.getRootElement();if(h!==null&&(!ya(f)||p===null||!p.contains(h.anchorNode))){r(!1);return}if(!ya(f))return;if(f.getTextContent()!==""){let C=f.getNodes(),E=!1;for(let w of C)if(P5(w)){r(!0),E=!0;break}E||r(!1)}else r(!1);let g=f.getTextContent().replace(/\n/g,"");if(!f.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,u,d;o[2]!==i?(u=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),d=[i],o[2]=i,o[3]=u,o[4]=d):(u=o[3],d=o[4]),Pt(u,d);let c,a;if(o[5]!==t||o[6]!==i?(c=()=>Ia(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=a):(c=o[7],a=o[8]),Pt(c,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=U5(Se(V5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Da=t=>{let{anchorElem:e}=t,[o]=O5();return K5(o,e)};var J5=A({plugins:[{Component:Da,position:"floatingAnchorElem"}]});import{TableCellNode as U2,TableNode as z2,TableRowNode as W2}from"@lexical/table";import{jsx as $a}from"react/jsx-runtime";import"react";var X5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Wn=({className:t,size:e=24})=>$a("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:$a("path",{clipRule:"evenodd",d:X5[e],fill:"currentColor",fillRule:"evenodd"})});import{$convertToMarkdownString as Y5}from"@lexical/markdown";import{$createTableCellNode as Z5,$createTableNode as q5,$createTableRowNode as Q5,$isTableCellNode as Oa,$isTableNode as Vn,$isTableRowNode as Kn,TableCellHeaderStates as ko,TableCellNode as eg,TableNode as tg,TableRowNode as og}from"@lexical/table";import{$isParagraphNode as ng,$isTextNode as rg}from"lexical";var Pa=/^\|(.+)\|\s?$/,lg=/^(\| ?:?-*:? ?)+\|\s?$/,Ba=({allTransformers:t})=>({type:"element",dependencies:[tg,og,eg],export:e=>{if(!Vn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!Kn(n))continue;let l=!1;for(let s of n.getChildren())Oa(s)&&(r.push(Y5(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===ko.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
58
+ `)},regExp:Pa,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(lg.test(r)){let a=e.getPreviousSibling();if(!a||!Vn(a))return;let m=a.getChildren(),f=m[m.length-1];if(!f||!Kn(f))return;f.getChildren().forEach(h=>{Oa(h)&&h.setHeaderStyles(ko.ROW,ko.ROW)}),e.remove();return}let l=Fa(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),u=l.length;for(;i&&!(!ng(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!rg(a))break;let m=Fa(a.getTextContent(),t);if(m==null)break;u=Math.max(u,m.length),s.unshift(m);let f=i.getPreviousSibling();i.remove(),i=f}let d=q5();for(let a of s){let m=Q5();d.append(m);for(let f=0;f<u;f++)m.append(f<a.length?a[f]:ja("",t))}let c=e.getPreviousSibling();Vn(c)&&ig(c)===u?(c.append(...d.getChildren()),e.remove()):e.replace(d),d.selectEnd()}});function ig(t){let e=t.getFirstChild();return Kn(e)?e.getChildrenSize():0}var ja=(t,e)=>{t=t.replace(/\\n/g,`
59
+ `);let o=Z5(ko.NO_STATUS);return qt(t,e,o,!1,!0),o},Fa=(t,e)=>{let o=t.match(Pa);return!o||!o[1]?null:o[1].split("|").map(n=>ja(n,e))};import{c as ug}from"react/compiler-runtime";import{jsx as B,jsxs as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as Va}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as dg}from"@lexical/react/useLexicalEditable";import{$computeTableMap as mg,$deleteTableColumnAtSelection as fg,$deleteTableRowAtSelection as pg,$getNodeTriplet as hg,$getTableCellNodeFromLexicalNode as Wa,$getTableNodeFromLexicalNodeOrThrow as Me,$getTableRowIndexFromTableCellNode as gg,$insertTableColumnAtSelection as xg,$insertTableRowAtSelection as Cg,$isTableCellNode as Ka,$isTableSelection as Bt,$mergeCells as bg,$setTableColumnIsHeader as kg,$setTableRowIsHeader as _g,$unmergeCell as Tg,getTableElement as Jn,getTableObserverFromTableElement as Xn,TableCellHeaderStates as mt,TableCellNode as Eg}from"@lexical/table";import{mergeRegister as wg}from"@lexical/utils";import{useScrollInfo as Sg}from"@payloadcms/ui";import{$getSelection as To,$isElementNode as Ng,$isRangeSelection as Yn,$isTextNode as Lg,$setSelection as yg,COMMAND_PRIORITY_CRITICAL as Rg,getDOMSelection as vg,isDOMNode as Ig,SELECTION_CHANGE_COMMAND as Mg}from"lexical";import*as Zn from"react";import{useCallback as me,useEffect as ft,useRef as _o,useState as pt}from"react";import{createPortal as Ja}from"react-dom";import{jsx as Ha}from"react/jsx-runtime";import"react";var sg={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},Ga=({className:t,size:e=24})=>Ha("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ha("path",{clipRule:"evenodd",d:sg[e],fill:"currentColor",fillRule:"evenodd"})});import{$computeTableCellRectBoundary as ag,$computeTableMap as cg,$getNodeTriplet as Ua}from"@lexical/table";function za({selection:t}){let[e,,o]=Ua(t.anchor),[n]=Ua(t.focus),[r,l,s]=cg(o,e,n),{maxColumn:i,maxRow:u,minColumn:d,minRow:c}=ag(r,l,s);return{columns:i-d+1,rows:u-c+1}}function Ag(){let t=To();if(Yn(t)&&!t.isCollapsed()||Bt(t)&&!t.anchor.is(t.focus)||!Yn(t)&&!Bt(t))return!1;let[e]=hg(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Dg(t){let e=t.getLastDescendant();Lg(e)?e.select():Ng(e)?e.selectEnd():e!==null&&e.selectNext()}function $g({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Va(),s=_o(null),[i,u]=pt(r),[d,c]=pt({columns:1,rows:1}),[a,m]=pt(!1),[f,h]=pt(!1),{y:p}=Sg();ft(()=>l.registerMutationListener(Eg,L=>{L.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{u(i.getLatest())})},{skipInitialization:!0}),[l,i]),ft(()=>{l.getEditorState().read(()=>{let L=To();if(Bt(L)){let R=za({selection:L});c(R);let v=L.anchor.is(L.focus);m(!v&&(R.columns>1||R.rows>1))}h(Ag())})},[l]),ft(()=>{let L=e.current,R=s.current,v=l.getRootElement();if(L!=null&&R!=null&&v!=null){let D=v.getBoundingClientRect(),M=L.getBoundingClientRect();R.style.opacity="1";let O=R.getBoundingClientRect(),P=5,$=M.right+P;if($+O.width>window.innerWidth||$+O.width>D.right){let V=M.left-O.width-P;$=(V<0?P:V)+window.pageXOffset}R.style.left=`${$+window.pageXOffset}px`;let U=M.top;if(U+O.height>window.innerHeight){let V=M.bottom-O.height;U=V<0?P:V}R.style.top=`${U}px`}},[e,s,l,p]),ft(()=>{function L(R){s.current!=null&&e.current!=null&&Ig(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&n(!1)}return window.addEventListener("click",L),()=>window.removeEventListener("click",L)},[n,e]);let g=me(()=>{l.update(()=>{if(i.isAttached()){let L=Me(i),R=Jn(L,l.getElementByKey(L.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let v=Xn(R);v!==null&&v.$clearHighlight(),L.markDirty(),u(i.getLatest())}yg(null)})},[l,i]),C=()=>{l.update(()=>{let L=To();if(!Bt(L))return;let v=L.getNodes().filter(Ka),D=bg(v);D&&(Dg(D),o())})},E=()=>{l.update(()=>{Tg()}),g()},w=me(L=>{l.update(()=>{for(let R=0;R<d.rows;R++)Cg(L);o()})},[l,o,d.rows]),x=me(L=>{l.update(()=>{for(let R=0;R<d.columns;R++)xg(L);o()})},[l,o,d.columns]),b=me(()=>{l.update(()=>{pg(),o()})},[l,o]),k=me(()=>{l.update(()=>{Me(i).remove(),g(),o()})},[l,i,g,o]),_=me(()=>{l.update(()=>{fg(),o()})},[l,o]),T=me(()=>{l.update(()=>{let L=Me(i),R=gg(i),v=!i.hasHeaderState(mt.ROW);_g(L,R,v),g(),o()})},[l,i,g,o]),I=me(()=>{l.update(()=>{let L=Me(i),[,R]=mg(L,i,i),v=!i.hasHeaderState(mt.COLUMN);kg(L,R.startColumn,v),g(),o()})},[l,i,g,o]),N=me(()=>{l.update(()=>{if(i.isAttached()){let L=Me(i);L&&L.setRowStriping(!L.getRowStriping())}g(),o()})},[l,i,g,o]),S=me(()=>{l.update(()=>{if(i.isAttached()){let L=Me(i);L&&L.setFrozenColumns(L.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),y=null;return t&&(a?y=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>C(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):f&&(y=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),Ja(Ne("div",{className:"table-action-menu-dropdown",onClick:L=>{L.stopPropagation()},ref:s,children:[y?Ne(Zn.Fragment,{children:[y,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:B("span",{className:"text",children:"Toggle row striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>S(),type:"button",children:B("span",{className:"text",children:"Toggle first column freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>w(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>w(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&mt.ROW)===mt.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&mt.COLUMN)===mt.COLUMN?"Remove":"Add"," ","column header"]})})]}),l.getRootElement()?.closest('dialog, [role="dialog"]')??document.body)}function Og({anchorElem:t,cellMerge:e}){let[o]=Va(),n=_o(null),r=_o(null),[l,s]=pt(!1),[i,u]=pt(null),d=me(()=>{let a=n.current,m=To(),f=vg(o._window),h=document.activeElement;function p(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(m==null||a==null)return p();let g=o.getRootElement(),C=null,E=null;if(Yn(m)&&g!==null&&f!==null&&g.contains(f.anchorNode)){let x=Wa(m.anchor.getNode());if(x==null||(E=o.getElementByKey(x.getKey()),E==null||!x.isAttached()))return p();let b=Me(x),k=Jn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Xn(k),u(x)}else if(Bt(m)){let x=Wa(m.anchor.getNode());if(!Ka(x))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=Me(x),k=Jn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Xn(k),E=o.getElementByKey(x.getKey())}else if(!h)return p();if(C===null||E===null)return p();let w=!C||!C.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",w),a.classList.toggle("table-cell-action-button-container--inactive",!w),w){let x=E.getBoundingClientRect(),b=t.getBoundingClientRect(),k=x.top-b.top,_=x.right-b.left;a.style.transform=`translate(${_}px, ${k}px)`}},[o,t]);ft(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(d)},f=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return wg(o.registerUpdateListener(f),o.registerCommand(Mg,f,Rg),o.registerRootListener((h,p)=>{p&&p.removeEventListener("pointerup",f),h&&(h.addEventListener("pointerup",f),f())}),()=>clearTimeout(a))});let c=_o(i);return ft(()=>{c.current!==i&&s(!1),c.current=i},[c,i]),B("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Ne(Zn.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:B(Ga,{})}),l&&B($g,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Xa=t=>{let e=ug(3),{anchorElem:o}=t,n=dg(),r;return e[0]!==o||e[1]!==n?(r=Ja(n?B(Og,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as Fg}from"react/compiler-runtime";import{jsx as wo,jsxs as Pg}from"react/jsx-runtime";import{useLexicalComposerContext as Bg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as jg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Hg,$getTableNodeFromLexicalNodeOrThrow as qn,$getTableRowIndexFromTableCellNode as Gg,$isTableCellNode as Ya,$isTableRowNode as Ug,getDOMCellFromTarget as zg,getTableElement as Wg,TableNode as Za}from"@lexical/table";import{calculateZoomLevel as qa,mergeRegister as Vg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Qn,isHTMLElement as Kg,SKIP_SCROLL_INTO_VIEW_TAG as Qa}from"lexical";import*as tc from"react";import{useCallback as jt,useEffect as So,useRef as Eo,useState as Ke}from"react";import{createPortal as Jg}from"react-dom";var Xg=33,ec=92;function Yg({editor:t}){let e=Eo(null),o=Eo(null),n=Eo(null),[r,l]=Ke(!1),s=W(),i=Eo(null),[u,d]=Ke(null),[c,a]=Ke(null),[m,f]=Ke(!1),[h,p]=Ke(null),g=jt(()=>{a(null),e.current=null,p(null),i.current=null,n.current=null},[]),C=S=>(S.buttons&1)===1;So(()=>{let S=new Set;return Vg(t.registerMutationListener(Za,y=>{for(let[L,R]of y)R==="destroyed"?S.delete(L):S.add(L);l(S.size>0)}),t.registerNodeTransform(Za,y=>{if(y.getColWidths())return y;let L=y.getColumnCount(),R=ec;return y.setColWidths(Array(L).fill(R)),y}))},[t]),So(()=>{if(!r)return;let S=v=>{let D=v.target;if(Kg(D)){if(h){d({x:v.clientX,y:v.clientY});return}if(f(C(v)),!(o.current&&o.current.contains(D))&&e.current!==D){e.current=D;let M=zg(D);M&&c!==M?t.getEditorState().read(()=>{let O=Qn(M.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let P=qn(O),$=Wg(P,t.getElementByKey(P.getKey()));if(!$)throw new Error("TableCellResizer: Table element not found.");e.current=D,n.current=$.getBoundingClientRect(),a(M)},{editor:t}):M==null&&g()}}},y=v=>{f(!0)},L=v=>{f(!1)},R=t.registerRootListener((v,D)=>{D?.removeEventListener("mousemove",S),D?.removeEventListener("mousedown",y),D?.removeEventListener("mouseup",L),v?.addEventListener("mousemove",S),v?.addEventListener("mousedown",y),v?.addEventListener("mouseup",L)});return()=>{R()}},[c,h,t,r,g]);let E=S=>S==="bottom",w=jt(S=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=Qn(c.elem);if(!Ya(y))throw new Error("TableCellResizer: Table cell node not found.");let L=qn(y),R=Gg(y),v=L.getChildren(),M=y.getColSpan()===L.getColumnCount()?R:R+y.getRowSpan()-1;if(M>=v.length||M<0)throw new Error("Expected table cell to be inside of table row.");let O=v[M];if(!Ug(O))throw new Error("Expected table row");let P=O.getHeight();if(P===void 0){let U=O.getChildren();P=Math.min(...U.map(V=>x(V,t)??1/0))}let $=Math.max(P+S,Xg);O.setHeight($)},{tag:Qa})},[c,t]),x=(S,y)=>y.getElementByKey(S.getKey())?.clientHeight,b=(S,y)=>{let L;return y.forEach(R=>{R.forEach((v,D)=>{v.cell===S&&(L=D)})}),L},k=jt(S=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=Qn(c.elem);if(!Ya(y))throw new Error("TableCellResizer: Table cell node not found.");let L=qn(y),[R]=Hg(L,null,null),v=b(y,R);if(v===void 0)throw new Error("TableCellResizer: Table column not found.");let D=L.getColWidths();if(!D)return;let M=D[v];if(M===void 0)return;let O=[...D],P=Math.max(M+S,ec);O[v]=P,L.setColWidths(O)},{tag:Qa})},[c,t]),_=jt(S=>{let y=L=>{if(L.preventDefault(),L.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:v}=i.current;if(c===null)return;let D=qa(L.target);if(E(S)){let M=(L.clientY-v)/D;w(M)}else{let M=(L.clientX-R)/D;k(M)}g(),document.removeEventListener("mouseup",y)}};return y},[c,g,k,w]),T=jt(S=>y=>{if(y.preventDefault(),y.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");i.current={x:y.clientX,y:y.clientY},d(i.current),p(S),document.addEventListener("mouseup",_(S))},[c,_]),[I,N]=Ke({bottom:null,left:null,right:null,top:null});return So(()=>{if(c){let{height:S,left:y,top:L,width:R}=c.elem.getBoundingClientRect(),v=qa(c.elem),D=!!t.getRootElement()?.closest('dialog, [role="dialog"]'),M=D?0:window.scrollX,O=D?0:window.scrollY,P=D?"fixed":"absolute",$=10,U={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${$}px`,left:`${M+y}px`,position:P,top:`${O+L+S-$/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${S}px`,left:`${M+y+R-$/2}px`,position:P,top:`${O+L}px`,width:`${$}px`}},V=n.current;h&&u&&V&&(E(h)?(U[h].left=`${M+V.left}px`,U[h].top=`${O+u.y/v}px`,U[h].height="3px",U[h].width=`${V.width}px`):(U[h].top=`${O+V.top}px`,U[h].left=`${M+u.x/v}px`,U[h].width="3px",U[h].height=`${V.height}px`),U[h].backgroundColor="#adf"),N(U)}else N({bottom:null,left:null,right:null,top:null})},[c,h,t,u]),wo("div",{ref:o,children:c!=null&&!m&&Pg(tc.Fragment,{children:[wo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),wo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var oc=()=>{let t=Fg(7),[e]=Bg(),o=jg(),[n,r]=Ke(null),l,s;t[0]!==e?(l=()=>e.registerRootListener(u=>{r(u?.closest('dialog, [role="dialog"]')??document.body)}),s=[e],t[0]=e,t[1]=l,t[2]=s):(l=t[1],s=t[2]),So(l,s);let i;return t[3]!==e||t[4]!==o||t[5]!==n?(i=o&&n?Jg(wo(Yg,{editor:e}),n):null,t[3]=e,t[4]=o,t[5]=n,t[6]=i):i=t[6],i};import{c as r2}from"react/compiler-runtime";import{jsx as er,jsxs as l2,Fragment as i2}from"react/jsx-runtime";import{useLexicalComposerContext as s2}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as uc}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as a2,$getTableColumnIndexFromTableCellNode as c2,$getTableRowIndexFromTableCellNode as u2,$insertTableColumnAtSelection as d2,$insertTableRowAtSelection as m2,$isTableCellNode as f2,$isTableNode as lc,getTableElement as p2,TableNode as h2}from"@lexical/table";import{$findMatchingParent as g2,mergeRegister as x2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ic,isHTMLElement as C2}from"lexical";import{useEffect as sc,useMemo as b2,useRef as ac,useState as No}from"react";import"react";import{createPortal as k2}from"react-dom";import{c as t2}from"react/compiler-runtime";import{useEffect as o2,useRef as n2}from"react";var Zg="Expected a function",qg=Math.max,Qg=Math.min;function e2(t,e,o){let n,r,l=0,s,i=!1,u=!1,d,c,a,m=!0;if(typeof t!="function")throw new TypeError(Zg);e=e||0,typeof o=="object"&&(i=!!o.leading,u="maxWait"in o,d=u?qg(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function f(k){let _=n,T=s;return n=s=void 0,l=k,c=t.apply(T,_),c}function h(k){return l=k,a=setTimeout(C,e),i?f(k):c}function p(k){let _=k-r,T=k-l,I=e-_;return u?Qg(I,d-T):I}function g(k){let _=k-r,T=k-l;return r===void 0||_>=e||_<0||u&&T>=d}function C(){let k=Date.now();if(g(k))return E(k);a=setTimeout(C,p(k))}function E(k){return a=void 0,m&&n?f(k):(n=s=void 0,c)}function w(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function x(){return a===void 0?c:E(Date.now())}function b(){let k=Date.now(),_=g(k);if(n=arguments,s=this,r=k,_){if(a===void 0)return h(r);if(u)return clearTimeout(a),a=setTimeout(C,e),f(r)}return a===void 0&&(a=setTimeout(C,e)),c}return b.cancel=w,b.flush=x,b}var nc=e2;function rc(t,e,o){let n=t2(6),r=n2(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=nc(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),o2(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...d)=>{let c=d;r.current&&r.current(...c)},n[5]=i):i=n[5],i}var cc=16;function _2({anchorElem:t}){let[e]=s2(),o=uc(),n=W(),[r,l]=No(!1),[s,i]=No(!1),[u,d]=No(!1),[c,a]=No({}),m=ac(new Set),f=ac(null),h=rc(C=>{let{isOutside:E,tableDOMNode:w}=T2(C,n.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!w)return;f.current=w;let x=null,b=null,k=null;if(e.getEditorState().read(()=>{let M=ic(w);if(f2(M)){let O=g2(M,P=>lc(P));if(!lc(O))return;if(k=p2(O,e.getElementByKey(O.getKey())),k){let P=O.getChildrenSize(),$=O.getChildAtIndex(0)?.getChildrenSize(),U=u2(M),V=c2(M);U===P-1?x=M:V===$-1&&(b=M)}}},{editor:e}),!k)return;let _=k.parentElement;if(!_)return;let{bottom:T,height:I,left:N,right:S,width:y,y:L}=k.getBoundingClientRect(),R=!1;_&&_.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(R=_.scrollWidth>_.clientWidth);let{left:v,y:D}=t.getBoundingClientRect();x?(i(!1),l(!0),a({height:cc,left:R&&_?_.offsetLeft:N-v,top:T-D+5,width:R&&_?_.offsetWidth:y})):b&&(i(!0),l(!1),a({height:I,left:S-v+5,top:L-D,width:cc}))},50,250),p=b2(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);sc(()=>{if(u)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[u,h]),sc(()=>x2(e.registerMutationListener(h2,C=>{e.getEditorState().read(()=>{let E=!1;for(let[w,x]of C)switch(x){case"created":{m.current.add(w),E=!0;break}case"destroyed":{m.current.delete(w),E=!0;break}default:break}if(E){p.disconnect();for(let w of m.current){let{tableElement:x}=a2(w);p.observe(x)}d(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,p]);let g=C=>{e.update(()=>{f.current&&(ic(f.current)?.selectEnd(),C?(m2(),l(!1)):(d2(),i(!1)))})};return o?l2(i2,{children:[r&&er("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...c},type:"button"}),s&&er("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...c},type:"button"})]}):null}function T2(t,e){let o=t.target;if(C2(o)){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function dc(t){let e=r2(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!uc())return null;let l;return e[0]!==n?(l=k2(er(_2,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as nr,jsxs as N2}from"react/jsx-runtime";import{useLexicalComposerContext as L2}from"@lexical/react/LexicalComposerContext";import{TablePlugin as y2}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as R2,TableCellNode as v2,TableNode as I2,TableRowNode as M2}from"@lexical/table";import{mergeRegister as A2}from"@lexical/utils";import{$getSelection as D2,$isRangeSelection as $2,$setSelection as O2,COMMAND_PRIORITY_EDITOR as F2,createCommand as P2}from"lexical";import{createContext as B2,use as j2,useCallback as xc,useEffect as Cc,useMemo as H2,useRef as G2,useState as Lo}from"react";import*as bc from"react";import{jsx as te,jsxs as Le}from"react/jsx-runtime";import{useCallback as tr,useEffect as mc,useRef as or,useState as Ht}from"react";import*as hc from"react";import{createPortal as E2}from"react-dom";var fc=10,pc=7;function w2(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function S2(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function gc({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Ht(0),[u,d]=Ht(0),[c,a]=Ht(""),[m,f]=Ht(""),[h,p]=Ht(null),g=or(null),C=or(null),E=or(null),w=s>0?s:c?parseInt(c,10)||0:5,x=u>0?u:m?parseInt(m,10)||0:5;mc(()=>{o||(i(0),d(0),a(""),f(""),p(null))},[o]),mc(()=>{if(!o)return;let N=S=>{if(S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),n()),S.key==="Enter"&&h){S.preventDefault();let y=parseInt(c,10),L=parseInt(m,10);y>0&&L>0&&r(y,L)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,h,c,m]);let b=tr((N,S)=>{N>0&&S>0&&r(N,S)},[r]),k=tr((N,S)=>{i(N),d(S)},[]),_=tr(()=>{i(0),d(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=pc;N++)for(let S=1;S<=fc;S++){let y=S<=w&&N<=x,L=S<=s&&N<=u,R="table-grid-popup__cell";y&&L?R+=" table-grid-popup__cell--hover":y&&(R+=" table-grid-popup__cell--selected"),T.push(te("div",{"aria-label":`${S} columns, ${N} rows`,className:R,onClick:()=>b(S,N),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),b(S,N))},onMouseEnter:()=>k(S,N),role:"button",tabIndex:-1},`${N}-${S}`))}let I=s>0&&u>0;return E2(Le(hc.Fragment,{children:[te("div",{className:"table-grid-popup__backdrop",onClick:n}),te("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:Le("div",{className:"table-grid-popup__content",children:[Le("div",{className:"table-grid-popup__header",children:[Le("div",{className:`table-grid-popup__input-group${h==="cols"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(w2,{})}),te("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>p(null),onChange:N=>a(N.target.value),onFocus:()=>p("cols"),placeholder:s>0?String(s):"5",ref:C,type:"number",value:c})]}),te("span",{className:"table-grid-popup__separator",children:"\xD7"}),Le("div",{className:`table-grid-popup__input-group${h==="rows"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(S2,{})}),te("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>p(null),onChange:N=>f(N.target.value),onFocus:()=>p("rows"),placeholder:u>0?String(u):"5",ref:E,type:"number",value:m})]})]}),Le("div",{className:"table-grid-popup__grid",onMouseLeave:_,children:[T,I&&Le("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/fc*100}%)`,top:`calc(${(u-1)/pc*100}%)`},children:[w," \xD7 ",x]})]})]})})]}),t)}var yo=P2("OPEN_EMBED_DRAWER_COMMAND"),kc=B2({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function _c({children:t}){let[e,o]=Lo({cellEditorConfig:null,cellEditorPlugins:null});return nr(kc,{value:H2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Tc=()=>{let[t]=L2(),e=j2(kc),[o,n]=Lo(!1),[r,l]=Lo(null),s=G2(null),[i,u]=Lo(null);Cc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;u(m??a.parentElement)}},[t]),Cc(()=>{if(!t.hasNodes([I2,M2,v2]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return A2(t.registerCommand(yo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),f=null;t.getEditorState().read(()=>{let p=D2();if($2(p)){s.current=p.clone();let g=p.anchor.getNode(),C=t.getElementByKey(g.getKey());if(C){let E=C.getBoundingClientRect();E.height>0&&(f={left:E.left-m.left,top:E.bottom-m.top+8})}}});let h=window.getSelection();if(h&&h.rangeCount>0){let g=h.getRangeAt(0).getBoundingClientRect();g.height>0&&(f={left:g.left-m.left,top:g.bottom-m.top+8})}return f||(f={left:0,top:40}),l(f),n(!0),!0},F2))},[e,t,i]);let d=xc(()=>{n(!1)},[]),c=xc((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&O2(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(R2,{columns:String(a),rows:String(m)})},1)},[t]);return N2(bc.Fragment,{children:[nr(gc,{anchorElem:i,editor:t,isOpen:o,onClose:d,onInsert:c,position:r}),nr(y2,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var V2=A({markdownTransformers:[Ba],nodes:[z2,U2,W2],plugins:[{Component:Tc,position:"normal"},{Component:oc,position:"normal"},{Component:Xa,position:"floatingAnchorElem"},{Component:dc,position:"floatingAnchorElem"}],providers:[_c],slashMenu:{groups:[Q([{Icon:Wn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Wn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]}});import{$isNodeSelection as _x}from"lexical";import{jsx as Ec}from"react/jsx-runtime";import"react";var K2="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",rr=({className:t})=>Ec("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ec("path",{clipRule:"evenodd",d:K2,fill:"currentColor",fillRule:"evenodd"})});import{c as tx}from"react/compiler-runtime";import{jsx as ox}from"react/jsx-runtime";import{useLexicalComposerContext as nx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Dc,$insertNodeToNearestRoot as sr,mergeRegister as rx}from"@lexical/utils";import{useBulkUpload as lx,useEffectEvent as ix,useModal as sx}from"@payloadcms/ui";import ar from"bson-objectid";import{$createRangeSelection as ax,$getPreviousSelection as Rc,$getSelection as vc,$isParagraphNode as cr,$isRangeSelection as Ic,$setSelection as cx,COMMAND_PRIORITY_EDITOR as ux,COMMAND_PRIORITY_LOW as Mc,createCommand as dx,DROP_COMMAND as mx,getDOMSelectionFromTarget as fx,isHTMLElement as Ac,PASTE_COMMAND as px}from"lexical";import{useEffect as hx}from"react";import{c as wc}from"react/compiler-runtime";import{jsx as lr}from"react/jsx-runtime";import{useLexicalComposerContext as Sc}from"@lexical/react/LexicalComposerContext.js";import{toast as J2}from"@payloadcms/ui";import{$getNodeByKey as X2,COMMAND_PRIORITY_EDITOR as Nc}from"lexical";import{useEffect as Lc,useState as Y2}from"react";var Z2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=X2(o);r&&r.replace(ye({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(ir,{fields:null,relationTo:e,value:n})},q2=t=>{let e=wc(13),{enabledCollectionSlugs:o}=t,[n]=Sc(),[r,l]=Y2(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:u,openListDrawer:d}=$t(s),c,a;e[2]!==n||e[3]!==d?(c=()=>n.registerCommand(Qe,p=>(l(p?.replace?p?.replace.nodeKey:null),d(),!0),Nc),a=[n,d],e[2]=n,e[3]=d,e[4]=c,e[5]=a):(c=e[4],a=e[5]),Lc(c,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=p=>{let{collectionSlug:g,doc:C}=p;i(),Z2({editor:n,relationTo:g,replaceNodeKey:r,value:C.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let f=m,h;return e[10]!==u||e[11]!==f?(h=lr(u,{onSelect:f}),e[10]=u,e[11]=f,e[12]=h):h=e[12],h},Q2=()=>{let t=wc(3),[e]=Sc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Qe,ex,Nc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Lc(o,n),null},yc=({enabledCollectionSlugs:t})=>t?.length?lr(q2,{enabledCollectionSlugs:t}):lr(Q2,{});function ex(){return J2.error("No upload collections enabled"),!0}function gx(t){let e=t.target;return!!(Ac(e)&&!e.closest("code, span.editor-image")&&Ac(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function xx(t){let e,o=fx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var ir=dx("INSERT_UPLOAD_COMMAND"),$c=t=>{let e=tx(20),{clientProps:o}=t,[n]=nx(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=po(r),{modalSlug:s,setCollectionSlug:i,setInitialForms:u,setOnCancel:d,setOnSuccess:c,setSelectableCollections:a}=lx(),{isModalOpen:m,openModal:f}=sx(),h;e[2]!==s||e[3]!==n||e[4]!==l||e[5]!==m||e[6]!==f||e[7]!==i||e[8]!==u||e[9]!==d||e[10]!==c||e[11]!==a?(h=w=>{let{files:x}=w;if(x?.length!==0&&(u(b=>[...b??[],...x.map(Cx)]),!m(s))){if(!l.length||!l[0])return;i(l[0]),a(l),d(()=>{n.update(bx)}),c(b=>{let k=new Map(b.map(kx));n.update(()=>{for(let _ of Dc()){let T=_.node;if(tt(T)){let I=T.getData();if(I?.pending){let N=k.get(I.pending?.formID);N&&T.replace(ye({data:{id:new ar.default().toHexString(),fields:{},relationTo:N.collectionSlug,value:N.doc.id}}))}}}})}),f(s)}},e[2]=s,e[3]=n,e[4]=l,e[5]=m,e[6]=f,e[7]=i,e[8]=u,e[9]=d,e[10]=c,e[11]=a,e[12]=h):h=e[12];let p=ix(h),g;e[13]!==n||e[14]!==p?(g=()=>{if(!n.hasNodes([et]))throw new Error("UploadPlugin: UploadNode not registered on editor");return rx(n.registerNodeTransform(et,w=>{let x=w.getData();if(!x?.pending)return;(async function(){let _=null,T=x?.pending?.src,I=x?.pending?.formID;if(T?.startsWith("data:")){let N=T.match(/data:(image\/[a-zA-Z]+);base64,/),S=N?N[1]:"image/png",y=T.replace(/^data:image\/[a-zA-Z]+;base64,/,""),L=atob(y),R=new Array(L.length);for(let M=0;M<L.length;M++)R[M]=L.charCodeAt(M);let v=new Uint8Array(R);_={alt:void 0,file:new File([v],"pasted-image."+S?.split("/",2)[1],{type:S}),formID:I}}else if(T?.startsWith("http")||T?.startsWith("https")){let S=await(await fetch(T)).blob(),y=T.split("/").pop()||"pasted-image"+S.type.split("/",2)[1];_={alt:void 0,file:new File([S],y,{type:S.type}),formID:I}}_&&p({files:[_]})})()}),n.registerCommand(ir,w=>(n.update(()=>{let x=vc()||Rc();if(Ic(x)){let b=ye({data:{id:w.id,fields:w.fields,relationTo:w.relationTo,value:w.value}}),{focus:k}=x,_=k.getNode();sr(b),cr(_)&&!_.__first&&_.remove()}}),!0),ux),n.registerCommand(px,w=>{if(!(w instanceof ClipboardEvent))return!1;let x=w.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(k=>{b.push({alt:"",file:k,formID:new ar.default().toHexString()})}),b.length?(n.update(()=>{let k=vc()||Rc();if(Ic(k))for(let _ of b){let T=ye({data:{pending:{formID:_.formID,src:URL.createObjectURL(_.file)}}}),{focus:I}=k,N=I.getNode();sr(T),cr(N)&&!N.__first&&N.remove()}}),p({files:b}),!0):!1},Mc),n.registerCommand(mx,w=>{if(!(w instanceof DragEvent))return!1;let x=w.dataTransfer;if(!x?.types?.length)return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(k=>{b.push({alt:"",file:k,formID:new ar.default().toHexString()})}),b.length?(w.preventDefault(),w.stopPropagation(),n.update(()=>{if(gx(w)){let k=xx(w),_=ax();k!=null&&_.applyDOMRange(k),cx(_);for(let T of b){let I=ye({data:{pending:{formID:T.formID,src:URL.createObjectURL(T.file)}}}),{focus:N}=_,S=N.getNode();sr(I),cr(S)&&!S.__first&&S.remove()}}}),p({files:b}),!0):!1},Mc))},e[13]=n,e[14]=p,e[15]=g):g=e[15];let C;e[16]!==n?(C=[n],e[16]=n,e[17]=C):C=e[17],hx(g,C);let E;return e[18]!==l?(E=ox(yc,{enabledCollectionSlugs:l}),e[18]=l,e[19]=E):E=e[19],E};function Cx(t){return{file:t.file,formID:t.formID}}function bx(){for(let t of Dc()){let e=t.node;tt(e)&&e.getData()?.pending&&e.remove()}}function kx(t){return[t.formID,t]}var Tx=A({nodes:[et],plugins:[{Component:$c,position:"normal"}],slashMenu:{groups:[Q([{Icon:rr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:rr,isActive:({selection:t})=>{if(!_x(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return tt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]}});import{c as wx}from"react/compiler-runtime";import{jsx as Ro}from"react/jsx-runtime";import{createElement as Sx}from"react";import{ShimmerEffect as Nx,useConfig as Lx}from"@payloadcms/ui";import{lazy as yx,Suspense as Rx,useEffect as vx,useState as Ix}from"react";var Oc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var ur={namespace:"lexical",theme:Oc};function Fc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map,i=[];for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null){console.warn("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected. Skipping feature.");continue}s.set(c.clientFeatureProps.featureKey,c),i.push(c)}l.features=i,l.features=l.features.sort((c,a)=>c.clientFeatureProps.order-a.clientFeatureProps.order);let u=new Map,d=0;for(let c of l.features){let a=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:u,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;a.key=c.clientFeatureProps.featureKey,a.order=d,u.set(c.clientFeatureProps.featureKey,a),d++}return u}import{deepMerge as Ex}from"payload/shared";var Pc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?Ex(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function dr(t,e,o,n){return{admin:o,features:Pc(t),lexical:e,resolvedFeatureMap:t,view:n}}var Mx=yx(()=>import("./Field-TS5CRYHE.js").then(t=>({default:t.RichText}))),Ax=t=>Ro(Go,{inheritable:!0,views:t.views,children:Ro(Dx,{...t})}),Dx=t=>{let e=wx(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:u,views:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let a=c,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let f=m,h=i===void 0?ur:i,{currentView:p}=Uo(),g=d?.[p]?.admin??a,C=d?.[p]?.lexical,E;e[4]!==h||e[5]!==C?(E=typeof C=="function"?C(h):C??h,e[4]=h,e[5]=C,e[6]=E):E=e[6];let w=E,{config:x}=Lx(),[b,k]=Ix(null),_,T;e[7]!==n||e[8]!==x||e[9]!==p||e[10]!==g||e[11]!==w||e[12]!==f||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==u||e[17]!==d?(_=()=>{if(b&&b.view===p)return;let N=d?.[p],S=N?.filterFeatures?N.filterFeatures(n):n,y=[];for(let R of Object.values(S))!R.clientFeatureProvider||!R.clientFeatureProps||y.push(R.clientFeatureProvider(R.clientFeatureProps));let L=Fc({config:x,featureClientImportMap:f,featureClientSchemaMap:l,field:s,schemaPath:u??s.name,unSanitizedEditorConfig:{features:y,lexical:w}});k(dr(L,w,g,p))},T=[g,n,x,f,l,s,b,w,u,p,d],e[7]=n,e[8]=x,e[9]=p,e[10]=g,e[11]=w,e[12]=f,e[13]=l,e[14]=s,e[15]=b,e[16]=u,e[17]=d,e[18]=_,e[19]=T):(_=e[18],T=e[19]),vx(_,T);let I;return e[20]!==b||e[21]!==t?(I=Ro(Rx,{fallback:Ro(Nx,{height:"35vh"}),children:b&&Sx(Mx,{...t,editorConfig:b,key:b.view})}),e[20]=b,e[21]=t,e[22]=I):I=e[22],I};function $x(...t){return t.filter(Boolean).join(" ")}var Ox=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var vo=new WeakMap;function Bc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Io(t,e){let o=vo.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Bc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let u=Bc(s);for(let d of n)u!==null&&d([u[0]-i[0],u[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},vo.set(t,o)}return o.listeners.add(e),()=>{Fx(t,e)}}function Fx(t,e){let o=vo.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(vo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Px(t,e){return Io(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function Bx(t,e){return Io(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function jx(t,e){return Io(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function Hx(t,e){return Io(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as Gx}from"react/compiler-runtime";import{jsx as Ux}from"react/jsx-runtime";import"react";var zx=()=>{let t=Gx(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?Ux(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Wx}from"react/compiler-runtime";import{jsx as Vx}from"react/jsx-runtime";import"react";var Kx=()=>{let t=Wx(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?Vx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Jx}from"react/compiler-runtime";import{jsx as Xx}from"react/jsx-runtime";import"react";var Yx=()=>{let t=Jx(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?Xx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Zx}from"react/compiler-runtime";import{jsx as qx}from"react/jsx-runtime";import"react";var Qx=t=>{let e=Zx(3),{children:o}=t,{InlineBlockContainer:n}=xe(),r;return e[0]!==n||e[1]!==o?(r=n?qx(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as eC}from"react/jsx-runtime";import"react";var tC=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?eC(n,{...o,children:e}):null};import{c as oC}from"react/compiler-runtime";import{jsx as nC}from"react/jsx-runtime";import"react";var rC=()=>{let t=oC(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?nC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as lC}from"react/compiler-runtime";import{jsx as iC}from"react/jsx-runtime";import"react";var sC=()=>{let t=lC(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?iC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as aC}from"qs-esm";var cC=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let u=aC({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(c=>c.json())};var jc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
60
60
  `)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
61
61
  `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let n=o?.[1];return t.startsWith(`
62
62
  `)&&(t=t.slice(1)),t.endsWith(`
63
63
  `)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
64
- `)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as pC}from"react/jsx-runtime";import{CodeField as fC,useFormFields as hC}from"@payloadcms/ui";import{useId as gC,useMemo as CC}from"react";var Ro={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var xC=({autoComplete:t,field:e,forceRender:o,languages:n=Ro,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,typescript:d,validate:c})=>{let a=hC(([_])=>_.language),m=a?.value||a?.initialValue||"typescript",p=gC(),h=n[m],f=CC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),g=`${e.name}-${m}-${h}`;return f&&pC(fC,{autoComplete:t,field:f,forceRender:o,onMount:(_,L)=>{L.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),L.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),L.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:L.languages.typescript.JsxEmit.React,moduleResolution:L.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:d?.paths,reactNamespace:"React",target:L.languages.typescript.ScriptTarget[d?.target??"ESNext"],typeRoots:d?.typeRoots??["node_modules/@types"]}),L.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!d?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>d?.fetchTypes&&Array.isArray(d.fetchTypes)&&d.fetchTypes.length>0&&await Promise.all(d.fetchTypes.map(async b=>{let x=await(await fetch(b.url)).text();L.languages.typescript.typescriptDefaults.addExtraLib(x,b.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,validate:c},g)};import{jsx as re,jsxs as yc}from"react/jsx-runtime";import{useLexicalEditable as RC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as yC,Combobox as vC,CopyToClipboard as IC,PopupList as MC,RenderFields as AC,useForm as $C,useFormFields as vc,useTranslation as DC}from"@payloadcms/ui";import OC from"react";import{jsx as wc}from"react/jsx-runtime";import"react";var bC={16:"M6.646 6.146a.5.5 0 1 0 .708.708l1.5-1.5a.5.5 0 0 0 0-.708l-1.5-1.5a.5.5 0 1 0-.708.708L7.793 5zm-1.292-3a.5.5 0 0 1 0 .708L4.207 5l1.147 1.146a.5.5 0 1 1-.708.708l-1.5-1.5a.5.5 0 0 1 0-.708l1.5-1.5a.5.5 0 0 1 .708 0M10.5 3h1A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5v-3a.5.5 0 0 1 1 0v3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 1 0-1",24:"M16.5 6C17.3284 6 18 6.67157 18 7.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V12.5C6 12.2239 6.22386 12 6.5 12C6.77614 12 7 12.2239 7 12.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V7.5C17 7.22386 16.7761 7 16.5 7H15.5C15.2239 7 15 6.77614 15 6.5C15 6.22386 15.2239 6 15.5 6H16.5ZM8.14648 6.14648C8.34175 5.95122 8.65825 5.95122 8.85352 6.14648C9.04878 6.34175 9.04878 6.65825 8.85352 6.85352L7.20703 8.5L8.85352 10.1465C9.04878 10.3417 9.04878 10.6583 8.85352 10.8535C8.65825 11.0488 8.34175 11.0488 8.14648 10.8535L6.14648 8.85352C5.95122 8.65825 5.95122 8.34175 6.14648 8.14648L8.14648 6.14648ZM11.1465 6.14648C11.3417 5.95122 11.6583 5.95122 11.8535 6.14648L13.8535 8.14648C14.0488 8.34175 14.0488 8.65825 13.8535 8.85352L11.8535 10.8535C11.6583 11.0488 11.3417 11.0488 11.1465 10.8535C10.9512 10.6583 10.9512 10.3417 11.1465 10.1465L12.793 8.5L11.1465 6.85352C10.9512 6.65825 10.9512 6.34175 11.1465 6.14648Z"},Ec=({className:t,size:e=24})=>wc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:wc("path",{clipRule:"evenodd",d:bC[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as er}from"react/jsx-runtime";import"react";import{useCollapsible as wC}from"@payloadcms/ui";import{jsx as Sc}from"react/jsx-runtime";import"react";var kC="M11.4999 13C11.6325 13 11.7597 13.0527 11.8535 13.1464L14.8535 16.1464C15.0487 16.3417 15.0487 16.6582 14.8535 16.8535C14.6582 17.0487 14.3417 17.0487 14.1464 16.8535L11.4999 14.207L8.85346 16.8535C8.6582 17.0487 8.34169 17.0487 8.14643 16.8535C7.95119 16.6582 7.95119 16.3417 8.14643 16.1464L11.1464 13.1464C11.2402 13.0527 11.3674 13 11.4999 13ZM14.1464 7.14644C14.3417 6.95119 14.6582 6.95118 14.8535 7.14644C15.0487 7.3417 15.0487 7.65821 14.8535 7.85347L11.8535 10.8535C11.7597 10.9472 11.6325 10.9999 11.4999 11C11.3674 10.9999 11.2402 10.9472 11.1464 10.8535L8.14643 7.85347C7.95119 7.65821 7.95119 7.3417 8.14643 7.14644C8.34169 6.9512 8.6582 6.9512 8.85346 7.14644L11.4999 9.79292L14.1464 7.14644Z",yo=({className:t})=>Sc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Sc("path",{d:kC,fill:"currentColor"})});import{jsx as Nc}from"react/jsx-runtime";import"react";var _C="M11.5 6C11.6326 6 11.7597 6.05272 11.8535 6.14648L14.8535 9.14648C15.0487 9.34175 15.0487 9.65825 14.8535 9.85352C14.6582 10.0488 14.3417 10.0488 14.1464 9.85352L12 7.70703V16.293L14.1464 14.1465C14.3417 13.9512 14.6582 13.9512 14.8535 14.1465C15.0487 14.3417 15.0487 14.6583 14.8535 14.8535L11.8535 17.8535C11.6582 18.0488 11.3417 18.0488 11.1464 17.8535L8.14645 14.8535C7.95119 14.6583 7.95119 14.3417 8.14645 14.1465C8.34171 13.9512 8.65822 13.9512 8.85348 14.1465L11 16.293V7.70703L8.85348 9.85352C8.65822 10.0488 8.34171 10.0488 8.14645 9.85352C7.95118 9.65825 7.95118 9.34175 8.14645 9.14648L11.1464 6.14648C11.2402 6.05272 11.3674 6 11.5 6Z",vo=({className:t})=>Nc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Nc("path",{clipRule:"evenodd",d:_C,fill:"currentColor",fillRule:"evenodd"})});var TC="code-block-collapse-button",Lc=()=>{let{isCollapsed:t,toggle:e}=wC();return er("button",{className:TC,onClick:e,type:"button",children:t?er(vo,{}):er(yo,{})})};import{jsx as tr,jsxs as EC}from"react/jsx-runtime";import{useCollapsible as SC,useTranslation as NC}from"@payloadcms/ui";import"react";var LC="code-block-floating-collapse-button",Rc=()=>{let{isCollapsed:t,toggle:e}=SC(),{t:o}=NC();return EC("button",{className:LC,onClick:e,type:"button",children:[t?tr(vo,{}):tr(yo,{}),tr("span",{children:o(t?"general:expand":"general:collapse")})]})};var We="payload-richtext-code-block",FC=t=>{let{languages:e}=t,o=e||Ro,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ae(),{setModified:s}=$C(),{t:i}=DC(),{codeField:u}=vc(([h])=>({codeField:h?.code})),{selectedLanguageField:d,setSelectedLanguage:c}=vc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[d?.value],m=RC(),p=OC.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:re(MC.Button,{active:!1,disabled:!1,onClick:()=>{c(h)},children:re("span",{className:`${We}__language-code`,"data-language":h,children:f})})})),[o,c]);return re(n,{Actions:yc("div",{className:`${We}__actions`,children:[re(vC,{"aria-label":i("general:language"),button:yc("div",{className:`${We}__language-selector-button`,"data-selected-language":d?.value,children:[re("span",{children:a}),re(yC,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(IC,{value:u?.value??""}),re(Lc,{}),m&&re(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:re(Rc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${We}__pill`,children:re(Ec,{})}),showDragHandle:!1,showRowNumber:!1,children:re(AC,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as BC}from"react/compiler-runtime";import{jsx as pt}from"react/jsx-runtime";import{FieldContext as PC,FieldPathContext as Ic,ServerFunctionsContext as Mc,ShimmerEffect as jC,useServerFunctions as HC}from"@payloadcms/ui";import GC,{useEffect as UC,useRef as VC}from"react";var zC=t=>{let e=BC(9),{field:o,initialValue:n,Loading:r,path:l,schemaPath:s,setValue:i,value:u}=t,[d,c]=GC.useState(null),a=HC(),{_internal_renderField:m}=a,[p,h]=s.split(".",2),f=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==m||e[1]!==o||e[2]!==n||e[3]!==l||e[4]!==s?(g=()=>{(async function(){let{Field:I}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:n??void 0,path:l,schemaPath:s});c(I)})()},e[0]=m,e[1]=o,e[2]=n,e[3]=l,e[4]=s,e[5]=g):g=e[5];let _=g,L=VC(!1),v,b;if(e[6]!==_?(v=()=>{L.current||(L.current=!0,_())},b=[_],e[6]=_,e[7]=v,e[8]=b):(v=e[7],b=e[8]),UC(v,b),!d)return typeof r<"u"?r:pt(jC,{});let C={...a,getFormState:async k=>a.getFormState({...k,collectionSlug:p==="collection"?h:void 0,globalSlug:p==="global"?h:void 0})};if(typeof u>"u"&&!i)return pt(Mc,{value:{...C},children:pt(Ic,{value:f,children:d},f)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:f,setValue:i??WC,showError:!1,value:u};return pt(Mc,{value:{...C},children:pt(Ic,{value:f,children:pt(PC,{value:x,children:d})},f)})};function WC(){}function Ac({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o.root.children.length===0&&o.root.children.push({type:"paragraph",children:[],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),o}var KC=Ac;export{Rt as $createAutoLinkNode,Be as $createBlockNode,nt as $createHorizontalRuleNode,xt as $createInlineBlockNode,_e as $createLinkNode,ze as $createRelationshipNode,ye as $createUploadNode,we as $isAutoLinkNode,Ie as $isBlockNode,He as $isHorizontalRuleNode,bt as $isInlineBlockNode,K as $isLinkNode,wn as $isRelationshipNode,et as $isUploadNode,ru as AlignFeatureClient,Te as AutoLinkNode,rC as BlockCollapsible,sC as BlockEditButton,ce as BlockNode,uC as BlockRemoveButton,mu as BlockquoteFeatureClient,Od as BlocksFeatureClient,u1 as BoldFeatureClient,se as CAN_USE_DOM,Lf as ChecklistFeatureClient,FC as CodeBlockBlockComponent,xC as CodeComponent,t0 as DETAIL_TYPE_TO_DETAIL,Yf as DOUBLE_LINE_BREAK,f0 as DebugJsxConverterFeatureClient,n0 as ELEMENT_FORMAT_TO_TYPE,o0 as ELEMENT_TYPE_TO_FORMAT,Uc as ENABLE_SLASH_MENU_COMMAND,Pc as EditorConfigProvider,$o as FieldsDrawer,Hh as FixedToolbarFeatureClient,gm as HeadingFeatureClient,Om as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,tt as INSERT_BLOCK_COMMAND,ot as INSERT_INLINE_BLOCK_COMMAND,Jf as IS_ALL_FORMATTING,qm as IndentFeatureClient,oC as InlineBlockContainer,K2 as InlineBlockEditButton,Q2 as InlineBlockLabel,Ct as InlineBlockNode,Z2 as InlineBlockRemoveButton,g1 as InlineCodeFeatureClient,t5 as InlineToolbarFeatureClient,w1 as ItalicFeatureClient,Qf as LTR_REGEX,Cf as LinkFeatureClient,oe as LinkNode,Zf as NON_BREAKING_SPACE,O as NodeFormat,Af as OrderedListFeatureClient,Hf as ParagraphFeatureClient,Hc as Point,qf as RTL_REGEX,Vc as Rect,rh as RelationshipFeatureClient,Ee as RelationshipNode,zC as RenderLexical,O2 as RichTextField,Do as RichTextViewProvider,y1 as StrikethroughFeatureClient,$1 as SubscriptFeatureClient,P1 as SuperscriptFeatureClient,r0 as TEXT_MODE_TO_TYPE,e0 as TEXT_TYPE_TO_FORMAT,l0 as TEXT_TYPE_TO_MODE,pe as TOGGLE_LINK_COMMAND,Jg as TableFeatureClient,Zd as TestRecorderFeatureClient,tm as TextStateFeatureClient,$t as ToolbarButton,Dt as ToolbarDropdown,t1 as TreeViewFeatureClient,V1 as UnderlineFeatureClient,Pf as UnorderedListFeatureClient,S2 as UploadFeatureClient,Qe as UploadNode,V2 as addSwipeDownListener,H2 as addSwipeLeftListener,G2 as addSwipeRightListener,U2 as addSwipeUpListener,KC as buildDefaultEditorState,Ac as buildEditorState,Tc as codeConverterClient,P2 as createBlockNode,A as createClientFeature,h0 as defaultColors,qn as defaultEditorLexicalConfig,In as getDOMRangeRect,zc as getEnabledNodes,mC as getRestPopulateFn,rt as getSelectedNode,Gc as isPoint,B2 as joinClasses,Qn as sanitizeClientEditorConfig,kc as sanitizeClientFeatures,ho as setFloatingElemPosition,no as setFloatingElemPositionForLinkEditor,J as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,on as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ae as useBlockComponentContext,U as useEditorConfigContext,Ce as useInlineBlockComponentContext,jc as useLexicalDocumentDrawer,De as useLexicalDrawer,At as useLexicalListDrawer,Oo as useRichTextView};
64
+ `)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as uC}from"react/jsx-runtime";import{CodeField as dC,useFormFields as mC}from"@payloadcms/ui";import{useId as fC,useMemo as pC}from"react";var Mo={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var hC=({autoComplete:t,field:e,forceRender:o,languages:n=Mo,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,typescript:d,validate:c})=>{let a=mC(([C])=>C.language),m=a?.value||a?.initialValue||"typescript",f=fC(),h=n[m],p=pC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${f}.tsx`:void 0},language:m}}),[e,m,f]),g=`${e.name}-${m}-${h}`;return p&&uC(dC,{autoComplete:t,field:p,forceRender:o,onMount:(C,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:d?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[d?.target??"ESNext"],typeRoots:d?.typeRoots??["node_modules/@types"]}),E.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!d?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>d?.fetchTypes&&Array.isArray(d.fetchTypes)&&d.fetchTypes.length>0&&await Promise.all(d.fetchTypes.map(async x=>{let k=await(await fetch(x.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(k,x.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,validate:c},g)};import{jsx as le,jsxs as Kc}from"react/jsx-runtime";import{useLexicalEditable as SC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as NC,Combobox as LC,CopyToClipboard as yC,PopupList as RC,RenderFields as vC,useForm as IC,useFormFields as Jc,useTranslation as MC}from"@payloadcms/ui";import AC from"react";import{jsx as Hc}from"react/jsx-runtime";import"react";var gC={16:"M6.646 6.146a.5.5 0 1 0 .708.708l1.5-1.5a.5.5 0 0 0 0-.708l-1.5-1.5a.5.5 0 1 0-.708.708L7.793 5zm-1.292-3a.5.5 0 0 1 0 .708L4.207 5l1.147 1.146a.5.5 0 1 1-.708.708l-1.5-1.5a.5.5 0 0 1 0-.708l1.5-1.5a.5.5 0 0 1 .708 0M10.5 3h1A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5v-3a.5.5 0 0 1 1 0v3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 1 0-1",24:"M16.5 6C17.3284 6 18 6.67157 18 7.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V12.5C6 12.2239 6.22386 12 6.5 12C6.77614 12 7 12.2239 7 12.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V7.5C17 7.22386 16.7761 7 16.5 7H15.5C15.2239 7 15 6.77614 15 6.5C15 6.22386 15.2239 6 15.5 6H16.5ZM8.14648 6.14648C8.34175 5.95122 8.65825 5.95122 8.85352 6.14648C9.04878 6.34175 9.04878 6.65825 8.85352 6.85352L7.20703 8.5L8.85352 10.1465C9.04878 10.3417 9.04878 10.6583 8.85352 10.8535C8.65825 11.0488 8.34175 11.0488 8.14648 10.8535L6.14648 8.85352C5.95122 8.65825 5.95122 8.34175 6.14648 8.14648L8.14648 6.14648ZM11.1465 6.14648C11.3417 5.95122 11.6583 5.95122 11.8535 6.14648L13.8535 8.14648C14.0488 8.34175 14.0488 8.65825 13.8535 8.85352L11.8535 10.8535C11.6583 11.0488 11.3417 11.0488 11.1465 10.8535C10.9512 10.6583 10.9512 10.3417 11.1465 10.1465L12.793 8.5L11.1465 6.85352C10.9512 6.65825 10.9512 6.34175 11.1465 6.14648Z"},Gc=({className:t,size:e=24})=>Hc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Hc("path",{clipRule:"evenodd",d:gC[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as mr}from"react/jsx-runtime";import"react";import{useCollapsible as kC}from"@payloadcms/ui";import{jsx as Uc}from"react/jsx-runtime";import"react";var xC="M11.4999 13C11.6325 13 11.7597 13.0527 11.8535 13.1464L14.8535 16.1464C15.0487 16.3417 15.0487 16.6582 14.8535 16.8535C14.6582 17.0487 14.3417 17.0487 14.1464 16.8535L11.4999 14.207L8.85346 16.8535C8.6582 17.0487 8.34169 17.0487 8.14643 16.8535C7.95119 16.6582 7.95119 16.3417 8.14643 16.1464L11.1464 13.1464C11.2402 13.0527 11.3674 13 11.4999 13ZM14.1464 7.14644C14.3417 6.95119 14.6582 6.95118 14.8535 7.14644C15.0487 7.3417 15.0487 7.65821 14.8535 7.85347L11.8535 10.8535C11.7597 10.9472 11.6325 10.9999 11.4999 11C11.3674 10.9999 11.2402 10.9472 11.1464 10.8535L8.14643 7.85347C7.95119 7.65821 7.95119 7.3417 8.14643 7.14644C8.34169 6.9512 8.6582 6.9512 8.85346 7.14644L11.4999 9.79292L14.1464 7.14644Z",Ao=({className:t})=>Uc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Uc("path",{d:xC,fill:"currentColor"})});import{jsx as zc}from"react/jsx-runtime";import"react";var CC="M11.5 6C11.6326 6 11.7597 6.05272 11.8535 6.14648L14.8535 9.14648C15.0487 9.34175 15.0487 9.65825 14.8535 9.85352C14.6582 10.0488 14.3417 10.0488 14.1464 9.85352L12 7.70703V16.293L14.1464 14.1465C14.3417 13.9512 14.6582 13.9512 14.8535 14.1465C15.0487 14.3417 15.0487 14.6583 14.8535 14.8535L11.8535 17.8535C11.6582 18.0488 11.3417 18.0488 11.1464 17.8535L8.14645 14.8535C7.95119 14.6583 7.95119 14.3417 8.14645 14.1465C8.34171 13.9512 8.65822 13.9512 8.85348 14.1465L11 16.293V7.70703L8.85348 9.85352C8.65822 10.0488 8.34171 10.0488 8.14645 9.85352C7.95118 9.65825 7.95118 9.34175 8.14645 9.14648L11.1464 6.14648C11.2402 6.05272 11.3674 6 11.5 6Z",Do=({className:t})=>zc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:zc("path",{clipRule:"evenodd",d:CC,fill:"currentColor",fillRule:"evenodd"})});var bC="code-block-collapse-button",Wc=()=>{let{isCollapsed:t,toggle:e}=kC();return mr("button",{className:bC,onClick:e,type:"button",children:t?mr(Do,{}):mr(Ao,{})})};import{jsx as fr,jsxs as _C}from"react/jsx-runtime";import{useCollapsible as TC,useTranslation as EC}from"@payloadcms/ui";import"react";var wC="code-block-floating-collapse-button",Vc=()=>{let{isCollapsed:t,toggle:e}=TC(),{t:o}=EC();return _C("button",{className:wC,onClick:e,type:"button",children:[t?fr(Do,{}):fr(Ao,{}),fr("span",{children:o(t?"general:expand":"general:collapse")})]})};var Je="payload-richtext-code-block",DC=t=>{let{languages:e}=t,o=e||Mo,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ae(),{setModified:s}=IC(),{t:i}=MC(),{codeField:u}=Jc(([h])=>({codeField:h?.code})),{selectedLanguageField:d,setSelectedLanguage:c}=Jc(([h,p])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{p({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[d?.value],m=SC(),f=AC.useMemo(()=>Object.entries(o).map(([h,p])=>({name:`${h} ${p}`,Component:le(RC.Button,{active:!1,disabled:!1,onClick:()=>{c(h)},children:le("span",{className:`${Je}__language-code`,"data-language":h,children:p})})})),[o,c]);return le(n,{Actions:Kc("div",{className:`${Je}__actions`,children:[le(LC,{"aria-label":i("general:language"),button:Kc("div",{className:`${Je}__language-selector-button`,"data-selected-language":d?.value,children:[le("span",{children:a}),le(NC,{className:`${Je}__chevron`})]}),buttonType:"custom",className:`${Je}__language-selector`,disabled:!m,entries:f,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),le(yC,{value:u?.value??""}),le(Wc,{}),m&&le(l,{})]}),className:Je,collapsibleProps:{AfterCollapsible:le(Vc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:le("div",{className:`${Je}__pill`,children:le(Gc,{})}),showDragHandle:!1,showRowNumber:!1,children:le(vC,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as $C}from"react/compiler-runtime";import{jsx as ht}from"react/jsx-runtime";import{FieldContext as OC,FieldPathContext as Xc,ServerFunctionsContext as Yc,ShimmerEffect as FC,useServerFunctions as PC}from"@payloadcms/ui";import BC,{useEffect as jC,useRef as HC}from"react";var GC=t=>{let e=$C(10),{name:o,field:n,initialValue:r,label:l,Loading:s,path:i,schemaPath:u,setValue:d,value:c}=t,[a,m]=BC.useState(null),f=PC(),{_internal_renderField:h}=f,[p,g]=u.split(".",2),C=o!==void 0?o:n?.name,E=l!==void 0?l:n?.label,w=i??C??"",x;e[0]!==h||e[1]!==E||e[2]!==C||e[3]!==r||e[4]!==i||e[5]!==u?(x=()=>{(async function(){let{Field:L}=await h({name:C,hidden:!1,initialValue:r??void 0,label:typeof E=="function"?void 0:E,path:i,schemaPath:u});m(L)})()},e[0]=h,e[1]=E,e[2]=C,e[3]=r,e[4]=i,e[5]=u,e[6]=x):x=e[6];let b=x,k=HC(!1),_,T;if(e[7]!==b?(_=()=>{k.current||(k.current=!0,b())},T=[b],e[7]=b,e[8]=_,e[9]=T):(_=e[8],T=e[9]),jC(_,T),!a)return typeof s<"u"?s:ht(FC,{});let I={...f,getFormState:async S=>f.getFormState({...S,collectionSlug:p==="collection"?g:void 0,globalSlug:p==="global"?g:void 0})};if(typeof c>"u"&&!d)return ht(Yc,{value:{...I},children:ht(Xc,{value:w,children:a},w)});let N={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:c,path:w,setValue:d??UC,showError:!1,value:c};return ht(Yc,{value:{...I},children:ht(Xc,{value:w,children:ht(OC,{value:N,children:a})},w)})};function UC(){}function Zc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o.root.children.length===0&&o.root.children.push({type:"paragraph",children:[],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),o}var zC=Zc;export{vt as $createAutoLinkNode,Pe as $createBlockNode,rt as $createHorizontalRuleNode,kt as $createInlineBlockNode,_e as $createLinkNode,We as $createRelationshipNode,ye as $createUploadNode,Ee as $isAutoLinkNode,Ie as $isBlockNode,He as $isHorizontalRuleNode,_t as $isInlineBlockNode,Z as $isLinkNode,On as $isRelationshipNode,tt as $isUploadNode,Nu as AlignFeatureClient,Te as AutoLinkNode,tC as BlockCollapsible,rC as BlockEditButton,de as BlockNode,sC as BlockRemoveButton,Du as BlockquoteFeatureClient,dm as BlocksFeatureClient,Bm as BoldFeatureClient,se as CAN_USE_DOM,d0 as ChecklistFeatureClient,DC as CodeBlockBlockComponent,hC as CodeComponent,B0 as DETAIL_TYPE_TO_DETAIL,$0 as DOUBLE_LINE_BREAK,q0 as DebugJsxConverterFeatureClient,H0 as ELEMENT_FORMAT_TO_TYPE,j0 as ELEMENT_TYPE_TO_FORMAT,du as ENABLE_SLASH_MENU_COMMAND,su as EditorConfigProvider,Ho as FieldsDrawer,D5 as FixedToolbarFeatureClient,ep as HeadingFeatureClient,bp as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,ot as INSERT_BLOCK_COMMAND,nt as INSERT_INLINE_BLOCK_COMMAND,A0 as IS_ALL_FORMATTING,Fp as IndentFeatureClient,Qx as InlineBlockContainer,zx as InlineBlockEditButton,Yx as InlineBlockLabel,bt as InlineBlockNode,Kx as InlineBlockRemoveButton,Wm as InlineCodeFeatureClient,J5 as InlineToolbarFeatureClient,qm as ItalicFeatureClient,F0 as LTR_REGEX,t0 as LinkFeatureClient,ne as LinkNode,D0 as NON_BREAKING_SPACE,F as NodeFormat,x0 as OrderedListFeatureClient,S0 as ParagraphFeatureClient,cu as Point,O0 as RTL_REGEX,mu as Rect,zh as RelationshipFeatureClient,we as RelationshipNode,GC as RenderLexical,Ax as RichTextField,Go as RichTextViewProvider,rf as StrikethroughFeatureClient,uf as SubscriptFeatureClient,hf as SuperscriptFeatureClient,G0 as TEXT_MODE_TO_TYPE,P0 as TEXT_TYPE_TO_FORMAT,U0 as TEXT_TYPE_TO_MODE,he as TOGGLE_LINK_COMMAND,V2 as TableFeatureClient,Sm as TestRecorderFeatureClient,If as TextStateFeatureClient,Ot as ToolbarButton,Ft as ToolbarDropdown,vm as TreeViewFeatureClient,kf as UnderlineFeatureClient,E0 as UnorderedListFeatureClient,Tx as UploadFeatureClient,et as UploadNode,Hx as addSwipeDownListener,Px as addSwipeLeftListener,Bx as addSwipeRightListener,jx as addSwipeUpListener,zC as buildDefaultEditorState,Zc as buildEditorState,jc as codeConverterClient,Ox as createBlockNode,A as createClientFeature,Q0 as defaultColors,ur as defaultEditorLexicalConfig,zn as getDOMRangeRect,fu as getEnabledNodes,cC as getRestPopulateFn,lt as getSelectedNode,uu as isPoint,$x as joinClasses,dr as sanitizeClientEditorConfig,Pc as sanitizeClientFeatures,Co as setFloatingElemPosition,so as setFloatingElemPositionForLinkEditor,Q as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,gn as toolbarFeatureButtonsGroupWithItems,ee as toolbarFormatGroupWithItems,oe as toolbarTextDropdownGroupWithItems,ae as useBlockComponentContext,W as useEditorConfigContext,xe as useInlineBlockComponentContext,au as useLexicalDocumentDrawer,$e as useLexicalDrawer,$t as useLexicalListDrawer,Uo as useRichTextView};
65
65
  //# sourceMappingURL=index.js.map