@payloadcms/richtext-lexical 4.0.0-internal.d21c039 → 4.0.0-internal.d3909a9

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 (267) hide show
  1. package/dist/exports/client/Field-ZK6DB4T2.js +2 -0
  2. package/dist/exports/client/Field-ZK6DB4T2.js.map +7 -0
  3. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  4. package/dist/exports/client/{chunk-LN6VX25I.js.map → chunk-3LRZDIIG.js.map} +2 -2
  5. package/dist/exports/client/chunk-4JYWPIBB.js +2 -0
  6. package/dist/exports/client/chunk-4JYWPIBB.js.map +7 -0
  7. package/dist/exports/client/chunk-UH7ALTP6.js +2 -0
  8. package/dist/exports/client/chunk-UH7ALTP6.js.map +7 -0
  9. package/dist/exports/client/{component-D5QLYS7W.js → component-ELXHSW52.js} +2 -2
  10. package/dist/exports/client/componentInline-HCGJ5ZFN.js +2 -0
  11. package/dist/exports/client/index.js +28 -28
  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 +196 -107
  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.css +0 -1
  26. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  27. package/dist/features/blocks/client/componentInline/index.js +30 -28
  28. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  29. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts +9 -0
  30. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts.map +1 -0
  31. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js +95 -0
  32. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -0
  33. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  34. package/dist/features/blocks/client/nodes/BlocksNode.js +0 -10
  35. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  36. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  37. package/dist/features/blocks/server/nodes/BlocksNode.js +1 -12
  38. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  39. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +2 -2
  40. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  41. package/dist/features/blocks/server/schema.d.ts +2 -0
  42. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  43. package/dist/features/blocks/server/schema.js +7 -9
  44. package/dist/features/blocks/server/schema.js.map +1 -1
  45. package/dist/features/blocks/server/validate.js +1 -1
  46. package/dist/features/blocks/server/validate.js.map +1 -1
  47. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +3 -3
  48. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  49. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +3 -3
  50. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  51. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  52. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  53. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  54. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +4 -5
  55. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  56. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  57. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  58. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  59. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +11 -1
  60. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  61. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +17 -0
  62. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  63. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +2 -2
  64. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  65. package/dist/features/horizontalRule/server/schema.d.ts +1 -0
  66. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -1
  67. package/dist/features/horizontalRule/server/schema.js +6 -5
  68. package/dist/features/horizontalRule/server/schema.js.map +1 -1
  69. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  70. package/dist/features/indent/client/IndentPlugin.js +122 -1
  71. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  72. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  73. package/dist/features/indent/server/i18n.js +74 -37
  74. package/dist/features/indent/server/i18n.js.map +1 -1
  75. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  76. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +8 -5
  77. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  78. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  79. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  80. package/dist/features/link/markdownTransformer.js +2 -2
  81. package/dist/features/link/markdownTransformer.js.map +1 -1
  82. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  83. package/dist/features/link/nodes/AutoLinkNode.js +2 -10
  84. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  85. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  86. package/dist/features/link/nodes/LinkNode.js +2 -15
  87. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  88. package/dist/features/link/server/baseFields.js.map +1 -1
  89. package/dist/features/link/server/validate.js +1 -1
  90. package/dist/features/link/server/validate.js.map +1 -1
  91. package/dist/features/lists/shared/schema.d.ts.map +1 -1
  92. package/dist/features/lists/shared/schema.js.map +1 -1
  93. package/dist/features/relationship/client/components/index.css +3 -6
  94. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  95. package/dist/features/relationship/client/nodes/RelationshipNode.js +0 -3
  96. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  97. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  98. package/dist/features/relationship/server/nodes/RelationshipNode.js +1 -5
  99. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  100. package/dist/features/relationship/server/schema.d.ts +1 -0
  101. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  102. package/dist/features/relationship/server/schema.js +4 -2
  103. package/dist/features/relationship/server/schema.js.map +1 -1
  104. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.css +0 -1
  105. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js +1 -1
  106. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  107. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  108. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js +41 -18
  109. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  110. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.css +0 -3
  111. package/dist/features/textState/defaultColors.js +1 -1
  112. package/dist/features/textState/defaultColors.js.map +1 -1
  113. package/dist/features/toolbars/fixed/client/Toolbar/index.css +2 -2
  114. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  115. package/dist/features/toolbars/fixed/client/Toolbar/index.js +15 -0
  116. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  117. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  118. package/dist/features/toolbars/inline/client/Toolbar/index.js +17 -2
  119. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  120. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  121. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  122. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  123. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  124. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  125. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  126. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +4 -1
  127. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts +5 -0
  128. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts.map +1 -0
  129. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +79 -0
  130. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -0
  131. package/dist/features/typesServer.d.ts +16 -11
  132. package/dist/features/typesServer.d.ts.map +1 -1
  133. package/dist/features/typesServer.js.map +1 -1
  134. package/dist/features/upload/client/component/index.css +0 -2
  135. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  136. package/dist/features/upload/client/nodes/UploadNode.js +0 -7
  137. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  138. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  139. package/dist/features/upload/client/plugin/index.js +3 -1
  140. package/dist/features/upload/client/plugin/index.js.map +1 -1
  141. package/dist/features/upload/server/index.d.ts +1 -1
  142. package/dist/features/upload/server/index.d.ts.map +1 -1
  143. package/dist/features/upload/server/index.js.map +1 -1
  144. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  145. package/dist/features/upload/server/nodes/UploadNode.js +1 -9
  146. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  147. package/dist/features/upload/server/schema.d.ts +2 -14
  148. package/dist/features/upload/server/schema.d.ts.map +1 -1
  149. package/dist/features/upload/server/schema.js +4 -2
  150. package/dist/features/upload/server/schema.js.map +1 -1
  151. package/dist/features/upload/server/validate.js +1 -1
  152. package/dist/features/upload/server/validate.js.map +1 -1
  153. package/dist/field/Diff/converters/relationship/index.css +0 -1
  154. package/dist/field/Diff/converters/unknown/index.css +0 -1
  155. package/dist/field/Diff/converters/upload/index.css +0 -1
  156. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  157. package/dist/field/Diff/index.css +20 -19
  158. package/dist/field/Diff/index.d.ts +3 -2
  159. package/dist/field/Diff/index.d.ts.map +1 -1
  160. package/dist/field/Diff/index.js +2 -2
  161. package/dist/field/Diff/index.js.map +1 -1
  162. package/dist/field/Field.d.ts.map +1 -1
  163. package/dist/field/Field.js +8 -1
  164. package/dist/field/Field.js.map +1 -1
  165. package/dist/field/ViewSelector.d.ts.map +1 -1
  166. package/dist/field/ViewSelector.js +1 -0
  167. package/dist/field/ViewSelector.js.map +1 -1
  168. package/dist/field/bundled.css +1 -1
  169. package/dist/field/index.css +0 -5
  170. package/dist/field/rscEntry.d.ts +2 -2
  171. package/dist/field/rscEntry.d.ts.map +1 -1
  172. package/dist/field/rscEntry.js.map +1 -1
  173. package/dist/index.d.ts +4 -4
  174. package/dist/index.d.ts.map +1 -1
  175. package/dist/index.js +23 -1
  176. package/dist/index.js.map +1 -1
  177. package/dist/lexical/LexicalEditor.css +23 -12
  178. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  179. package/dist/lexical/LexicalEditor.js +61 -64
  180. package/dist/lexical/LexicalEditor.js.map +1 -1
  181. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  182. package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
  183. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  184. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +2 -1
  185. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -1
  186. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  187. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  188. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  189. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  190. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  191. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +1 -0
  192. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  193. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -2
  194. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  195. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  196. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  197. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  198. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  199. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  200. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  201. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  202. package/dist/lexical/theme/EditorTheme.css +35 -25
  203. package/dist/lexical/ui/ContentEditable.css +0 -1
  204. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  205. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  206. package/dist/lexical/ui/ContentEditable.js +32 -11
  207. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  208. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  209. package/dist/lexical/utils/nodeFormat.js +0 -2
  210. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  211. package/dist/lexical/utils/url.d.ts.map +1 -1
  212. package/dist/lexical/utils/url.js +1 -1
  213. package/dist/lexical/utils/url.js.map +1 -1
  214. package/dist/populateGraphQL/populate.js.map +1 -1
  215. package/dist/presets/llmInstructions.d.ts +2 -0
  216. package/dist/presets/llmInstructions.d.ts.map +1 -0
  217. package/dist/presets/llmInstructions.js +13 -0
  218. package/dist/presets/llmInstructions.js.map +1 -0
  219. package/dist/types/builtInNodes.d.ts +1 -1
  220. package/dist/types/builtInNodes.d.ts.map +1 -1
  221. package/dist/types/builtInNodes.js +8 -3
  222. package/dist/types/builtInNodes.js.map +1 -1
  223. package/dist/types/index.d.ts +3 -6
  224. package/dist/types/index.d.ts.map +1 -1
  225. package/dist/types/index.js.map +1 -1
  226. package/dist/types/jsonSchemaHelpers.d.ts +5 -1
  227. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  228. package/dist/types/jsonSchemaHelpers.js +7 -2
  229. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  230. package/dist/types/nodeTypes.d.ts +5 -0
  231. package/dist/types/nodeTypes.d.ts.map +1 -1
  232. package/dist/types/nodeTypes.js.map +1 -1
  233. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  234. package/dist/utilities/buildEditorState.js.map +1 -1
  235. package/dist/utilities/buildInitialState.d.ts +3 -2
  236. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  237. package/dist/utilities/buildInitialState.js +1 -0
  238. package/dist/utilities/buildInitialState.js.map +1 -1
  239. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  240. package/dist/utilities/fieldsDrawer/DrawerContent.js +2 -7
  241. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  242. package/dist/utilities/generateImportMap.d.ts +2 -2
  243. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  244. package/dist/utilities/generateImportMap.js.map +1 -1
  245. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  246. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  247. package/dist/validate/hasText.d.ts +2 -2
  248. package/dist/validate/hasText.d.ts.map +1 -1
  249. package/dist/validate/hasText.js.map +1 -1
  250. package/dist/validate/index.d.ts +1 -1
  251. package/dist/validate/index.d.ts.map +1 -1
  252. package/package.json +44 -47
  253. package/dist/exports/client/Field-QKAL7KMC.js +0 -2
  254. package/dist/exports/client/Field-QKAL7KMC.js.map +0 -7
  255. package/dist/exports/client/bundled.css +0 -1
  256. package/dist/exports/client/chunk-43E5QYAA.js +0 -2
  257. package/dist/exports/client/chunk-43E5QYAA.js.map +0 -7
  258. package/dist/exports/client/chunk-ESITTE3C.js +0 -2
  259. package/dist/exports/client/chunk-ESITTE3C.js.map +0 -7
  260. package/dist/exports/client/chunk-LN6VX25I.js +0 -2
  261. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  262. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts +0 -11
  263. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +0 -1
  264. package/dist/features/blocks/client/component/removeEmptyArrayValues.js +0 -20
  265. package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +0 -1
  266. /package/dist/exports/client/{component-D5QLYS7W.js.map → component-ELXHSW52.js.map} +0 -0
  267. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-HCGJ5ZFN.js.map} +0 -0
@@ -1,26 +1,26 @@
1
- "use client";import{a as xe,c as Ct,d as bt,e as kt}from"./chunk-ESITTE3C.js";import{a as Ye}from"./chunk-DBWINSQN.js";import{a as $o,b as Ze,c as qe,d as Re,e as Qe}from"./chunk-43E5QYAA.js";import{a as fr,b as pr,c as $e}from"./chunk-5VIL27GI.js";import{a as Gc}from"./chunk-WSAPGI3Z.js";import{a as se,b as hr,c as gr,d as Do,e as Oo,f as zc,g as Uc,i as Wc,k as Vc,n as Kc}from"./chunk-LN6VX25I.js";import{a as Hc,b as z}from"./chunk-RJ5MAOKZ.js";function J(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as qc}from"react/compiler-runtime";import{useLexicalComposerContext as Qc}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as Ce}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as eu}from"@lexical/utils";import{$getSelection as tu,$isElementNode as me,$isNodeSelection as ou,$isRangeSelection as _t,COMMAND_PRIORITY_LOW as nu,FORMAT_ELEMENT_COMMAND as Tt}from"lexical";import{useEffect as ru}from"react";import{jsx as xr}from"react/jsx-runtime";import"react";var Xc="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m3 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 15a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Cr=({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:Xc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as br}from"react/jsx-runtime";import"react";var Jc="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",kr=({className:t})=>br("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:br("path",{clipRule:"evenodd",d:Jc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as _r}from"react/jsx-runtime";import"react";var Yc="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})=>_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:Yc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Tr}from"react/jsx-runtime";import"react";var Zc="M19 7.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5m0 4a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 .5-.5m-.5 3.5a.5.5 0 0 1 0 1h-9a.5.5 0 0 1 0-1z",wr=({className:t})=>Tr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{clipRule:"evenodd",d:Zc,fill:"currentColor",fillRule:"evenodd"})});var I=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a})=>{let m=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,props:o,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Er=t=>({type:"dropdown",ChildComponent:zt,iconOnly:!0,items:t,key:"align",order:30});var ve=t=>me(t)?t.getFormatType():t.__format,Sr=[Er([{ChildComponent:zt,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((me(e)||Ce(e))&&ve(e)==="left")continue;let o=e.getParent();if(!((me(o)||Ce(o))&&ve(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"left")},order:1},{ChildComponent:Cr,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((me(e)||Ce(e))&&ve(e)==="center")continue;let o=e.getParent();if(!((me(o)||Ce(o))&&ve(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"center")},order:2},{ChildComponent:wr,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((me(e)||Ce(e))&&ve(e)==="right")continue;let o=e.getParent();if(!((me(o)||Ce(o))&&ve(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"right")},order:3},{ChildComponent:kr,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((me(e)||Ce(e))&&ve(e)==="justify")continue;let o=e.getParent();if(!((me(o)||Ce(o))&&ve(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"justify")},order:4}])],lu=()=>{let t=qc(3),[e]=Qc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Tt,au,nu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ru(o,n),null},iu=I({plugins:[{Component:lu,position:"normal"}],toolbarFixed:{groups:Sr},toolbarInline:{groups:Sr}});function su(t){return(me(t)||Ce(t))&&!t.isInline()}function au(t){let e=tu();if(!_t(e)&&!ou(e))return!1;let o=e.getNodes();for(let n of o){let r=eu(n,su);r!==null&&r.setFormat(t)}return!0}import{QUOTE as du}from"@lexical/markdown";import{$createQuoteNode as vr,$isQuoteNode as yr,QuoteNode as mu}from"@lexical/rich-text";import{$setBlocksType as Ir}from"@lexical/selection";import{$getSelection as Mr,$isRangeSelection as fu}from"lexical";import{jsx as Nr}from"react/jsx-runtime";import"react";var cu="M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",Fo=({className:t})=>Nr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Nr("path",{d:cu,fill:"currentColor"})});import{jsx as Lr}from"react/jsx-runtime";import"react";var uu={16:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-1 0V4H8.5v8h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1V4H4v1a.5.5 0 0 1-1 0z",24:"M6 6.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V9a.5.5 0 0 1-1 0V7h-4.5v10h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2V7H7v2a.5.5 0 0 1-1 0z"},wt=({className:t,size:e=24})=>Lr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Lr("path",{clipRule:"evenodd",d:uu[e],fill:"currentColor",fillRule:"evenodd"})});var te=t=>({type:"dropdown",ChildComponent:wt,items:t,key:"text",order:25});var Rr=[te([{ChildComponent:Fo,isActive:({selection:t})=>{if(!fu(t))return!1;for(let e of t.getNodes())if(!yr(e)&&!yr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Mr();Ir(e,()=>vr())})},order:20}])],pu=I({markdownTransformers:[du],nodes:[mu],slashMenu:{groups:[J([{Icon:Fo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Mr();Ir(e,()=>vr())})}}])]},toolbarFixed:{groups:Rr},toolbarInline:{groups:Rr}});import{getTranslation as qt}from"@payloadcms/translations";import{jsx as Ar}from"react/jsx-runtime";import"react";var hu="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",Po=({className:t})=>Ar("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ar("path",{d:hu,fill:"currentColor"})});import{jsx as $r}from"react/jsx-runtime";import"react";var gu="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Bo=({className:t})=>$r("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:$r("path",{clipRule:"evenodd",d:gu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as xu}from"react/jsx-runtime";import"react";function Dr(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let u=i??"Block Image";return()=>xu("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=Cu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function Cu(t,e){let o=t[e];return o==='"'?Or(t,e):o==="'"?Or(t,e,!0):o==="{"?ku(t,e):o==="["?bu(t,e):Tu(t,e)}function bu(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="["?o++:t[r]==="]"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:jo.parse(`[${n}]`)}}function Or(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function ku(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:_u(n)}}function _u(t){return t[0]!=="{"?jo.parse(t):jo.parse(t.replace(/(\w+):/g,'"$1":'))}function Tu(t,e){let o="",n=e;for(;n<t.length&&t[n]!==" ";)o+=t[n],n++;return{newIndex:n-1,value:o}}function Et({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${wu(n)}"`):typeof n=="number"?e.push(`${o}={${n}}`):typeof n=="boolean"?n&&e.push(`${o}`):n!==null&&typeof n=="object"&&(Array.isArray(n)?e.push(`${o}={[${n.map(r=>JSON.stringify(r,Fr)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Fr)}}`));return e.join(" ")}function wu(t){return t.replace(/"/g,"&quot;")}function Fr(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Wt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",u=e.slice(n),d=!1,c=0,a=0,m=null,f=!1,h=0,p=u[0].slice(0,r.index),x=0,T=n;e:for(let[S,g]of u.entries()){let C=l?g.trim():g,b=0;if(l)for(let _=0;_<g.length&&g[_]===" ";_++)b++;let k=0;for(S===0&&(k=(r.index??0)+r[0].length-b);k<C.length;){let _=C[k],A=C[k+1];if(d){if(_==="`"&&h++,h%2===0)if(_==="<"&&A==="/"){if(c--,c<0){i[i.length-1]===`
2
- `&&(i=i.slice(0,-1)),T=S;for(let L=k;L<C.length;L++)if(C[L]===">"){x=L+1;break}break e}}else if(_==="/"&&A===">"){if(c--,c<0){i[i.length-1]===`
3
- `&&(i=i.slice(0,-1)),T=S,x=k+2;break e}}else _==="<"&&A!=="/"&&c++;i+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&A===">"&&a===0&&!m){f=!0,T=S,x=k+2;break e}else if(_===">"&&a===0&&!m){d=!0,k++;continue}s+=_}k++}if(d?i?.length>0&&S>0&&(i+=`
1
+ "use client";import{a as vr,b as bt,c as xe,e as kt,f as _t,g as Tt}from"./chunk-4JYWPIBB.js";import{a as et}from"./chunk-DBWINSQN.js";import{a as Vo,b as tt,c as ot,d as ye,e as nt}from"./chunk-UH7ALTP6.js";import{a as yr,b as Rr,c as De}from"./chunk-5VIL27GI.js";import{a as fu}from"./chunk-WSAPGI3Z.js";import{a as se,b as Ir,c as Mr,d as Ko,e as Jo,f as pu,g as hu,i as gu,k as xu,n as Cu}from"./chunk-3LRZDIIG.js";import{a as mu,b as U}from"./chunk-RJ5MAOKZ.js";function q(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Eu}from"react/compiler-runtime";import{useLexicalComposerContext as wu}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as Ce}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Su}from"@lexical/utils";import{$getSelection as Nu,$isElementNode as fe,$isNodeSelection as Lu,$isRangeSelection as Et,COMMAND_PRIORITY_LOW as yu,FORMAT_ELEMENT_COMMAND as wt}from"lexical";import{useEffect as Ru}from"react";import{jsx as Ar}from"react/jsx-runtime";import"react";var bu="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",Dr=({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:bu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as $r}from"react/jsx-runtime";import"react";var ku="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",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:ku,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Fr}from"react/jsx-runtime";import"react";var _u="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.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",Vt=({className:t})=>Fr("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:Fr("path",{clipRule:"evenodd",d:_u,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Pr}from"react/jsx-runtime";import"react";var Tu="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",Br=({className:t})=>Pr("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:Pr("path",{clipRule:"evenodd",d:Tu,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:c,resolvedFeatures:u,schemaPath:d,unSanitizedEditorConfig:a})=>{let f=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:c,props:o,resolvedFeatures:u,schemaPath:d,unSanitizedEditorConfig:a});return f.sanitizedClientFeatureProps===null&&(f.sanitizedClientFeatureProps=o),f};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var jr=t=>({type:"dropdown",ChildComponent:Vt,iconOnly:!0,items:t,key:"align",order:30});var Re=t=>fe(t)?t.getFormatType():t.__format,Hr=[jr([{ChildComponent:Vt,isActive:({selection:t})=>{if(!Et(t))return!1;for(let e of t.getNodes()){if((fe(e)||Ce(e))&&Re(e)==="left")continue;let o=e.getParent();if(!((fe(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(wt,"left")},order:1},{ChildComponent:Dr,isActive:({selection:t})=>{if(!Et(t))return!1;for(let e of t.getNodes()){if((fe(e)||Ce(e))&&Re(e)==="center")continue;let o=e.getParent();if(!((fe(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(wt,"center")},order:2},{ChildComponent:Br,isActive:({selection:t})=>{if(!Et(t))return!1;for(let e of t.getNodes()){if((fe(e)||Ce(e))&&Re(e)==="right")continue;let o=e.getParent();if(!((fe(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(wt,"right")},order:3},{ChildComponent:Or,isActive:({selection:t})=>{if(!Et(t))return!1;for(let e of t.getNodes()){if((fe(e)||Ce(e))&&Re(e)==="justify")continue;let o=e.getParent();if(!((fe(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(wt,"justify")},order:4}])],vu=()=>{let t=Eu(3),[e]=wu(),o,n;return t[0]!==e?(o=()=>e.registerCommand(wt,Au,yu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Ru(o,n),null},Iu=A({plugins:[{Component:vu,position:"normal"}],toolbarFixed:{groups:Hr},toolbarInline:{groups:Hr}});function Mu(t){return(fe(t)||Ce(t))&&!t.isInline()}function Au(t){let e=Nu();if(!Et(e)&&!Lu(e))return!1;let o=e.getNodes();for(let n of o){let r=Su(n,Mu);r!==null&&r.setFormat(t)}return!0}import{QUOTE as Ou}from"@lexical/markdown";import{$createQuoteNode as Vr,$isQuoteNode as Ur,QuoteNode as Fu}from"@lexical/rich-text";import{$setBlocksType as Kr}from"@lexical/selection";import{$getSelection as Jr,$isRangeSelection as Pu}from"lexical";import{jsx as zr}from"react/jsx-runtime";import"react";var Du="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",Xo=({className:t})=>zr("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:zr("path",{d:Du,fill:"currentColor"})});import{jsx as Gr}from"react/jsx-runtime";import"react";var $u={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"},St=({className:t,size:e=24})=>Gr("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:Gr("path",{clipRule:"evenodd",d:$u[e],fill:"currentColor",fillRule:"evenodd"})});var oe=t=>({type:"dropdown",ChildComponent:St,items:t,key:"text",order:25});var Wr=[oe([{ChildComponent:Xo,isActive:({selection:t})=>{if(!Pu(t))return!1;for(let e of t.getNodes())if(!Ur(e)&&!Ur(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Jr();Kr(e,()=>Vr())})},order:20}])],Bu=A({markdownTransformers:[Ou],nodes:[Fu],slashMenu:{groups:[q([{Icon:Xo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Jr();Kr(e,()=>Vr())})}}])]},toolbarFixed:{groups:Wr},toolbarInline:{groups:Wr}});import{getTranslation as oo}from"@payloadcms/translations";import{jsx as Xr}from"react/jsx-runtime";import"react";var ju="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",Yo=({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",{d:ju,fill:"currentColor"})});import{jsx as Yr}from"react/jsx-runtime";import"react";var Hu="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Zo=({className:t})=>Yr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Yr("path",{clipRule:"evenodd",d:Hu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as zu}from"react/jsx-runtime";import"react";function Zr(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 c=i??"Block Image";return()=>zu("img",{alt:c,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Cl}from"lexical";import{JSOX as qo}from"jsox";function Kt({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==='"'?qr(t,e):o==="'"?qr(t,e,!0):o==="{"?Wu(t,e):o==="["?Uu(t,e):Ku(t,e)}function Uu(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:qo.parse(`[${n}]`)}}function qr(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 Wu(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:Vu(n)}}function Vu(t){return t[0]!=="{"?qo.parse(t):qo.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 Nt({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${Ju(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,Qr)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Qr)}}`));return e.join(" ")}function Ju(t){return t.replace(/"/g,"&quot;")}function Qr(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Jt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",c=e.slice(n),u=!1,d=0,a=0,f=null,m=!1,p=0,h=c[0].slice(0,r.index),g=0,C=n;e:for(let[L,x]of c.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(L===0&&(_=(r.index??0)+r[0].length-k);_<b.length;){let T=b[_],I=b[_+1];if(u){if(T==="`"&&p++,p%2===0)if(T==="<"&&I==="/"){if(d--,d<0){i[i.length-1]===`
2
+ `&&(i=i.slice(0,-1)),C=L;for(let N=_;N<b.length;N++)if(b[N]===">"){g=N+1;break}break e}}else if(T==="/"&&I===">"){if(d--,d<0){i[i.length-1]===`
3
+ `&&(i=i.slice(0,-1)),C=L,g=_+2;break e}}else T==="<"&&I!=="/"&&d++;i+=T}else{if(T==="{"&&!f?a++:T==="}"&&!f?a--:(T==='"'||T==="'")&&!f?f=T:T===f&&(f=null),T==="/"&&I===">"&&a===0&&!f){m=!0,C=L,g=_+2;break e}else if(T===">"&&a===0&&!f){u=!0,_++;continue}s+=T}_++}if(u?i?.length>0&&L>0&&(i+=`
4
4
  `):s+=`
5
- `,o&&c<0){let _=C.match(o);if(_?.index!==void 0){T=S,x=_.index+_[0].length-1;break}}if(S===u.length-1&&!t&&!f)throw new Error("End match not found for lines "+e.join(`
5
+ `,o&&d<0){let T=b.match(o);if(T?.index!==void 0){C=L,g=T.index+T[0].length-1;break}}if(L===c.length-1&&!t&&!m)throw new Error("End match not found for lines "+e.join(`
6
6
  `)+`
7
7
 
8
- . Start match: `+JSON.stringify(r))}return{afterEndLine:u[T].trim().slice(x),beforeStartLine:p,content:i,endLineIndex:n+T,endlineLastCharIndex:x,propsString:s}}import{jsx as ld}from"react/jsx-runtime";import id from"bson-objectid";import{$applyNodeReplacement as sd}from"lexical";import"react";import{DecoratorBlockNode as Eu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Su}from"@lexical/utils";import Nu from"bson-objectid";import{$applyNodeReplacement as Lu}from"lexical";var St=class extends Eu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=yu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Su(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function yu(t){return Lu(new St({fields:{...t,id:t?.id||new Nu.default().toHexString()}}))}import{jsx as U,jsxs as Nt}from"react/jsx-runtime";import{useLexicalComposerContext as Ou}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Fu}from"@lexical/react/useLexicalEditable";import{getTranslation as Pu}from"@payloadcms/translations";import{Button as Hr,Collapsible as Bu,Drawer as ju,EditDepthProvider as Hu,ErrorPill as Gu,Form as zu,formatDrawerSlug as Uu,MoreIcon as Wu,Pill as Vu,Popup as Ku,PopupList as Ho,RenderFields as Xu,SectionTitle as Ju,useConfig as Yu,useDocumentForm as Zu,useDocumentInfo as Gr,useEditDepth as qu,useFormSubmitted as Qu,useServerFunctions as ed,useTranslation as td,XIcon as od}from"@payloadcms/ui";import{abortAndIgnore as Go}from"@payloadcms/ui/shared";import{$getNodeByKey as Kt,$getRoot as nd,SKIP_DOM_SELECTION_TAG as zo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as Xt,reduceFieldsToValues as zr}from"payload/shared";import De,{useCallback as Uo,useEffect as Jt,useMemo as Oe,useRef as Wo}from"react";import{v4 as rd}from"uuid";import{c as Ru}from"react/compiler-runtime";import{jsx as Vt,jsxs as vu}from"react/jsx-runtime";import{useLexicalEditable as Iu}from"@lexical/react/useLexicalEditable";import{RenderFields as Mu,useFormSubmitted as Au}from"@payloadcms/ui";import $u,{createContext as Du}from"react";var Pr=Du({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>$u.use(Pr),Br=t=>{let e=Ru(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:u}=l,c=Au()&&i>0,a=Iu(),m;e[0]!==o||e[1]!==i||e[2]!==c?(m=p=>{let{children:x,...T}=p;return Vt(o,{errorCount:i,fieldHasErrors:c,...T,children:x})},e[0]=o,e[1]=i,e[2]=c,e[3]=m):m=e[3];let f=m,h={...l,BlockCollapsible:f};return n?vu(Pr,{value:h,children:[n,Vt(s,{})]}):Vt(f,{children:Vt(Mu,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function jr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Ur=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=Qu(),{id:u,collectionSlug:d,globalSlug:c}=Gr(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:f,schemaPath:h},uuid:p}=z(),{fields:x}=Zu(),T=Wo(new AbortController),N=qu(),[S,g]=De.useState(0),{config:C}=Yu(),b=Uu({slug:`lexical-blocks-create-${p}-${l.id}`,depth:N}),{toggleDrawer:k}=$e(b),{getDocPreferences:_,setDocFieldPreferences:A}=Gr(),[L]=Ou(),E=Fu(),R=l.blockType,{getFormState:w}=ed(),y=`${h}.lexical_internal_feature.blocks.lexical_blocks.${R}.fields`,[v,$]=De.useState(()=>{let P=f?.[l.id]?.formState;if(!P)return!1;let q=Object.fromEntries(Object.entries(P).map(([G,W])=>[G,G in l?{...W,initialValue:l[G],value:l[G]}:W]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),M=Wo(!1),D=Wo(e);Jt(()=>{M.current?(D.current!==e&&$(!1),D.current=e):M.current=!0},[e]);let[H]=De.useState(()=>rd()),[F,Z]=De.useState(()=>{if(!r)return v?._components?.customComponents?.BlockLabel??void 0}),[X,Ve]=De.useState(()=>{if(!n)return v?._components?.customComponents?.Block??void 0}),ye=Oe(()=>n?U(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):X,[n,o,l,s,X]),he=Oe(()=>r?U(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):F,[r,o,l,s,F]);Jt(()=>{let P=new AbortController;return l&&!v&&(async()=>{let{state:G}=await w({id:u,collectionSlug:d,data:l,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:Xt(x,{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 W=zr(Xt(G,{excludeFiles:!0}),!0);L.update(()=>{let V=Kt(s);if(V&&Ie(V)){let ie=W;ie.blockType=R,V.setFields(ie,!0)}},{tag:zo}),$(G),r||Z(G._components?.customComponents?.BlockLabel??void 0),n||Ve(G._components?.customComponents?.Block??void 0)}})(),()=>{Go(P)}},[w,y,E,u,r,n,l,L,s,v,d,c,_,x,R]);let[le,ge]=De.useState(f?.[l.id]?.collapsed??!1),Ht=`${h}.lexical_internal_feature.blocks.lexical_blocks.${R}`,ht=a.blocks?.[Ht]?.[0]?.blocks?.[0],ee=typeof ht=="string"?C.blocksMap[ht]:ht,{i18n:gt,t:de}=td(),Io=Uo(async({formState:P,submit:q})=>{Go(T.current);let G=new AbortController;T.current=G;let{state:W}=await w({id:u,collectionSlug:d,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:Xt(x,{excludeFiles:!0}),formState:P,globalSlug:c,initialBlockFormState:P,operation:"update",readOnly:!E,renderAllFields:!!q,schemaPath:y,signal:G.signal});if(!W)return P;P.blockName&&(W.blockName=P.blockName);let V=zr(jr({fields:Xt(W,{excludeFiles:!0})}),!0);if(setTimeout(()=>{L.update(()=>{let ie=Kt(s);if(ie&&Ie(ie)){let Je=V;Je.blockType=R,ie.setFields(Je,!0)}},{tag:zo})},0),q){r||Z(W._components?.customComponents?.BlockLabel??void 0),n||Ve(W._components?.customComponents?.Block??void 0);let ie=0;for(let Je of Object.values(W))Je?.valid===!1&&ie++;g(ie)}return W},[w,u,d,_,c,y,R,x,E,L,s,n,r]);Jt(()=>()=>{Go(T.current)},[]);let Gt=Uo(()=>{L.update(()=>{Kt(s)?.remove()})},[L,s]),[nr,Oc]=De.useState(0);Jt(()=>{let P=()=>{L.getEditorState().read(()=>{let G=nd().getChildren(),W=0;for(let V of G)if(Ie(V)){if(V.getKey()===s){Oc(W);return}W++}})};return P(),L.registerUpdateListener(()=>{P()})},[L,s]);let Xe=ee?.labels?.singular?Pu(ee.labels.singular,gt):ee?.slug,rr=Uo(P=>{_().then(q=>{let W=q?.fields?.[m.name]?.collapsed,V=W&&W?.length?W:[];P?V.includes(l.id)||V.push(l.id):V.includes(l.id)&&V.splice(V.indexOf(l.id),1),A(m.name,{collapsed:V,hello:"hi"})})},[_,m.name,A,l.id]),lr=Oe(()=>()=>U(Hr,{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:Xe})}),[o,E,de,Xe,k]),ir=Oe(()=>()=>U(Hr,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!E,icon:"x",onClick:P=>{P.preventDefault(),Gt()},round:!0,tooltip:"Remove Block"}),[o,E,Gt]),Mo=Oe(()=>({Actions:P,children:q,className:G,collapsibleProps:W,disableBlockName:V,editButton:ie,errorCount:Je,fieldHasErrors:Ao,Label:dr,Pill:mr,removeButton:Pc,showDragHandle:Bc=!0,showRowNumber:jc=!0})=>U("div",{className:`${o}__container ${o}-${R}`,children:U(Bu,{actions:typeof P<"u"?P:E?U(Ku,{button:U(Wu,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",render:({close:xt})=>Nt(Ho.ButtonGroup,{buttonSize:"medium",children:[(ye&&ie!==!1||!ye&&ie)&&U(Ho.Button,{onClick:()=>{k(),xt()},children:de("general:edit")}),Pc!==!1&&Nt(Ho.Button,{onClick:()=>{Gt(),xt()},children:[U(od,{}),de("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Ao?`${o}__row--has-errors`:`${o}__row--no-errors`,G].filter(Boolean).join(" "),collapsibleStyle:Ao?"error":"default",dragHandleProps:Bc?{id:s,attributes:{role:"button",tabIndex:0},listeners:{}}:void 0,header:U("div",{className:`${o}__block-header`,children:typeof dr<"u"?dr:typeof he<"u"?he:Nt("div",{className:`${o}__block-label`,children:[jc&&U("span",{className:`${o}__block-number`,children:String(nr+1).padStart(2,"0")}),typeof mr<"u"?mr:U(Vu,{className:`${o}__block-pill ${o}__block-pill-${R}`,pillStyle:"white",size:"small",children:Xe??R}),!V&&!ee?.admin?.disableBlockName&&U(Ju,{path:"blockName",readOnly:!E}),Ao&&U(Gu,{count:Je??0,i18n:gt,withMessage:!0})]})}),isCollapsed:le,onToggle:xt=>{rr(xt),ge(xt)},...W||{},children:q},0)}),[ye,he,Xe,o,ee?.admin?.disableBlockName,R,gt,le,rr,E,s,Gt,nr,de,k]),sr=l?.id,{headerActions:ar,submitRef:cr}=fr(),ur=Oe(()=>()=>U(Hu,{children:U(ju,{className:"",headerActions:ar,slug:b,title:de(`lexical:blocks:inlineBlocks:${sr?"edit":"create"}`,{label:Xe??de("lexical:blocks:inlineBlocks:label")}),children:v?Nt("div",{className:"fields-drawer",children:[U(Xu,{fields:ee?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:y,permissions:!0,readOnly:!E}),U(pr,{submitRef:cr})]}):null})}),[v,b,sr,Xe,de,E,ee?.fields,y,ar,cr]),Fc=Oe(()=>v?U("div",{"data-block-drawer-slug":b,style:{display:"contents"},children:U(zu,{beforeSubmit:[async({formState:P})=>await Io({formState:P,submit:!0})],el:"div",fields:ee?.fields??[],initialState:v,onChange:[Io],onSubmit:(P,q)=>{q.blockType=R,L.update(()=>{let G=Kt(s);G&&Ie(G)&&G.setFields(q,!0)},{tag:zo}),k()},submitted:i,uuid:H,children:U(Br,{baseClass:o,BlockDrawer:ur,Collapsible:Mo,CustomBlock:ye,CustomLabel:he,EditButton:lr,errorCount:S,formSchema:ee?.fields??[],initialState:v,nodeKey:s,RemoveButton:ir})})}):null,[Mo,ur,ye,he,R,b,ir,lr,o,L,S,k,ee?.fields,H,v,s,Io,i]);return ee?Fc:U(Mo,{disableBlockName:!0,fieldHasErrors:!0,children:Nt("div",{className:`${o}-not-found`,children:["Error: Block '",R,"' not found in the config but exists in the lexical data"]})})};var ce=class extends St{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Fe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return ld(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 Fe(t){return sd(new ce({fields:{...t,id:t?.id||new id.default().toHexString()}}))}function Ie(t){return t instanceof ce}import{createHeadlessEditor as ad}from"@lexical/headless";import{$convertToMarkdownString as cd}from"@lexical/markdown";function Vo(t,e){return({editorState:n})=>{let r=ad({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=cd(e)}),l}}import{createHeadlessEditor as bd}from"@lexical/headless";import{$convertFromMarkdownString as qr,TRANSFORMERS as Cd}from"@lexical/markdown";var Wr=/^[\t ]*$/,ud=/^(\s*)(\d+)\.\s/,dd=/^(\s*)[-*+]\s/,md=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,Vr=/^(#{1,6})\s/,fd=/^>\s/,pd=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,Kr=/[ \t]*(\\`\\`\\`|```)$/,hd=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,gd=/^\|(.+)\|\s?$/,xd=/^(\| ?:?-*:? ?)+\|\s?$/,Xr=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Jr=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function Yr(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];let e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function 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?Yr(i):null,c=u!==void 0&&Yr(u)!==null;if(hd.test(i)){r.push(i);continue}if(Kr.test(i)){l===0&&(n=!0),l===1&&(n=!1),l>0&&l--,r.push(i);continue}if(pd.test(i)){n=!0,l++,r.push(i);continue}if(n){r.push(i);continue}Wr.test(i)||Wr.test(u)||!u||Vr.test(u)||Vr.test(i)||fd.test(i)||ud.test(i)||dd.test(i)||md.test(i)||gd.test(i)||xd.test(i)||c||!e||Xr.test(i)||Jr.test(i)||Xr.test(u)||Jr.test(u)||Kr.test(u)?r.push(i):r[r.length-1]=u+" "+(d===null?i.trim():i.trimStart())}return r.join(`
10
- `)}function Yt(t,e=Cd,o,n=!1,r=!1){if(n)return qr(t,e,o,!0);let l=Zr(t,r);return qr(l,e,o,!1,!1)}function Zt(t,e){return({markdown:n})=>{let r=bd({nodes:t});return r.update(()=>{Yt(n,e,void 0,!1,!0)},{discrete:!0}),r.getEditorState().toJSON()}}function kd(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var tl=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=el(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=el(n,!0);r&&(o=o.concat(r))}return o};function el(t,e){if(!t.jsx)return null;let o=kd(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[Ct],export:s=>{if(!kt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=Vo(r,l),d=t.jsx.export({fields:i,lexicalToMarkdown:u});if(d===!1)return null;if(typeof d=="string")return d;let c=d.props&&Object.keys(d.props)?.length>0,a=d.props??{};return d?.children?.length?`<${i.blockType}${c?" "+Et({props:a}):""}>${d.children}</${i.blockType}>`:`<${i.blockType}${c?" "+Et({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:u}=Wt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return u},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:u,propsString:d}=Wt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let c=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=bt({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[ce],export:s=>{if(!Ie(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=Vo(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
- `))for(let h of m.split(`
12
- `)){let p="";!t?.jsx?.doNotTrimChildren&&h!==""&&(p=" "),p+=h+`
13
- `,f+=p}else f=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
- `;return`<${i.blockType}${c?" "+Et({props:a}):""}>
15
- ${f}</${i.blockType}>`}return`<${i.blockType}${c?" "+Et({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:u,startMatch:d,transformer:c})=>{let a=typeof c.regExpEnd=="object"&&"regExp"in c.regExpEnd?c.regExpEnd.regExp:c.regExpEnd,m=c.regExpEnd&&typeof c.regExpEnd=="object"&&"optional"in c.regExpEnd?c.regExpEnd.optional:!c.regExpEnd,{afterEndLine:f,beforeStartLine:h,content:p,endLineIndex:x,propsString:T}=Wt({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:u,startMatch:d,trimChildren:!1}),N="";if(t?.jsx?.doNotTrimChildren)N=p.endsWith(`
16
- `)?p.slice(0,-1):p;else if(p.includes(`
17
- `)){let b=p.split(`
18
- `),k=0;for(let _ of b){if(k++,_.startsWith(" "))N+=_.slice(2);else if(_==="")N+=_;else{N=p.endsWith(`
19
- `)?p.slice(0,-1):p;break}N+=k===b.length?"":`
20
- `}}else N=(p.startsWith(" ")?p.slice(2):p)+`
21
- `;if(!t?.jsx?.import)return[!1,u];let S=Zt(r,l),g=t.jsx.import({children:N,closeMatch:null,htmlToLexical:null,markdownToLexical:S,openMatch:d,props:T?Ut({propsString:T}):{}});if(g===!1)return[!1,u];let C=Fe({...g,blockType:t.slug});if(C){let b=null,k=null;if(h?.length){b=S({markdown:h})?.root?.children??[];let _=b?.[0];_&&i.append(Qr(_))}if(i.append(C),f?.length){k=S({markdown:f})?.root?.children;let _=i.getChildren()[i.getChildren().length-1],A=Qr(k[0])?.getChildren();if(A?.length)for(let L of A)_.append(L)}}return[!0,x]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,u,d,c)=>{if(t?.jsx?.import){if(!c){let x="";if(i)for(let T of i)x+=T.getTextContent();c=[x]}let a="";t?.jsx?.doNotTrimChildren?a=c.join(`
22
- `):a=c.join(`
23
- `).trim();let m=u[1]?.trim(),f=Zt(r,l),h=t.jsx.import({children:a,closeMatch:d,htmlToLexical:null,markdownToLexical:f,openMatch:u,props:m?Ut({propsString:m}):{}});if(h===!1)return!1;let p=Fe({...h,blockType:t.slug});p&&s.append(p);return}return!1}})),n)}import{createCommand as ol}from"lexical";var et=ol("INSERT_BLOCK_COMMAND"),tt=ol("INSERT_INLINE_BLOCK_COMMAND");import{c as _d}from"react/compiler-runtime";import{useLexicalComposerContext as Td}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as wd,$wrapNodeInElement as Ed,mergeRegister as Sd}from"@lexical/utils";import{formatDrawerSlug as Nd,useEditDepth as Ld}from"@payloadcms/ui";import{$createParagraphNode as yd,$getNodeByKey as Rd,$getPreviousSelection as vd,$getSelection as Id,$insertNodes as Md,$isParagraphNode as Ad,$isRangeSelection as $d,$isRootOrShadowRoot as Dd,COMMAND_PRIORITY_EDITOR as nl}from"lexical";import{useEffect as Od,useState as Fd}from"react";var rl=()=>{let t=_d(12),[e]=Td(),[o,n]=Fd(null),{setCreatedInlineBlock:r,uuid:l}=z(),s=Ld(),i="lexical-inlineBlocks-create-"+l,u;t[0]!==s||t[1]!==i?(u=Nd({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=u):u=t[2];let d=u,{toggleDrawer:c}=$e(d,!0),a;t[3]!==e||t[4]!==r||t[5]!==o?(a=()=>{if(!e.hasNodes([ce]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Sd(e.registerCommand(et,f=>(e.update(()=>{let h=Id()||vd();if($d(h)){let p=Fe(f),{focus:x}=h,T=x.getNode();wd(p),Ad(T)&&!T.__first&&T.remove()}}),!0),nl),e.registerCommand(tt,f=>{if(o){let p=Rd(o);return!p||!kt(p)?!1:(p.setFields(f),n(null),!0)}let h=bt(f);return r?.(h),Md([h]),Dd(h.getParentOrThrow())&&Ed(h,yd).selectEnd(),!0},nl))},t[3]=e,t[4]=r,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==r||t[9]!==o||t[10]!==c?(m=[e,r,o,c],t[7]=e,t[8]=r,t[9]=o,t[10]=c,t[11]=m):m=t[11],Od(a,m),null};var Pd=I(({config:t,featureClientSchemaMap:e,props:o,schemaPath:n})=>{let r=`${n}.lexical_internal_feature.blocks.lexical_blocks`,l=`${n}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(r+".")&&!a.replace(r+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),d=i.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0),c=u.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0);return{markdownTransformers:tl({blocks:d,inlineBlocks:c}),nodes:[ce,Ct],plugins:[{Component:rl,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[d?.length?{items:d.map(a=>({Icon:Dr(a,Po),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?qt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(et,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,c?.length?{items:c.map(a=>({Icon:Bo,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?qt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(tt,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[d.length?{type:"dropdown",ChildComponent:Po,items:d.map((a,m)=>({isActive:void 0,key:"block-"+a.slug,label:({i18n:f})=>a?.labels?.singular?qt(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(et,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,c?.length?{type:"dropdown",ChildComponent:Bo,items:c.map((a,m)=>({isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:f})=>a?.labels?.singular?qt(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(tt,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Hd}from"react/compiler-runtime";import{jsx as Be,jsxs as Yo}from"react/jsx-runtime";import{useLexicalComposerContext as Gd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as zd,$createTextNode as Ud,$getRoot as Wd,getDOMSelection as Ko}from"lexical";import*as cl from"react";import{useCallback as Pe,useEffect as Xo,useLayoutEffect as il,useRef as Jo,useState as Qt}from"react";var Bd=se&&"documentMode"in document?document.documentMode:null,ll=se&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),l7=se&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),i7=se&&"InputEvent"in window&&!Bd?"getTargetRanges"in new window.InputEvent("input"):!1,s7=se&&/Version\/[\d.].*Safari/.test(navigator.userAgent),a7=se&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,c7=se&&/Android/.test(navigator.userAgent),u7=se&&/Win/.test(navigator.platform),jd=se&&/^(?=.*Chrome).*/i.test(navigator.userAgent),d7=se&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!jd;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)},Kd=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},Xd=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
8
+ . Start match: `+JSON.stringify(r))}return{afterEndLine:c[C].trim().slice(g),beforeStartLine:h,content:i,endLineIndex:n+C,endlineLastCharIndex:g,propsString:s}}import{jsx as Pd}from"react/jsx-runtime";import Bd from"bson-objectid";import{$applyNodeReplacement as jd}from"lexical";import"react";import{DecoratorBlockNode as Xu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Yu}from"@lexical/utils";import Zu from"bson-objectid";import{$applyNodeReplacement as qu}from"lexical";var Lt=class extends Xu{__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){let o=Qu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Yu(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()}}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 Qu(t){return qu(new Lt({fields:{...t,id:t?.id||new Zu.default().toHexString()}}))}import{c as fd}from"react/compiler-runtime";import{jsx as G,jsxs as ve,Fragment as pd}from"react/jsx-runtime";import{useLexicalComposerContext as hd}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as gd}from"@lexical/react/useLexicalEditable";import{getTranslation as xd}from"@payloadcms/translations";import{Button as ll,Collapsible as Cd,Drawer as bd,EditDepthProvider as kd,ErrorPill as _d,Form as Td,formatDrawerSlug as Ed,MoreIcon as wd,Pill as Sd,Popup as Nd,PopupList as yt,RenderFields as Ld,SectionTitle as yd,useConfig as Rd,useDocumentForm as vd,useDocumentInfo as il,useEditDepth as Id,useFormSubmitted as Md,useServerFunctions as Ad,useTranslation as al,XIcon as Dd}from"@payloadcms/ui";import{abortAndIgnore as tn}from"@payloadcms/ui/shared";import{$getNodeByKey as Zt,$getRoot as $d,SKIP_DOM_SELECTION_TAG as on}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as sl}from"payload/shared";import $e,{useCallback as nn,useEffect as qt,useMemo as Oe,useRef as Qt}from"react";import{v4 as Od}from"uuid";import{c as ed}from"react/compiler-runtime";import{jsx as Xt,jsxs as td}from"react/jsx-runtime";import{useLexicalEditable as od}from"@lexical/react/useLexicalEditable";import{RenderFields as nd,useFormSubmitted as rd}from"@payloadcms/ui";import ld,{createContext as id}from"react";var el=id({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>ld.use(el),tl=t=>{let e=ed(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:c}=l,d=rd()&&i>0,a=od(),f;e[0]!==o||e[1]!==i||e[2]!==d?(f=h=>{let{children:g,...C}=h;return Xt(o,{errorCount:i,fieldHasErrors:d,...C,children:g})},e[0]=o,e[1]=i,e[2]=d,e[3]=f):f=e[3];let m=f,p={...l,BlockCollapsible:m};return n?td(el,{value:p,children:[n,Xt(s,{})]}):Xt(m,{children:Xt(nd,{fields:c,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};import{useId as md}from"react";import{$getNodeByKey as Yt,COMMAND_PRIORITY_HIGH as sd,KEY_DOWN_COMMAND as ad,SKIP_DOM_SELECTION_TAG as cd}from"lexical";import{useCallback as Qo,useEffect as ol,useLayoutEffect as ud,useRef as en,useState as dd}from"react";function nl({editor:t,nodeKey:e}){let[o,n]=dd(null),r=en(null),l=en(!1),s=en(!1),i=o!==null;ol(()=>t.registerCommand(ad,a=>{let f=a?.target;return f instanceof HTMLElement&&!!t.getElementByKey(e)?.contains(f)&&!!f.closest(".collapsible__actions button")},sd),[t,e]),ol(()=>{if(!i)return;let a,f=()=>{l.current=!0},m=()=>{l.current=!1,s.current&&(a=setTimeout(()=>{r.current=null,n(null)},0))};return document.addEventListener("pointerdown",f,!0),document.addEventListener("pointerup",m,!0),document.addEventListener("pointercancel",m,!0),()=>{document.removeEventListener("pointerdown",f,!0),document.removeEventListener("pointerup",m,!0),document.removeEventListener("pointercancel",m,!0),clearTimeout(a),l.current=!1,s.current=!1}},[i]),ud(()=>{if(o===null)return;let a=[];return t.getEditorState().read(()=>{let f=Yt(e),m=f?.getParent()?.getChildren(),p=f?.getIndexWithinParent();if(!m||p===void 0||p===o)return;let h=m.map(I=>t.getElementByKey(I.getKey())),g=h[p],C=h[o],E=h[p+(o>p?1:-1)];if(!g||!C||!E)return;let L=g.getBoundingClientRect(),x=C.getBoundingClientRect(),b=E.getBoundingClientRect(),k=o>p,_=k?x.bottom-L.bottom:x.top-L.top,T=k?L.top-b.top:L.bottom-b.bottom;for(let I=Math.min(p,o);I<=Math.max(p,o);I++){let N=h[I];if(N){let w=N.style.translate;a.push(()=>{N.style.translate=w}),N.style.translate=`0 ${I===p?_:T}px`}}g.querySelector(".collapsible__drag")?.scrollIntoView({block:"nearest"})}),()=>a.forEach(f=>f())},[t,e,o]);let c=Qo(({direction:a,index:f})=>{t.isEditable()&&t.update(()=>{let m=Yt(e),p=m?.getParent()?.getChildren();if(!m||!p)return;let h=m.getIndexWithinParent(),g=f??h+(a??0),C=p[g];C&&C!==m&&(g<h?C.insertBefore(m):C.insertAfter(m))},{onUpdate:()=>{requestAnimationFrame(()=>{let m=t.getElementByKey(e)?.querySelector(".collapsible__toggle-wrap");(m?.querySelector(".collapsible__drag")??m?.querySelector(".LexicalEditorTheme__block__actions-button"))?.focus()})},tag:cd})},[t,e]),u=Qo(a=>{t.isEditable()&&(a.key===" "||a.key==="Enter"?(a.preventDefault(),a.stopPropagation(),r.current===null?(t.getEditorState().read(()=>{r.current=Yt(e)?.getIndexWithinParent()??null}),n(r.current)):(c({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 f=Yt(e)?.getParent()?.getChildrenSize()??0;r.current=Math.max(0,Math.min(f-1,(r.current??0)+(a.key==="ArrowDown"?1:-1)))}),n(r.current))))},[t,c,e]),d=Qo(()=>{if(l.current){s.current=!0;return}r.current=null,n(null)},[]);return{isReordering:i,move:c,onBlur:d,onKeyDown:u,targetIndex:o}}function rl({children:t,editor:e,nodeKey:o}){let n=nl({editor:e,nodeKey:o}),r=md();return t({...n,reorderInstructionsID:r})}var cl=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=Md(),{id:c,collectionSlug:u,globalSlug:d}=il(),{fieldProps:{featureClientSchemaMap:a,field:f,initialLexicalFormState:m,schemaPath:p},uuid:h}=U(),{fields:g}=vd(),C=Qt(new AbortController),E=Id(),[L,x]=$e.useState(0),{config:b}=Rd(),k=Ed({slug:`lexical-blocks-create-${h}-${l.id}`,depth:E}),{toggleDrawer:_}=De(k),{getDocPreferences:T,setDocFieldPreferences:I}=il(),[N]=hd(),w=gd(),y=l.blockType,S=Qt(l);S.current=l;let R=`${p}.lexical_internal_feature.blocks.lexical_blocks.${y}`,F=a.blocks?.[R]?.[0]?.blocks?.[0],M=typeof F=="string"?b.blocksMap[F]:F,{getFormState:B}=Ad(),$=`${p}.lexical_internal_feature.blocks.lexical_blocks.${y}.fields`,[P,V]=$e.useState(()=>{let H=m?.[l.id],Z=H?.formState;if(!Z)return!1;let K=vr({cachedFormState:Z,cachedSchemaPath:H.schemaPath,currentSchemaPath:$,formData:l});return K?{...K,blockName:{initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName}}:!1}),Xe=Qt(!1),xt=Qt(e);qt(()=>{Xe.current?(xt.current!==e&&V(!1),xt.current=e):Xe.current=!0},[e]);let[Ye]=$e.useState(()=>Od()),[ie,me]=$e.useState(()=>{if(!r)return P?._components?.customComponents?.BlockLabel??void 0}),[Ct,Gt]=$e.useState(()=>{if(!n)return P?._components?.customComponents?.Block??void 0}),ce=Oe(()=>n?G(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):Ct,[n,o,l,s,Ct]),Ae=Oe(()=>r?G(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):ie,[r,o,l,s,ie]);qt(()=>{let H=new AbortController;return M&&l&&!P&&(async()=>{let{state:K}=await B({id:c,collectionSlug:u,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:g,globalSlug:d,initialBlockData:l,operation:"update",readOnly:!w,renderAllFields:!0,schemaPath:$,signal:H.signal});if(K){K.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let ee=bt(sl(K,{excludeFiles:!0}));N.update(()=>{let W=Zt(s);if(W&&Ie(W)){let qe=ee;qe.blockType=y,W.setFields(qe,!0)}},{tag:on}),V(K),r||me(K._components?.customComponents?.BlockLabel??void 0),n||Gt(K._components?.customComponents?.Block??void 0)}})(),()=>{tn(H)}},[B,$,w,c,r,n,l,N,s,P,u,d,T,g,y,M]);let[Ut,Bo]=$e.useState(m?.[l.id]?.collapsed??!1),{i18n:jo,t:Y}=al(),Ho=nn(async({formState:H,submit:Z})=>{tn(C.current);let K=new AbortController;C.current=K;let ee=bt(H,S.current),{state:W}=await B({id:c,collectionSlug:u,data:ee,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:g,formState:H,globalSlug:d,initialBlockData:ee,operation:"update",readOnly:!w,renderAllFields:!!Z,schemaPath:$,signal:K.signal});if(!W)return H;H.blockName&&(W.blockName=H.blockName);let qe=bt(sl(W,{excludeFiles:!0}),ee);if(setTimeout(()=>{N.update(()=>{let ge=Zt(s);if(ge&&Ie(ge)){let Qe=qe;Qe.blockType=y,ge.setFields(Qe,!0)}},{tag:on})},0),Z){r||me(W._components?.customComponents?.BlockLabel??void 0),n||Gt(W._components?.customComponents?.Block??void 0);let ge=0;for(let Qe of Object.values(W))Qe?.valid===!1&&ge++;x(ge)}return W},[B,c,u,T,d,$,y,g,w,N,s,n,r]);qt(()=>()=>{tn(C.current)},[]);let Wt=nn(()=>{N.update(()=>{Zt(s)?.remove()})},[N,s]),[gr,ru]=$e.useState(0);qt(()=>{let H=()=>{N.getEditorState().read(()=>{let K=$d().getChildren(),ee=0;for(let W of K)if(Ie(W)){if(W.getKey()===s){ru(ee);return}ee++}})};return H(),N.registerUpdateListener(()=>{H()})},[N,s]);let Ze=M?.labels?.singular?xd(M.labels.singular,jo):M?.slug,xr=nn(H=>{T().then(Z=>{let ee=Z?.fields?.[f.name]?.collapsed,W=ee&&ee?.length?ee:[];H?W.includes(l.id)||W.push(l.id):W.includes(l.id)&&W.splice(W.indexOf(l.id),1),I(f.name,{collapsed:W,hello:"hi"})})},[T,f.name,I,l.id]),Cr=Oe(()=>()=>G(ll,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!w,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,w,Y,Ze,_]),br=Oe(()=>()=>G(ll,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!w,icon:"x",onClick:H=>{H.preventDefault(),Wt()},round:!0,tooltip:"Remove Block"}),[o,w,Wt]),zo=Oe(()=>function({Actions:Z,children:K,className:ee,collapsibleProps:W,disableBlockName:qe,editButton:ge,errorCount:Qe,fieldHasErrors:Go,Label:wr,Pill:Sr,removeButton:iu,showDragHandle:su=!0,showRowNumber:au=!0}){return G(rl,{editor:N,nodeKey:s,children:({isReordering:Uo,move:Nr,onBlur:cu,onKeyDown:uu,reorderInstructionsID:Lr,targetIndex:du})=>G("div",{className:`${o}__container ${o}-${y}`,onKeyDownCapture:J=>{let Wo=J.target;J.altKey||J.ctrlKey||J.metaKey||Wo.closest(".collapsible")?.parentElement!==J.currentTarget||(Wo.matches(".collapsible__drag")&&(J.key!=="Escape"||Uo)&&[" ","ArrowDown","ArrowUp","Enter","Escape","Tab"].includes(J.key)?(uu(J),J.stopPropagation()):J.key==="Tab"&&Wo.matches(".collapsible__toggle")&&J.stopPropagation())},children:ve(Cd,{actions:typeof Z<"u"?Z:w?G(Nd,{button:G(wd,{}),buttonAriaLabel:Y("general:moreOptions"),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",popupType:"menu",render:({close:J})=>ve(yt.ButtonGroup,{buttonSize:"medium",children:[G(yt.Button,{onClick:()=>{J(),Nr({direction:-1})},children:Y("general:moveUp")}),G(yt.Button,{onClick:()=>{J(),Nr({direction:1})},children:Y("general:moveDown")}),(ce&&ge!==!1||!ce&&ge)&&G(yt.Button,{onClick:()=>{_(),J()},children:Y("general:edit")}),iu!==!1&&ve(yt.Button,{onClick:()=>{Wt(),J()},children:[G(Dd,{}),Y("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Go?`${o}__row--has-errors`:`${o}__row--no-errors`,ee].filter(Boolean).join(" "),collapsibleStyle:Go?"error":"default",dragHandleProps:su&&w?{id:s,attributes:{"aria-describedby":Lr,"aria-pressed":Uo,role:"button",tabIndex:0},listeners:{onBlur:cu}}:void 0,header:G("div",{className:`${o}__block-header`,children:typeof wr<"u"?wr:typeof Ae<"u"?Ae:ve("div",{className:`${o}__block-label`,children:[au&&G("span",{className:`${o}__block-number`,children:String(gr+1).padStart(2,"0")}),typeof Sr<"u"?Sr:G(Sd,{className:`${o}__block-pill ${o}__block-pill-${y}`,pillStyle:"white",size:"small",children:Ze??y}),!qe&&!M?.admin?.disableBlockName&&G(yd,{path:"blockName",readOnly:!w}),Go&&G(Fd,{count:Qe??0})]})}),isCollapsed:Ut,onToggle:J=>{xr(J),Bo(J)},...W||{},AfterCollapsible:ve(pd,{children:[W?.AfterCollapsible,G("span",{className:"sr-only",role:"status",children:Uo?`${Y("general:order")}: ${(du??0)+1}`:""})]}),children:[ve("span",{className:"sr-only",id:Lr,children:["Space / Enter \xB7 ",Y("general:moveUp")," \u2191 \xB7 ",Y("general:moveDown")," \u2193 \xB7"," ",Y("general:cancel")," Escape"]}),K]},0)})})},[N,ce,Ae,Ze,o,M?.admin?.disableBlockName,y,Ut,xr,w,s,Wt,gr,Y,_]),kr=l?.id,{headerActions:_r,submitRef:Tr}=yr(),Er=Oe(()=>()=>G(kd,{children:G(bd,{className:"",headerActions:_r,slug:k,title:Y(`lexical:blocks:inlineBlocks:${kr?"edit":"create"}`,{label:Ze??Y("lexical:blocks:inlineBlocks:label")}),children:P?ve("div",{className:"fields-drawer",children:[G(Ld,{fields:M?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:$,permissions:!0,readOnly:!w}),G(Rr,{submitRef:Tr})]}):null})}),[P,k,kr,Ze,Y,w,M?.fields,$,_r,Tr]),lu=Oe(()=>P?G("div",{"data-block-drawer-slug":k,style:{display:"contents"},children:G(Td,{beforeSubmit:[async({formState:H})=>await Ho({formState:H,submit:!0})],el:"div",fields:M?.fields??[],initialState:P,onChange:[Ho],onSubmit:H=>{let Z=bt(H,S.current);Z.blockType=y,N.update(()=>{let K=Zt(s);K&&Ie(K)&&K.setFields(Z,!0)},{tag:on}),_()},submitted:i,uuid:Ye,children:G(tl,{baseClass:o,BlockDrawer:Er,Collapsible:zo,CustomBlock:ce,CustomLabel:Ae,EditButton:Cr,errorCount:L,formSchema:M?.fields??[],initialState:P,nodeKey:s,RemoveButton:br})})}):null,[zo,Er,ce,Ae,y,k,br,Cr,o,N,L,_,M?.fields,Ye,P,s,Ho,i]);return M?lu:G(zo,{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"]})})},Fd=t=>{let e=fd(3),{count:o}=t,{i18n:n}=al(),r;return e[0]!==o||e[1]!==n?(r=G(_d,{count:o,i18n:n,withMessage:!0}),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};var ue=class extends Lt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){let o=Fe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return Pd(cl,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Fe(t){return jd(new ue({fields:{...t,id:t?.id||new Bd.default().toHexString()}}))}function Ie(t){return t instanceof ue}import{createHeadlessEditor as Hd}from"@lexical/headless";import{$convertToMarkdownString as zd}from"@lexical/markdown";function rn(t,e){return({editorState:n})=>{let r=Hd({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=zd(e)}),l}}import{createHeadlessEditor as qd}from"@lexical/headless";import{$convertFromMarkdownString as xl,TRANSFORMERS as Zd}from"@lexical/markdown";var ul=/^[\t ]*$/,Gd=/^(\s*)(\d+)\.\s/,Ud=/^(\s*)[-*+]\s/,Wd=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,dl=/^(#{1,6})\s/,Vd=/^>\s/,Kd=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,ml=/[ \t]*(\\`\\`\\`|```)$/,Jd=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Xd=/^\|(.+)\|\s?$/,Yd=/^(\| ?:?-*:? ?)+\|\s?$/,fl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,pl=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function hl(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];let e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function gl(t,e){let o=t.split(`
9
+ `),n=!1,r=[],l=0;for(let s=0;s<o.length;s++){let i=o[s],c=r[r.length-1],u=s<o.length-1?hl(i):null,d=c!==void 0&&hl(c)!==null;if(Jd.test(i)){r.push(i);continue}if(ml.test(i)){l===0&&(n=!0),l===1&&(n=!1),l>0&&l--,r.push(i);continue}if(Kd.test(i)){n=!0,l++,r.push(i);continue}if(n){r.push(i);continue}ul.test(i)||ul.test(c)||!c||dl.test(c)||dl.test(i)||Vd.test(i)||Gd.test(i)||Ud.test(i)||Wd.test(i)||Xd.test(i)||Yd.test(i)||d||!e||fl.test(i)||pl.test(i)||fl.test(c)||pl.test(c)||ml.test(c)?r.push(i):r[r.length-1]=c+" "+(u===null?i.trim():i.trimStart())}return r.join(`
10
+ `)}function eo(t,e=Zd,o,n=!1,r=!1){if(n)return xl(t,e,o,!0);let l=gl(t,r);return xl(l,e,o,!1,!1)}function to(t,e){return({markdown:n})=>{let r=qd({nodes:t});return r.update(()=>{eo(n,e,void 0,!1,!0)},{discrete:!0}),r.getEditorState().toJSON()}}function Qd(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var kl=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=bl(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=bl(n,!0);r&&(o=o.concat(r))}return o};function bl(t,e){if(!t.jsx)return null;let o=Qd(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[kt],export:s=>{if(!Tt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),c=rn(r,l),u=t.jsx.export({fields:i,lexicalToMarkdown:c});if(u===!1)return null;if(typeof u=="string")return u;let d=u.props&&Object.keys(u.props)?.length>0,a=u.props??{};return u?.children?.length?`<${i.blockType}${d?" "+Nt({props:a}):""}>${u.children}</${i.blockType}>`:`<${i.blockType}${d?" "+Nt({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:c}=Jt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return c},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:c,propsString:u}=Jt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let d=to(r,l),a=t.jsx.import({children:c,closeMatch:null,htmlToLexical:null,markdownToLexical:d,openMatch:i,props:u?Kt({propsString:u}):{}});if(a===!1)return;let f=_t({blockType:t.slug,...a});s.replace(f)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[ue],export:s=>{if(!Ie(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),c=rn(r,l),u=t.jsx.export({fields:i,lexicalToMarkdown:c});if(u===!1)return null;if(typeof u=="string")return u;let d=u.props&&Object.keys(u.props)?.length>0,a=u.props??{};if(u?.children?.length){let f=u.children,m="";if(f.includes(`
11
+ `))for(let p of f.split(`
12
+ `)){let h="";!t?.jsx?.doNotTrimChildren&&p!==""&&(h=" "),h+=p+`
13
+ `,m+=h}else m=(t?.jsx?.doNotTrimChildren?"":" ")+f+`
14
+ `;return`<${i.blockType}${d?" "+Nt({props:a}):""}>
15
+ ${m}</${i.blockType}>`}return`<${i.blockType}${d?" "+Nt({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:c,startMatch:u,transformer:d})=>{let a=typeof d.regExpEnd=="object"&&"regExp"in d.regExpEnd?d.regExpEnd.regExp:d.regExpEnd,f=d.regExpEnd&&typeof d.regExpEnd=="object"&&"optional"in d.regExpEnd?d.regExpEnd.optional:!d.regExpEnd,{afterEndLine:m,beforeStartLine:p,content:h,endLineIndex:g,propsString:C}=Jt({isEndOptional:f,lines:s,regexpEndRegex:a,startLineIndex:c,startMatch:u,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=h.endsWith(`
16
+ `)?h.slice(0,-1):h;else if(h.includes(`
17
+ `)){let k=h.split(`
18
+ `),_=0;for(let T of k){if(_++,T.startsWith(" "))E+=T.slice(2);else if(T==="")E+=T;else{E=h.endsWith(`
19
+ `)?h.slice(0,-1):h;break}E+=_===k.length?"":`
20
+ `}}else E=(h.startsWith(" ")?h.slice(2):h)+`
21
+ `;if(!t?.jsx?.import)return[!1,c];let L=to(r,l),x=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:L,openMatch:u,props:C?Kt({propsString:C}):{}});if(x===!1)return[!1,c];let b=Fe({...x,blockType:t.slug});if(b){let k=null,_=null;if(p?.length){k=L({markdown:p})?.root?.children??[];let T=k?.[0];T&&i.append(Cl(T))}if(i.append(b),m?.length){_=L({markdown:m})?.root?.children;let T=i.getChildren()[i.getChildren().length-1],I=Cl(_[0])?.getChildren();if(I?.length)for(let N of I)T.append(N)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,c,u,d)=>{if(t?.jsx?.import){if(!d){let g="";if(i)for(let C of i)g+=C.getTextContent();d=[g]}let a="";t?.jsx?.doNotTrimChildren?a=d.join(`
22
+ `):a=d.join(`
23
+ `).trim();let f=c[1]?.trim(),m=to(r,l),p=t.jsx.import({children:a,closeMatch:u,htmlToLexical:null,markdownToLexical:m,openMatch:c,props:f?Kt({propsString:f}):{}});if(p===!1)return!1;let h=Fe({...p,blockType:t.slug});h&&s.append(h);return}return!1}})),n)}import{createCommand as _l}from"lexical";var rt=_l("INSERT_BLOCK_COMMAND"),lt=_l("INSERT_INLINE_BLOCK_COMMAND");import{c as em}from"react/compiler-runtime";import{useLexicalComposerContext as tm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as om,$wrapNodeInElement as nm,mergeRegister as rm}from"@lexical/utils";import{formatDrawerSlug as lm,useEditDepth as im}from"@payloadcms/ui";import{$createParagraphNode as sm,$getNodeByKey as am,$getPreviousSelection as cm,$getSelection as um,$insertNodes as dm,$isParagraphNode as mm,$isRangeSelection as fm,$isRootOrShadowRoot as pm,COMMAND_PRIORITY_EDITOR as Tl}from"lexical";import{useEffect as hm,useState as gm}from"react";var El=()=>{let t=em(12),[e]=tm(),[o,n]=gm(null),{setCreatedInlineBlock:r,uuid:l}=U(),s=im(),i="lexical-inlineBlocks-create-"+l,c;t[0]!==s||t[1]!==i?(c=lm({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=c):c=t[2];let u=c,{toggleDrawer:d}=De(u,!0),a;t[3]!==e||t[4]!==r||t[5]!==o?(a=()=>{if(!e.hasNodes([ue]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return rm(e.registerCommand(rt,m=>(e.update(()=>{let p=um()||cm();if(fm(p)){let h=Fe(m),{focus:g}=p,C=g.getNode();om(h),mm(C)&&!C.__first&&C.remove()}}),!0),Tl),e.registerCommand(lt,m=>{if(o){let h=am(o);return!h||!Tt(h)?!1:(h.setFields(m),n(null),!0)}let p=_t(m);return r?.(p),dm([p]),pm(p.getParentOrThrow())&&nm(p,sm).selectEnd(),!0},Tl))},t[3]=e,t[4]=r,t[5]=o,t[6]=a):a=t[6];let f;return t[7]!==e||t[8]!==r||t[9]!==o||t[10]!==d?(f=[e,r,o,d],t[7]=e,t[8]=r,t[9]=o,t[10]=d,t[11]=f):f=t[11],hm(a,f),null};var xm=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]),c=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),u=i.map(a=>{let f=a.blocks[0];return typeof f=="string"?t.blocksMap[f]:f}).filter(a=>a!==void 0),d=c.map(a=>{let f=a.blocks[0];return typeof f=="string"?t.blocksMap[f]:f}).filter(a=>a!==void 0);return{markdownTransformers:kl({blocks:u,inlineBlocks:d}),nodes:[ue,kt],plugins:[{Component:El,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[u?.length?{items:u.map(a=>({Icon:Zr(a,Yo),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:f})=>a?.labels?.singular?oo(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(rt,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Zo,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:f})=>a?.labels?.singular?oo(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(lt,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[u.length?{type:"dropdown",ChildComponent:Yo,items:u.map((a,f)=>({isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?oo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(rt,{blockName:"",blockType:a.slug})},order:f})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Zo,items:d.map((a,f)=>({isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?oo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(lt,{blockName:"",blockType:a.slug})},order:f})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as km}from"react/compiler-runtime";import{jsx as Be,jsxs as cn}from"react/jsx-runtime";import{useLexicalComposerContext as _m}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Tm,$createTextNode as Em,$getRoot as wm,getDOMSelection as ln}from"lexical";import*as yl from"react";import{useCallback as Pe,useEffect as sn,useLayoutEffect as Sl,useRef as an,useState as no}from"react";var Cm=se&&"documentMode"in document?document.documentMode:null,wl=se&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),q7=se&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Q7=se&&"InputEvent"in window&&!Cm?"getTargetRanges"in new window.InputEvent("input"):!1,e3=se&&/Version\/[\d.].*Safari/.test(navigator.userAgent),t3=se&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,o3=se&&/Android/.test(navigator.userAgent),n3=se&&/Win/.test(navigator.platform),bm=se&&/^(?=.*Chrome).*/i.test(navigator.userAgent),r3=se&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!bm;var Sm=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)},Nm=(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)},Lm=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 @@ ${f}</${i.blockType}>`}return`<${i.blockType}${c?" "+Et({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 Jd(t){return t.key.toLowerCase()==="a"&&(ll?t.metaKey:t.ctrlKey)}function Yd(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:n,focusOffset:r}=t;return n!==0&&n--,r!==0&&r--,{anchorNode:e,anchorOffset:n,focusNode:o,focusOffset:r}}function sl(t,e){let o=t,n=[];for(;o!==e;)o!=null&&n.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return n}var al=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Zd(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 g=t.getRootElement(),C=Ko(t._window);return g==null||C==null||C.anchorNode==null||C.focusNode==null||!g.contains(C.anchorNode)||!g.contains(C.focusNode)?null:`
33
+ );`}};function ym(t){return t.key.toLowerCase()==="a"&&(wl?t.metaKey:t.ctrlKey)}function Rm(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 Nl(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 Ll=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function vm(t){let[e,o]=no([]),[n,r]=no(!1),[,l]=no(""),[s,i]=no(""),c=an(null),u=an(!1),d=an(null),a=Pe(()=>t,[t]),f=Pe(()=>{let x=t.getRootElement(),b=ln(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(Xd).join(`
50
+ ${e.map(Lm).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),f=Pe((g,C)=>{o(b=>{let k=e.length-1,_=e[k];if(_&&_.name===g){if(g==="type")return[...e.slice(0,k),{..._,value:_.value+C}];if(_.value===C)return[...e.slice(0,k),{..._,count:_.count+1}]}return[...b,{name:g,count:1,value:C}]})},[e,o]);il(()=>{let g=b=>{if(!n)return;let k=b.key;Jd(b)?f("selectAll",""):al.has(k)?f("press",b.key):[...k].length>1?f("keydown",b.key):f("type",b.key)},C=b=>{if(!n)return;let k=b.key;!al.has(k)&&[...k].length>1&&f("keyup",b.key)};return t.registerRootListener((b,k)=>{k!==null&&(k.removeEventListener("keydown",g),k.removeEventListener("keyup",C)),b!==null&&(b.addEventListener("keydown",g),b.addEventListener("keyup",C))})},[t,n,f]),il(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),Xo(()=>{if(e){let g=m();g!==null&&i(g),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),Xo(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:b,editorState:k})=>{if(!n)return;let _=k._selection,A=u.current,L=d.current;if(A!==_){if(b.size===0&&C.size===0&&!L){let R=Ko(t._window);if(R&&(R.anchorNode==null||R.focusNode==null))return}u.current=_}d.current=!1;let E=m();E!==null&&i(E)}),[t,m,n,f]),Xo(()=>n?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,n]);let h=Pe(g=>{n||(g.update(()=>{let C=Wd();C.clear();let b=Ud();C.append(zd().append(b)),b.select()}),o([])),r(C=>!C)},[n]),p=Pe(()=>{if(!n)return;let g=Ko(t._window);if(g===null||g.anchorNode==null||g.focusNode==null)return;let{anchorNode:C,anchorOffset:b,focusNode:k,focusOffset:_}=Yd(g),A=a().getRootElement(),L;C!==null&&(L=sl(C,A));let E;k!==null&&(E=sl(k,A)),f("snapshot",{anchorNode:C,anchorOffset:b,anchorPath:L,focusNode:k,focusOffset:_,focusPath:E})},[f,n,a]),x=Pe(()=>{Vd(m())},[m]),T=Pe(()=>{Kd("test.js",m())},[m]);return[Be("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:g=>{h(a()),g.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?Yo("div",{className:"test-recorder-output",children:[Yo("div",{className:"test-recorder-toolbar",children:[Be("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:g=>{p(),g.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:g=>{x(),g.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:g=>{T(),g.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Be("pre",{id:"test-recorder",ref:c,children:s})]}):null]}var ul=()=>{let t=Hd(3),[e]=Gd(),[o,n]=Zd(e),r;return t[0]!==o||t[1]!==n?(r=Yo(cl.Fragment,{children:[Be("p",{children:"HI"}),o,n,Be("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var qd=I({plugins:[{Component:ul,position:"bottom"}]});import{c as Qd}from"react/compiler-runtime";import{jsx as em}from"react/jsx-runtime";import{useLexicalComposerContext as tm}from"@lexical/react/LexicalComposerContext.js";import{TreeView as om}from"@lexical/react/LexicalTreeView.js";import"react";var dl=()=>{let t=Qd(2),[e]=tm(),o;return t[0]!==e?(o=em(om,{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 nm=I({plugins:[{Component:dl,position:"bottom"}]});import{BOLD_ITALIC_STAR as lm,BOLD_ITALIC_UNDERSCORE as im,BOLD_STAR as sm,BOLD_UNDERSCORE as am}from"@lexical/markdown";import{$isTableSelection as cm}from"@lexical/table";import{$isRangeSelection as um,FORMAT_TEXT_COMMAND as dm}from"lexical";import{jsx as ml}from"react/jsx-runtime";import"react";var rm="M14.5 9.25A1.75 1.75 0 0 1 12.75 11H9.5V7.5h3.25c.966 0 1.75.784 1.75 1.75M8 11V7.5A1.5 1.5 0 0 1 9.5 6h3.25a3.25 3.25 0 0 1 2.418 5.422A3.5 3.5 0 0 1 13.5 18h-4A1.5 1.5 0 0 1 8 16.5zm1.5 1.5v4h4a2 2 0 1 0 0-4z",fl=({className:t})=>ml("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ml("path",{clipRule:"evenodd",d:rm,fill:"currentColor",fillRule:"evenodd"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var pl=[Y([{ChildComponent:fl,isActive:({selection:t})=>um(t)||cm(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(dm,"bold")},order:1}])],mm=I(({featureProviderMap:t})=>{let e=[sm,am];return t.get("italic")&&e.push(im,lm),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:pl},toolbarInline:{groups:pl}}});import{INLINE_CODE as pm}from"@lexical/markdown";import{$isTableSelection as hm}from"@lexical/table";import{$isRangeSelection as gm,FORMAT_TEXT_COMMAND as xm}from"lexical";import{jsx as hl}from"react/jsx-runtime";import"react";var fm="M9.64645 8.14645C9.84171 7.95118 10.1582 7.95118 10.3535 8.14645C10.5487 8.34171 10.5487 8.65822 10.3535 8.85348L7.20699 12L10.3535 15.1464C10.5487 15.3417 10.5487 15.6582 10.3535 15.8535C10.1582 16.0487 9.84171 16.0487 9.64645 15.8535L6.14645 12.3535C5.95118 12.1582 5.95118 11.8417 6.14645 11.6464L9.64645 8.14645ZM13.6464 8.14645C13.8417 7.95118 14.1582 7.95118 14.3535 8.14645L17.8535 11.6464C18.0487 11.8417 18.0487 12.1582 17.8535 12.3535L14.3535 15.8535C14.1582 16.0487 13.8417 16.0487 13.6464 15.8535C13.4512 15.6582 13.4512 15.3417 13.6464 15.1464L16.7929 12L13.6464 8.85348C13.4512 8.65822 13.4512 8.34171 13.6464 8.14645Z",gl=({className:t})=>hl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:hl("path",{clipRule:"evenodd",d:fm,fill:"currentColor",fillRule:"evenodd"})});var xl=[Y([{ChildComponent:gl,isActive:({selection:t})=>gm(t)||hm(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(xm,"code")},order:7}])],Cm=I({enableFormats:["code"],markdownTransformers:[pm],toolbarFixed:{groups:xl},toolbarInline:{groups:xl}});import{ITALIC_STAR as km,ITALIC_UNDERSCORE as _m}from"@lexical/markdown";import{$isTableSelection as Tm}from"@lexical/table";import{$isRangeSelection as wm,FORMAT_TEXT_COMMAND as Em}from"lexical";import{jsx as Cl}from"react/jsx-runtime";import"react";var bm="M10 6.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-2.083L11.6 17h1.9a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2.083L12.4 7h-1.9a.5.5 0 0 1-.5-.5",bl=({className:t})=>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:bm,fill:"currentColor",fillRule:"evenodd"})});var kl=[Y([{ChildComponent:bl,isActive:({selection:t})=>wm(t)||Tm(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Em,"italic")},order:2}])],Sm=I({enableFormats:["italic"],markdownTransformers:[km,_m],toolbarFixed:{groups:kl},toolbarInline:{groups:kl}});import{STRIKETHROUGH as Lm}from"@lexical/markdown";import{$isTableSelection as ym}from"@lexical/table";import{$isRangeSelection as Rm,FORMAT_TEXT_COMMAND as vm}from"lexical";import{jsx as _l}from"react/jsx-runtime";import"react";var Nm="M15.835 13.5a.27.27 0 0 1 .24.138q.306.554.306 1.316 0 1.01-.543 1.816-.543.8-1.554 1.268-1.01.462-2.409.462-1.323 0-2.295-.419-.972-.424-1.534-1.175a3.2 3.2 0 0 1-.533-1.135c-.082-.326.187-.614.522-.614.299 0 .539.233.625.519q.13.43.415.768.448.524 1.17.8.73.271 1.63.272.996 0 1.764-.32.773-.327 1.215-.906a2.16 2.16 0 0 0 .44-1.348q0-.645-.345-1.09c-.1-.132-.016-.352.15-.352zm-3.846-8q1.215 0 2.142.438.933.43 1.476 1.187.38.518.519 1.134c.07.31-.19.577-.507.577-.286 0-.518-.22-.6-.493q-.22-.738-.875-1.224-.864-.646-2.18-.646-.92 0-1.63.313-.703.308-1.1.85a2.04 2.04 0 0 0-.395 1.237q0 .492.217.874.216.376.588.652.376.278.843.475.474.197.972.338l1.052.288H18.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1h3.94a4.4 4.4 0 0 1-.844-.602q-.844-.781-.844-1.982 0-1.009.562-1.778t1.522-1.2q.959-.438 2.153-.438",Tl=({className:t})=>_l("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:_l("path",{d:Nm,fill:"currentColor"})});var wl=[Y([{ChildComponent:Tl,isActive:({selection:t})=>Rm(t)||ym(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(vm,"strikethrough")},order:4}])],Im=I({enableFormats:["strikethrough"],markdownTransformers:[Lm],toolbarFixed:{groups:wl},toolbarInline:{groups:wl}});import{$isTableSelection as Am}from"@lexical/table";import{$isRangeSelection as $m,FORMAT_TEXT_COMMAND as Dm}from"lexical";import{jsx as El}from"react/jsx-runtime";import"react";var Mm="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652 3.925a.436.436 0 0 1-.287-.765l1.64-1.431q.259-.228.433-.407.175-.178.266-.345a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.195-.4 0-.643.21a.7.7 0 0 0-.133.151c-.127.197-.3.403-.534.403s-.432-.194-.367-.418q.11-.378.434-.642.494-.402 1.257-.403.513 0 .897.183.387.181.604.501.217.316.217.714 0 .316-.13.586-.125.27-.395.555a9 9 0 0 1-.695.634l-.927.798a.023.023 0 0 0 .016.042h1.895a.357.357 0 0 1 0 .714z",Sl=({className:t})=>El("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:Mm,fill:"currentColor"})});var Nl=[Y([{ChildComponent:Sl,isActive:({selection:t})=>$m(t)||Am(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Dm,"subscript")},order:5}])],Om=I({enableFormats:["subscript"],toolbarFixed:{groups:Nl},toolbarInline:{groups:Nl}});import{$isTableSelection as Pm}from"@lexical/table";import{$isRangeSelection as Bm,FORMAT_TEXT_COMMAND as jm}from"lexical";import{jsx as Ll}from"react/jsx-runtime";import"react";var Fm="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652-1.303a.436.436 0 0 1-.287-.765l1.64-1.432q.259-.228.433-.406.175-.179.266-.346a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.194-.4 0-.643.209a.7.7 0 0 0-.133.152c-.127.196-.3.403-.534.403s-.432-.194-.367-.419q.11-.378.434-.641.494-.403 1.257-.403.513 0 .897.182.387.183.604.502.217.315.217.714 0 .315-.13.585-.125.27-.395.555a9 9 0 0 1-.695.635l-.927.798a.023.023 0 0 0 .016.041h1.895a.357.357 0 1 1 0 .715z",yl=({className:t})=>Ll("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ll("path",{d:Fm,fill:"currentColor"})});var Rl=[Y([{ChildComponent:yl,isActive:({selection:t})=>Bm(t)||Pm(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(jm,"superscript")},order:6}])],Hm=I({enableFormats:["superscript"],toolbarFixed:{groups:Rl},toolbarInline:{groups:Rl}});import{$isTableSelection as zm}from"@lexical/table";import{$isRangeSelection as Um,FORMAT_TEXT_COMMAND as Wm}from"lexical";import{jsx as vl}from"react/jsx-runtime";import"react";var Gm="M9 7.5a.5.5 0 0 0-1 0V12a4 4 0 0 0 8 0V7.5a.5.5 0 0 0-1 0V12a3 3 0 1 1-6 0zM16.5 19a.5.5 0 0 0 0-1h-9a.5.5 0 0 0 0 1z",Il=({className:t})=>vl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:vl("path",{clipRule:"evenodd",d:Gm,fill:"currentColor",fillRule:"evenodd"})});var Ml=[Y([{ChildComponent:Il,isActive:({selection:t})=>Um(t)||zm(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Wm,"underline")},order:3}])],Vm=I({enableFormats:["underline"],toolbarFixed:{groups:Ml},toolbarInline:{groups:Ml}});import{jsx as qo}from"react/jsx-runtime";import{jsx as Km}from"react/jsx-runtime";function Xm(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var eo=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[Xm(o),n])):{};return Km("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Jm}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Ym}from"@lexical/selection";import{$getNodeByKey as Zm,$getState as qm,$setState as Qm,createState as ef,TextNode as tf}from"lexical";import{useEffect as of}from"react";function Al(t){let e=new Map;for(let o in t){let n=t[o],r=ef(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function Zo(t,e,o,n){t.update(()=>{Ym(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);Qm(r,l.stateConfig,n)})})}function $l({stateMap:t}){let[e]=Jm();return of(()=>e.registerMutationListener(tf,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=Zm(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((u,d)=>{let c=qm(l,u.stateConfig);if(!c){delete s.dataset[d];return}s.dataset[d]=c;let a=u.stateValues[c]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var Dl=(t,e)=>{let o=[];for(let r in t.state){let l=t.state[r];for(let s in l){let i=l[s];o.push({ChildComponent:()=>qo(eo,{css:i.css}),key:s,label:i.label,onSelect:({editor:u})=>{Zo(u,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>qo(eo,{css:{color:"var(--color-icon-secondary)"}}),items:[...[{ChildComponent:()=>qo(eo,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)Zo(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},nf=I(({props:t})=>{let e=Al(t.state);return{plugins:[{Component:()=>$l({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Dl(t,e)},toolbarInline:{groups:Dl(t,e)}}});import{c as kf}from"react/compiler-runtime";import{useLexicalComposerContext as _f}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Tf,$isHeadingNode as Jl,HeadingNode as ql}from"@lexical/rich-text";import{$setBlocksType as wf}from"@lexical/selection";import{$getSelection as Ef,$isRangeSelection as Sf}from"lexical";import{useEffect as Nf}from"react";import{jsx as Ol}from"react/jsx-runtime";import"react";var rf="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm11 6a.5.5 0 0 0-.777-.416l-1.5 1a.5.5 0 1 0 .554.832l.723-.482V17.5a.5.5 0 0 0 1 0z",Fl=({className:t})=>Ol("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ol("path",{d:rf,fill:"currentColor"})});import{jsx as Pl}from"react/jsx-runtime";import"react";var lf="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm9.034 10.952c0 .303.245.548.548.548h2.97a.448.448 0 0 0 0-.896H17.48v-.04l.997-1.038q.562-.555.873-.945.314-.39.438-.711t.124-.653q0-.497-.245-.885a1.7 1.7 0 0 0-.684-.61A2.24 2.24 0 0 0 17.96 12a2.2 2.2 0 0 0-1.017.228 1.71 1.71 0 0 0-.888 1.13c-.064.268.168.495.444.495.275 0 .479-.236.595-.485l.019-.039q.12-.22.333-.338a1 1 0 0 1 .5-.121q.278 0 .495.11a.83.83 0 0 1 .341.312.9.9 0 0 1 .125.48q0 .245-.096.462t-.288.448-.48.529l-1.85 1.854a.55.55 0 0 0-.16.387",Bl=({className:t})=>Pl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Pl("path",{d:lf,fill:"currentColor"})});import{jsx as jl,jsxs as sf}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 0V11H7z",cf="M16.59 13.32 A1.5 1.25 0 1 1 18 15 A1.5 1.25 0 1 1 16.59 16.68",Hl=({className:t})=>sf("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:af,fill:"currentColor"}),jl("path",{d:cf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as Gl,jsxs as uf}from"react/jsx-runtime";import"react";var df="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",mf="M18.85 17.5 V12.5 L16.5 15.85 H19.5",zl=({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:[Gl("path",{d:df,fill:"currentColor"}),Gl("path",{d:mf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as Ul,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",hf="M19.2 12.5 H16.8 V14.9 A1.5 1.5 0 1 1 16.7 16.9",Wl=({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:[Ul("path",{d:pf,fill:"currentColor"}),Ul("path",{d:hf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as Vl,jsxs as gf}from"react/jsx-runtime";import"react";var xf="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",Cf="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",Kl=({className:t})=>gf("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[Vl("path",{d:xf,fill:"currentColor"}),Vl("path",{d:Cf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{HEADING as bf}from"@lexical/markdown";var Xl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`;return{...bf,regExp:new RegExp(o)}};var Yl=t=>{let e=Ef();wf(e,()=>Tf(t))},Zl={h1:Fl,h2:Bl,h3:Hl,h4:zl,h5:Wl,h6:Kl},Lf=I(({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(!Sf(l))return!1;for(let s of l.getNodes()){if(Jl(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(Jl(i)&&i.getTag()===n))return!1}return!0},key:n,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Yl(n)})},order:r+2})))];return{markdownTransformers:[Xl(e)],nodes:[ql],plugins:[{Component:yf,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(()=>{Yl(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),yf=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]=_f(),d,c;return e[4]!==u||e[5]!==l||e[6]!==i?(d=()=>{if(!(!i||l.length===6))return u.registerNodeTransform(ql,a=>{l.includes(a.getTag())||a.setTag(i)})},c=[u,l,i],e[4]=u,e[5]=l,e[6]=i,e[7]=d,e[8]=c):(d=e[7],c=e[8]),Nf(d,c),null};import{$isNodeSelection as Wf}from"lexical";import{jsx as Ql}from"react/jsx-runtime";import"react";var Rf="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:Rf,fill:"currentColor"})});var be=t=>({type:"dropdown",ChildComponent:hr,items:t,key:"add",order:10});import{addClassNamesToElement as vf}from"@lexical/utils";import{$applyNodeReplacement as If,createCommand as Mf,DecoratorNode as Af}from"lexical";var yt=Mf("INSERT_HORIZONTAL_RULE_COMMAND"),Lt=class extends Af{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:$f,priority:0})}}static importJSON(e){return ei()}createDOM(e){let o=document.createElement("hr");return vf(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 $f(){return{node:ei()}}function ei(){return If(new Lt)}import{$applyNodeReplacement as Df}from"lexical";import"react";var ke=class extends Lt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return ot()}decorate(){return null}exportJSON(){return super.exportJSON()}};function ot(){return Df(new ke)}function je(t){return t instanceof ke}var ti={type:"element",dependencies:[ke],export:(t,e)=>je(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=ot();e&&t.replace(e)}};import{c as Of}from"react/compiler-runtime";import{useLexicalComposerContext as Ff}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as oi,$insertNodeToNearestRoot as Pf}from"@lexical/utils";import{$getRoot as Bf,$getSelection as ni,$isRangeSelection as ri,$isRootOrShadowRoot as li,COMMAND_PRIORITY_EDITOR as jf}from"lexical";import{useEffect as Hf}from"react";var en="LexicalEditorTheme__hrSelected",ii=()=>{let t=Of(3),[e]=Ff(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(yt,Gf,jf),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let d=Bf().getChildren(),c=ni(),a=[];for(let g=0;g<d.length;g++){let C=d[g];if(je(C)){let b=e.getElementByKey(C.getKey());b&&a.push({element:b,index:g})}}if(a.length===0)return;if(!ri(c)||c.isCollapsed()){for(let{element:g}of a)g.classList.remove(en);return}let m=c.anchor.getNode(),f=c.focus.getNode(),h=oi(m,zf)||m,p=oi(f,Uf)||f,x=d.indexOf(h),T=d.indexOf(p);if(x===-1||T===-1)return;let N=Math.min(x,T),S=Math.max(x,T);for(let{element:g,index:C}of a)C>=N&&C<=S?g.classList.add(en):g.classList.remove(en)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Hf(o,n),null};function Gf(t){let e=ni();if(!ri(e))return!1;if(e.focus.getNode()!==null){let n=ot();Pf(n)}return!0}function zf(t){return li(t.getParent())}function Uf(t){return li(t.getParent())}var Vf=I({markdownTransformers:[ti],nodes:[ke],plugins:[{Component:ii,position:"normal"}],slashMenu:{groups:[J([{Icon:Qo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:Qo,isActive:({selection:t})=>{if(!Wf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return je(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]}});import{$findMatchingParent as xi}from"@lexical/utils";import{$isElementNode as lp,INDENT_CONTENT_COMMAND as ip,OUTDENT_CONTENT_COMMAND as sp}from"lexical";import{jsx as tn}from"react/jsx-runtime";import"react";var Kf="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",si=({className:t})=>tn("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:tn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:tn("path",{clipRule:"evenodd",d:Kf,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as ai}from"react/jsx-runtime";import"react";var Xf="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",ci=({className:t})=>ai("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ai("path",{clipRule:"evenodd",d:Xf,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Jf}from"react/jsx-runtime";import{useLexicalComposerContext as Yf}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Zf}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as qf,mergeRegister as ui}from"@lexical/utils";import{$getSelection as Qf,$isElementNode as pi,$isRangeSelection as ep,COMMAND_PRIORITY_LOW as di,INDENT_CONTENT_COMMAND as mi,KEY_TAB_COMMAND as tp,OUTDENT_CONTENT_COMMAND as op,TabNode as np}from"lexical";import{useEffect as fi}from"react";var hi=({clientProps:t})=>{let[e]=Yf(),{disabledNodes:o,disableTabNode:n}=t;return fi(()=>{if(!(!e||!o?.length))return ui(e.registerCommand(mi,()=>rp(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),di),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);pi(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),fi(()=>{if(!(!e||!n))return ui(e.registerCommand(tp,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?op:mi,void 0)),di),e.registerNodeTransform(np,r=>{r.remove()}))},[e,n]),Jf(Zf,{})};function rp(t){let e=Qf();if(!ep(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=qf(l,d=>pi(d)&&!d.isInline());if(i===null)continue;let u=i.getKey();i.canIndent()&&!o.has(u)&&(o.add(u),t(i))}return o.size>0}var gi=t=>({type:"buttons",items:t,key:"indent",order:35});var Ci=({disabledNodes:t})=>[gi([{ChildComponent:si,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>bi(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!xi(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(sp,void 0)},order:1},{ChildComponent:ci,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>bi(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!xi(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ip,void 0)},order:2}])],ap=I(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:hi,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ci({disabledNodes:e})},toolbarInline:{groups:Ci({disabledNodes:e})}}}),bi=t=>lp(t)&&t.canIndent();import{$findMatchingParent as S1}from"@lexical/utils";import{$getSelection as fn,$isRangeSelection as es}from"lexical";import{jsx as ki}from"react/jsx-runtime";import"react";var cp={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4436 10.3708C12.6861 10.5041 12.9148 10.6721 13.1204 10.8776C14.2919 12.0492 14.2918 13.9482 13.1204 15.1198L11.1204 17.1198C9.94879 18.2914 8.04975 18.2914 6.87817 17.1198C5.70664 15.9482 5.70661 14.0492 6.87817 12.8776L8.1477 11.6071C8.4098 11.345 8.89329 11.5392 8.97388 11.9011C9.00617 12.0462 8.96861 12.2012 8.86353 12.3063L7.5852 13.5847C6.80417 14.3657 6.80419 15.6317 7.5852 16.4128C8.36625 17.1938 9.63228 17.1938 10.4133 16.4128L12.4133 14.4128C13.1942 13.6317 13.1943 12.3657 12.4133 11.5847C12.4042 11.5755 12.3953 11.5662 12.386 11.5573C12.2925 11.468 12.1984 11.3736 12.1614 11.2497C12.0724 10.9515 12.1448 10.6149 12.3801 10.3796C12.397 10.3628 12.4228 10.3594 12.4436 10.3708ZM12.8782 6.87764C14.0497 5.70615 15.9488 5.70616 17.1204 6.87764C18.2919 8.04919 18.2919 9.94825 17.1204 11.1198L15.8508 12.3903C15.5887 12.6522 15.1053 12.4581 15.0247 12.0964C14.9924 11.9512 15.0308 11.7963 15.136 11.6911L16.4133 10.4128C17.1943 9.63175 17.1943 8.3657 16.4133 7.58467C15.6323 6.80371 14.3662 6.8037 13.5852 7.58467L11.5852 9.58467C10.8046 10.3657 10.8044 11.6319 11.5852 12.4128C11.5943 12.4219 11.6042 12.4303 11.6135 12.4392C11.7064 12.5278 11.7999 12.622 11.8372 12.7448C11.9276 13.044 11.8545 13.3827 11.6184 13.6188C11.6023 13.6347 11.5778 13.6383 11.5579 13.6276C11.3146 13.4942 11.0843 13.3259 10.8782 13.1198C9.7068 11.9484 9.707 10.0492 10.8782 8.87764L12.8782 6.87764Z"},to=({className:t,size:e=24})=>ki("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ki("path",{d:cp[e],fill:"currentColor"})});import{$isAtNodeEnd as _i}from"@lexical/selection";function nt(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?_i(o)?n:r:_i(e)?n:r}var on=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Tp}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 up=/^(?:[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+)?$/,dp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Ti(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||up.test(t)||dp.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 mp,isHTMLAnchorElement as fp}from"@lexical/utils";import sn from"bson-objectid";import{$applyNodeReplacement as pp,$createTextNode as wi,$getSelection as hp,$isElementNode as Ei,$isRangeSelection as ln,createCommand as gp,ElementNode as xp}from"lexical";var Cp=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends xp{__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:bp,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")),mp(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!ln(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Ei(n)){let r=_e({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Cp.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 bp(t){let e=null;if(fp(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 pp(new oe({id:t??new sn.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var fe=gp("TOGGLE_LINK_COMMAND");function an(t){let e=hp();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:kp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(wi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let n=null,r=null;o?.forEach(l=>{let s=l.getParent();if(!(s===r||s===null||Ei(l)&&!l.isInline())){if(K(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(wi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=_e({fields:t.fields}),K(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),K(l)){if(l.is(r))return;if(r!==null){let i=l.getChildren();r.append(...i)}l.remove();return}r!==null&&r.append(l)}})}function kp(t){return _p(t,e=>K(e))}function _p(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 wp=(t,e)=>{let[,o,n]=e,r=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=Tp(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},Ep=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:wp,trigger:")"}),Si=Ep();import{$applyNodeReplacement as Sp,$isElementNode as Np}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(Np(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 Sp(new Te({id:"",fields:t}))}function we(t){return t instanceof Te}import{c as Lp}from"react/compiler-runtime";import{useLexicalComposerContext as yp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Rp}from"@lexical/utils";import{$createTextNode as Ni,$getSelection as vp,$isElementNode as yi,$isLineBreakNode as Ri,$isNodeSelection as Ip,$isRangeSelection as Mp,$isTextNode as vt,TextNode as Ap}from"lexical";import{useEffect as $p}from"react";function Li(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function vi(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var Dp=/[.,;\s]/;function no(t){return t!==void 0&&Dp.test(t)}function Ii(t){return no(t[t.length-1])}function un(t){return no(t[0])}function Op(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Mi(t){let e=t.getPreviousSibling();return yi(e)&&(e=e.getLastDescendant()),e===null||Ri(e)||vt(e)&&Ii(e.getTextContent())}function Ai(t){let e=t.getNextSibling();return yi(e)&&(e=e.getFirstDescendant()),e===null||Ri(e)||vt(e)&&un(e.getTextContent())}function Fp(t,e,o,n){return(t>0?no(o[t-1]):Mi(n[0]))?e<o.length?no(o[e]):Ai(n[n.length-1]):!1}function Pp(t,e,o){let n=[],r=[],l=[],s=0,i=0,u=[...t];for(;u.length>0;){let d=u[0],a=d.getTextContent().length,m=i;i+a<=e?(n.push(d),s+=a):m>=o?l.push(d):r.push(d),i+=a,u.shift()}return[s,n,r,l]}function Bp(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=Rt({fields:r});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let u=Ni(n.text);u.setFormat(i.getFormat()),u.setDetail(i.getDetail()),u.setStyle(i.getStyle()),l.append(u),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,u;e===0?u=s:[,u]=s.splitText(e);let d=[],c;if(t.forEach(a=>{let f=a.getTextContent().length,h=i,p=i+f;if(h<o)if(p<=o)d.push(a);else{let[x,T]=a.splitText(o-h);x&&d.push(x),c=T}i+=f}),u){let a=vp(),m=a?a.getNodes().find(vt):void 0,f=Ni(u.getTextContent());return f.setFormat(u.getFormat()),f.setDetail(u.getDetail()),f.setStyle(u.getStyle()),l.append(f,...d),m&&m===u&&(Mp(a)?f.select(a.anchor.offset,a.focus.offset):Ip(a)&&f.select(0,f.getTextContent().length)),u.replace(l),c}}}function jp(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(Fp(i+u,i+c,r,n)){let[m,,f,h]=Pp(n,i+u,i+c),p=i+u-m,x=i+c-m,T=Bp(f,p,x,s);n=T?[T,...h]:h,o(s.url,null),i=0}else i+=c;l=l.substring(c)}}function cn(t,e,o){let n=t.getChildren(),r=n.length;for(let u=0;u<r;u++){let d=n[u];if(!vt(d)||!d.isSimpleText()){oo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=vi(l,e);if(s===null||s.text!==l){oo(t),o(null,t.getFields()?.url??null);return}if(!Mi(t)||!Ai(t)){oo(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let u=t.getFields();u.url=s?.url,t.setFields(u),o(s.url,i??null)}}function Hp(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)||Op(l,s))&&(n.append(t),cn(n,e,o),o(null,n.getFields()?.url??null))}we(r)&&!Ii(l)&&(oo(r),cn(r,e,o),o(null,r.getFields()?.url??null))}function oo(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function Gp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&vt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function zp(t,e,o){let n=Lp(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 Rp(t.registerNodeTransform(Ap,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=Gp(i);jp(c,e,s)}Hp(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]),$p(r,l)}var Up=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Wp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Vp=[Li(Up,t=>t.startsWith("http")?t:`https://${t}`),Li(Wp,t=>`mailto:${t}`)],$i=()=>{let[t]=yp();return zp(t,Vp),null};import{jsx as Kp}from"react/jsx-runtime";import{ClickableLinkPlugin as Xp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Di=()=>Kp(Xp,{});import{jsx as p1}from"react/jsx-runtime";import"react";import{createPortal as h1}from"react-dom";import{jsx as ne,jsxs as He,Fragment as dn}from"react/jsx-runtime";import{useLexicalComposerContext as Zp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as qp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Hi,mergeRegister as Gi}from"@lexical/utils";import{getTranslation as mn}from"@payloadcms/translations";import{formatDrawerSlug as Qp,NewTabIcon as zi,useConfig as e1,useEditDepth as t1,useLocale as o1,useTranslation as n1,WriteIcon as r1}from"@payloadcms/ui";import{requests as l1}from"@payloadcms/ui/shared";import{$getSelection as Ui,$isLineBreakNode as i1,$isRangeSelection as Wi,COMMAND_PRIORITY_HIGH as s1,COMMAND_PRIORITY_LOW as Vi,getDOMSelection as a1,KEY_ESCAPE_COMMAND as c1,SELECTION_CHANGE_COMMAND as u1}from"lexical";import{formatAdminURL as d1}from"payload/shared";import m1,{useCallback as Ki,useEffect as io,useLayoutEffect as f1,useRef as Xi,useState as Ge}from"react";import{jsx as Oi}from"react/jsx-runtime";import"react";var Jp="M12.5 5C12.6326 5 12.7597 5.05272 12.8535 5.14648L16.8535 9.14648C16.9965 9.28948 17.0393 9.50457 16.9619 9.69141C16.8845 9.87821 16.7022 10 16.5 10H12.5C12.2239 10 12 9.77614 12 9.5V6H8.5C8.22386 6 8 6.22386 8 6.5V17.5C8 17.7761 8.22386 18 8.5 18H15.5C15.7761 18 16 17.7761 16 17.5V11.5C16 11.2239 16.2239 11 16.5 11C16.7761 11 17 11.2239 17 11.5V17.5C17 18.3284 16.3284 19 15.5 19H8.5C7.67157 19 7 18.3284 7 17.5V6.5C7 5.67157 7.67157 5 8.5 5H12.5ZM13 9H15.293L13 6.70703V9Z",Fi=({className:t})=>Oi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Oi("path",{d:Jp,fill:"currentColor"})});import{jsx as Pi}from"react/jsx-runtime";import"react";var Bi={default:"M6 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .496.5h12.008a.5.5 0 0 0 .496-.5v-1A.5.5 0 0 0 18 5zM4.5 6.5a1.5 1.5 0 0 0 1.037 1.427L5.725 10H5a.5.5 0 0 0 0 1h.816l.653 7.181A2 2 0 0 0 8.46 20h7.078a2 2 0 0 0 1.992-1.819L18.184 11H19a.5.5 0 0 0 0-1h-.725l.188-2.073A1.5 1.5 0 0 0 19.5 6.5v-1A1.5 1.5 0 0 0 18 4H6a1.5 1.5 0 0 0-1.5 1.5zm2.965 11.59L6.548 8h10.905l-.918 10.09a1 1 0 0 1-.996.91H8.461a1 1 0 0 1-.996-.91M11 10.5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"},ji=({className:t,small:e})=>Pi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Pi("path",{clipRule:"evenodd",d:e?Bi.small:Bi.default,fill:"currentColor",fillRule:"evenodd"})});function ro(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),u=t.top-n,d=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let c=e.scrollWidth,a=i.right-d,m=d-i.left,f;if(c<=a)f=e.getBoundingClientRect();else{let h=m+t.width,p=m>a,T=Math.min(c,p?h:a);T<c&&(e.style.width=`${T}px`,e.style.maxWidth=`${T}px`,e.offsetHeight),p&&(d=t.right-T),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 Yp}from"lexical";var lo=Yp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ji(t){t.preventDefault()}function Yi({anchorElem:t}){let[e]=Zp(),[o,n]=Ge(),r=Xi(null),l=Xi(null),[s,i]=Ge(null),[u,d]=Ge(null),{fieldProps:{schemaPath:c},uuid:a}=z(),m=qp(),{config:f,getEntityConfig:h}=e1(),{i18n:p,t:x}=n1(),[T,N]=Ge(),S=t1(),[g,C]=Ge(!1),[b,k]=Ge([]),_=o1(),[A,L]=Ge(!1),E=Qp({slug:"lexical-rich-text-link-"+a,depth:S}),{toggleDrawer:R}=$e(E),w=Ki(()=>{C(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),L(!1),i(null),d(null),k([]),N(void 0)},[C,i,d,k]),y=Ki(()=>{let v=Ui(),$;if(!Wi(v)||!v){w();return}let M=nt(v);$=e.getElementByKey(M.getKey())?.getBoundingClientRect();let D=Hi(M,K),H=v.getNodes().filter(le=>!i1(le)).find(le=>{let ge=Hi(le,K);return D&&!D.is(ge)||ge&&!ge.is(D)});if(D==null||H){w();return}n(D);let F=D.getFields(),Z={...F,id:D.getID(),text:D.getTextContent()};if(F?.linkType==="custom")i(F?.url??null),d(null);else{i(`${f.routes.admin==="/"?"":f.routes.admin}/collections/${F?.doc?.relationTo}/${F?.doc?.value}`);let le=F?.doc?.relationTo?h({collectionSlug:F?.doc?.relationTo}):void 0;if(!le)d(F?.label?String(F?.label):null),i(F?.url?String(F?.url):null);else{let ge=typeof F.doc?.value=="object"?F.doc.value.id:F.doc?.value,Ht=F.doc?.relationTo;if(!ge||!Ht)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let or=x("fields:linkedTo",{label:`${mn(le.labels.singular,p)} - ${x("lexical:link:loadingWithEllipsis",p)}`}).replace(/<[^>]*>?/g,"");d(or),l1.get(d1({apiRoute:f.routes.api,path:`/${Ht}/${ge}`,serverURL:f.serverURL}),{headers:{"Accept-Language":p.language},params:{depth:0,locale:_?.code}}).then(async Ke=>{if(!Ke.ok)throw new Error(`HTTP error! Status: ${Ke.status}`);let ht=await Ke.json(),ee=le?.admin?.useAsTitle||"id",gt=ht[ee],de=x("fields:linkedTo",{label:`${mn(le.labels.singular,p)} - ${gt}`}).replace(/<[^>]*>?/g,"");d(de)}).catch(()=>{let Ke=x("fields:linkedTo",{label:`${mn(le.labels.singular,p)} - ${x("general:untitled",p)} - ID: ${ge}`}).replace(/<[^>]*>?/g,"");d(Ke)})}}N(Z),C(!0),k(v?v?.getNodes():[]),we(D)?L(!0):L(!1);let X=r.current,Ve=a1(e._window),{activeElement:ye}=document;if(X===null)return;let he=e.getRootElement();return Ve!==null&&he!==null&&he.contains(Ve.anchorNode)?($||($=Ve.getRangeAt(0).getBoundingClientRect()),$!=null&&($.y+=40,l.current=$)):(ye==null||ye.className!=="link-input")&&(he!==null&&ro(null,X,t),i(null),d(null)),!0},[e,w,f.routes.admin,f.routes.api,f.serverURL,h,x,p,_?.code,t]);return io(()=>Gi(e.registerCommand(lo,v=>(e.dispatchCommand(fe,v),y(),R(),!0),Vi)),[e,y,R,E]),io(()=>{let v=t.parentElement,$=()=>{e.getEditorState().read(()=>{y()})};return window.addEventListener("resize",$),v?.addEventListener("scroll",$),()=>{window.removeEventListener("resize",$),v?.removeEventListener("scroll",$)}},[t.parentElement,e,y]),io(()=>Gi(e.registerUpdateListener(({editorState:v})=>{v.read(()=>{y()})}),e.registerCommand(u1,()=>(y(),!0),Vi),e.registerCommand(c1,()=>g?(w(),!0):!1,s1)),[e,y,g,w]),io(()=>{e.getEditorState().read(()=>{y()})},[e,y]),f1(()=>{!g||!r.current||!t||!l.current||ro(l.current,r.current,t)},[s,u,g,t,o]),He(m1.Fragment,{children:[ne("div",{className:"link-editor","data-theme":"dark",ref:r,children:He("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?ne(to,{}):ne(Fi,{}),s&&s.length>0?He("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[u!=null&&u.length>0?u:s,o?.__fields.newTab?He(dn,{children:[ne(zi,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):u!=null&&u.length>0?He(dn,{children:[ne("span",{className:"link-input__label-pure",children:u}),o?.__fields.newTab?He(dn,{children:[ne(zi,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):null,m&&He("div",{className:"link-input__actions",children:[ne("button",{"aria-label":"Edit link",className:"link-edit",onClick:v=>{v.preventDefault(),R()},onMouseDown:Ji,tabIndex:0,type:"button",children:ne(r1,{})}),!A&&ne("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(fe,null)},onMouseDown:Ji,tabIndex:0,type:"button",children:ne(ji,{small:!0})})]})]})}),ne($o,{className:"lexical-link-edit-drawer",data:T,drawerSlug:E,drawerTitle:x("fields:editLink"),featureKey:"link",handleDrawerSubmit:(v,$)=>{let M=$,D={...M};delete D.text,e.update(()=>{let H=Ui(),F=null;if(Wi(H)?F=nt(H).getParent():b.length&&(F=b[0]?.getParent()??null),F&&we(F)){let Z=_e({fields:D});F.replace(Z,!0)}}),e.dispatchCommand(fe,{fields:D,selectedNodes:b,text:M.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Zi=t=>{let{anchorElem:e=document.body}=t;return h1(p1(Yi,{anchorElem:e}),e)};import{c as g1}from"react/compiler-runtime";import{useLexicalComposerContext as x1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as C1}from"@lexical/utils";import{$getSelection as b1,$isElementNode as k1,$isRangeSelection as _1,COMMAND_PRIORITY_LOW as qi,PASTE_COMMAND as T1}from"lexical";import{useEffect as w1}from"react";var Qi=t=>{let e=g1(5),{clientProps:o}=t,[n]=x1(),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 C1(n.registerCommand(fe,s=>s===null?(an(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),an(s),!0),qi),n.registerCommand(T1,s=>{let i=b1();if(!_1(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let u=s.clipboardData.getData("text");if(!Ti(u))return!1;if(!i.getNodes().some(E1)){let d={doc:null,linkType:"custom",newTab:!1,url:u};return n.dispatchCommand(fe,{fields:d,text:null}),s.preventDefault(),!0}return!1},qi))},l=[o.defaultLinkType,o.defaultLinkURL,n],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=n,e[3]=r,e[4]=l):(r=e[3],l=e[4]),w1(r,l),null};function E1(t){return k1(t)}var ts=[on([{ChildComponent:to,isActive:({selection:t})=>{if(es(t)){let e=nt(t);return S1(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(es(t)&&fn()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(fe,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=fn()?.getTextContent(),n=fn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(lo,{fields:r,selectedNodes:n,text:o})}},order:1}])],N1=I(({props:t})=>({markdownTransformers:[Si],nodes:[oe,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:Qi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:$i,position:"normal"},{Component:Di,position:"normal"},{Component:Zi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ts},toolbarInline:{groups:ts}}));import{$isListNode as hn,INSERT_CHECK_LIST_COMMAND as ls,ListItemNode as M1,ListNode as A1}from"@lexical/list";import{CHECK_LIST as $1}from"@lexical/markdown";import{$isRangeSelection as D1}from"lexical";import{jsx as os}from"react/jsx-runtime";import"react";var L1={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},pn=({className:t,size:e=24})=>os("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:os("path",{d:L1[e],fill:"currentColor"})});import{jsx as y1}from"react/jsx-runtime";import{ListPlugin as R1}from"@lexical/react/LexicalListPlugin.js";import"react";var rt=()=>y1(R1,{});function so(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function lt(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{jsx as v1}from"react/jsx-runtime";import{CheckListPlugin as I1}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var ns=()=>v1(I1,{});var rs=[te([{ChildComponent:pn,isActive:({selection:t})=>{if(!D1(t))return!1;for(let e of t.getNodes()){if(hn(e)&&e.getListType()==="check")continue;let o=e.getParent();if(hn(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(hn(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(ls,void 0)},order:12}])],O1=I(({featureProviderMap:t})=>{let e=[{Component:ns,position:"normal"}],o=so("checklist",t);return o&&e.push({Component:rt,position:"normal"}),{markdownTransformers:[$1],nodes:o?[A1,M1]:[],plugins:e,slashMenu:{groups:[lt([{Icon:pn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(ls,void 0)}}])]},toolbarFixed:{groups:rs},toolbarInline:{groups:rs}}});import{$isListNode as xn,INSERT_ORDERED_LIST_COMMAND as as,ListItemNode as P1,ListNode as B1}from"@lexical/list";import{ORDERED_LIST as j1}from"@lexical/markdown";import{$isRangeSelection as H1}from"lexical";import{jsx as is}from"react/jsx-runtime";import"react";var F1={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},gn=({className:t,size:e=24})=>is("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:is("path",{clipRule:"evenodd",d:F1[e],fill:"currentColor",fillRule:"evenodd"})});var ss=[te([{ChildComponent:gn,isActive:({selection:t})=>{if(!H1(t))return!1;for(let e of t.getNodes()){if(xn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(xn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(xn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(as,void 0)},order:10}])],G1=I(({featureProviderMap:t})=>{let e=so("ordered",t);return{markdownTransformers:[j1],nodes:e?[B1,P1]:[],plugins:e?[{Component:rt,position:"normal"}]:[],slashMenu:{groups:[lt([{Icon:gn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(as,void 0)}}])]},toolbarFixed:{groups:ss},toolbarInline:{groups:ss}}});import{$isListNode as bn,INSERT_UNORDERED_LIST_COMMAND as ds,ListItemNode as U1,ListNode as W1}from"@lexical/list";import{UNORDERED_LIST as V1}from"@lexical/markdown";import{$isRangeSelection as K1}from"lexical";import{jsx as cs}from"react/jsx-runtime";import"react";var z1="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",Cn=({className:t})=>cs("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:cs("path",{d:z1,fill:"currentColor"})});var us=[te([{ChildComponent:Cn,isActive:({selection:t})=>{if(!K1(t))return!1;for(let e of t.getNodes()){if(bn(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(bn(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(bn(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ds,void 0)},order:11}])],X1=I({markdownTransformers:[V1],nodes:[W1,U1],plugins:[{Component:rt,position:"normal"}],slashMenu:{groups:[lt([{Icon:Cn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ds,void 0)}}])]},toolbarFixed:{groups:us},toolbarInline:{groups:us}});import{$setBlocksType as ps}from"@lexical/selection";import{$createParagraphNode as hs,$getSelection as gs,$isParagraphNode as ms,$isRangeSelection as J1}from"lexical";var fs=[te([{ChildComponent:wt,isActive:({selection:t})=>{if(!J1(t))return!1;for(let e of t.getNodes())if(!ms(e)&&!ms(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=gs();ps(e,()=>hs())})},order:1}])],Y1=I({slashMenu:{groups:[J([{Icon:wt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=gs();ps(e,()=>hs())})}}])]},toolbarFixed:{groups:fs},toolbarInline:{groups:fs}});import{c as b0}from"react/compiler-runtime";import{jsx as Ps}from"react/jsx-runtime";import{useLexicalComposerContext as k0}from"@lexical/react/LexicalComposerContext";import{useEffect as _0,useState as T0}from"react";import{jsx as Fs,Fragment as C0}from"react/jsx-runtime";import"react";import{jsx as Z1}from"react/jsx-runtime";var xs={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Z1("blockquote",{children:o})}};import{jsx as q1}from"react/jsx-runtime";var Cs=new Set(["h1","h2","h3","h4","h5","h6"]);var bs={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=Cs.has(t.tag)?t.tag:"h1";return q1(n,{children:o})}};import{jsx as Q1}from"react/jsx-runtime";var ks={horizontalrule:Q1("hr",{})};import{jsx as e0}from"react/jsx-runtime";var _s={linebreak:e0("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 it,jsxs as t0,Fragment as o0}from"react/jsx-runtime";import{v4 as n0}from"uuid";var Es=new Set(["ol","ul"]);var Ss={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=Es.has(t.tag)?t.tag:"ul";return it(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=n0();return it("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:t0(o0,{children:[it("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),it("label",{htmlFor:l,children:r}),it("br",{})]})})}else return it("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as kn}from"react/jsx-runtime";var Ns={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?kn("p",{children:o}):kn("p",{children:kn("br",{})})}};var Ls={tab:" "};import{jsx as It}from"react/jsx-runtime";var ys={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return It("div",{className:"lexical-table-container",children:It("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:It("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return It(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return It("tr",{className:"lexical-table-row",children:o})}};import{jsx as ze}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},r0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,l0="\xA0",i0=`
54
+ `},[t,e]),m=Pe((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]);Sl(()=>{let x=k=>{if(!n)return;let _=k.key;ym(k)?m("selectAll",""):Ll.has(_)?m("press",k.key):[..._].length>1?m("keydown",k.key):m("type",k.key)},b=k=>{if(!n)return;let _=k.key;!Ll.has(_)&&[..._].length>1&&m("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,m]),Sl(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[f]),sn(()=>{if(e){let x=f();x!==null&&i(x),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[f,e]),sn(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:k,editorState:_})=>{if(!n)return;let T=_._selection,I=c.current,N=u.current;if(I!==T){if(k.size===0&&b.size===0&&!N){let y=ln(t._window);if(y&&(y.anchorNode==null||y.focusNode==null))return}c.current=T}u.current=!1;let w=f();w!==null&&i(w)}),[t,f,n,m]),sn(()=>n?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,n]);let p=Pe(x=>{n||(x.update(()=>{let b=wm();b.clear();let k=Em();b.append(Tm().append(k)),k.select()}),o([])),r(b=>!b)},[n]),h=Pe(()=>{if(!n)return;let x=ln(t._window);if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:b,anchorOffset:k,focusNode:_,focusOffset:T}=Rm(x),I=a().getRootElement(),N;b!==null&&(N=Nl(b,I));let w;_!==null&&(w=Nl(_,I)),m("snapshot",{anchorNode:b,anchorOffset:k,anchorPath:N,focusNode:_,focusOffset:T,focusPath:w})},[m,n,a]),g=Pe(()=>{Sm(f())},[f]),C=Pe(()=>{Nm("test.js",f())},[f]);return[Be("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:x=>{p(a()),x.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?cn("div",{className:"test-recorder-output",children:[cn("div",{className:"test-recorder-toolbar",children:[Be("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{g(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{C(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Be("pre",{id:"test-recorder",ref:d,children:s})]}):null]}var Rl=()=>{let t=km(3),[e]=_m(),[o,n]=vm(e),r;return t[0]!==o||t[1]!==n?(r=cn(yl.Fragment,{children:[Be("p",{children:"HI"}),o,n,Be("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var Im=A({plugins:[{Component:Rl,position:"bottom"}]});import{c as Mm}from"react/compiler-runtime";import{jsx as Am}from"react/jsx-runtime";import{useLexicalComposerContext as Dm}from"@lexical/react/LexicalComposerContext.js";import{TreeView as $m}from"@lexical/react/LexicalTreeView.js";import"react";var vl=()=>{let t=Mm(2),[e]=Dm(),o;return t[0]!==e?(o=Am($m,{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 Om=A({plugins:[{Component:vl,position:"bottom"}]});import{BOLD_ITALIC_STAR as Pm,BOLD_ITALIC_UNDERSCORE as Bm,BOLD_STAR as jm,BOLD_UNDERSCORE as Hm}from"@lexical/markdown";import{$isTableSelection as zm}from"@lexical/table";import{$isRangeSelection as Gm,FORMAT_TEXT_COMMAND as Um}from"lexical";import{jsx as Il}from"react/jsx-runtime";import"react";var Fm="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})=>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:Fm,fill:"currentColor",fillRule:"evenodd"})});var Q=t=>({type:"buttons",items:t,key:"format",order:40});var Al=[Q([{ChildComponent:Ml,isActive:({selection:t})=>Gm(t)||zm(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Um,"bold")},order:1}])],Wm=A(({featureProviderMap:t})=>{let e=[jm,Hm];return t.get("italic")&&e.push(Bm,Pm),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Al},toolbarInline:{groups:Al}}});import{INLINE_CODE as Km}from"@lexical/markdown";import{$isTableSelection as Jm}from"@lexical/table";import{$isRangeSelection as Xm,FORMAT_TEXT_COMMAND as Ym}from"lexical";import{jsx as Dl}from"react/jsx-runtime";import"react";var Vm="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",$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=[Q([{ChildComponent:$l,isActive:({selection:t})=>Xm(t)||Jm(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Ym,"code")},order:7}])],Zm=A({enableFormats:["code"],markdownTransformers:[Km],toolbarFixed:{groups:Ol},toolbarInline:{groups:Ol}});import{ITALIC_STAR as Qm,ITALIC_UNDERSCORE 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="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",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",{clipRule:"evenodd",d:qm,fill:"currentColor",fillRule:"evenodd"})});var Bl=[Q([{ChildComponent:Pl,isActive:({selection:t})=>of(t)||tf(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(nf,"italic")},order:2}])],rf=A({enableFormats:["italic"],markdownTransformers:[Qm,ef],toolbarFixed:{groups:Bl},toolbarInline:{groups:Bl}});import{STRIKETHROUGH as sf}from"@lexical/markdown";import{$isTableSelection as af}from"@lexical/table";import{$isRangeSelection as cf,FORMAT_TEXT_COMMAND as uf}from"lexical";import{jsx as jl}from"react/jsx-runtime";import"react";var lf="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",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 zl=[Q([{ChildComponent:Hl,isActive:({selection:t})=>cf(t)||af(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(uf,"strikethrough")},order:4}])],df=A({enableFormats:["strikethrough"],markdownTransformers:[sf],toolbarFixed:{groups:zl},toolbarInline:{groups:zl}});import{$isTableSelection as ff}from"@lexical/table";import{$isRangeSelection as pf,FORMAT_TEXT_COMMAND as hf}from"lexical";import{jsx as Gl}from"react/jsx-runtime";import"react";var mf="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652 3.925a.436.436 0 0 1-.287-.765l1.64-1.431q.259-.228.433-.407.175-.178.266-.345a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.195-.4 0-.643.21a.7.7 0 0 0-.133.151c-.127.197-.3.403-.534.403s-.432-.194-.367-.418q.11-.378.434-.642.494-.402 1.257-.403.513 0 .897.183.387.181.604.501.217.316.217.714 0 .316-.13.586-.125.27-.395.555a9 9 0 0 1-.695.634l-.927.798a.023.023 0 0 0 .016.042h1.895a.357.357 0 0 1 0 .714z",Ul=({className:t})=>Gl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Gl("path",{d:mf,fill:"currentColor"})});var Wl=[Q([{ChildComponent:Ul,isActive:({selection:t})=>pf(t)||ff(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(hf,"subscript")},order:5}])],gf=A({enableFormats:["subscript"],toolbarFixed:{groups:Wl},toolbarInline:{groups:Wl}});import{$isTableSelection as Cf}from"@lexical/table";import{$isRangeSelection as bf,FORMAT_TEXT_COMMAND as kf}from"lexical";import{jsx as Vl}from"react/jsx-runtime";import"react";var xf="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",Kl=({className:t})=>Vl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Vl("path",{d:xf,fill:"currentColor"})});var Jl=[Q([{ChildComponent:Kl,isActive:({selection:t})=>bf(t)||Cf(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(kf,"superscript")},order:6}])],_f=A({enableFormats:["superscript"],toolbarFixed:{groups:Jl},toolbarInline:{groups:Jl}});import{$isTableSelection as Ef}from"@lexical/table";import{$isRangeSelection as wf,FORMAT_TEXT_COMMAND as Sf}from"lexical";import{jsx as Xl}from"react/jsx-runtime";import"react";var Tf="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",Yl=({className:t})=>Xl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Xl("path",{clipRule:"evenodd",d:Tf,fill:"currentColor",fillRule:"evenodd"})});var Zl=[Q([{ChildComponent:Yl,isActive:({selection:t})=>wf(t)||Ef(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Sf,"underline")},order:3}])],Nf=A({enableFormats:["underline"],toolbarFixed:{groups:Zl},toolbarInline:{groups:Zl}});import{jsx as dn}from"react/jsx-runtime";import{jsx as Lf}from"react/jsx-runtime";function yf(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var ro=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[yf(o),n])):{};return Lf("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Rf}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as vf}from"@lexical/selection";import{$getNodeByKey as If,$getState as Mf,$setState as Af,createState as Df,TextNode as $f}from"lexical";import{useEffect as Of}from"react";function ql(t){let e=new Map;for(let o in t){let n=t[o],r=Df(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function un(t,e,o,n){t.update(()=>{vf(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);Af(r,l.stateConfig,n)})})}function Ql({stateMap:t}){let[e]=Rf();return Of(()=>e.registerMutationListener($f,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=If(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((c,u)=>{let d=Mf(l,c.stateConfig);if(!d){delete s.dataset[u];return}s.dataset[u]=d;let a=c.stateValues[d]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var ei=(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:()=>dn(ro,{css:i.css}),key:s,label:i.label,onSelect:({editor:c})=>{un(c,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>dn(ro,{css:{color:"var(--color-icon-secondary)"}}),items:[...[{ChildComponent:()=>dn(ro,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)un(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},Ff=A(({props:t})=>{let e=ql(t.state);return{plugins:[{Component:()=>Ql({stateMap:e}),position:"normal"}],toolbarFixed:{groups:ei(t,e)},toolbarInline:{groups:ei(t,e)}}});import{c as Qf}from"react/compiler-runtime";import{useLexicalComposerContext as ep}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as tp,$isHeadingNode as pi,HeadingNode as xi}from"@lexical/rich-text";import{$setBlocksType as op}from"@lexical/selection";import{$getSelection as np,$isRangeSelection as rp}from"lexical";import{useEffect as lp}from"react";import{jsx as ti}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 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",oi=({className:t})=>ti("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ti("path",{d:Pf,fill:"currentColor"})});import{jsx as ni}from"react/jsx-runtime";import"react";var Bf="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",ri=({className:t})=>ni("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ni("path",{d:Bf,fill:"currentColor"})});import{jsx as li,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",zf="M16.59 13.32 A1.5 1.25 0 1 1 18 15 A1.5 1.25 0 1 1 16.59 16.68",ii=({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:[li("path",{d:Hf,fill:"currentColor"}),li("path",{d:zf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as si,jsxs as Gf}from"react/jsx-runtime";import"react";var Uf="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 17.5 V12.5 L16.5 15.85 H19.5",ai=({className:t})=>Gf("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[si("path",{d:Uf,fill:"currentColor"}),si("path",{d:Wf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ci,jsxs as Vf}from"react/jsx-runtime";import"react";var Kf="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",Jf="M19.2 12.5 H16.8 V14.9 A1.5 1.5 0 1 1 16.7 16.9",ui=({className:t})=>Vf("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[ci("path",{d:Kf,fill:"currentColor"}),ci("path",{d:Jf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as di,jsxs as Xf}from"react/jsx-runtime";import"react";var Yf="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",Zf="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",mi=({className:t})=>Xf("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[di("path",{d:Yf,fill:"currentColor"}),di("path",{d:Zf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{HEADING as qf}from"@lexical/markdown";var fi=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`;return{...qf,regExp:new RegExp(o)}};var hi=t=>{let e=np();op(e,()=>tp(t))},gi={h1:oi,h2:ri,h3:ii,h4:ai,h5:ui,h6:mi},ip=A(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[oe(e.map((n,r)=>({ChildComponent:gi[n],isActive:({selection:l})=>{if(!rp(l))return!1;for(let s of l.getNodes()){if(pi(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(pi(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(()=>{hi(n)})},order:r+2})))];return{markdownTransformers:[fi(e)],nodes:[xi],plugins:[{Component:sp,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[q(e.map(n=>({Icon:gi[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(()=>{hi(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),sp=t=>{let e=Qf(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,[c]=ep(),u,d;return e[4]!==c||e[5]!==l||e[6]!==i?(u=()=>{if(!(!i||l.length===6))return c.registerNodeTransform(xi,a=>{l.includes(a.getTag())||a.setTag(i)})},d=[c,l,i],e[4]=c,e[5]=l,e[6]=i,e[7]=u,e[8]=d):(u=e[7],d=e[8]),lp(u,d),null};import{$isNodeSelection as Sp}from"lexical";import{jsx as Ci}from"react/jsx-runtime";import"react";var ap="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",mn=({className:t})=>Ci("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ci("path",{d:ap,fill:"currentColor"})});var be=t=>({type:"dropdown",ChildComponent:Ir,items:t,key:"add",order:10});import{addClassNamesToElement as cp}from"@lexical/utils";import{$applyNodeReplacement as up,createCommand as dp,DecoratorNode as mp}from"lexical";var vt=dp("INSERT_HORIZONTAL_RULE_COMMAND"),Rt=class extends mp{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:fp,priority:0})}}static importJSON(e){return bi()}createDOM(e){let o=document.createElement("hr");return cp(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{...super.exportJSON(),type:"horizontalrule"}}getTextContent(){return`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function fp(){return{node:bi()}}function bi(){return up(new Rt)}import{$applyNodeReplacement as pp}from"lexical";import"react";var ke=class extends Rt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{hr:()=>({conversion:hp,priority:0})}}static importJSON(e){return je()}decorate(){return null}exportJSON(){return super.exportJSON()}};function hp(){return{node:je()}}function je(){return pp(new ke)}function He(t){return t instanceof ke}var ki={type:"element",dependencies:[ke],export:(t,e)=>He(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=je();e&&t.replace(e)}};import{c as gp}from"react/compiler-runtime";import{useLexicalComposerContext as xp}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as _i,$insertNodeToNearestRoot as Cp}from"@lexical/utils";import{$getRoot as bp,$getSelection as Ti,$isRangeSelection as Ei,$isRootOrShadowRoot as wi,COMMAND_PRIORITY_EDITOR as kp}from"lexical";import{useEffect as _p}from"react";var fn="LexicalEditorTheme__hrSelected",Si=()=>{let t=gp(3),[e]=xp(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(vt,Tp,kp),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let u=bp().getChildren(),d=Ti(),a=[];for(let x=0;x<u.length;x++){let b=u[x];if(He(b)){let k=e.getElementByKey(b.getKey());k&&a.push({element:k,index:x})}}if(a.length===0)return;if(!Ei(d)||d.isCollapsed()){for(let{element:x}of a)x.classList.remove(fn);return}let f=d.anchor.getNode(),m=d.focus.getNode(),p=_i(f,Ep)||f,h=_i(m,wp)||m,g=u.indexOf(p),C=u.indexOf(h);if(g===-1||C===-1)return;let E=Math.min(g,C),L=Math.max(g,C);for(let{element:x,index:b}of a)b>=E&&b<=L?x.classList.add(fn):x.classList.remove(fn)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),_p(o,n),null};function Tp(t){let e=Ti();if(!Ei(e))return!1;if(e.focus.getNode()!==null){let n=je();Cp(n)}return!0}function Ep(t){return wi(t.getParent())}function wp(t){return wi(t.getParent())}var Np=A({markdownTransformers:[ki],nodes:[ke],plugins:[{Component:Si,position:"normal"}],slashMenu:{groups:[q([{Icon:mn,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(vt,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:mn,isActive:({selection:t})=>{if(!Sp(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(vt,void 0)}}])]}});import{$findMatchingParent as Oi}from"@lexical/utils";import{$isElementNode as Hp,INDENT_CONTENT_COMMAND as zp,OUTDENT_CONTENT_COMMAND as Gp}from"lexical";import{jsx as pn}from"react/jsx-runtime";import"react";var Lp="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Ni=({className:t})=>pn("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:pn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:pn("path",{clipRule:"evenodd",d:Lp,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as Li}from"react/jsx-runtime";import"react";var yp="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",yi=({className:t})=>Li("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Li("path",{clipRule:"evenodd",d:yp,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Rp}from"react/jsx-runtime";import{useLexicalComposerContext as vp}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Ip}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Mp,mergeRegister as hn}from"@lexical/utils";import{$addUpdateTag as gn,$getSelection as Ii,$isElementNode as Mi,$isRangeSelection as Ai,$isRootOrShadowRoot as Ap,BLUR_COMMAND as Dp,COMMAND_PRIORITY_HIGH as lo,COMMAND_PRIORITY_LOW as xn,FOCUS_COMMAND as $p,INDENT_CONTENT_COMMAND as Ri,KEY_ESCAPE_COMMAND as Op,KEY_TAB_COMMAND as vi,OUTDENT_CONTENT_COMMAND as Fp,SELECTION_CHANGE_COMMAND as Pp,SKIP_DOM_SELECTION_TAG as Cn,TabNode as Bp}from"lexical";import{useEffect as bn}from"react";var Di=({clientProps:t})=>{let[e]=vp(),{disabledNodes:o,disableTabNode:n}=t;return bn(()=>{let r=!1,l=!1,s=()=>{r=!1},i,c,u;function d(){s(),l=!1}function a(h){if(h.key!=="Tab"||!r){["Escape","Shift","Tab"].includes(h.key)||s();return}let g=e.getRootElement();if(!g)return;s(),l=!0,h.stopPropagation(),i?.(),clearTimeout(c);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]')]),L=new Map;for(let x of E)L.set(x,x.getAttribute("tabindex")),x.setAttribute("tabindex","-1");i=()=>{for(let[x,b]of L)b===null?x.removeAttribute("tabindex"):x.setAttribute("tabindex",b);i=void 0},c=setTimeout(()=>i?.(),0),e.update(()=>gn(Cn))}function f(h){if(h.key==="Escape"&&!h.defaultPrevented&&e.isEditable()){if(r&&!h.repeat)return;h.preventDefault(),h.stopPropagation(),r=!0}}let m=e.registerRootListener(h=>{u?.abort(),u=new AbortController;let{signal:g}=u;h?.addEventListener("pointerdown",d,{signal:g}),h?.addEventListener("keydown",a,{capture:!0,signal:g}),h?.addEventListener("keydown",f,{signal:g})}),p=hn(e.registerCommand(Op,h=>e.isEditable()?(f(h),!0):!1,xn),e.registerCommand(vi,()=>{let h=Ii();return Ai(h)&&h.isCollapsed()&&Ap(h.anchor.getNode())?(s(),l=!0,gn(Cn),!0):!1},lo),e.registerCommand(Dp,()=>(s(),!1),lo),e.registerCommand($p,()=>(d(),!1),lo),e.registerCommand(Pp,()=>{let h=e.getRootElement();return l&&h?.ownerDocument.activeElement!==h&&gn(Cn),!1},lo));return()=>{p(),m(),u?.abort(),clearTimeout(c),i?.()}},[e]),bn(()=>{if(!(!e||!o?.length))return hn(e.registerCommand(Ri,()=>jp(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),xn),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);Mi(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),bn(()=>{if(!(!e||!n))return hn(e.registerCommand(vi,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?Fp:Ri,void 0)),xn),e.registerNodeTransform(Bp,r=>{r.remove()}))},[e,n]),Rp(Ip,{})};function jp(t){let e=Ii();if(!Ai(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=Mp(l,u=>Mi(u)&&!u.isInline());if(i===null)continue;let c=i.getKey();i.canIndent()&&!o.has(c)&&(o.add(c),t(i))}return o.size>0}var $i=t=>({type:"buttons",items:t,key:"indent",order:35});var Fi=({disabledNodes:t})=>[$i([{ChildComponent:Ni,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Pi(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!Oi(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Gp,void 0)},order:1},{ChildComponent:yi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Pi(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!Oi(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(zp,void 0)},order:2}])],Up=A(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Di,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Fi({disabledNodes:e})},toolbarInline:{groups:Fi({disabledNodes:e})}}}),Pi=t=>Hp(t)&&t.canIndent();import{$findMatchingParent as a0}from"@lexical/utils";import{$getSelection as Rn,$isRangeSelection as ks}from"lexical";import{jsx as Bi}from"react/jsx-runtime";import"react";var Wp={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"},io=({className:t,size:e=24})=>Bi("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:Bi("path",{d:Wp[e],fill:"currentColor"})});import{$isAtNodeEnd as ji}from"@lexical/selection";function it(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?ji(o)?n:r:ji(e)?n:r}var kn=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as r1}from"lexical";function _n(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 Vp=/^(?:[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+)?$/,Kp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w-]+)$/;function Hi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||Vp.test(t)||Kp.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 Jp,isHTMLAnchorElement as Xp}from"@lexical/utils";import Gi from"bson-objectid";import{$applyNodeReplacement as Yp,$createTextNode as zi,$getSelection as Zp,$isElementNode as Ui,$isRangeSelection as En,createCommand as qp,ElementNode as Qp}from"lexical";var e1=new Set(["http:","https:","mailto:","sms:","tel:"]),ne=class extends Qp{__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:t1,priority:1})}}static importJSON(e){return _e({}).updateFromJSON(e)}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=Tn(o.rel,"add","noopener")),Jp(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},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!En(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(Ui(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(!e1.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=Tn(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Tn(o.rel,"remove","noopener"))),!1}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields).setID(o.id)}};function t1(t){let e=null;if(Xp(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new Gi.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 Yp(new ne({id:t??new Gi.default().toHexString(),fields:e}))}function X(t){return t instanceof ne}var pe=qp("TOGGLE_LINK_COMMAND");function wn(t){let e=Zp();if(!En(e)&&(t===null||!t.selectedNodes?.length))return;let o=En(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();X(s)&&(s.getChildren().forEach(c=>{s.insertBefore(c)}),s.remove())});return}if(o?.length===1){let l=o[0],s=X(l)?l:o1(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(zi(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||Ui(l)&&!l.isInline())){if(X(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(zi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=_e({fields:t.fields}),X(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),X(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 o1(t){return n1(t,e=>X(e))}function n1(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Tn(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 l1=(t,e)=>{let[,o,n]=e,r=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=r1(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},i1=t=>({type:"text-match",dependencies:[ne],export:(e,o)=>{if(!X(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=_n(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=_n(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:l1,trigger:")"}),Wi=i1();import{$applyNodeReplacement as s1,$isElementNode as a1}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){return It({}).updateFromJSON(e)}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:e.version}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(a1(n)){let r=It({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields)}};function It({fields:t}){return s1(new Te({id:"",fields:t}))}function Ee(t){return t instanceof Te}import{c as c1}from"react/compiler-runtime";import{useLexicalComposerContext as u1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as d1}from"@lexical/utils";import{$createTextNode as Vi,$getSelection as m1,$isElementNode as Ji,$isLineBreakNode as Xi,$isNodeSelection as f1,$isRangeSelection as p1,$isTextNode as Mt,TextNode as h1}from"lexical";import{useEffect as g1}from"react";function Ki(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 Yi(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var x1=/[.,;\s]/;function ao(t){return t!==void 0&&x1.test(t)}function Zi(t){return ao(t[t.length-1])}function Nn(t){return ao(t[0])}function C1(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function qi(t){let e=t.getPreviousSibling();return Ji(e)&&(e=e.getLastDescendant()),e===null||Xi(e)||Mt(e)&&Zi(e.getTextContent())}function Qi(t){let e=t.getNextSibling();return Ji(e)&&(e=e.getFirstDescendant()),e===null||Xi(e)||Mt(e)&&Nn(e.getTextContent())}function b1(t,e,o,n){return(t>0?ao(o[t-1]):qi(n[0]))?e<o.length?ao(o[e]):Qi(n[n.length-1]):!1}function k1(t,e,o){let n=[],r=[],l=[],s=0,i=0,c=[...t];for(;c.length>0;){let u=c[0],a=u.getTextContent().length,f=i;i+a<=e?(n.push(u),s+=a):f>=o?l.push(u):r.push(u),i+=a,c.shift()}return[s,n,r,l]}function _1(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=It({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 c=Vi(n.text);c.setFormat(i.getFormat()),c.setDetail(i.getDetail()),c.setStyle(i.getStyle()),l.append(c),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,c;e===0?c=s:[,c]=s.splitText(e);let u=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,p=i,h=i+m;if(p<o)if(h<=o)u.push(a);else{let[g,C]=a.splitText(o-p);g&&u.push(g),d=C}i+=m}),c){let a=m1(),f=a?a.getNodes().find(Mt):void 0,m=Vi(c.getTextContent());return m.setFormat(c.getFormat()),m.setDetail(c.getDetail()),m.setStyle(c.getStyle()),l.append(m,...u),f&&f===c&&(p1(a)?m.select(a.anchor.offset,a.focus.offset):f1(a)&&m.select(0,m.getTextContent().length)),c.replace(l),d}}}function T1(t,e,o){let n=[...t],r=n.map(c=>c.getTextContent()).join(""),l=r,s,i=0;for(;(s=Yi(l,e))!=null&&s!==null;){let c=s.index,u=s.length,d=c+u;if(b1(i+c,i+d,r,n)){let[f,,m,p]=k1(n,i+c,i+d),h=i+c-f,g=i+d-f,C=_1(m,h,g,s);n=C?[C,...p]:p,o(s.url,null),i=0}else i+=d;l=l.substring(d)}}function Sn(t,e,o){let n=t.getChildren(),r=n.length;for(let c=0;c<r;c++){let u=n[c];if(!Mt(u)||!u.isSimpleText()){so(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Yi(l,e);if(s===null||s.text!==l){so(t),o(null,t.getFields()?.url??null);return}if(!qi(t)||!Qi(t)){so(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let c=t.getFields();c.url=s?.url,t.setFields(c),o(s.url,i??null)}}function E1(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;(!Nn(l)||C1(l,s))&&(n.append(t),Sn(n,e,o),o(null,n.getFields()?.url??null))}Ee(r)&&!Zi(l)&&(so(r),Sn(r,e,o),o(null,r.getFields()?.url??null))}function so(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 w1(t){let e=[t],o=t.getNextSibling();for(;o!==null&&Mt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function S1(t,e,o){let n=c1(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,c)=>{o?.(i,c)};return d1(t.registerNodeTransform(h1,i=>{let c=i.getParentOrThrow(),u=i.getPreviousSibling();if(Ee(c))Sn(c,e,s);else if(!X(c)){if(i.isSimpleText()&&(Nn(i.getTextContent())||!Ee(u))){let d=w1(i);T1(d,e,s)}E1(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]),g1(r,l)}var N1=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,L1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,y1=[Ki(N1,t=>t.startsWith("http")?t:`https://${t}`),Ki(L1,t=>`mailto:${t}`)],es=()=>{let[t]=u1();return S1(t,y1),null};import{jsx as R1}from"react/jsx-runtime";import{ClickableLinkPlugin as v1}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var ts=()=>R1(v1,{});import{jsx as Z1}from"react/jsx-runtime";import"react";import{createPortal as q1}from"react-dom";import{jsx as re,jsxs as ze,Fragment as Ln}from"react/jsx-runtime";import{useLexicalComposerContext as A1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as D1}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as ss,mergeRegister as as}from"@lexical/utils";import{getTranslation as yn}from"@payloadcms/translations";import{formatDrawerSlug as $1,NewTabIcon as cs,useConfig as O1,useEditDepth as F1,useLocale as P1,useTranslation as B1,WriteIcon as j1}from"@payloadcms/ui";import{requests as H1}from"@payloadcms/ui/shared";import{$getSelection as us,$isLineBreakNode as z1,$isRangeSelection as ds,$onUpdate as G1,COMMAND_PRIORITY_HIGH as U1,COMMAND_PRIORITY_LOW as ms,getDOMSelection as W1,KEY_ESCAPE_COMMAND as V1,SELECTION_CHANGE_COMMAND as K1}from"lexical";import{formatAdminURL as J1}from"payload/shared";import X1,{useCallback as fs,useEffect as mo,useLayoutEffect as Y1,useRef as ps,useState as Ge}from"react";import{jsx as os}from"react/jsx-runtime";import"react";var I1="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",ns=({className:t})=>os("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:os("path",{d:I1,fill:"currentColor"})});import{jsx as rs}from"react/jsx-runtime";import"react";var ls={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"},is=({className:t,small:e})=>rs("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:rs("path",{clipRule:"evenodd",d:e?ls.small:ls.default,fill:"currentColor",fillRule:"evenodd"})});function co(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(),c=t.top-n,u=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let d=e.scrollWidth,a=i.right-u,f=u-i.left,m;if(d<=a)m=e.getBoundingClientRect();else{let p=f+t.width,h=f>a,C=Math.min(d,h?p:a);C<d&&(e.style.width=`${C}px`,e.style.maxWidth=`${C}px`,e.offsetHeight),h&&(u=t.right-C),m=e.getBoundingClientRect()}c<i.top&&(c+=m.height+t.height+n*2),u+m.width>i.right&&(u=i.right-m.width-r),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as M1}from"lexical";var uo=M1("TOGGLE_LINK_WITH_MODAL_COMMAND");function hs(t){t.preventDefault()}function gs({anchorElem:t}){let[e]=A1(),[o,n]=Ge(),r=ps(null),l=ps(null),[s,i]=Ge(null),[c,u]=Ge(null),{fieldProps:{schemaPath:d},uuid:a}=U(),f=D1(),{config:m,getEntityConfig:p}=O1(),{i18n:h,t:g}=B1(),[C,E]=Ge(),L=F1(),[x,b]=Ge(!1),[k,_]=Ge([]),T=P1(),[I,N]=Ge(!1),w=$1({slug:"lexical-rich-text-link-"+a,depth:L}),{toggleDrawer:y}=De(w),S=fs(()=>{b(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),u(null),_([]),E(void 0)},[b,i,u,_]),R=fs(()=>{let v=us(),D;if(!ds(v)||!v){S();return}let F=it(v);D=e.getElementByKey(F.getKey())?.getBoundingClientRect();let M=ss(F,X),B=v.getNodes().filter(ie=>!z1(ie)).find(ie=>{let me=ss(ie,X);return M&&!M.is(me)||me&&!me.is(M)});if(M==null||B){S();return}n(M);let $=M.getFields(),P={...$,id:M.getID(),text:M.getTextContent()};if($?.linkType==="custom")i($?.url??null),u(null);else{i(`${m.routes.admin==="/"?"":m.routes.admin}/collections/${$?.doc?.relationTo}/${$?.doc?.value}`);let ie=$?.doc?.relationTo?p({collectionSlug:$?.doc?.relationTo}):void 0;if(!ie)u($?.label?String($?.label):null),i($?.url?String($?.url):null);else{let me=typeof $.doc?.value=="object"?$.doc.value.id:$.doc?.value,Ct=$.doc?.relationTo;if(!me||!Ct)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Gt=g("fields:linkedTo",{label:`${yn(ie.labels.singular,h)} - ${g("lexical:link:loadingWithEllipsis",h)}`}).replace(/<[^>]*>?/g,"");u(Gt),H1.get(J1({apiRoute:m.routes.api,path:`/${Ct}/${me}`,serverURL:m.serverURL}),{headers:{"Accept-Language":h.language},params:{depth:0,locale:T?.code}}).then(async ce=>{if(!ce.ok)throw new Error(`HTTP error! Status: ${ce.status}`);let Ae=await ce.json(),Ut=ie?.admin?.useAsTitle||"id",Bo=Ae[Ut],jo=g("fields:linkedTo",{label:`${yn(ie.labels.singular,h)} - ${Bo}`}).replace(/<[^>]*>?/g,"");u(jo)}).catch(()=>{let ce=g("fields:linkedTo",{label:`${yn(ie.labels.singular,h)} - ${g("general:untitled",h)} - ID: ${me}`}).replace(/<[^>]*>?/g,"");u(ce)})}}E(P),b(!0),_(v?v?.getNodes():[]),Ee(M)?N(!0):N(!1);let V=r.current,Xe=W1(e._window),{activeElement:xt}=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)):(xt==null||xt.className!=="link-input")&&(Ye!==null&&co(null,V,t),i(null),u(null)),!0},[e,S,m.routes.admin,m.routes.api,m.serverURL,p,g,h,T?.code,t]);return mo(()=>as(e.registerCommand(uo,v=>(e.dispatchCommand(pe,v),R(),y(),!0),ms)),[e,R,y,w]),mo(()=>{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]),mo(()=>as(e.registerUpdateListener(({editorState:v})=>{v.read(()=>{R()})}),e.registerCommand(K1,()=>(G1(()=>e.read("latest",R)),!0),ms),e.registerCommand(V1,v=>x?(v.preventDefault(),v.stopImmediatePropagation(),S(),!0):!1,U1)),[e,R,x,S]),mo(()=>{e.getEditorState().read(()=>{R()})},[e,R]),Y1(()=>{!x||!r.current||!t||!l.current||co(l.current,r.current,t)},[s,c,x,t,o]),ze(X1.Fragment,{children:[re("div",{className:"link-editor","data-theme":"dark",hidden:!x,ref:r,children:ze("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?re(io,{}):re(ns,{}),s&&s.length>0?ze("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[c!=null&&c.length>0?c:s,o?.__fields.newTab?ze(Ln,{children:[re(cs,{size:16})," ",re("div",{className:"link-input__divider"})," "]}):null]}):c!=null&&c.length>0?ze(Ln,{children:[re("span",{className:"link-input__label-pure",children:c}),o?.__fields.newTab?ze(Ln,{children:[re(cs,{size:16})," ",re("div",{className:"link-input__divider"})," "]}):null]}):null,f&&ze("div",{className:"link-input__actions",children:[re("button",{"aria-label":"Edit link",className:"link-edit",onClick:v=>{v.preventDefault(),y()},onMouseDown:hs,tabIndex:0,type:"button",children:re(j1,{})}),!I&&re("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(pe,null)},onMouseDown:hs,tabIndex:0,type:"button",children:re(is,{small:!0})})]})]})}),re(Vo,{className:"lexical-link-edit-drawer",data:C,drawerSlug:w,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(v,D)=>{let F=D,M={...F};delete M.text,e.update(()=>{let B=us(),$=null;if(ds(B)?$=it(B).getParent():k.length&&($=k[0]?.getParent()??null),$&&Ee($)){let P=_e({fields:M});$.replace(P,!0)}}),e.dispatchCommand(pe,{fields:M,selectedNodes:k,text:F.text})},schemaPath:d,schemaPathSuffix:"fields"})]})}var xs=t=>{let{anchorElem:e=document.body}=t;return q1(Z1(gs,{anchorElem:e}),e)};import{c as Q1}from"react/compiler-runtime";import{useLexicalComposerContext as e0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as t0}from"@lexical/utils";import{$getSelection as o0,$isElementNode as n0,$isRangeSelection as r0,COMMAND_PRIORITY_LOW as Cs,PASTE_COMMAND as l0}from"lexical";import{useEffect as i0}from"react";var bs=t=>{let e=Q1(5),{clientProps:o}=t,[n]=e0(),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 t0(n.registerCommand(pe,s=>s===null?(wn(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),wn(s),!0),Cs),n.registerCommand(l0,s=>{let i=o0();if(!r0(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let c=s.clipboardData.getData("text");if(!Hi(c))return!1;if(!i.getNodes().some(s0)){let u={doc:null,linkType:"custom",newTab:!1,url:c};return n.dispatchCommand(pe,{fields:u,text:null}),s.preventDefault(),!0}return!1},Cs))},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]),i0(r,l),null};function s0(t){return n0(t)}var _s=[kn([{ChildComponent:io,isActive:({selection:t})=>{if(ks(t)){let e=it(t);return a0(e,X)!=null}return!1},isEnabled:({selection:t})=>!!(ks(t)&&Rn()?.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=Rn()?.getTextContent(),n=Rn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(uo,{fields:r,selectedNodes:n,text:o})}},order:1}])],c0=A(({props:t})=>({markdownTransformers:[Wi],nodes:[ne,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:bs,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:es,position:"normal"},{Component:ts,position:"normal"},{Component:xs,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:_s},toolbarInline:{groups:_s}}));import{$isListNode as In,INSERT_CHECK_LIST_COMMAND as Ss,ListItemNode as h0,ListNode as g0}from"@lexical/list";import{CHECK_LIST as x0}from"@lexical/markdown";import{$isRangeSelection as C0}from"lexical";import{jsx as Ts}from"react/jsx-runtime";import"react";var u0={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"},vn=({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",{d:u0[e],fill:"currentColor"})});import{jsx as d0}from"react/jsx-runtime";import{ListPlugin as m0}from"@lexical/react/LexicalListPlugin.js";import"react";var st=()=>d0(m0,{});function fo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function at(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{jsx as f0}from"react/jsx-runtime";import{CheckListPlugin as p0}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Es=()=>f0(p0,{});var ws=[oe([{ChildComponent:vn,isActive:({selection:t})=>{if(!C0(t))return!1;for(let e of t.getNodes()){if(In(e)&&e.getListType()==="check")continue;let o=e.getParent();if(In(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(In(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ss,void 0)},order:12}])],b0=A(({featureProviderMap:t})=>{let e=[{Component:Es,position:"normal"}],o=fo("checklist",t);return o&&e.push({Component:st,position:"normal"}),{markdownTransformers:[x0],nodes:o?[g0,h0]:[],plugins:e,slashMenu:{groups:[at([{Icon:vn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(Ss,void 0)}}])]},toolbarFixed:{groups:ws},toolbarInline:{groups:ws}}});import{$isListNode as An,INSERT_ORDERED_LIST_COMMAND as ys,ListItemNode as _0,ListNode as T0}from"@lexical/list";import{ORDERED_LIST as E0}from"@lexical/markdown";import{$isRangeSelection as w0}from"lexical";import{jsx as Ns}from"react/jsx-runtime";import"react";var k0={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},Mn=({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",{clipRule:"evenodd",d:k0[e],fill:"currentColor",fillRule:"evenodd"})});var Ls=[oe([{ChildComponent:Mn,isActive:({selection:t})=>{if(!w0(t))return!1;for(let e of t.getNodes()){if(An(e)&&e.getListType()==="number")continue;let o=e.getParent();if(An(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(An(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ys,void 0)},order:10}])],S0=A(({featureProviderMap:t})=>{let e=fo("ordered",t);return{markdownTransformers:[E0],nodes:e?[T0,_0]:[],plugins:e?[{Component:st,position:"normal"}]:[],slashMenu:{groups:[at([{Icon:Mn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(ys,void 0)}}])]},toolbarFixed:{groups:Ls},toolbarInline:{groups:Ls}}});import{$isListNode as $n,INSERT_UNORDERED_LIST_COMMAND as Is,ListItemNode as L0,ListNode as y0}from"@lexical/list";import{UNORDERED_LIST as R0}from"@lexical/markdown";import{$isRangeSelection as v0}from"lexical";import{jsx as Rs}from"react/jsx-runtime";import"react";var N0="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",Dn=({className:t})=>Rs("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:Rs("path",{d:N0,fill:"currentColor"})});var vs=[oe([{ChildComponent:Dn,isActive:({selection:t})=>{if(!v0(t))return!1;for(let e of t.getNodes()){if($n(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if($n(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!($n(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Is,void 0)},order:11}])],I0=A({markdownTransformers:[R0],nodes:[y0,L0],plugins:[{Component:st,position:"normal"}],slashMenu:{groups:[at([{Icon:Dn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Is,void 0)}}])]},toolbarFixed:{groups:vs},toolbarInline:{groups:vs}});import{$setBlocksType as Ds}from"@lexical/selection";import{$createParagraphNode as $s,$getSelection as Os,$isParagraphNode as Ms,$isRangeSelection as M0}from"lexical";var As=[oe([{ChildComponent:St,isActive:({selection:t})=>{if(!M0(t))return!1;for(let e of t.getNodes())if(!Ms(e)&&!Ms(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Os();Ds(e,()=>$s())})},order:1}])],A0=A({slashMenu:{groups:[q([{Icon:St,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Os();Ds(e,()=>$s())})}}])]},toolbarFixed:{groups:As},toolbarInline:{groups:As}});import{c as oh}from"react/compiler-runtime";import{jsx as ra}from"react/jsx-runtime";import{useLexicalComposerContext as nh}from"@lexical/react/LexicalComposerContext";import{useEffect as rh,useState as lh}from"react";import{jsx as na,Fragment as th}from"react/jsx-runtime";import"react";import{jsx as D0}from"react/jsx-runtime";var Fs={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return D0("blockquote",{children:o})}};import{jsx as $0}from"react/jsx-runtime";var Ps=new Set(["h1","h2","h3","h4","h5","h6"]);var Bs={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=Ps.has(t.tag)?t.tag:"h1";return $0(n,{children:o})}};import{jsx as O0}from"react/jsx-runtime";var js={horizontalrule:O0("hr",{})};import{jsx as F0}from"react/jsx-runtime";var Hs={linebreak:F0("br",{})};import{jsx as zs}from"react/jsx-runtime";var Gs=({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 zs("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="#")),zs("a",{href:s,rel:r,target:l,children:n})}});import{jsx as ct,jsxs as P0,Fragment as B0}from"react/jsx-runtime";import{v4 as j0}from"uuid";var Us=new Set(["ol","ul"]);var Ws={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=Us.has(t.tag)?t.tag:"ul";return ct(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=j0();return ct("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:P0(B0,{children:[ct("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),ct("label",{htmlFor:l,children:r}),ct("br",{})]})})}else return ct("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as On}from"react/jsx-runtime";var Vs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?On("p",{children:o}):On("p",{children:On("br",{})})}};var Ks={tab:" "};import{jsx as At}from"react/jsx-runtime";var Js={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return At("div",{className:"lexical-table-container",children:At("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:At("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 At(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 At("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ue}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},H0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,z0="\xA0",G0=`
56
56
 
57
- `,Rs="\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",s0=new RegExp("^[^"+vs+"]*["+Rs+"]"),a0=new RegExp("^[^"+Rs+"]*["+vs+"]"),c0={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},u0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},d0={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},m0={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},f0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},p0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Is={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=ze("strong",{children:e})),t.format&O.IS_ITALIC&&(e=ze("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=ze("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=ze("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=ze("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=ze("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=ze("sup",{children:e})),e}};import{jsx as Mt}from"react/jsx-runtime";var Ms={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return Mt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Mt("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let u=i?.url;l.push(Mt("source",{media:`(max-width: ${i.width}px)`,srcSet:u,type:i.mimeType},s))}return l.push(Mt("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),Mt("picture",{children:l})}};var st={...Ns,...Is,..._s,...xs,...ys,...bs,...ks,...Ss,...ws({}),...Ms,...Ls};import{jsx as co,Fragment as h0}from"react/jsx-runtime";import ao from"react";function As(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function g0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return co("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function $s(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return ao.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return co("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function x0(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=$s(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]=$s(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=g0(r))}return e}function Ds({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(As(e)){let l=r?x0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Os({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return co(h0,{})}function Os({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=>Os({converters:f.converters??t,disableIndent:f.disableIndent??e,disableTextAlign:f.disableTextAlign??o,nodes:f.nodes,parent:f.parent??{...i,parent:r}}),parent:r}):d:c=co("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),ao.isValidElement(c)){if(a.textAlign||a.paddingInlineStart){let m={...a,...c?.props?.style??{}};return ao.cloneElement(c,{key:u,style:m})}return ao.cloneElement(c,{key:u})}return c}catch(c){return console.error("Error converting lexical node to JSX:",c,"node:",i),null}}).filter(Boolean)}function _n({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i=e,u={};i?typeof i=="function"?u=i({defaultConverters:st}):u=i:u=st;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Ds({converters:u,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Fs(C0,{children:d}):Fs("div",{className:t??"payload-richtext",children:d})}function Bs(){let t=b0(7),[e]=k0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=T0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:d}=u;r(d.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),_0(l,s);let i;return t[5]!==n?(i=Ps("div",{className:"debug-jsx-converter",children:Ps(_n,{converters:st,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var w0=I({plugins:[{Component:Bs,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)"}},E0={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 ph}from"lexical";import{jsx as js}from"react/jsx-runtime";import"react";var S0="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",Tn=({className:t})=>js("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:js("path",{d:S0,fill:"currentColor"})});import{jsx as v0}from"react/jsx-runtime";import{$applyNodeReplacement as I0}from"lexical";import*as Gs from"react";import{DecoratorBlockNode as N0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as L0}from"@lexical/utils";import{$applyNodeReplacement as y0}from"lexical";function R0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Hs({relationTo:o,value:e})}:null}var At=class extends N0{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:R0,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=Hs(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return L0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Hs(t){return y0(new At({data:t}))}var M0=Gs.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function A0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ue({relationTo:o,value:e})}:null}var Ee=class extends At{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:A0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Ue(o);return n.setFormat(e.format),n}decorate(e,o){return v0(M0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ue(t){return I0(new Ee({data:t}))}function wn(t){return t instanceof Ee}import{c as oh}from"react/compiler-runtime";import{jsx as nh}from"react/jsx-runtime";import{useLexicalComposerContext as rh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as lh}from"@lexical/utils";import{$getPreviousSelection as ih,$getSelection as sh,$isParagraphNode as ah,$isRangeSelection as ch,COMMAND_PRIORITY_EDITOR as uh,createCommand as dh}from"lexical";import{useEffect as mh}from"react";import{c as Ws}from"react/compiler-runtime";import{jsx as En}from"react/jsx-runtime";import{useLexicalComposerContext as Vs}from"@lexical/react/LexicalComposerContext.js";import{toast as W0}from"@payloadcms/ui";import{$getNodeByKey as V0,COMMAND_PRIORITY_EDITOR as Ks}from"lexical";import{useEffect as Xs,useState as K0}from"react";import{c as $0}from"react/compiler-runtime";import{jsx as D0}from"react/jsx-runtime";import{useLexicalComposerContext as O0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as F0,useModal as P0}from"@payloadcms/ui";import{$getNodeByKey as zs,$getPreviousSelection as B0,$getRoot as j0,$getSelection as H0,$isRangeSelection as G0,$setSelection as z0}from"lexical";import{useEffect as U0,useState as Us}from"react";var $t=t=>{let e=$0(23),[o]=O0(),[n,r]=Us(null),[l,s]=Us(!1),[i,u,d]=F0(t),{closeDrawer:c,drawerSlug:a,isDrawerOpen:m,openDrawer:f}=d,{modalState:h}=P0(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{let L=H0()??B0();r(L)},e[0]=p):p=e[0];let x=p,T;e[1]!==o||e[2]!==n?(T=()=>{n&&o.update(()=>{if(G0(n)){let{anchor:L,focus:E}=n;zs(L.key)&&zs(E.key)&&z0(n.clone())}else j0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=T):T=e[3];let N=T,S;e[4]!==c?(S=()=>{c()},e[4]=c,e[5]=S):S=e[5];let g=S,C,b;e[6]!==a||e[7]!==h||e[8]!==N||e[9]!==l?(C=()=>{if(!l)return;let L=h[a];L&&!L?.isOpen&&(s(!1),setTimeout(()=>{N()},1))},b=[h,a,N,l],e[6]=a,e[7]=h,e[8]=N,e[9]=l,e[10]=C,e[11]=b):(C=e[10],b=e[11]),U0(C,b);let k;e[12]!==u?(k=L=>D0(u,{...L,onClick:()=>{x()}}),e[12]=u,e[13]=k):k=e[13];let _;e[14]!==f?(_=()=>{x(),f(),s(!0)},e[14]=f,e[15]=_):_=e[15];let A;return e[16]!==i||e[17]!==g||e[18]!==m||e[19]!==a||e[20]!==k||e[21]!==_?(A={closeListDrawer:g,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:_},e[16]=i,e[17]=g,e[18]=m,e[19]=a,e[20]=k,e[21]=_,e[22]=A):A=e[22],A};var X0=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=V0(o);r&&r.replace(Ue({relationTo:e,value:n}))}):t.dispatchCommand(Sn,{relationTo:e,value:n})},J0=t=>{let e=Ws(14),{enabledCollectionSlugs:o}=t,[n]=Vs(),[r,l]=K0(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:u,ListDrawer:d,openListDrawer:c}=$t(i),a,m;e[3]!==n||e[4]!==c?(a=()=>n.registerCommand(Ye,x=>(l(x?.replace?x?.replace.nodeKey:null),c(),!0),Ks),m=[n,c],e[3]=n,e[4]=c,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Xs(a,m);let f;e[7]!==u||e[8]!==n||e[9]!==r?(f=x=>{let{collectionSlug:T,doc:N}=x;X0({editor:n,relationTo:T,replaceNodeKey:r,value:N.id}),u()},e[7]=u,e[8]=n,e[9]=r,e[10]=f):f=e[10];let h=f,p;return e[11]!==d||e[12]!==h?(p=En(d,{onSelect:h}),e[11]=d,e[12]=h,e[13]=p):p=e[13],p},Y0=()=>{let t=Ws(3),[e]=Vs(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Ye,Z0,Ks),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Xs(o,n),null},Js=({enabledCollectionSlugs:t})=>t?.length?En(J0,{enabledCollectionSlugs:t}):En(Y0,{});function Z0(){return W0.error("No relationship collections enabled"),!0}import{c as q0}from"react/compiler-runtime";import{useConfig as Q0,useEntityVisibility as eh}from"@payloadcms/ui";import"react";var uo=t=>{let e=q0(11),{enabledCollectionSlugs:o}=t,{config:n}=Q0(),{collections:r}=n,{visibleEntities:l}=eh(),s,i;if(e[0]!==r||e[1]!==o||e[2]!==l){let d;e[5]!==o||e[6]!==l?(d=a=>{let{slug:m}=a;return o.includes(m)&&(!l?.collections||l.collections.includes(m))},e[5]=o,e[6]=l,e[7]=d):d=e[7];let c=r.filter(d);s=c,i=c.map(th),e[0]=r,e[1]=o,e[2]=l,e[3]=s,e[4]=i}else s=e[3],i=e[4];let u;return e[8]!==s||e[9]!==i?(u={enabledCollections:s,enabledCollectionSlugs:i},e[8]=s,e[9]=i,e[10]=u):u=e[10],u};function th(t){return t.slug}var Sn=dh("INSERT_RELATIONSHIP_COMMAND"),Ys=t=>{let e=oh(7),{clientProps:o}=t,[n]=rh(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=uo(r),s,i;e[2]!==n?(s=()=>{if(!n.hasNodes([Ee]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Sn,fh,uh)},i=[n],e[2]=n,e[3]=s,e[4]=i):(s=e[3],i=e[4]),mh(s,i);let u;return e[5]!==l?(u=nh(Js,{enabledCollectionSlugs:l}),e[5]=l,e[6]=u):u=e[6],u};function fh(t){let e=sh()||ih();if(ch(e)){let o=Ue(t),{focus:n}=e,r=n.getNode();lh(o),ah(r)&&!r.__first&&r.remove()}return!0}var hh=I({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(!ph(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 Yh}from"react/compiler-runtime";import{jsx as pe,jsxs as Zh}from"react/jsx-runtime";import{useLexicalComposerContext as qh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as aa}from"@lexical/react/useLexicalEditable";import{useScrollInfo as Qh,useThrottledEffect as e5,useTranslation as t5}from"@payloadcms/ui";import*as ca from"react";import{useMemo as vn}from"react";import{jsx as gh,jsxs as xh}from"react/jsx-runtime";import{Tooltip as Ch,useTranslation as bh}from"@payloadcms/ui";import{$addUpdateTag as kh}from"lexical";import{useCallback as Zs,useEffect as _h,useMemo as qs,useRef as Th,useState as wh}from"react";var Nn="toolbar-popup__button",Dt=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=bh(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=z(),[u,d]=wh(!1),c=Th(null);_h(()=>{c.current?.removeAttribute("data-pressing")},[t]);let a=qs(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,p=>p.toUpperCase()),[s,l,i,r]),m=qs(()=>[Nn,n?"":"disabled",t?"active":"",r.key?`${Nn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),f=Zs(()=>{n&&o.focus(()=>{o.update(()=>{kh("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=Zs(p=>{p.preventDefault(),p.currentTarget.setAttribute("data-pressing","")},[]);return xh("button",{"aria-label":a,className:m,"data-button-key":r.key,disabled:!n,onClick:f,onMouseDown:h,onPointerEnter:()=>d(!0),onPointerLeave:()=>{d(!1),c.current?.removeAttribute("data-pressing")},ref:c,type:"button",children:[gh(Ch,{className:`${Nn}__tooltip`,show:u,children:a}),e]})};import{c as vh}from"react/compiler-runtime";import{jsx as at}from"react/jsx-runtime";import Ih,{useMemo as Mh}from"react";import{useTranslation as Ah}from"@payloadcms/ui";import{jsx as Me,jsxs as Qs}from"react/jsx-runtime";import{Button as Eh}from"@payloadcms/ui";import{$addUpdateTag as Sh,isDOMNode as Nh}from"lexical";import mo,{useCallback as Lh,useEffect as fo,useMemo as ta,useRef as Ln,useState as yn}from"react";import{createPortal as yh}from"react-dom";var ea="toolbar-popup__dropdown-item",oa=mo.createContext(null);function na({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let u=ta(()=>[ea,n===!1?"disabled":"",t?"active":"",l?.key?`${ea}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),d=Ln(null),c=mo.use(oa);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=c;return fo(()=>{d?.current!=null&&a(d)},[d,a]),Me(Eh,{"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(()=>{Sh("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:i,type:"button",children:e})}function Rh({children:t,dropdownKey:e,dropDownRef:o,itemsContainerClassNames:n,onClose:r}){let[l,s]=yn(),[i,u]=yn(),d=Lh(m=>{s(f=>f!=null?[...f,m]:[m])},[s]),c=m=>{if(l==null)return;let{key:f}=m;["ArrowDown","ArrowUp","Escape","Tab"].includes(f)&&m.preventDefault(),f==="Escape"||f==="Tab"?r():f==="ArrowUp"?u(h=>{if(h==null)return l[0];let p=l.indexOf(h)-1;return l[p===-1?l.length-1:p]}):f==="ArrowDown"&&u(h=>h==null?l[0]:l[l.indexOf(h)+1])},a=ta(()=>({registerItem:d}),[d]);return fo(()=>{l!=null&&i==null&&u(l[0]),i!=null&&i?.current!=null&&i.current.focus()},[l,i]),Me(oa,{value:a,children:Me("div",{className:(n??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":e,"data-theme":"dark",onKeyDown:c,ref:o,children:t})})}function ra({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:u}){let d=Ln(null),c=Ln(null),[a,m]=yn(!1),f=()=>{m(!1),c?.current!=null&&c.current.focus()};fo(()=>{let p=c.current,x=d.current;if(a&&p!==null&&x!==null){let{left:T,top:N}=p.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;x.style.top=`${N+S+p.offsetHeight+5}px`,x.style.left=`${Math.min(T-5,window.innerWidth-x.offsetWidth-20)}px`}},[d,c,a]),fo(()=>{let p=c.current;if(p!==null&&a){let x=T=>{let N=T.target;Nh(N)&&(u&&d.current&&d.current.contains(N)||p.contains(N)||m(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[d,c,a,u]);let h=yh(Me(Rh,{dropdownKey:r,dropDownRef:d,itemsContainerClassNames:s,onClose:f,children:o}),document.body);return Qs(mo.Fragment,{children:[Qs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":r,disabled:n,onClick:p=>{p.preventDefault(),m(!a)},onMouseDown:p=>{p.preventDefault()},ref:c,type:"button",children:[l&&Me(l,{}),i&&Me("span",{className:"toolbar-popup__dropdown-label",children:i}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Me(mo.Fragment,{children:h})]})}var Rn="toolbar-popup__dropdown",$h=t=>{let e=vh(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:u}=Ah(),{fieldProps:d}=z(),{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&&at(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=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=at(na,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?at(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?f:void 0,children:at("span",{className:"text",children:h})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=c,e[10]=u,e[11]=s,e[12]=i,e[13]=a,e[14]=m}else m=e[14];return m},Dh=Ih.memo($h),Ot=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:u,key:d}=n,c=Mh(()=>u?.length?u.map(a=>at(Dh,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[u,r.activeItemKeys,r.enabledItemKeys,t,o]);return at(ra,{buttonAriaLabel:`${d} dropdown`,buttonClassName:[Rn,`${Rn}-${d}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:d,Icon:l,itemsContainerClassNames:[`${Rn}-items`,...s||[]],label:i,children:c},d)};import{mergeRegister as Oh}from"@lexical/utils";import{$getSelection as Fh}from"lexical";import{useCallback as Ph,useDeferredValue as Bh,useEffect as jh,useRef as la,useState as Hh}from"react";function Gh(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]=Hh(()=>Gh(e)),r=Bh(o),l=z(),s=la(l);s.current=l;let i=la(e);i.current=e;let u=gr(),d=Ph(()=>{t.getEditorState().read(()=>{let c=Fh();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 x=[],T=[],N=[],S=p.type==="dropdown"?p.maxActiveItems??1:void 0;for(let C of p.items){let b=C.isActive?(!S||x.length<S)&&C.isActive({editor:t,editorConfigContext:m,selection:c}):!1,k=C.isEnabled?C.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;b&&(x.push(C.key),T.push(C)),k&&N.push(C.key),f.set(C.key,{active:b,enabled:k})}let g=p.type==="dropdown"&&p.isEnabled?p.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;h.set(p.key,{activeItemKeys:x,activeItems:T,enabledGroup:g,enabledItemKeys:N})}n({groupStates:h,itemStates:f})})},[t]);return jh(()=>{u(d);let c=()=>{u(d)},a=Oh(t.registerUpdateListener(c));return document.addEventListener("mouseup",c),()=>{a(),document.removeEventListener("mouseup",c)}},[t,u,d]),r}import{c as zh}from"react/compiler-runtime";import{useEffect as Uh}from"react";var Wh=".fixed-toolbar__scroll",Vh=40;function Kh({clientWidth:t,deltaMode:e,deltaY:o,isRightToLeft:n}){let r=e===1?o*Vh:e===2?o*t:o;return n?-r:r}function ia(t){if(!(Math.abs(t.deltaY)>Math.abs(t.deltaX)))return;let o=t.target;if(!(o instanceof Element))return;let n=o.closest(Wh);!n||!(n.scrollWidth>n.clientWidth)||(t.preventDefault(),n.scrollLeft+=Kh({clientWidth:n.clientWidth,deltaMode:t.deltaMode,deltaY:t.deltaY,isRightToLeft:getComputedStyle(n).direction==="rtl"}))}var ct=0;function sa(){let t=zh(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],Uh(Xh,e)}function Xh(){return ct===0&&document.addEventListener("wheel",ia,{passive:!1}),ct=ct+1,Jh}function Jh(){ct=ct-1,ct===0&&document.removeEventListener("wheel",ia)}function o5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&pe(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?pe(Dt,{active:t,editor:o,enabled:n,item:r,children:pe(r.ChildComponent,{})},r.key):null}function n5({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=t5(),{fieldProps:{featureClientSchemaMap:i,schemaPath:u}}=z(),d=l.groupStates.get(n.key),c=vn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,d?.activeItems]),a=vn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let f=m[0],h=f.key;return f.label&&(h=typeof f.label=="function"?f.label({featureClientSchemaMap:i,i18n:s,schemaPath:u}):f.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,d?.activeItems,s,i,u]);return Zh("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&d?pe(Ot,{anchorElem:t,editor:e,group:n,groupState:d,Icon:c,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let f=l.itemStates.get(m.key);return pe(o5,{active:f?.active??!1,anchorElem:t,editor:e,enabled:f?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&pe("div",{className:"divider"})]},n.key)}function r5({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=ca.useRef(null),s=aa(),{y:i}=Qh();sa();let u=po(o,n?.features?.toolbarFixed?.groups),d=vn(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return e5(()=>{if(!d)return;let c=l.current;if(!c)return;let a=c.getBoundingClientRect(),m=d.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,i]),pe("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&pe("div",{className:"fixed-toolbar__scroll",children:n?.features&&n.features?.toolbarFixed?.groups.map((c,a)=>pe(n5,{anchorElem:t,editor:o,editorConfig:n,group:c,index:a,toolbarStates:u},c.key))})})}var ua=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ua(t.parentEditor)}return!1},da=t=>{let e=Yh(6),{clientProps:o}=t,[n]=qh(),r=z();if(!aa())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,u=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,d,c;if(e[0]!==o||e[1]!==i||e[2]!==u||e[3]!==r){c=Symbol.for("react.early_return_sentinel");e:{let a=ua(r);if(o?.disableIfParentHasFixedToolbar&&a){c=null;break e}if(!u?.features?.toolbarFixed?.groups?.length){c=null;break e}d=pe(r5,{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 l5=I({plugins:[{Component:da,position:"aboveContainer"}]});import{c as i5}from"react/compiler-runtime";import{jsx as Se,jsxs as pa}from"react/jsx-runtime";import{useLexicalComposerContext as s5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as a5}from"@lexical/react/useLexicalEditable";import{mergeRegister as ha}from"@lexical/utils";import{$getSelection as ga,$isRangeSelection as ma,$isTextNode as c5,COMMAND_PRIORITY_LOW as u5,getDOMSelection as xa,SELECTION_CHANGE_COMMAND as d5}from"lexical";import{useCallback as go,useEffect as Ft,useMemo as m5,useRef as fa,useState as f5}from"react";import"react";import{createPortal as p5}from"react-dom";function In(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function ho(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:u,verticalGap:d=10}=t,c=o.parentElement;if(u===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),f=c.getBoundingClientRect(),h=u.top-a.height-d,p=u.left-l;s==="center"&&(p=u.left+u.width/2-a.width/2);let x=0;return!e&&h<f.top&&!i&&(x=a.height+u.height+d*2,h+=x),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)`),x}function h5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&Se(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?Se(Dt,{active:t,editor:o,enabled:n,item:r,children:Se(r.ChildComponent,{})},r.key):null}function g5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=z(),s=r.groupStates.get(o.key),i=m5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return pa("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Se(Ot,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(u=>{let d=r.itemStates.get(u.key);return Se(h5,{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 x5({anchorElem:t,editor:e}){let o=fa(null),n=fa(null),{editorConfig:r}=z(),l=po(e,r?.features?.toolbarInline?.groups),s=go(()=>{if(o?.current){let c=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=go(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let f=c.clientX,h=c.clientY,p=document.elementFromPoint(f,h);o.current.contains(p)||s()}}},[s]),u=go(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ft(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",u)}),[o,i,u]);let d=go(()=>{let c=ga(),a=xa(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),f=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(c!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let p=In(a,h),x=ho({alwaysDisplayOnTop:f,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:p});n.current&&ho({anchorElem:o.current,anchorFlippedOffset:x,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:p,verticalGap:8})}else s()},[e,s,t]);return Ft(()=>{let c=t.parentElement,a=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",a),c&&c.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),c&&c.removeEventListener("scroll",a)}},[e,d,t]),Ft(()=>(e.getEditorState().read(()=>{d()}),ha(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(d5,()=>(d(),!1),u5))),[e,d]),pa("div",{className:"inline-toolbar-popup",ref:o,children:[Se("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,a)=>Se(g5,{anchorElem:t,editor:e,group:c,index:a,toolbarStates:l},c.key))]})}function C5(t,e){let o=i5(12),[n,r]=f5(!1),l=a5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let f=ga(),h=xa(t._window),p=t.getRootElement();if(h!==null&&(!ma(f)||p===null||!p.contains(h.anchorNode))){r(!1);return}if(!ma(f))return;if(f.getTextContent()!==""){let T=f.getNodes(),N=!1;for(let S of T)if(c5(S)){r(!0),N=!0;break}N||r(!1)}else r(!1);let x=f.getTextContent().replace(/\n/g,"");if(!f.isCollapsed()&&x===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,u,d;o[2]!==i?(u=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),d=[i],o[2]=i,o[3]=u,o[4]=d):(u=o[3],d=o[4]),Ft(u,d);let c,a;if(o[5]!==t||o[6]!==i?(c=()=>ha(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=a):(c=o[7],a=o[8]),Ft(c,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=p5(Se(x5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Ca=t=>{let{anchorElem:e}=t,[o]=s5();return C5(o,e)};var b5=I({plugins:[{Component:Ca,position:"floatingAnchorElem"}]});import{TableCellNode as p2,TableNode as h2,TableRowNode as g2}from"@lexical/table";import{jsx as ba}from"react/jsx-runtime";import"react";var k5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Mn=({className:t,size:e=24})=>ba("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ba("path",{clipRule:"evenodd",d:k5[e],fill:"currentColor",fillRule:"evenodd"})});import{$convertToMarkdownString as _5}from"@lexical/markdown";import{$createTableCellNode as T5,$createTableNode as w5,$createTableRowNode as E5,$isTableCellNode as ka,$isTableNode as An,$isTableRowNode as $n,TableCellHeaderStates as xo,TableCellNode as S5,TableNode as N5,TableRowNode as L5}from"@lexical/table";import{$isParagraphNode as y5,$isTextNode as R5}from"lexical";var Ta=/^\|(.+)\|\s?$/,v5=/^(\| ?:?-*:? ?)+\|\s?$/,wa=({allTransformers:t})=>({type:"element",dependencies:[N5,L5,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())ka(s)&&(r.push(_5(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===xo.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
58
- `)},regExp:Ta,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(v5.test(r)){let a=e.getPreviousSibling();if(!a||!An(a))return;let m=a.getChildren(),f=m[m.length-1];if(!f||!$n(f))return;f.getChildren().forEach(h=>{ka(h)&&h.setHeaderStyles(xo.ROW,xo.ROW)}),e.remove();return}let l=_a(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),u=l.length;for(;i&&!(!y5(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!R5(a))break;let m=_a(a.getTextContent(),t);if(m==null)break;u=Math.max(u,m.length),s.unshift(m);let f=i.getPreviousSibling();i.remove(),i=f}let d=w5();for(let a of s){let m=E5();d.append(m);for(let f=0;f<u;f++)m.append(f<a.length?a[f]:Ea("",t))}let c=e.getPreviousSibling();An(c)&&I5(c)===u?(c.append(...d.getChildren()),e.remove()):e.replace(d),d.selectEnd()}});function I5(t){let e=t.getFirstChild();return $n(e)?e.getChildrenSize():0}var Ea=(t,e)=>{t=t.replace(/\\n/g,`
59
- `);let o=T5(xo.NO_STATUS);return Yt(t,e,o,!1,!0),o},_a=(t,e)=>{let o=t.match(Ta);return!o||!o[1]?null:o[1].split("|").map(n=>Ea(n,e))};import{c as D5}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 O5}from"@lexical/react/useLexicalEditable";import{$computeTableMap as F5,$deleteTableColumnAtSelection as P5,$deleteTableRowAtSelection as B5,$getNodeTriplet as j5,$getTableCellNodeFromLexicalNode as Ra,$getTableNodeFromLexicalNodeOrThrow as Ae,$getTableRowIndexFromTableCellNode as H5,$insertTableColumnAtSelection as G5,$insertTableRowAtSelection as z5,$isTableCellNode as Ia,$isTableSelection as Pt,$mergeCells as U5,$setTableColumnIsHeader as W5,$setTableRowIsHeader as V5,$unmergeCell as K5,getTableElement as Dn,getTableObserverFromTableElement as On,TableCellHeaderStates as ut,TableCellNode as X5}from"@lexical/table";import{mergeRegister as J5}from"@lexical/utils";import{useScrollInfo as Y5}from"@payloadcms/ui";import{$getSelection as bo,$isElementNode as Z5,$isRangeSelection as Fn,$isTextNode as q5,$setSelection as Q5,COMMAND_PRIORITY_CRITICAL as eg,getDOMSelection as tg,isDOMNode as og,SELECTION_CHANGE_COMMAND as ng}from"lexical";import*as Pn from"react";import{useCallback as ue,useEffect as dt,useRef as Co,useState as mt}from"react";import{createPortal as Ma}from"react-dom";import{jsx as Sa}from"react/jsx-runtime";import"react";var M5={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},Na=({className:t,size:e=24})=>Sa("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Sa("path",{clipRule:"evenodd",d:M5[e],fill:"currentColor",fillRule:"evenodd"})});import{$computeTableCellRectBoundary as A5,$computeTableMap as $5,$getNodeTriplet as La}from"@lexical/table";function ya({selection:t}){let[e,,o]=La(t.anchor),[n]=La(t.focus),[r,l,s]=$5(o,e,n),{maxColumn:i,maxRow:u,minColumn:d,minRow:c}=A5(r,l,s);return{columns:i-d+1,rows:u-c+1}}function rg(){let t=bo();if(Fn(t)&&!t.isCollapsed()||Pt(t)&&!t.anchor.is(t.focus)||!Fn(t)&&!Pt(t))return!1;let[e]=j5(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function lg(t){let e=t.getLastDescendant();q5(e)?e.select():Z5(e)?e.selectEnd():e!==null&&e.selectNext()}function ig({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=va(),s=Co(null),[i,u]=mt(r),[d,c]=mt({columns:1,rows:1}),[a,m]=mt(!1),[f,h]=mt(!1),{y:p}=Y5();dt(()=>l.registerMutationListener(X5,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{u(i.getLatest())})},{skipInitialization:!0}),[l,i]),dt(()=>{l.getEditorState().read(()=>{let w=bo();if(Pt(w)){let y=ya({selection:w});c(y);let v=w.anchor.is(w.focus);m(!v&&(y.columns>1||y.rows>1))}h(rg())})},[l]),dt(()=>{let w=e.current,y=s.current,v=l.getRootElement();if(w!=null&&y!=null&&v!=null){let $=v.getBoundingClientRect(),M=w.getBoundingClientRect();y.style.opacity="1";let D=y.getBoundingClientRect(),H=5,F=M.right+H;if(F+D.width>window.innerWidth||F+D.width>$.right){let X=M.left-D.width-H;F=(X<0?H:X)+window.pageXOffset}y.style.left=`${F+window.pageXOffset}px`;let Z=M.top;if(Z+D.height>window.innerHeight){let X=M.bottom-D.height;Z=X<0?H:X}y.style.top=`${Z}px`}},[e,s,l,p]),dt(()=>{function w(y){s.current!=null&&e.current!=null&&og(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 x=ue(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i),y=Dn(w,l.getElementByKey(w.getKey()));if(y===null)throw new Error("Expected to find tableElement in DOM");let v=On(y);v!==null&&v.$clearHighlight(),w.markDirty(),u(i.getLatest())}Q5(null)})},[l,i]),T=()=>{l.update(()=>{let w=bo();if(!Pt(w))return;let v=w.getNodes().filter(Ia),$=U5(v);$&&(lg($),o())})},N=()=>{l.update(()=>{K5()}),x()},S=ue(w=>{l.update(()=>{for(let y=0;y<d.rows;y++)z5(w);o()})},[l,o,d.rows]),g=ue(w=>{l.update(()=>{for(let y=0;y<d.columns;y++)G5(w);o()})},[l,o,d.columns]),C=ue(()=>{l.update(()=>{B5(),o()})},[l,o]),b=ue(()=>{l.update(()=>{Ae(i).remove(),x(),o()})},[l,i,x,o]),k=ue(()=>{l.update(()=>{P5(),o()})},[l,o]),_=ue(()=>{l.update(()=>{let w=Ae(i),y=H5(i),v=!i.hasHeaderState(ut.ROW);V5(w,y,v),x(),o()})},[l,i,x,o]),A=ue(()=>{l.update(()=>{let w=Ae(i),[,y]=F5(w,i,i),v=!i.hasHeaderState(ut.COLUMN);W5(w,y.startColumn,v),x(),o()})},[l,i,x,o]),L=ue(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i);w&&w.setRowStriping(!w.getRowStriping())}x(),o()})},[l,i,x,o]),E=ue(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}x(),o()})},[l,i,x,o]),R=null;return t&&(a?R=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):f&&(R=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>N(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),Ma(Ne("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[R?Ne(Pn.Fragment,{children:[R,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>L(),type:"button",children:B("span",{className:"text",children:"Toggle row striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>E(),type:"button",children:B("span",{className:"text",children:"Toggle first column freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>S(!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:()=>S(!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:()=>g(!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:()=>g(!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:()=>k(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>b(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>_(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&ut.ROW)===ut.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>A(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&ut.COLUMN)===ut.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function sg({anchorElem:t,cellMerge:e}){let[o]=va(),n=Co(null),r=Co(null),[l,s]=mt(!1),[i,u]=mt(null),d=ue(()=>{let a=n.current,m=bo(),f=tg(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 x=o.getRootElement(),T=null,N=null;if(Fn(m)&&x!==null&&f!==null&&x.contains(f.anchorNode)){let g=Ra(m.anchor.getNode());if(g==null||(N=o.getElementByKey(g.getKey()),N==null||!g.isAttached()))return p();let C=Ae(g),b=Dn(C,o.getElementByKey(C.getKey()));if(b===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=On(b),u(g)}else if(Pt(m)){let g=Ra(m.anchor.getNode());if(!Ia(g))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=Ae(g),b=Dn(C,o.getElementByKey(C.getKey()));if(b===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=On(b),N=o.getElementByKey(g.getKey())}else if(!h)return p();if(T===null||N===null)return p();let S=!T||!T.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let g=N.getBoundingClientRect(),C=t.getBoundingClientRect(),b=g.top-C.top,k=g.right-C.left;a.style.transform=`translate(${k}px, ${b}px)`}},[o,t]);dt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(d)},f=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return J5(o.registerUpdateListener(f),o.registerCommand(ng,f,eg),o.registerRootListener((h,p)=>{p&&p.removeEventListener("pointerup",f),h&&(h.addEventListener("pointerup",f),f())}),()=>clearTimeout(a))});let c=Co(i);return dt(()=>{c.current!==i&&s(!1),c.current=i},[c,i]),B("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Ne(Pn.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:B(Na,{})}),l&&B(ig,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Aa=t=>{let e=D5(3),{anchorElem:o}=t,n=O5(),r;return e[0]!==o||e[1]!==n?(r=Ma(n?B(sg,{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 ag}from"react/compiler-runtime";import{jsx as _o,jsxs as cg}from"react/jsx-runtime";import{useLexicalComposerContext as ug}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as dg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as mg,$getTableNodeFromLexicalNodeOrThrow as Bn,$getTableRowIndexFromTableCellNode as fg,$isTableCellNode as $a,$isTableRowNode as pg,getDOMCellFromTarget as hg,getTableElement as gg,TableNode as Da}from"@lexical/table";import{calculateZoomLevel as Oa,mergeRegister as xg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as jn,isHTMLElement as Cg,SKIP_SCROLL_INTO_VIEW_TAG as Fa}from"lexical";import*as Ba from"react";import{useCallback as Bt,useEffect as Hn,useRef as ko,useState as ft}from"react";import{createPortal as bg}from"react-dom";var kg=33,Pa=92;function _g({editor:t}){let e=ko(null),o=ko(null),n=ko(null),[r,l]=ft(!1),s=z(),i=ko(null),[u,d]=ft(null),[c,a]=ft(null),[m,f]=ft(!1),[h,p]=ft(null),x=Bt(()=>{a(null),e.current=null,p(null),i.current=null,n.current=null},[]),T=E=>(E.buttons&1)===1;Hn(()=>{let E=new Set;return xg(t.registerMutationListener(Da,R=>{for(let[w,y]of R)y==="destroyed"?E.delete(w):E.add(w);l(E.size>0)}),t.registerNodeTransform(Da,R=>{if(R.getColWidths())return R;let w=R.getColumnCount(),y=Pa;return R.setColWidths(Array(w).fill(y)),R}))},[t]),Hn(()=>{if(!r)return;let E=v=>{let $=v.target;if(Cg($)){if(h){d({x:v.clientX,y:v.clientY});return}if(f(T(v)),!(o.current&&o.current.contains($))&&e.current!==$){e.current=$;let M=hg($);M&&c!==M?t.getEditorState().read(()=>{let D=jn(M.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let H=Bn(D),F=gg(H,t.getElementByKey(H.getKey()));if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=$,n.current=F.getBoundingClientRect(),a(M)},{editor:t}):M==null&&x()}}},R=v=>{f(!0)},w=v=>{f(!1)},y=t.registerRootListener((v,$)=>{$?.removeEventListener("mousemove",E),$?.removeEventListener("mousedown",R),$?.removeEventListener("mouseup",w),v?.addEventListener("mousemove",E),v?.addEventListener("mousedown",R),v?.addEventListener("mouseup",w)});return()=>{y()}},[c,h,t,r,x]);let N=E=>E==="bottom",S=Bt(E=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=jn(c.elem);if(!$a(R))throw new Error("TableCellResizer: Table cell node not found.");let w=Bn(R),y=fg(R),v=w.getChildren(),M=R.getColSpan()===w.getColumnCount()?y:y+R.getRowSpan()-1;if(M>=v.length||M<0)throw new Error("Expected table cell to be inside of table row.");let D=v[M];if(!pg(D))throw new Error("Expected table row");let H=D.getHeight();if(H===void 0){let Z=D.getChildren();H=Math.min(...Z.map(X=>g(X,t)??1/0))}let F=Math.max(H+E,kg);D.setHeight(F)},{tag:Fa})},[c,t]),g=(E,R)=>R.getElementByKey(E.getKey())?.clientHeight,C=(E,R)=>{let w;return R.forEach(y=>{y.forEach((v,$)=>{v.cell===E&&(w=$)})}),w},b=Bt(E=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=jn(c.elem);if(!$a(R))throw new Error("TableCellResizer: Table cell node not found.");let w=Bn(R),[y]=mg(w,null,null),v=C(R,y);if(v===void 0)throw new Error("TableCellResizer: Table column not found.");let $=w.getColWidths();if(!$)return;let M=$[v];if(M===void 0)return;let D=[...$],H=Math.max(M+E,Pa);D[v]=H,w.setColWidths(D)},{tag:Fa})},[c,t]),k=Bt(E=>{let R=w=>{if(w.preventDefault(),w.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:y,y:v}=i.current;if(c===null)return;let $=Oa(w.target);if(N(E)){let M=(w.clientY-v)/$;S(M)}else{let M=(w.clientX-y)/$;b(M)}x(),document.removeEventListener("mouseup",R)}};return R},[c,x,b,S]),_=Bt(E=>R=>{if(R.preventDefault(),R.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");i.current={x:R.clientX,y:R.clientY},d(i.current),p(E),document.addEventListener("mouseup",k(E))},[c,k]),[A,L]=ft({bottom:null,left:null,right:null,top:null});return Hn(()=>{if(c){let{height:E,left:R,top:w,width:y}=c.elem.getBoundingClientRect(),v=Oa(c.elem),$=10,M={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${$}px`,left:`${window.scrollX+R}px`,top:`${window.scrollY+w+E-$/2}px`,width:`${y}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${E}px`,left:`${window.scrollX+R+y-$/2}px`,top:`${window.scrollY+w}px`,width:`${$}px`}},D=n.current;h&&u&&D&&(N(h)?(M[h].left=`${window.scrollX+D.left}px`,M[h].top=`${window.scrollY+u.y/v}px`,M[h].height="3px",M[h].width=`${D.width}px`):(M[h].top=`${window.scrollY+D.top}px`,M[h].left=`${window.scrollX+u.x/v}px`,M[h].width="3px",M[h].height=`${D.height}px`),M[h].backgroundColor="#adf"),L(M)}else L({bottom:null,left:null,right:null,top:null})},[c,h,u]),_o("div",{ref:o,children:c!=null&&!m&&cg(Ba.Fragment,{children:[_o("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:A.right||void 0}),_o("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:A.bottom||void 0})]})})}var ja=()=>{let t=ag(3),[e]=ug(),o=dg(),n;return t[0]!==e||t[1]!==o?(n=o?bg(_o(_g,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],n};import{c as Rg}from"react/compiler-runtime";import{jsx as Gn,jsxs as vg,Fragment as Ig}from"react/jsx-runtime";import{useLexicalComposerContext as Mg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Xa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Ag,$getTableColumnIndexFromTableCellNode as $g,$getTableRowIndexFromTableCellNode as Dg,$insertTableColumnAtSelection as Og,$insertTableRowAtSelection as Fg,$isTableCellNode as Pg,$isTableNode as za,getTableElement as Bg,TableNode as jg}from"@lexical/table";import{$findMatchingParent as Hg,mergeRegister as Gg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ua,isHTMLElement as zg}from"lexical";import{useEffect as Wa,useMemo as Ug,useRef as Va,useState as To}from"react";import"react";import{createPortal as Wg}from"react-dom";import{c as Ng}from"react/compiler-runtime";import{useEffect as Lg,useRef as yg}from"react";var Tg="Expected a function",wg=Math.max,Eg=Math.min;function Sg(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(Tg);e=e||0,typeof o=="object"&&(i=!!o.leading,u="maxWait"in o,d=u?wg(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function f(b){let k=n,_=s;return n=s=void 0,l=b,c=t.apply(_,k),c}function h(b){return l=b,a=setTimeout(T,e),i?f(b):c}function p(b){let k=b-r,_=b-l,A=e-k;return u?Eg(A,d-_):A}function x(b){let k=b-r,_=b-l;return r===void 0||k>=e||k<0||u&&_>=d}function T(){let b=Date.now();if(x(b))return N(b);a=setTimeout(T,p(b))}function N(b){return a=void 0,m&&n?f(b):(n=s=void 0,c)}function S(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function g(){return a===void 0?c:N(Date.now())}function C(){let b=Date.now(),k=x(b);if(n=arguments,s=this,r=b,k){if(a===void 0)return h(r);if(u)return clearTimeout(a),a=setTimeout(T,e),f(r)}return a===void 0&&(a=setTimeout(T,e)),c}return C.cancel=S,C.flush=g,C}var Ha=Sg;function Ga(t,e,o){let n=Ng(6),r=yg(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=Ha(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),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 Ka=16;function Vg({anchorElem:t}){let[e]=Mg(),o=Xa(),n=z(),[r,l]=To(!1),[s,i]=To(!1),[u,d]=To(!1),[c,a]=To({}),m=Va(new Set),f=Va(null),h=Ga(T=>{let{isOutside:N,tableDOMNode:S}=Kg(T,n.editorConfig?.lexical);if(N){l(!1),i(!1);return}if(!S)return;f.current=S;let g=null,C=null,b=null;if(e.getEditorState().read(()=>{let M=Ua(S);if(Pg(M)){let D=Hg(M,H=>za(H));if(!za(D))return;if(b=Bg(D,e.getElementByKey(D.getKey())),b){let H=D.getChildrenSize(),F=D.getChildAtIndex(0)?.getChildrenSize(),Z=Dg(M),X=$g(M);Z===H-1?g=M:X===F-1&&(C=M)}}},{editor:e}),!b)return;let k=b.parentElement;if(!k)return;let{bottom:_,height:A,left:L,right:E,width:R,y:w}=b.getBoundingClientRect(),y=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(y=k.scrollWidth>k.clientWidth);let{left:v,y:$}=t.getBoundingClientRect();g?(i(!1),l(!0),a({height:Ka,left:y&&k?k.offsetLeft:L-v,top:_-$+5,width:y&&k?k.offsetWidth:R})):C&&(i(!0),l(!1),a({height:A,left:E-v+5,top:w-$,width:Ka}))},50,250),p=Ug(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Wa(()=>{if(u)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[u,h]),Wa(()=>Gg(e.registerMutationListener(jg,T=>{e.getEditorState().read(()=>{let N=!1;for(let[S,g]of T)switch(g){case"created":{m.current.add(S),N=!0;break}case"destroyed":{m.current.delete(S),N=!0;break}default:break}if(N){p.disconnect();for(let S of m.current){let{tableElement:g}=Ag(S);p.observe(g)}d(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,p]);let x=T=>{e.update(()=>{f.current&&(Ua(f.current)?.selectEnd(),T?(Fg(),l(!1)):(Og(),i(!1)))})};return o?vg(Ig,{children:[r&&Gn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...c},type:"button"}),s&&Gn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...c},type:"button"})]}):null}function Kg(t,e){let o=t.target;if(zg(o)){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function Ja(t){let e=Rg(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!Xa())return null;let l;return e[0]!==n?(l=Wg(Gn(Vg,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as Wn,jsxs as Zg}from"react/jsx-runtime";import{useLexicalComposerContext as qg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Qg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as e2,TableCellNode as t2,TableNode as o2,TableRowNode as n2}from"@lexical/table";import{mergeRegister as r2}from"@lexical/utils";import{$getSelection as l2,$isRangeSelection as i2,$setSelection as s2,COMMAND_PRIORITY_EDITOR as a2,createCommand as c2}from"lexical";import{createContext as u2,use as d2,useCallback as tc,useEffect as oc,useMemo as m2,useRef as f2,useState as wo}from"react";import*as nc from"react";import{jsx as Q,jsxs as Le}from"react/jsx-runtime";import{useCallback as zn,useEffect as Ya,useRef as Un,useState as jt}from"react";import*as Qa from"react";import{createPortal as Xg}from"react-dom";var Za=10,qa=7;function Jg(){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 Yg(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function ec({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=jt(0),[u,d]=jt(0),[c,a]=jt(""),[m,f]=jt(""),[h,p]=jt(null),x=Un(null),T=Un(null),N=Un(null),S=s>0?s:c?parseInt(c,10)||0:5,g=u>0?u:m?parseInt(m,10)||0:5;Ya(()=>{o||(i(0),d(0),a(""),f(""),p(null))},[o]),Ya(()=>{if(!o)return;let L=E=>{if(E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),n()),E.key==="Enter"&&h){E.preventDefault();let R=parseInt(c,10),w=parseInt(m,10);R>0&&w>0&&r(R,w)}};return document.addEventListener("keydown",L,!0),()=>document.removeEventListener("keydown",L,!0)},[o,n,r,h,c,m]);let C=zn((L,E)=>{L>0&&E>0&&r(L,E)},[r]),b=zn((L,E)=>{i(L),d(E)},[]),k=zn(()=>{i(0),d(0)},[]);if(!o||!l||!t)return null;let _=[];for(let L=1;L<=qa;L++)for(let E=1;E<=Za;E++){let R=E<=S&&L<=g,w=E<=s&&L<=u,y="table-grid-popup__cell";R&&w?y+=" table-grid-popup__cell--hover":R&&(y+=" table-grid-popup__cell--selected"),_.push(Q("div",{"aria-label":`${E} columns, ${L} rows`,className:y,onClick:()=>C(E,L),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),C(E,L))},onMouseEnter:()=>b(E,L),role:"button",tabIndex:-1},`${L}-${E}`))}let A=s>0&&u>0;return Xg(Le(Qa.Fragment,{children:[Q("div",{className:"table-grid-popup__backdrop",onClick:n}),Q("div",{className:"table-grid-popup",ref:x,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(Jg,{})}),Q("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>p(null),onChange:L=>a(L.target.value),onFocus:()=>p("cols"),placeholder:s>0?String(s):"5",ref:T,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(Yg,{})}),Q("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>p(null),onChange:L=>f(L.target.value),onFocus:()=>p("rows"),placeholder:u>0?String(u):"5",ref:N,type:"number",value:m})]})]}),Le("div",{className:"table-grid-popup__grid",onMouseLeave:k,children:[_,A&&Le("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/Za*100}%)`,top:`calc(${(u-1)/qa*100}%)`},children:[S," \xD7 ",g]})]})]})})]}),t)}var Eo=c2("OPEN_EMBED_DRAWER_COMMAND"),rc=u2({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function lc({children:t}){let[e,o]=wo({cellEditorConfig:null,cellEditorPlugins:null});return Wn(rc,{value:m2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ic=()=>{let[t]=qg(),e=d2(rc),[o,n]=wo(!1),[r,l]=wo(null),s=f2(null),[i,u]=wo(null);oc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;u(m??a.parentElement)}},[t]),oc(()=>{if(!t.hasNodes([o2,n2,t2]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return r2(t.registerCommand(Eo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),f=null;t.getEditorState().read(()=>{let p=l2();if(i2(p)){s.current=p.clone();let x=p.anchor.getNode(),T=t.getElementByKey(x.getKey());if(T){let N=T.getBoundingClientRect();N.height>0&&(f={left:N.left-m.left,top:N.bottom-m.top+8})}}});let h=window.getSelection();if(h&&h.rangeCount>0){let x=h.getRangeAt(0).getBoundingClientRect();x.height>0&&(f={left:x.left-m.left,top:x.bottom-m.top+8})}return f||(f={left:0,top:40}),l(f),n(!0),!0},a2))},[e,t,i]);let d=tc(()=>{n(!1)},[]),c=tc((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&s2(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(e2,{columns:String(a),rows:String(m)})},1)},[t]);return Zg(nc.Fragment,{children:[Wn(ec,{anchorElem:i,editor:t,isOpen:o,onClose:d,onInsert:c,position:r}),Wn(Qg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var x2=I({markdownTransformers:[wa],nodes:[h2,p2,g2],plugins:[{Component:ic,position:"normal"},{Component:ja,position:"normal"},{Component:Aa,position:"floatingAnchorElem"},{Component:Ja,position:"floatingAnchorElem"}],providers:[lc],slashMenu:{groups:[J([{Icon:Mn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Eo,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Mn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Eo,{})}}])]}});import{$isNodeSelection as V2}from"lexical";import{jsx as sc}from"react/jsx-runtime";import"react";var C2="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",Vn=({className:t})=>sc("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:sc("path",{clipRule:"evenodd",d:C2,fill:"currentColor",fillRule:"evenodd"})});import{c as N2}from"react/compiler-runtime";import{jsx as L2}from"react/jsx-runtime";import{useLexicalComposerContext as y2}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Cc,$insertNodeToNearestRoot as Jn,mergeRegister as R2}from"@lexical/utils";import{useBulkUpload as v2,useEffectEvent as I2,useModal as M2}from"@payloadcms/ui";import Yn from"bson-objectid";import{$createRangeSelection as A2,$getPreviousSelection as fc,$getSelection as pc,$isParagraphNode as Zn,$isRangeSelection as hc,$setSelection as $2,COMMAND_PRIORITY_EDITOR as D2,COMMAND_PRIORITY_LOW as gc,createCommand as O2,DROP_COMMAND as F2,getDOMSelectionFromTarget as P2,isHTMLElement as xc,PASTE_COMMAND as B2}from"lexical";import{useEffect as j2}from"react";import{c as ac}from"react/compiler-runtime";import{jsx as Kn}from"react/jsx-runtime";import{useLexicalComposerContext as cc}from"@lexical/react/LexicalComposerContext.js";import{toast as b2}from"@payloadcms/ui";import{$getNodeByKey as k2,COMMAND_PRIORITY_EDITOR as uc}from"lexical";import{useEffect as dc,useState as _2}from"react";var T2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=k2(o);r&&r.replace(Re({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(Xn,{fields:null,relationTo:e,value:n})},w2=t=>{let e=ac(13),{enabledCollectionSlugs:o}=t,[n]=cc(),[r,l]=_2(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(Ze,p=>(l(p?.replace?p?.replace.nodeKey:null),d(),!0),uc),a=[n,d],e[2]=n,e[3]=d,e[4]=c,e[5]=a):(c=e[4],a=e[5]),dc(c,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=p=>{let{collectionSlug:x,doc:T}=p;i(),T2({editor:n,relationTo:x,replaceNodeKey:r,value:T.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let f=m,h;return e[10]!==u||e[11]!==f?(h=Kn(u,{onSelect:f}),e[10]=u,e[11]=f,e[12]=h):h=e[12],h},E2=()=>{let t=ac(3),[e]=cc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Ze,S2,uc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),dc(o,n),null},mc=({enabledCollectionSlugs:t})=>t?.length?Kn(w2,{enabledCollectionSlugs:t}):Kn(E2,{});function S2(){return b2.error("No upload collections enabled"),!0}function H2(t){let e=t.target;return!!(xc(e)&&!e.closest("code, span.editor-image")&&xc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function G2(t){let e,o=P2(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=O2("INSERT_UPLOAD_COMMAND"),bc=t=>{let e=N2(20),{clientProps:o}=t,[n]=y2(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=uo(r),{modalSlug:s,setCollectionSlug:i,setInitialForms:u,setOnCancel:d,setOnSuccess:c,setSelectableCollections:a}=v2(),{isModalOpen:m,openModal:f}=M2(),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=S=>{let{files:g}=S;if(g?.length!==0&&(u(C=>[...C??[],...g.map(z2)]),!m(s))){if(!l.length||!l[0])return;i(l[0]),a(l),d(()=>{n.update(U2)}),c(C=>{let b=new Map(C.map(W2));n.update(()=>{for(let k of Cc()){let _=k.node;if(Qe(_)){let A=_.getData();if(A?.pending){let L=b.get(A.pending?.formID);L&&_.replace(Re({data:{id:new Yn.default().toHexString(),fields:{},relationTo:L.collectionSlug,value:L.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=I2(h),x;e[13]!==n||e[14]!==p?(x=()=>{if(!n.hasNodes([qe]))throw new Error("UploadPlugin: UploadNode not registered on editor");return R2(n.registerNodeTransform(qe,S=>{let g=S.getData();if(!g?.pending)return;(async function(){let k=null,_=g?.pending?.src,A=g?.pending?.formID;if(_?.startsWith("data:")){let L=_.match(/data:(image\/[a-zA-Z]+);base64,/),E=L?L[1]:"image/png",R=_.replace(/^data:image\/[a-zA-Z]+;base64,/,""),w=atob(R),y=new Array(w.length);for(let M=0;M<w.length;M++)y[M]=w.charCodeAt(M);let v=new Uint8Array(y);k={alt:void 0,file:new File([v],"pasted-image."+E?.split("/",2)[1],{type:E}),formID:A}}else if(_?.startsWith("http")||_?.startsWith("https")){let E=await(await fetch(_)).blob(),R=_.split("/").pop()||"pasted-image"+E.type.split("/",2)[1];k={alt:void 0,file:new File([E],R,{type:E.type}),formID:A}}k&&p({files:[k]})})()}),n.registerCommand(Xn,S=>(n.update(()=>{let g=pc()||fc();if(hc(g)){let C=Re({data:{id:S.id,fields:S.fields,relationTo:S.relationTo,value:S.value}}),{focus:b}=g,k=b.getNode();Jn(C),Zn(k)&&!k.__first&&k.remove()}}),!0),D2),n.registerCommand(B2,S=>{if(!(S instanceof ClipboardEvent))return!1;let g=S.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(b=>{C.push({alt:"",file:b,formID:new Yn.default().toHexString()})}),C.length?(n.update(()=>{let b=pc()||fc();if(hc(b))for(let k of C){let _=Re({data:{pending:{formID:k.formID,src:URL.createObjectURL(k.file)}}}),{focus:A}=b,L=A.getNode();Jn(_),Zn(L)&&!L.__first&&L.remove()}}),p({files:C}),!0):!1},gc),n.registerCommand(F2,S=>{if(!(S instanceof DragEvent))return!1;let g=S.dataTransfer;if(!g?.types?.length)return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(b=>{C.push({alt:"",file:b,formID:new Yn.default().toHexString()})}),C.length?(S.preventDefault(),S.stopPropagation(),n.update(()=>{if(H2(S)){let b=G2(S),k=A2();b!=null&&k.applyDOMRange(b),$2(k);for(let _ of C){let A=Re({data:{pending:{formID:_.formID,src:URL.createObjectURL(_.file)}}}),{focus:L}=k,E=L.getNode();Jn(A),Zn(E)&&!E.__first&&E.remove()}}}),p({files:C}),!0):!1},gc))},e[13]=n,e[14]=p,e[15]=x):x=e[15];let T;e[16]!==n?(T=[n],e[16]=n,e[17]=T):T=e[17],j2(x,T);let N;return e[18]!==l?(N=L2(mc,{enabledCollectionSlugs:l}),e[18]=l,e[19]=N):N=e[19],N};function z2(t){return{file:t.file,formID:t.formID}}function U2(){for(let t of Cc()){let e=t.node;Qe(e)&&e.getData()?.pending&&e.remove()}}function W2(t){return[t.formID,t]}var K2=I({nodes:[qe],plugins:[{Component:bc,position:"normal"}],slashMenu:{groups:[J([{Icon:Vn,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ze,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Vn,isActive:({selection:t})=>{if(!V2(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Qe(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ze,{replace:!1})}}])]}});import{c as J2}from"react/compiler-runtime";import{jsx as So}from"react/jsx-runtime";import{createElement as Y2}from"react";import{ShimmerEffect as Z2,useConfig as q2}from"@payloadcms/ui";import{lazy as Q2,Suspense as ex,useEffect as tx,useState as ox}from"react";var kc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var qn={namespace:"lexical",theme:kc};function _c({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map,i=[];for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null){console.warn("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected. Skipping feature.");continue}s.set(c.clientFeatureProps.featureKey,c),i.push(c)}l.features=i,l.features=l.features.sort((c,a)=>c.clientFeatureProps.order-a.clientFeatureProps.order);let u=new Map,d=0;for(let c of l.features){let a=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:u,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;a.key=c.clientFeatureProps.featureKey,a.order=d,u.set(c.clientFeatureProps.featureKey,a),d++}return u}import{deepMerge as X2}from"payload/shared";var Tc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?X2(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function Qn(t,e,o,n){return{admin:o,features:Tc(t),lexical:e,resolvedFeatureMap:t,view:n}}var nx=Q2(()=>import("./Field-QKAL7KMC.js").then(t=>({default:t.RichText}))),rx=t=>So(Do,{inheritable:!0,views:t.views,children:So(lx,{...t})}),lx=t=>{let e=J2(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:u,views:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let a=c,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let f=m,h=i===void 0?qn:i,{currentView:p}=Oo(),x=d?.[p]?.admin??a,T=d?.[p]?.lexical,N;e[4]!==h||e[5]!==T?(N=typeof T=="function"?T(h):T??h,e[4]=h,e[5]=T,e[6]=N):N=e[6];let S=N,{config:g}=q2(),[C,b]=ox(null),k,_;e[7]!==n||e[8]!==g||e[9]!==p||e[10]!==x||e[11]!==S||e[12]!==f||e[13]!==l||e[14]!==s||e[15]!==C||e[16]!==u||e[17]!==d?(k=()=>{if(C&&C.view===p)return;let L=d?.[p],E=L?.filterFeatures?L.filterFeatures(n):n,R=[];for(let y of Object.values(E))!y.clientFeatureProvider||!y.clientFeatureProps||R.push(y.clientFeatureProvider(y.clientFeatureProps));let w=_c({config:g,featureClientImportMap:f,featureClientSchemaMap:l,field:s,schemaPath:u??s.name,unSanitizedEditorConfig:{features:R,lexical:S}});b(Qn(w,S,x,p))},_=[x,n,g,f,l,s,C,S,u,p,d],e[7]=n,e[8]=g,e[9]=p,e[10]=x,e[11]=S,e[12]=f,e[13]=l,e[14]=s,e[15]=C,e[16]=u,e[17]=d,e[18]=k,e[19]=_):(k=e[18],_=e[19]),tx(k,_);let A;return e[20]!==C||e[21]!==t?(A=So(ex,{fallback:So(Z2,{height:"35vh"}),children:C&&Y2(nx,{...t,editorConfig:C,key:C.view})}),e[20]=C,e[21]=t,e[22]=A):A=e[22],A};function ix(...t){return t.filter(Boolean).join(" ")}var sx=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var No=new WeakMap;function wc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Lo(t,e){let o=No.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=wc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let u=wc(s);for(let d of n)u!==null&&d([u[0]-i[0],u[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},No.set(t,o)}return o.listeners.add(e),()=>{ax(t,e)}}function ax(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 cx(t,e){return Lo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function ux(t,e){return Lo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function dx(t,e){return Lo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function mx(t,e){return Lo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as fx}from"react/compiler-runtime";import{jsx as px}from"react/jsx-runtime";import"react";var hx=()=>{let t=fx(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?px(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gx}from"react/compiler-runtime";import{jsx as xx}from"react/jsx-runtime";import"react";var Cx=()=>{let t=gx(2),{RemoveButton: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 bx}from"react/compiler-runtime";import{jsx as kx}from"react/jsx-runtime";import"react";var _x=()=>{let t=bx(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?kx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Tx}from"react/compiler-runtime";import{jsx as wx}from"react/jsx-runtime";import"react";var Ex=t=>{let e=Tx(3),{children:o}=t,{InlineBlockContainer:n}=xe(),r;return e[0]!==n||e[1]!==o?(r=n?wx(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as Sx}from"react/jsx-runtime";import"react";var Nx=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?Sx(n,{...o,children:e}):null};import{c as Lx}from"react/compiler-runtime";import{jsx as yx}from"react/jsx-runtime";import"react";var Rx=()=>{let t=Lx(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?yx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as vx}from"react/compiler-runtime";import{jsx as Ix}from"react/jsx-runtime";import"react";var Mx=()=>{let t=vx(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?Ix(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Ax}from"qs-esm";var $x=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let u=Ax({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(c=>c.json())};var Ec={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
57
+ `,Xs="\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",U0=new RegExp("^[^"+Ys+"]*["+Xs+"]"),W0=new RegExp("^[^"+Xs+"]*["+Ys+"]"),V0={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},K0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},J0={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},X0={[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"},Y0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},Z0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Zs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ue("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ue("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ue("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ue("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ue("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ue("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ue("sup",{children:e})),e}};import{jsx as Dt}from"react/jsx-runtime";var qs={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return Dt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.variants||!Object.keys(o.variants).length)return Dt("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.variants){let i=o.variants[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let c=i?.url;l.push(Dt("source",{media:`(max-width: ${i.width}px)`,srcSet:c,type:i.mimeType},s))}return l.push(Dt("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),Dt("picture",{children:l})}};var ut={...Vs,...Zs,...Hs,...Fs,...Js,...Bs,...js,...Ws,...Gs({}),...qs,...Ks};import{jsx as ho,Fragment as q0}from"react/jsx-runtime";import po from"react";function Qs(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 Q0(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 ho("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function ea(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 po.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 ho("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function eh(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]=ea(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]=ea(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=Q0(r))}return e}function ta({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(Qs(e)){let l=r?eh(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return oa({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return ho(q0,{})}function oa({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,c)=>{let u;i.type==="block"?(u=t?.blocks?.[i?.fields?.blockType],!u&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(u=t?.inlineBlocks?.[i?.fields?.blockType],!u&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):u=t[i.type];try{!u&&l&&(u=l);let d;u?d=typeof u=="function"?u({childIndex:c,converters:t,node:i,nodesToJSX:m=>oa({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...i,parent:r}}),parent:r}):u:d=ho("span",{children:"unknown node"},c);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`),po.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let f={...a,...d?.props?.style??{}};return po.cloneElement(d,{key:c,style:f})}return po.cloneElement(d,{key:c})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",i),null}}).filter(Boolean)}function Fn({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i=e,c={};i?typeof i=="function"?c=i({defaultConverters:ut}):c=i:c=ut;let u=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ta({converters:c,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?na(th,{children:u}):na("div",{className:t??"payload-richtext",children:u})}function la(){let t=oh(7),[e]=nh(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=lh(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(c=>{let{editorState:u}=c;r(u.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),rh(l,s);let i;return t[5]!==n?(i=ra("div",{className:"debug-jsx-converter",children:ra(Fn,{converters:ut,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var ih=A({plugins:[{Component:la,position:"bottom"}]});var z={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)"}},sh={text:{"text-red":{css:{color:`light-dark(${z.red[600]}, ${z.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${z.orange[600]}, ${z.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${z.yellow[700]}, ${z.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${z.green[700]}, ${z.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${z.blue[600]}, ${z.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${z.purple[600]}, ${z.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${z.pink[600]}, ${z.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${z.red[400]}, ${z.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${z.orange[400]}, ${z.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${z.yellow[300]}, ${z.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${z.green[400]}, ${z.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${z.blue[400]}, ${z.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${z.purple[400]}, ${z.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${z.pink[400]}, ${z.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Zh}from"lexical";import{jsx as ia}from"react/jsx-runtime";import"react";var ah="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",Pn=({className:t})=>ia("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:ia("path",{d:ah,fill:"currentColor"})});import{jsx as fh}from"react/jsx-runtime";import{$applyNodeReplacement as ph}from"lexical";import*as aa from"react";import{DecoratorBlockNode as ch}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as uh}from"@lexical/utils";import{$applyNodeReplacement as dh}from"lexical";function mh(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:sa({relationTo:o,value:e})}:null}var $t=class extends ch{__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:mh,priority:2}}}static importJSON(e){let o={relationTo:e.relationTo,value:e.value},n=sa(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return uh(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"}}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 sa(t){return dh(new $t({data:t}))}var hh=aa.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function gh(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 $t{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:gh,priority:2}}}static importJSON(e){let o={relationTo:e.relationTo,value:e.value},n=We(o);return n.setFormat(e.format),n}decorate(e,o){return fh(hh,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function We(t){return ph(new we({data:t}))}function Bn(t){return t instanceof we}import{c as Bh}from"react/compiler-runtime";import{jsx as jh}from"react/jsx-runtime";import{useLexicalComposerContext as Hh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as zh}from"@lexical/utils";import{$getPreviousSelection as Gh,$getSelection as Uh,$isParagraphNode as Wh,$isRangeSelection as Vh,COMMAND_PRIORITY_EDITOR as Kh,createCommand as Jh}from"lexical";import{useEffect as Xh}from"react";import{c as da}from"react/compiler-runtime";import{jsx as jn}from"react/jsx-runtime";import{useLexicalComposerContext as ma}from"@lexical/react/LexicalComposerContext.js";import{toast as yh}from"@payloadcms/ui";import{$getNodeByKey as Rh,COMMAND_PRIORITY_EDITOR as fa}from"lexical";import{useEffect as pa,useState as vh}from"react";import{c as xh}from"react/compiler-runtime";import{jsx as Ch}from"react/jsx-runtime";import{useLexicalComposerContext as bh}from"@lexical/react/LexicalComposerContext";import{useListDrawer as kh,useModal as _h}from"@payloadcms/ui";import{$getNodeByKey as ca,$getPreviousSelection as Th,$getRoot as Eh,$getSelection as wh,$isRangeSelection as Sh,$setSelection as Nh}from"lexical";import{useEffect as Lh,useState as ua}from"react";var Ot=t=>{let e=xh(23),[o]=bh(),[n,r]=ua(null),[l,s]=ua(!1),[i,c,u]=kh(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:f,openDrawer:m}=u,{modalState:p}=_h(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let N=wh()??Th();r(N)},e[0]=h):h=e[0];let g=h,C;e[1]!==o||e[2]!==n?(C=()=>{n&&o.update(()=>{if(Sh(n)){let{anchor:N,focus:w}=n;ca(N.key)&&ca(w.key)&&Nh(n.clone())}else Eh().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=C):C=e[3];let E=C,L;e[4]!==d?(L=()=>{d()},e[4]=d,e[5]=L):L=e[5];let x=L,b,k;e[6]!==a||e[7]!==p||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let N=p[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},k=[p,a,E,l],e[6]=a,e[7]=p,e[8]=E,e[9]=l,e[10]=b,e[11]=k):(b=e[10],k=e[11]),Lh(b,k);let _;e[12]!==c?(_=N=>Ch(c,{...N,onClick:()=>{g()}}),e[12]=c,e[13]=_):_=e[13];let T;e[14]!==m?(T=()=>{g(),m(),s(!0)},e[14]=m,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==x||e[18]!==f||e[19]!==a||e[20]!==_||e[21]!==T?(I={closeListDrawer:x,isListDrawerOpen:f,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:_,openListDrawer:T},e[16]=i,e[17]=x,e[18]=f,e[19]=a,e[20]=_,e[21]=T,e[22]=I):I=e[22],I};var Ih=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=Rh(o);r&&r.replace(We({relationTo:e,value:n}))}):t.dispatchCommand(Hn,{relationTo:e,value:n})},Mh=t=>{let e=da(14),{enabledCollectionSlugs:o}=t,[n]=ma(),[r,l]=vh(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:c,ListDrawer:u,openListDrawer:d}=Ot(i),a,f;e[3]!==n||e[4]!==d?(a=()=>n.registerCommand(et,g=>(l(g?.replace?g?.replace.nodeKey:null),d(),!0),fa),f=[n,d],e[3]=n,e[4]=d,e[5]=a,e[6]=f):(a=e[5],f=e[6]),pa(a,f);let m;e[7]!==c||e[8]!==n||e[9]!==r?(m=g=>{let{collectionSlug:C,doc:E}=g;Ih({editor:n,relationTo:C,replaceNodeKey:r,value:E.id}),c()},e[7]=c,e[8]=n,e[9]=r,e[10]=m):m=e[10];let p=m,h;return e[11]!==u||e[12]!==p?(h=jn(u,{onSelect:p}),e[11]=u,e[12]=p,e[13]=h):h=e[13],h},Ah=()=>{let t=da(3),[e]=ma(),o,n;return t[0]!==e?(o=()=>e.registerCommand(et,Dh,fa),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),pa(o,n),null},ha=({enabledCollectionSlugs:t})=>t?.length?jn(Mh,{enabledCollectionSlugs:t}):jn(Ah,{});function Dh(){return yh.error("No relationship collections enabled"),!0}import{c as $h}from"react/compiler-runtime";import{useConfig as Oh,useEntityVisibility as Fh}from"@payloadcms/ui";import"react";var go=t=>{let e=$h(11),{enabledCollectionSlugs:o}=t,{config:n}=Oh(),{collections:r}=n,{visibleEntities:l}=Fh(),s,i;if(e[0]!==r||e[1]!==o||e[2]!==l){let u;e[5]!==o||e[6]!==l?(u=a=>{let{slug:f}=a;return o.includes(f)&&(!l?.collections||l.collections.includes(f))},e[5]=o,e[6]=l,e[7]=u):u=e[7];let d=r.filter(u);s=d,i=d.map(Ph),e[0]=r,e[1]=o,e[2]=l,e[3]=s,e[4]=i}else s=e[3],i=e[4];let c;return e[8]!==s||e[9]!==i?(c={enabledCollections:s,enabledCollectionSlugs:i},e[8]=s,e[9]=i,e[10]=c):c=e[10],c};function Ph(t){return t.slug}var Hn=Jh("INSERT_RELATIONSHIP_COMMAND"),ga=t=>{let e=Bh(7),{clientProps:o}=t,[n]=Hh(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=go(r),s,i;e[2]!==n?(s=()=>{if(!n.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Hn,Yh,Kh)},i=[n],e[2]=n,e[3]=s,e[4]=i):(s=e[3],i=e[4]),Xh(s,i);let c;return e[5]!==l?(c=jh(ha,{enabledCollectionSlugs:l}),e[5]=l,e[6]=c):c=e[6],c};function Yh(t){let e=Uh()||Gh();if(Vh(e)){let o=We(t),{focus:n}=e,r=n.getNode();zh(o),Wh(r)&&!r.__first&&r.remove()}return!0}var qh=A({nodes:[we],plugins:[{Component:ga,position:"normal"}],slashMenu:{groups:[q([{Icon:Pn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Pn,isActive:({selection:t})=>{if(!Zh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Bn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{c as D5}from"react/compiler-runtime";import{jsx as he,jsxs as $5}from"react/jsx-runtime";import{useLexicalComposerContext as O5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as ya}from"@lexical/react/useLexicalEditable";import{getTranslation as F5}from"@payloadcms/translations";import{useScrollInfo as P5,useThrottledEffect as B5,useTranslation as Ra}from"@payloadcms/ui";import*as va from"react";import{useMemo as _o}from"react";import{jsx as Qh,jsxs as e5}from"react/jsx-runtime";import{Tooltip as t5,useTranslation as o5}from"@payloadcms/ui";import{$addUpdateTag as n5}from"lexical";import{useCallback as xa,useEffect as r5,useMemo as Ca,useRef as l5,useState as i5}from"react";var zn="toolbar-popup__button",Ft=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=o5(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=U(),[c,u]=i5(!1),d=l5(null);r5(()=>{d.current?.removeAttribute("data-pressing")},[t]);let a=Ca(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,h=>h.toUpperCase()),[s,l,i,r]),f=Ca(()=>[zn,n?"":"disabled",t?"active":"",r.key?`${zn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),m=xa(()=>{n&&o.focus(()=>{o.update(()=>{n5("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),p=xa(h=>{h.preventDefault(),h.currentTarget.setAttribute("data-pressing","")},[]);return e5("button",{"aria-label":a,"aria-pressed":r.isActive?t:void 0,className:f,"data-button-key":r.key,disabled:!n,onClick:m,onMouseDown:p,onPointerEnter:()=>u(!0),onPointerLeave:()=>{u(!1),d.current?.removeAttribute("data-pressing")},ref:d,type:"button",children:[Qh(t5,{className:`${zn}__tooltip`,show:c,children:a}),e]})};import{c as f5}from"react/compiler-runtime";import{jsx as dt}from"react/jsx-runtime";import p5,{useMemo as h5}from"react";import{useTranslation as g5}from"@payloadcms/ui";import{jsx as Ve,jsxs as ba}from"react/jsx-runtime";import{Button as s5}from"@payloadcms/ui";import{$addUpdateTag as a5,isDOMNode as c5}from"lexical";import Un,{useCallback as u5,useEffect as Co,useId as d5,useMemo as _a,useRef as xo,useState as Gn}from"react";var ka="toolbar-popup__dropdown-item",Ta=Un.createContext(null);function Ea({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let c=_a(()=>[ka,n===!1?"disabled":"",t?"active":"",l?.key?`${ka}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),u=xo(null),d=Un.use(Ta);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return Co(()=>{u?.current!=null&&a(u)},[u,a]),Ve(s5,{"aria-label":i,buttonStyle:"ghost",className:c,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(()=>{a5("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:f=>{f.preventDefault()},ref:u,tooltip:i,type:"button",children:e})}function m5({id:t,children:e,dropdownKey:o,dropDownRef:n,itemsContainerClassNames:r,onClose:l,shouldAutoFocus:s}){let[i,c]=Gn(),[u,d]=Gn(),a=u5(p=>{c(h=>h!=null?[...h,p]:[p])},[c]),f=p=>{if(i==null)return;let{key:h}=p,g=i.filter(C=>!C.current?.disabled);["ArrowDown","ArrowUp","Escape"].includes(h)&&p.preventDefault(),h==="Escape"?l():h==="Tab"?setTimeout(()=>l({restoreFocus:!1})):h==="ArrowUp"?d(C=>{if(C==null)return g[0];let E=g.indexOf(C)-1;return g[E===-1?g.length-1:E]}):h==="ArrowDown"&&d(C=>{if(C==null)return g[0];let E=g.indexOf(C);return g[E===g.length-1?0:E+1]})},m=_a(()=>({registerItem:a}),[a]);return Co(()=>{s&&i!=null&&u==null&&d(i.find(p=>!p.current?.disabled)),u!=null&&u?.current!=null&&u.current.focus()},[i,u,s]),Ve(Ta,{value:m,children:Ve("div",{className:(r??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":o,"data-theme":"dark",id:t,onKeyDown:f,popover:"manual",ref:n,role:"menu",tabIndex:-1,children:e})})}function wa({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:c}){let u=xo(null),d=xo(null),a=xo(!1),f=d5(),m=`toolbar-dropdown-${r}-${f}`,[p,h]=Gn(!1),g=({restoreFocus:C=!0}={})=>{h(!1),C&&d?.current!=null&&d.current.focus()};return Co(()=>{let C=d.current,E=u.current;if(p&&C!==null&&E!==null){E.matches(":popover-open")||E.showPopover();let L=()=>{let{bottom:x,left:b,top:k}=C.getBoundingClientRect(),_=8,T=5,I=x+T,N=k-E.offsetHeight-T,w=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,w))}px`,E.style.left=`${Math.max(8,Math.min(b-5,window.innerWidth-E.offsetWidth-20))}px`};return L(),window.addEventListener("resize",L),window.addEventListener("scroll",L,{capture:!0,passive:!0}),()=>{window.removeEventListener("resize",L),window.removeEventListener("scroll",L,{capture:!0})}}},[u,d,p]),Co(()=>{let C=d.current;if(C!==null&&p){let E=L=>{let x=L.target;c5(x)&&(c&&u.current&&u.current.contains(x)||C.contains(x)||h(!1))};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}}},[u,d,p,c]),ba(Un.Fragment,{children:[ba("button",{"aria-controls":m,"aria-expanded":p,"aria-haspopup":"menu","aria-label":t,className:e+(p?" active":""),"data-dropdown-key":r,disabled:n,onClick:C=>{C.preventDefault(),a.current=!1,h(!p)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),a.current=!0,h(!p))},onMouseDown:C=>{C.preventDefault()},ref:d,type:"button",children:[l&&Ve(l,{}),i&&Ve("span",{className:"toolbar-popup__dropdown-label",children:i}),Ve("i",{className:"toolbar-popup__dropdown-caret"})]}),p&&Ve(m5,{dropdownKey:r,dropDownRef:u,id:m,itemsContainerClassNames:s,onClose:g,shouldAutoFocus:a.current,children:o})]})}var Wn="toolbar-popup__dropdown",x5=t=>{let e=f5(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:c}=g5(),{fieldProps:u}=U(),{featureClientSchemaMap:d,schemaPath:a}=u;if(i.Component){let m;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(m=i?.Component&&dt(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let f;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==d||e[10]!==c||e[11]!==s||e[12]!==i||e[13]!==a){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:d,i18n:c,schemaPath:a}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,f=dt(Ea,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?dt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?m:void 0,children:dt("span",{className:"text",children:p})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=d,e[10]=c,e[11]=s,e[12]=i,e[13]=a,e[14]=f}else f=e[14];return f},C5=p5.memo(x5),Pt=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:c,key:u}=n,d=h5(()=>c?.length?c.map(a=>dt(C5,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[c,r.activeItemKeys,r.enabledItemKeys,t,o]);return dt(wa,{buttonAriaLabel:`${u} dropdown`,buttonClassName:[Wn,`${Wn}-${u}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:u,Icon:l,itemsContainerClassNames:[`${Wn}-items`,...s||[]],label:i,children:d},u)};import{useEffect as b5}from"react";function bo({toolbarRef:t}){b5(()=>{let e=t.current;if(!e)return;let o,n=()=>Array.from(e.querySelectorAll("button")).filter(c=>!c.closest('[role="menu"]')&&c.closest('[role="toolbar"]')===e),r=()=>{let c=n(),u=c.filter(d=>!d.disabled);(!o||!u.includes(o))&&(o=u[0]);for(let d of c)d.tabIndex=d===o?0:-1},l=c=>{let u=n().find(d=>d===c.target);u&&(o=u,r())},s=c=>{if(c.altKey||c.ctrlKey||c.metaKey||c.shiftKey)return;let u=n().filter(m=>!m.disabled),d=u.findIndex(m=>m===c.target);if(d===-1)return;let a=getComputedStyle(e).direction==="rtl",f;switch(c.key){case"ArrowLeft":f=d+(a?1:-1);break;case"ArrowRight":f=d+(a?-1:1);break;case"End":f=u.length-1;break;case"Home":f=0;break;default:return}c.preventDefault(),c.stopPropagation(),u[(f+u.length)%u.length]?.focus()};r();let i=new MutationObserver(r);return i.observe(e,{attributeFilter:["disabled"],childList:!0,subtree:!0}),e.addEventListener("focusin",l),e.addEventListener("keydown",s),()=>{i.disconnect(),e.removeEventListener("focusin",l),e.removeEventListener("keydown",s)}},[t])}import{mergeRegister as k5}from"@lexical/utils";import{$getSelection as _5}from"lexical";import{useCallback as T5,useDeferredValue as E5,useEffect as w5,useRef as Sa,useState as S5}from"react";function N5(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 ko(t,e){let[o,n]=S5(()=>N5(e)),r=E5(o),l=U(),s=Sa(l);s.current=l;let i=Sa(e);i.current=e;let c=Mr(),u=T5(()=>{t.getEditorState().read(()=>{let d=_5();if(!d)return;let a=i.current;if(!a?.length)return;let f=s.current,m=new Map,p=new Map;for(let h of a){let g=[],C=[],E=[],L=h.type==="dropdown"?h.maxActiveItems??1:void 0;for(let b of h.items){let k=b.isActive?(!L||g.length<L)&&b.isActive({editor:t,editorConfigContext:f,selection:d}):!1,_=b.isEnabled?b.isEnabled({editor:t,editorConfigContext:f,selection:d}):!0;k&&(g.push(b.key),C.push(b)),_&&E.push(b.key),m.set(b.key,{active:k,enabled:_})}let x=h.type==="dropdown"&&h.isEnabled?h.isEnabled({editor:t,editorConfigContext:f,selection:d}):!0;p.set(h.key,{activeItemKeys:g,activeItems:C,enabledGroup:x,enabledItemKeys:E})}n({groupStates:p,itemStates:m})})},[t]);return w5(()=>{c(u);let d=()=>{c(u)},a=k5(t.registerUpdateListener(d));return document.addEventListener("mouseup",d),()=>{a(),document.removeEventListener("mouseup",d)}},[t,c,u]),r}import{c as L5}from"react/compiler-runtime";import{useEffect as y5}from"react";var R5=".fixed-toolbar__scroll",v5=40;function I5({clientWidth:t,deltaMode:e,deltaY:o,isRightToLeft:n}){let r=e===1?o*v5:e===2?o*t:o;return n?-r:r}function Na(t){if(!(Math.abs(t.deltaY)>Math.abs(t.deltaX)))return;let o=t.target;if(!(o instanceof Element))return;let n=o.closest(R5);!n||!(n.scrollWidth>n.clientWidth)||(t.preventDefault(),n.scrollLeft+=I5({clientWidth:n.clientWidth,deltaMode:t.deltaMode,deltaY:t.deltaY,isRightToLeft:getComputedStyle(n).direction==="rtl"}))}var mt=0;function La(){let t=L5(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],y5(M5,e)}function M5(){return mt===0&&document.addEventListener("wheel",Na,{passive:!1}),mt=mt+1,A5}function A5(){mt=mt-1,mt===0&&document.removeEventListener("wheel",Na)}function j5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&he(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?he(Ft,{active:t,editor:o,enabled:n,item:r,children:he(r.ChildComponent,{})},r.key):null}function H5({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=Ra(),{fieldProps:{featureClientSchemaMap:i,schemaPath:c}}=U(),u=l.groupStates.get(n.key),d=_o(()=>{if(n.type!=="dropdown")return;let f=u?.activeItems?.[0];return f?f.ChildComponent:n.ChildComponent},[n,u?.activeItems]),a=_o(()=>{if(n.type!=="dropdown")return;let f=u?.activeItems;if(!f?.length)return;if(f.length>1)return s.t("lexical:general:toolbarItemsActive",{count:f.length});let m=f[0],p=m.key;return m.label&&(p=typeof m.label=="function"?m.label({featureClientSchemaMap:i,i18n:s,schemaPath:c}):m.label),p.length>25&&(p=p.substring(0,25)+"..."),p},[n,u?.activeItems,s,i,c]);return $5("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&u?he(Pt,{anchorElem:t,editor:e,group:n,groupState:u,Icon:d,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(f=>{let m=l.itemStates.get(f.key);return he(j5,{active:m?.active??!1,anchorElem:t,editor:e,enabled:m?.enabled??!0,item:f},f.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&he("div",{className:"divider"})]},n.key)}function z5({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=va.useRef(null),s=_o(()=>({toolbarRef:l}),[]),{fieldProps:i}=U(),{i18n:c}=Ra();bo(s);let u=ya(),{y:d}=P5();La();let a=ko(o,n?.features?.toolbarFixed?.groups),f=_o(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let p=r.editorContainerRef.current.previousElementSibling;for(;p;){if(p.classList.contains("fixed-toolbar"))return p;p=p.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return B5(()=>{if(!f)return;let m=l.current;if(!m)return;let p=m.getBoundingClientRect(),h=f.getBoundingClientRect();if(!(p.bottom<h.top||p.top>h.bottom))m.classList.remove("fixed-toolbar"),m.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),f.classList.remove("fixed-toolbar"),f.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!m.classList.contains("fixed-toolbar--overlapping"))return;m.classList.remove("fixed-toolbar--overlapping"),m.classList.add("fixed-toolbar"),f.classList.remove("fixed-toolbar--hide"),f.classList.add("fixed-toolbar")}},50,[l,f,d]),he("div",{"aria-label":F5(i.field.label||i.path,c)||i.path,className:"fixed-toolbar",onFocus:m=>{m.stopPropagation()},ref:l,role:"toolbar",children:u&&he("div",{className:"fixed-toolbar__scroll",tabIndex:-1,children:n?.features&&n.features?.toolbarFixed?.groups.map((m,p)=>he(H5,{anchorElem:t,editor:o,editorConfig:n,group:m,index:p,toolbarStates:a},m.key))})})}var Ia=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Ia(t.parentEditor)}return!1},Ma=t=>{let e=D5(6),{clientProps:o}=t,[n]=O5(),r=U();if(!ya())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,c=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,u,d;if(e[0]!==o||e[1]!==i||e[2]!==c||e[3]!==r){d=Symbol.for("react.early_return_sentinel");e:{let a=Ia(r);if(o?.disableIfParentHasFixedToolbar&&a){d=null;break e}if(!c?.features?.toolbarFixed?.groups?.length){d=null;break e}u=he(z5,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:c,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=c,e[3]=r,e[4]=u,e[5]=d}else u=e[4],d=e[5];return d!==Symbol.for("react.early_return_sentinel")?d:u};var G5=A({plugins:[{Component:Ma,position:"aboveContainer"}]});import{c as U5}from"react/compiler-runtime";import{jsx as Se,jsxs as $a}from"react/jsx-runtime";import{useLexicalComposerContext as W5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as V5}from"@lexical/react/useLexicalEditable";import{mergeRegister as Oa}from"@lexical/utils";import{getTranslation as K5}from"@payloadcms/translations";import{useTranslation as J5}from"@payloadcms/ui";import{$getSelection as Fa,$isRangeSelection as Aa,$isTextNode as X5,$onUpdate as Y5,COMMAND_PRIORITY_LOW as Z5,getDOMSelection as Pa,SELECTION_CHANGE_COMMAND as q5}from"lexical";import{useCallback as Eo,useEffect as Bt,useMemo as Ba,useRef as Da,useState as Q5}from"react";import"react";import{createPortal as eg}from"react-dom";function Vn(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 To(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:c,verticalGap:u=10}=t,d=o.parentElement;if(c===null||d==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),f=o.getBoundingClientRect(),m=d.getBoundingClientRect(),p=c.top-a.height-u,h=c.left-l;s==="center"&&(h=c.left+c.width/2-a.width/2);let g=0;return!e&&p<m.top&&!i&&(g=a.height+c.height+u*2,p+=g),s==="center"?h+a.width>m.right?h=m.right-a.width-l:h<m.left&&(h=m.left+l):h+a.width>m.right&&(h=m.right-a.width-l),h-=f.left,r.style.opacity="1",i&&n!==0?(p-=f.bottom-n+a.height-3,r.style.transform=`translate(${h}px, ${p}px) rotate(180deg)`):(p-=f.top,r.style.transform=`translate(${h}px, ${p}px)`),g}function tg({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(Ft,{active:t,editor:o,enabled:n,item:r,children:Se(r.ChildComponent,{})},r.key):null}function og({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=U(),s=r.groupStates.get(o.key),i=Ba(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return $a("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(Pt,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(c=>{let u=r.itemStates.get(c.key);return Se(tg,{active:u?.active??!1,anchorElem:t,editor:e,enabled:u?.enabled??!0,item:c},c.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Se("div",{className:"divider"})]},o.key)}function ng({anchorElem:t,editor:e}){let o=Da(null),n=Ba(()=>({toolbarRef:o}),[]),{fieldProps:r}=U(),{i18n:l}=J5();bo(n);let s=Da(null),{editorConfig:i}=U(),c=ko(e,i?.features?.toolbarInline?.groups),u=Eo(()=>{if(o?.current){let m=o.current.style.opacity==="0",p=o.current.style.pointerEvents==="none";m||(o.current.style.opacity="0"),p||(o.current.style.pointerEvents="none")}},[o]),d=Eo(m=>{if(o?.current&&(m.buttons===1||m.buttons===3)){let p=o.current.style.opacity==="0",h=o.current.style.pointerEvents==="none";if(!p||!h){let g=m.clientX,C=m.clientY,E=document.elementFromPoint(g,C);o.current.contains(E)||u()}}},[u]),a=Eo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Bt(()=>(document.addEventListener("mousemove",d),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a)}),[o,d,a]);let f=Eo(()=>{let m=Fa(),p=Pa(e._window);if(o.current===null)return;let h=t.querySelector(":scope > .link-editor"),g=h!==null&&"style"in h&&h?.style?.opacity==="1",C=e.getRootElement();if(m!==null&&p!==null&&!p.isCollapsed&&C!==null&&C.contains(p.anchorNode)){let E=Vn(p,C),L=To({alwaysDisplayOnTop:g,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:E});s.current&&To({anchorElem:o.current,anchorFlippedOffset:L,floatingElem:s.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:E,verticalGap:8})}else u()},[e,u,t]);return Bt(()=>{let m=t.parentElement,p=()=>{e.getEditorState().read(()=>{f()})};return window.addEventListener("resize",p),m&&m.addEventListener("scroll",p),()=>{window.removeEventListener("resize",p),m&&m.removeEventListener("scroll",p)}},[e,f,t]),Bt(()=>(e.getEditorState().read(()=>{f()}),Oa(e.registerUpdateListener(({editorState:m})=>{m.read(()=>{f()})}),e.registerCommand(q5,()=>(Y5(()=>e.read("latest",f)),!1),Z5))),[e,f]),$a("div",{"aria-label":K5(r.field.label||r.path,l)||r.path,className:"inline-toolbar-popup",ref:o,role:"toolbar",children:[Se("div",{className:"caret",ref:s}),i?.features&&i.features?.toolbarInline?.groups.map((m,p)=>Se(og,{anchorElem:t,editor:e,group:m,index:p,toolbarStates:c},m.key))]})}function rg(t,e){let o=U5(12),[n,r]=Q5(!1),l=V5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=Fa(),p=Pa(t._window),h=t.getRootElement();if(p!==null&&(!Aa(m)||h===null||!h.contains(p.anchorNode))){r(!1);return}if(!Aa(m))return;if(m.getTextContent()!==""){let C=m.getNodes(),E=!1;for(let L of C)if(X5(L)){r(!0),E=!0;break}E||r(!1)}else r(!1);let g=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,c,u;o[2]!==i?(c=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=c,o[4]=u):(c=o[3],u=o[4]),Bt(c,u);let d,a;if(o[5]!==t||o[6]!==i?(d=()=>Oa(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=d,o[8]=a):(d=o[7],a=o[8]),Bt(d,a),!n||!l)return null;let f;return o[9]!==e||o[10]!==t?(f=eg(Se(ng,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=f):f=o[11],f}var ja=t=>{let{anchorElem:e}=t,[o]=W5();return rg(o,e)};var lg=A({plugins:[{Component:ja,position:"floatingAnchorElem"}]});import{TableCellNode as ex,TableNode as tx,TableRowNode as ox}from"@lexical/table";import{jsx as Ha}from"react/jsx-runtime";import"react";var ig={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"},Kn=({className:t,size:e=24})=>Ha("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:Ha("path",{clipRule:"evenodd",d:ig[e],fill:"currentColor",fillRule:"evenodd"})});import{$convertToMarkdownString as sg}from"@lexical/markdown";import{$createTableCellNode as ag,$createTableNode as cg,$createTableRowNode as ug,$isTableCellNode as za,$isTableNode as Jn,$isTableRowNode as Xn,TableCellHeaderStates as wo,TableCellNode as dg,TableNode as mg,TableRowNode as fg}from"@lexical/table";import{$isParagraphNode as pg,$isTextNode as hg}from"lexical";var Ua=/^\|(.+)\|\s?$/,gg=/^(\| ?:?-*:? ?)+\|\s?$/,Wa=({allTransformers:t})=>({type:"element",dependencies:[mg,fg,dg],export:e=>{if(!Jn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!Xn(n))continue;let l=!1;for(let s of n.getChildren())za(s)&&(r.push(sg(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===wo.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
58
+ `)},regExp:Ua,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(gg.test(r)){let a=e.getPreviousSibling();if(!a||!Jn(a))return;let f=a.getChildren(),m=f[f.length-1];if(!m||!Xn(m))return;m.getChildren().forEach(p=>{za(p)&&p.setHeaderStyles(wo.ROW,wo.ROW)}),e.remove();return}let l=Ga(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),c=l.length;for(;i&&!(!pg(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!hg(a))break;let f=Ga(a.getTextContent(),t);if(f==null)break;c=Math.max(c,f.length),s.unshift(f);let m=i.getPreviousSibling();i.remove(),i=m}let u=cg();for(let a of s){let f=ug();u.append(f);for(let m=0;m<c;m++)f.append(m<a.length?a[m]:Va("",t))}let d=e.getPreviousSibling();Jn(d)&&xg(d)===c?(d.append(...u.getChildren()),e.remove()):e.replace(u),u.selectEnd()}});function xg(t){let e=t.getFirstChild();return Xn(e)?e.getChildrenSize():0}var Va=(t,e)=>{t=t.replace(/\\n/g,`
59
+ `);let o=ag(wo.NO_STATUS);return eo(t,e,o,!1,!0),o},Ga=(t,e)=>{let o=t.match(Ua);return!o||!o[1]?null:o[1].split("|").map(n=>Va(n,e))};import{c as _g}from"react/compiler-runtime";import{jsx as j,jsxs as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as qa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Tg}from"@lexical/react/useLexicalEditable";import{$computeTableMap as Eg,$deleteTableColumnAtSelection as wg,$deleteTableRowAtSelection as Sg,$getNodeTriplet as Ng,$getTableCellNodeFromLexicalNode as Za,$getTableNodeFromLexicalNodeOrThrow as Me,$getTableRowIndexFromTableCellNode as Lg,$insertTableColumnAtSelection as yg,$insertTableRowAtSelection as Rg,$isTableCellNode as Qa,$isTableSelection as jt,$mergeCells as vg,$setTableColumnIsHeader as Ig,$setTableRowIsHeader as Mg,$unmergeCell as Ag,getTableElement as Yn,getTableObserverFromTableElement as Zn,TableCellHeaderStates as ft,TableCellNode as Dg}from"@lexical/table";import{mergeRegister as $g}from"@lexical/utils";import{useScrollInfo as Og}from"@payloadcms/ui";import{$getSelection as No,$isElementNode as Fg,$isRangeSelection as qn,$isTextNode as Pg,$setSelection as Bg,COMMAND_PRIORITY_CRITICAL as jg,getDOMSelection as Hg,isDOMNode as zg,SELECTION_CHANGE_COMMAND as Gg}from"lexical";import*as Qn from"react";import{useCallback as de,useEffect as pt,useRef as So,useState as ht}from"react";import{createPortal as ec}from"react-dom";import{jsx as Ka}from"react/jsx-runtime";import"react";var Cg={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},Ja=({className:t,size:e=24})=>Ka("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ka("path",{clipRule:"evenodd",d:Cg[e],fill:"currentColor",fillRule:"evenodd"})});import{$computeTableCellRectBoundary as bg,$computeTableMap as kg,$getNodeTriplet as Xa}from"@lexical/table";function Ya({selection:t}){let[e,,o]=Xa(t.anchor),[n]=Xa(t.focus),[r,l,s]=kg(o,e,n),{maxColumn:i,maxRow:c,minColumn:u,minRow:d}=bg(r,l,s);return{columns:i-u+1,rows:c-d+1}}function Ug(){let t=No();if(qn(t)&&!t.isCollapsed()||jt(t)&&!t.anchor.is(t.focus)||!qn(t)&&!jt(t))return!1;let[e]=Ng(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Wg(t){let e=t.getLastDescendant();Pg(e)?e.select():Fg(e)?e.selectEnd():e!==null&&e.selectNext()}function Vg({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=qa(),s=So(null),[i,c]=ht(r),[u,d]=ht({columns:1,rows:1}),[a,f]=ht(!1),[m,p]=ht(!1),{y:h}=Og();pt(()=>l.registerMutationListener(Dg,S=>{S.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{c(i.getLatest())})},{skipInitialization:!0}),[l,i]),pt(()=>{l.getEditorState().read(()=>{let S=No();if(jt(S)){let R=Ya({selection:S});d(R);let v=S.anchor.is(S.focus);f(!v&&(R.columns>1||R.rows>1))}p(Ug())})},[l]),pt(()=>{let S=e.current,R=s.current,v=l.getRootElement();if(S!=null&&R!=null&&v!=null){let D=v.getBoundingClientRect(),F=S.getBoundingClientRect();R.style.opacity="1";let M=R.getBoundingClientRect(),B=5,$=F.right+B;if($+M.width>window.innerWidth||$+M.width>D.right){let V=F.left-M.width-B;$=(V<0?B:V)+window.pageXOffset}R.style.left=`${$+window.pageXOffset}px`;let P=F.top;if(P+M.height>window.innerHeight){let V=F.bottom-M.height;P=V<0?B:V}R.style.top=`${P}px`}},[e,s,l,h]),pt(()=>{function S(R){s.current!=null&&e.current!=null&&zg(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&n(!1)}return window.addEventListener("click",S),()=>window.removeEventListener("click",S)},[n,e]);let g=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i),R=Yn(S,l.getElementByKey(S.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let v=Zn(R);v!==null&&v.$clearHighlight(),S.markDirty(),c(i.getLatest())}Bg(null)})},[l,i]),C=()=>{l.update(()=>{let S=No();if(!jt(S))return;let v=S.getNodes().filter(Qa),D=vg(v);D&&(Wg(D),o())})},E=()=>{l.update(()=>{Ag()}),g()},L=de(S=>{l.update(()=>{for(let R=0;R<u.rows;R++)Rg(S);o()})},[l,o,u.rows]),x=de(S=>{l.update(()=>{for(let R=0;R<u.columns;R++)yg(S);o()})},[l,o,u.columns]),b=de(()=>{l.update(()=>{Sg(),o()})},[l,o]),k=de(()=>{l.update(()=>{Me(i).remove(),g(),o()})},[l,i,g,o]),_=de(()=>{l.update(()=>{wg(),o()})},[l,o]),T=de(()=>{l.update(()=>{let S=Me(i),R=Lg(i),v=!i.hasHeaderState(ft.ROW);Mg(S,R,v),g(),o()})},[l,i,g,o]),I=de(()=>{l.update(()=>{let S=Me(i),[,R]=Eg(S,i,i),v=!i.hasHeaderState(ft.COLUMN);Ig(S,R.startColumn,v),g(),o()})},[l,i,g,o]),N=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i);S&&S.setRowStriping(!S.getRowStriping())}g(),o()})},[l,i,g,o]),w=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i);S&&S.setFrozenColumns(S.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),y=null;return t&&(a?y=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):m&&(y=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),ec(Ne("div",{className:"table-action-menu-dropdown",onClick:S=>{S.stopPropagation()},ref:s,children:[y?Ne(Qn.Fragment,{children:[y,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:j("span",{className:"text",children:"Toggle row striping"})}),j("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>w(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>L(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>L(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>k(),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&ft.ROW)===ft.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&ft.COLUMN)===ft.COLUMN?"Remove":"Add"," ","column header"]})})]}),l.getRootElement()?.closest('dialog, [role="dialog"]')??document.body)}function Kg({anchorElem:t,cellMerge:e}){let[o]=qa(),n=So(null),r=So(null),[l,s]=ht(!1),[i,c]=ht(null),u=de(()=>{let a=n.current,f=No(),m=Hg(o._window),p=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),c(null)}if(f==null||a==null)return h();let g=o.getRootElement(),C=null,E=null;if(qn(f)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let x=Za(f.anchor.getNode());if(x==null||(E=o.getElementByKey(x.getKey()),E==null||!x.isAttached()))return h();let b=Me(x),k=Yn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Zn(k),c(x)}else if(jt(f)){let x=Za(f.anchor.getNode());if(!Qa(x))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=Me(x),k=Yn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Zn(k),E=o.getElementByKey(x.getKey())}else if(!p)return h();if(C===null||E===null)return h();let L=!C||!C.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",L),a.classList.toggle("table-cell-action-button-container--inactive",!L),L){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]);pt(()=>{let a,f=()=>{a=void 0,o.getEditorState().read(u)},m=()=>(a===void 0&&(a=setTimeout(f,0)),!1);return $g(o.registerUpdateListener(m),o.registerCommand(Gg,m,jg),o.registerRootListener((p,h)=>{h&&h.removeEventListener("pointerup",m),p&&(p.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=So(i);return pt(()=>{d.current!==i&&s(!1),d.current=i},[d,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Ne(Qn.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(Ja,{})}),l&&j(Vg,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var tc=t=>{let e=_g(3),{anchorElem:o}=t,n=Tg(),r;return e[0]!==o||e[1]!==n?(r=ec(n?j(Kg,{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 Jg}from"react/compiler-runtime";import{jsx as yo,jsxs as Xg}from"react/jsx-runtime";import{useLexicalComposerContext as Yg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Zg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as qg,$getTableNodeFromLexicalNodeOrThrow as er,$getTableRowIndexFromTableCellNode as Qg,$isTableCellNode as oc,$isTableRowNode as e2,getDOMCellFromTarget as t2,getTableElement as o2,TableNode as nc}from"@lexical/table";import{calculateZoomLevel as rc,mergeRegister as n2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tr,isHTMLElement as r2,SKIP_SCROLL_INTO_VIEW_TAG as lc}from"lexical";import*as sc from"react";import{useCallback as Ht,useEffect as Ro,useRef as Lo,useState as Ke}from"react";import{createPortal as l2}from"react-dom";var i2=33,ic=92;function s2({editor:t}){let e=Lo(null),o=Lo(null),n=Lo(null),[r,l]=Ke(!1),s=U(),i=Lo(null),[c,u]=Ke(null),[d,a]=Ke(null),[f,m]=Ke(!1),[p,h]=Ke(null),g=Ht(()=>{a(null),e.current=null,h(null),i.current=null,n.current=null},[]),C=w=>(w.buttons&1)===1;Ro(()=>{let w=new Set;return n2(t.registerMutationListener(nc,y=>{for(let[S,R]of y)R==="destroyed"?w.delete(S):w.add(S);l(w.size>0)}),t.registerNodeTransform(nc,y=>{if(y.getColWidths())return y;let S=y.getColumnCount(),R=ic;return y.setColWidths(Array(S).fill(R)),y}))},[t]),Ro(()=>{if(!r)return;let w=v=>{let D=v.target;if(r2(D)){if(p){u({x:v.clientX,y:v.clientY});return}if(m(C(v)),!(o.current&&o.current.contains(D))&&e.current!==D){e.current=D;let F=t2(D);F&&d!==F?t.getEditorState().read(()=>{let M=tr(F.elem);if(!M)throw new Error("TableCellResizer: Table cell node not found.");let B=er(M),$=o2(B,t.getElementByKey(B.getKey()));if(!$)throw new Error("TableCellResizer: Table element not found.");e.current=D,n.current=$.getBoundingClientRect(),a(F)},{editor:t}):F==null&&g()}}},y=v=>{m(!0)},S=v=>{m(!1)},R=t.registerRootListener((v,D)=>{D?.removeEventListener("mousemove",w),D?.removeEventListener("mousedown",y),D?.removeEventListener("mouseup",S),v?.addEventListener("mousemove",w),v?.addEventListener("mousedown",y),v?.addEventListener("mouseup",S)});return()=>{R()}},[d,p,t,r,g]);let E=w=>w==="bottom",L=Ht(w=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=tr(d.elem);if(!oc(y))throw new Error("TableCellResizer: Table cell node not found.");let S=er(y),R=Qg(y),v=S.getChildren(),F=y.getColSpan()===S.getColumnCount()?R:R+y.getRowSpan()-1;if(F>=v.length||F<0)throw new Error("Expected table cell to be inside of table row.");let M=v[F];if(!e2(M))throw new Error("Expected table row");let B=M.getHeight();if(B===void 0){let P=M.getChildren();B=Math.min(...P.map(V=>x(V,t)??1/0))}let $=Math.max(B+w,i2);M.setHeight($)},{tag:lc})},[d,t]),x=(w,y)=>y.getElementByKey(w.getKey())?.clientHeight,b=(w,y)=>{let S;return y.forEach(R=>{R.forEach((v,D)=>{v.cell===w&&(S=D)})}),S},k=Ht(w=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=tr(d.elem);if(!oc(y))throw new Error("TableCellResizer: Table cell node not found.");let S=er(y),[R]=qg(S,null,null),v=b(y,R);if(v===void 0)throw new Error("TableCellResizer: Table column not found.");let D=S.getColWidths();if(!D)return;let F=D[v];if(F===void 0)return;let M=[...D],B=Math.max(F+w,ic);M[v]=B,S.setColWidths(M)},{tag:lc})},[d,t]),_=Ht(w=>{let y=S=>{if(S.preventDefault(),S.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:v}=i.current;if(d===null)return;let D=rc(S.target);if(E(w)){let F=(S.clientY-v)/D;L(F)}else{let F=(S.clientX-R)/D;k(F)}g(),document.removeEventListener("mouseup",y)}};return y},[d,g,k,L]),T=Ht(w=>y=>{if(y.preventDefault(),y.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");i.current={x:y.clientX,y:y.clientY},u(i.current),h(w),document.addEventListener("mouseup",_(w))},[d,_]),[I,N]=Ke({bottom:null,left:null,right:null,top:null});return Ro(()=>{if(d){let{height:w,left:y,top:S,width:R}=d.elem.getBoundingClientRect(),v=rc(d.elem),D=!!t.getRootElement()?.closest('dialog, [role="dialog"]'),F=D?0:window.scrollX,M=D?0:window.scrollY,B=D?"fixed":"absolute",$=10,P={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${$}px`,left:`${F+y}px`,position:B,top:`${M+S+w-$/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${w}px`,left:`${F+y+R-$/2}px`,position:B,top:`${M+S}px`,width:`${$}px`}},V=n.current;p&&c&&V&&(E(p)?(P[p].left=`${F+V.left}px`,P[p].top=`${M+c.y/v}px`,P[p].height="3px",P[p].width=`${V.width}px`):(P[p].top=`${M+V.top}px`,P[p].left=`${F+c.x/v}px`,P[p].width="3px",P[p].height=`${V.height}px`),P[p].backgroundColor="#adf"),N(P)}else N({bottom:null,left:null,right:null,top:null})},[d,p,t,c]),yo("div",{ref:o,children:d!=null&&!f&&Xg(sc.Fragment,{children:[yo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),yo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var ac=()=>{let t=Jg(7),[e]=Yg(),o=Zg(),[n,r]=Ke(null),l,s;t[0]!==e?(l=()=>e.registerRootListener(c=>{r(c?.closest('dialog, [role="dialog"]')??document.body)}),s=[e],t[0]=e,t[1]=l,t[2]=s):(l=t[1],s=t[2]),Ro(l,s);let i;return t[3]!==e||t[4]!==o||t[5]!==n?(i=o&&n?l2(yo(s2,{editor:e}),n):null,t[3]=e,t[4]=o,t[5]=n,t[6]=i):i=t[6],i};import{c as h2}from"react/compiler-runtime";import{jsx as or,jsxs as g2,Fragment as x2}from"react/jsx-runtime";import{useLexicalComposerContext as C2}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as gc}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as b2,$getTableColumnIndexFromTableCellNode as k2,$getTableRowIndexFromTableCellNode as _2,$insertTableColumnAtSelection as T2,$insertTableRowAtSelection as E2,$isTableCellNode as w2,$isTableNode as dc,getTableElement as S2,TableNode as N2}from"@lexical/table";import{$findMatchingParent as L2,mergeRegister as y2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as mc,isHTMLElement as R2}from"lexical";import{useEffect as fc,useMemo as v2,useRef as pc,useState as vo}from"react";import"react";import{createPortal as I2}from"react-dom";import{c as m2}from"react/compiler-runtime";import{useEffect as f2,useRef as p2}from"react";var a2="Expected a function",c2=Math.max,u2=Math.min;function d2(t,e,o){let n,r,l=0,s,i=!1,c=!1,u,d,a,f=!0;if(typeof t!="function")throw new TypeError(a2);e=e||0,typeof o=="object"&&(i=!!o.leading,c="maxWait"in o,u=c?c2(o.maxWait||0,e):u,f="trailing"in o?!!o.trailing:f);function m(k){let _=n,T=s;return n=s=void 0,l=k,d=t.apply(T,_),d}function p(k){return l=k,a=setTimeout(C,e),i?m(k):d}function h(k){let _=k-r,T=k-l,I=e-_;return c?u2(I,u-T):I}function g(k){let _=k-r,T=k-l;return r===void 0||_>=e||_<0||c&&T>=u}function C(){let k=Date.now();if(g(k))return E(k);a=setTimeout(C,h(k))}function E(k){return a=void 0,f&&n?m(k):(n=s=void 0,d)}function L(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function x(){return a===void 0?d:E(Date.now())}function b(){let k=Date.now(),_=g(k);if(n=arguments,s=this,r=k,_){if(a===void 0)return p(r);if(c)return clearTimeout(a),a=setTimeout(C,e),m(r)}return a===void 0&&(a=setTimeout(C,e)),d}return b.cancel=L,b.flush=x,b}var cc=d2;function uc(t,e,o){let n=m2(6),r=p2(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=cc(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]),f2(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...u)=>{let d=u;r.current&&r.current(...d)},n[5]=i):i=n[5],i}var hc=16;function M2({anchorElem:t}){let[e]=C2(),o=gc(),n=U(),[r,l]=vo(!1),[s,i]=vo(!1),[c,u]=vo(!1),[d,a]=vo({}),f=pc(new Set),m=pc(null),p=uc(C=>{let{isOutside:E,tableDOMNode:L}=A2(C,n.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!L)return;m.current=L;let x=null,b=null,k=null;if(e.getEditorState().read(()=>{let F=mc(L);if(w2(F)){let M=L2(F,B=>dc(B));if(!dc(M))return;if(k=S2(M,e.getElementByKey(M.getKey())),k){let B=M.getChildrenSize(),$=M.getChildAtIndex(0)?.getChildrenSize(),P=_2(F),V=k2(F);P===B-1?x=F:V===$-1&&(b=F)}}},{editor:e}),!k)return;let _=k.parentElement;if(!_)return;let{bottom:T,height:I,left:N,right:w,width:y,y:S}=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:hc,left:R&&_?_.offsetLeft:N-v,top:T-D+5,width:R&&_?_.offsetWidth:y})):b&&(i(!0),l(!1),a({height:I,left:w-v+5,top:S-D,width:hc}))},50,250),h=v2(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);fc(()=>{if(c)return document.addEventListener("mousemove",p),()=>{l(!1),i(!1),document.removeEventListener("mousemove",p)}},[c,p]),fc(()=>y2(e.registerMutationListener(N2,C=>{e.getEditorState().read(()=>{let E=!1;for(let[L,x]of C)switch(x){case"created":{f.current.add(L),E=!0;break}case"destroyed":{f.current.delete(L),E=!0;break}default:break}if(E){h.disconnect();for(let L of f.current){let{tableElement:x}=b2(L);h.observe(x)}u(f.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let g=C=>{e.update(()=>{m.current&&(mc(m.current)?.selectEnd(),C?(E2(),l(!1)):(T2(),i(!1)))})};return o?g2(x2,{children:[r&&or("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...d},type:"button"}),s&&or("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...d},type:"button"})]}):null}function A2(t,e){let o=t.target;if(R2(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 xc(t){let e=h2(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!gc())return null;let l;return e[0]!==n?(l=I2(or(M2,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as lr,jsxs as F2}from"react/jsx-runtime";import{useLexicalComposerContext as P2}from"@lexical/react/LexicalComposerContext";import{TablePlugin as B2}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as j2,TableCellNode as H2,TableNode as z2,TableRowNode as G2}from"@lexical/table";import{mergeRegister as U2}from"@lexical/utils";import{$getSelection as W2,$isRangeSelection as V2,$setSelection as K2,COMMAND_PRIORITY_EDITOR as J2,createCommand as X2}from"lexical";import{createContext as Y2,use as Z2,useCallback as Ec,useEffect as wc,useMemo as q2,useRef as Q2,useState as Io}from"react";import*as Sc from"react";import{jsx as te,jsxs as Le}from"react/jsx-runtime";import{useCallback as nr,useEffect as Cc,useRef as rr,useState as zt}from"react";import*as _c from"react";import{createPortal as D2}from"react-dom";var bc=10,kc=7;function $2(){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 O2(){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 Tc({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=zt(0),[c,u]=zt(0),[d,a]=zt(""),[f,m]=zt(""),[p,h]=zt(null),g=rr(null),C=rr(null),E=rr(null),L=s>0?s:d?parseInt(d,10)||0:5,x=c>0?c:f?parseInt(f,10)||0:5;Cc(()=>{o||(i(0),u(0),a(""),m(""),h(null))},[o]),Cc(()=>{if(!o)return;let N=w=>{if(w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),n()),w.key==="Enter"&&p){w.preventDefault();let y=parseInt(d,10),S=parseInt(f,10);y>0&&S>0&&r(y,S)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,p,d,f]);let b=nr((N,w)=>{N>0&&w>0&&r(N,w)},[r]),k=nr((N,w)=>{i(N),u(w)},[]),_=nr(()=>{i(0),u(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=kc;N++)for(let w=1;w<=bc;w++){let y=w<=L&&N<=x,S=w<=s&&N<=c,R="table-grid-popup__cell";y&&S?R+=" table-grid-popup__cell--hover":y&&(R+=" table-grid-popup__cell--selected"),T.push(te("div",{"aria-label":`${w} columns, ${N} rows`,className:R,onClick:()=>b(w,N),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),b(w,N))},onMouseEnter:()=>k(w,N),role:"button",tabIndex:-1},`${N}-${w}`))}let I=s>0&&c>0;return D2(Le(_c.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${p==="cols"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te($2,{})}),te("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>h(null),onChange:N=>a(N.target.value),onFocus:()=>h("cols"),placeholder:s>0?String(s):"5",ref:C,type:"number",value:d})]}),te("span",{className:"table-grid-popup__separator",children:"\xD7"}),Le("div",{className:`table-grid-popup__input-group${p==="rows"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(O2,{})}),te("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>h(null),onChange:N=>m(N.target.value),onFocus:()=>h("rows"),placeholder:c>0?String(c):"5",ref:E,type:"number",value:f})]})]}),Le("div",{className:"table-grid-popup__grid",onMouseLeave:_,children:[T,I&&Le("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/bc*100}%)`,top:`calc(${(c-1)/kc*100}%)`},children:[L," \xD7 ",x]})]})]})})]}),t)}var Mo=X2("OPEN_EMBED_DRAWER_COMMAND"),Nc=Y2({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Lc({children:t}){let[e,o]=Io({cellEditorConfig:null,cellEditorPlugins:null});return lr(Nc,{value:q2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var yc=()=>{let[t]=P2(),e=Z2(Nc),[o,n]=Io(!1),[r,l]=Io(null),s=Q2(null),[i,c]=Io(null);wc(()=>{let a=t.getRootElement();if(a){let f=a.closest(".editor")??null;c(f??a.parentElement)}},[t]),wc(()=>{if(!t.hasNodes([z2,G2,H2]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return U2(t.registerCommand(Mo,()=>{let a=i;if(!a)return!0;let f=a.getBoundingClientRect(),m=null;t.getEditorState().read(()=>{let h=W2();if(V2(h)){s.current=h.clone();let g=h.anchor.getNode(),C=t.getElementByKey(g.getKey());if(C){let E=C.getBoundingClientRect();E.height>0&&(m={left:E.left-f.left,top:E.bottom-f.top+8})}}});let p=window.getSelection();if(p&&p.rangeCount>0){let g=p.getRangeAt(0).getBoundingClientRect();g.height>0&&(m={left:g.left-f.left,top:g.bottom-f.top+8})}return m||(m={left:0,top:40}),l(m),n(!0),!0},J2))},[e,t,i]);let u=Ec(()=>{n(!1)},[]),d=Ec((a,f)=>{n(!1),t.focus(),t.update(()=>{s.current&&K2(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(j2,{columns:String(a),rows:String(f)})},1)},[t]);return F2(Sc.Fragment,{children:[lr(Tc,{anchorElem:i,editor:t,isOpen:o,onClose:u,onInsert:d,position:r}),lr(B2,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var nx=A({markdownTransformers:[Wa],nodes:[tx,ex,ox],plugins:[{Component:yc,position:"normal"},{Component:ac,position:"normal"},{Component:tc,position:"floatingAnchorElem"},{Component:xc,position:"floatingAnchorElem"}],providers:[Lc],slashMenu:{groups:[q([{Icon:Kn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Mo,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Kn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Mo,{})}}])]}});import{$isNodeSelection as Mx}from"lexical";import{jsx as Rc}from"react/jsx-runtime";import"react";var rx="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",ir=({className:t})=>Rc("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:Rc("path",{clipRule:"evenodd",d:rx,fill:"currentColor",fillRule:"evenodd"})});import{c as mx}from"react/compiler-runtime";import{jsx as fx}from"react/jsx-runtime";import{useLexicalComposerContext as px}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as jc,$insertNodeToNearestRoot as cr,mergeRegister as hx}from"@lexical/utils";import{useBulkUpload as gx,useEffectEvent as xx,useModal as Cx}from"@payloadcms/ui";import ur from"bson-objectid";import{$createRangeSelection as bx,$getPreviousSelection as $c,$getSelection as Oc,$isParagraphNode as dr,$isRangeSelection as Fc,$setSelection as kx,COMMAND_PRIORITY_EDITOR as _x,COMMAND_PRIORITY_LOW as Pc,createCommand as Tx,DROP_COMMAND as Ex,getDOMSelectionFromTarget as wx,isHTMLElement as Bc,PASTE_COMMAND as Sx}from"lexical";import{useEffect as Nx}from"react";import{c as vc}from"react/compiler-runtime";import{jsx as sr}from"react/jsx-runtime";import{useLexicalComposerContext as Ic}from"@lexical/react/LexicalComposerContext.js";import{toast as lx}from"@payloadcms/ui";import{$getNodeByKey as ix,COMMAND_PRIORITY_EDITOR as Mc}from"lexical";import{useEffect as Ac,useState as sx}from"react";var ax=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=ix(o);r&&r.replace(ye({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(ar,{fields:null,relationTo:e,value:n})},cx=t=>{let e=vc(13),{enabledCollectionSlugs:o}=t,[n]=Ic(),[r,l]=sx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:c,openListDrawer:u}=Ot(s),d,a;e[2]!==n||e[3]!==u?(d=()=>n.registerCommand(tt,h=>(l(h?.replace?h?.replace.nodeKey:null),u(),!0),Mc),a=[n,u],e[2]=n,e[3]=u,e[4]=d,e[5]=a):(d=e[4],a=e[5]),Ac(d,a);let f;e[6]!==i||e[7]!==n||e[8]!==r?(f=h=>{let{collectionSlug:g,doc:C}=h;i(),ax({editor:n,relationTo:g,replaceNodeKey:r,value:C.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=f):f=e[9];let m=f,p;return e[10]!==c||e[11]!==m?(p=sr(c,{onSelect:m}),e[10]=c,e[11]=m,e[12]=p):p=e[12],p},ux=()=>{let t=vc(3),[e]=Ic(),o,n;return t[0]!==e?(o=()=>e.registerCommand(tt,dx,Mc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Ac(o,n),null},Dc=({enabledCollectionSlugs:t})=>t?.length?sr(cx,{enabledCollectionSlugs:t}):sr(ux,{});function dx(){return lx.error("No upload collections enabled"),!0}function Lx(t){let e=t.target;return!!(Bc(e)&&!e.closest("code, span.editor-image")&&Bc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function yx(t){let e,o=wx(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 ar=Tx("INSERT_UPLOAD_COMMAND"),Hc=t=>{let e=mx(20),{clientProps:o}=t,[n]=px(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=go(r),{modalSlug:s,setCollectionSlug:i,setInitialForms:c,setOnCancel:u,setOnSuccess:d,setSelectableCollections:a}=gx(),{isModalOpen:f,openModal:m}=Cx(),p;e[2]!==s||e[3]!==n||e[4]!==l||e[5]!==f||e[6]!==m||e[7]!==i||e[8]!==c||e[9]!==u||e[10]!==d||e[11]!==a?(p=L=>{let{files:x}=L;if(x?.length!==0&&(c(b=>[...b??[],...x.map(Rx)]),!f(s))){if(!l.length||!l[0])return;i(l[0]),a(l),u(()=>{n.update(vx)}),d(b=>{let k=new Map(b.map(Ix));n.update(()=>{for(let _ of jc()){let T=_.node;if(nt(T)){let I=T.getData();if(I?.pending){let N=k.get(I.pending?.formID);N&&T.replace(ye({data:{id:new ur.default().toHexString(),fields:{},relationTo:N.collectionSlug,value:N.doc.id}}))}}}})}),m(s)}},e[2]=s,e[3]=n,e[4]=l,e[5]=f,e[6]=m,e[7]=i,e[8]=c,e[9]=u,e[10]=d,e[11]=a,e[12]=p):p=e[12];let h=xx(p),g;e[13]!==n||e[14]!==h?(g=()=>{if(!n.hasNodes([ot]))throw new Error("UploadPlugin: UploadNode not registered on editor");let L=new WeakSet;return hx(n.registerNodeTransform(ot,x=>{let b=x.getData();if(!b?.pending||L.has(b.pending))return;L.add(b.pending),async function(){let T=null,I=b?.pending?.src,N=b?.pending?.formID;if(I?.startsWith("data:")){let w=I.match(/data:(image\/[a-zA-Z]+);base64,/),y=w?w[1]:"image/png",S=I.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob(S),v=new Array(R.length);for(let M=0;M<R.length;M++)v[M]=R.charCodeAt(M);let D=new Uint8Array(v);T={alt:void 0,file:new File([D],"pasted-image."+y?.split("/",2)[1],{type:y}),formID:N}}else if(I?.startsWith("http")||I?.startsWith("https")){let y=await(await fetch(I)).blob(),S=I.split("/").pop()||"pasted-image"+y.type.split("/",2)[1];T={alt:void 0,file:new File([y],S,{type:y.type}),formID:N}}T&&h({files:[T]})}()}),n.registerCommand(ar,x=>(n.update(()=>{let b=Oc()||$c();if(Fc(b)){let k=ye({data:{id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}}),{focus:_}=b,T=_.getNode();cr(k),dr(T)&&!T.__first&&T.remove()}}),!0),_x),n.registerCommand(Sx,x=>{if(!(x instanceof ClipboardEvent))return!1;let b=x.clipboardData;if(!b?.types?.length||b?.types?.includes("text/html"))return!1;let k=[];return b?.files?.length&&Array.from(b.files).forEach(_=>{k.push({alt:"",file:_,formID:new ur.default().toHexString()})}),k.length?(n.update(()=>{let _=Oc()||$c();if(Fc(_))for(let T of k){let I=ye({data:{pending:{formID:T.formID,src:URL.createObjectURL(T.file)}}}),{focus:N}=_,w=N.getNode();cr(I),dr(w)&&!w.__first&&w.remove()}}),h({files:k}),!0):!1},Pc),n.registerCommand(Ex,x=>{if(!(x instanceof DragEvent))return!1;let b=x.dataTransfer;if(!b?.types?.length)return!1;let k=[];return b?.files?.length&&Array.from(b.files).forEach(_=>{k.push({alt:"",file:_,formID:new ur.default().toHexString()})}),k.length?(x.preventDefault(),x.stopPropagation(),n.update(()=>{if(Lx(x)){let _=yx(x),T=bx();_!=null&&T.applyDOMRange(_),kx(T);for(let I of k){let N=ye({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:w}=T,y=w.getNode();cr(N),dr(y)&&!y.__first&&y.remove()}}}),h({files:k}),!0):!1},Pc))},e[13]=n,e[14]=h,e[15]=g):g=e[15];let C;e[16]!==n?(C=[n],e[16]=n,e[17]=C):C=e[17],Nx(g,C);let E;return e[18]!==l?(E=fx(Dc,{enabledCollectionSlugs:l}),e[18]=l,e[19]=E):E=e[19],E};function Rx(t){return{file:t.file,formID:t.formID}}function vx(){for(let t of jc()){let e=t.node;nt(e)&&e.getData()?.pending&&e.remove()}}function Ix(t){return[t.formID,t]}var Ax=A({nodes:[ot],plugins:[{Component:Hc,position:"normal"}],slashMenu:{groups:[q([{Icon:ir,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(tt,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:ir,isActive:({selection:t})=>{if(!Mx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return nt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(tt,{replace:!1})}}])]}});import{c as $x}from"react/compiler-runtime";import{jsx as Ao}from"react/jsx-runtime";import{createElement as Ox}from"react";import{ShimmerEffect as Fx,useConfig as Px}from"@payloadcms/ui";import{lazy as Bx,Suspense as jx,useEffect as Hx,useState as zx}from"react";var zc={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 mr={namespace:"lexical",theme:zc};function Gc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map,i=[];for(let d of l.features){if(!d?.clientFeatureProps?.featureKey||d?.clientFeatureProps?.order===void 0||d?.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(d.clientFeatureProps.featureKey,d),i.push(d)}l.features=i,l.features=l.features.sort((d,a)=>d.clientFeatureProps.order-a.clientFeatureProps.order);let c=new Map,u=0;for(let d of l.features){let a=typeof d.feature=="function"?d.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:c,schemaPath:r,unSanitizedEditorConfig:l}):d.feature;a.key=d.clientFeatureProps.featureKey,a.order=u,c.set(d.clientFeatureProps.featureKey,a),u++}return c}import{deepMerge as Dx}from"payload/shared";var Uc=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?Dx(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 fr(t,e,o,n){return{admin:o,features:Uc(t),lexical:e,resolvedFeatureMap:t,view:n}}var Gx=Bx(()=>import("./Field-ZK6DB4T2.js").then(t=>({default:t.RichText}))),Ux=t=>Ao(Ko,{inheritable:!0,views:t.views,children:Ao(Wx,{...t})}),Wx=t=>{let e=$x(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:c,views:u}=t,d;e[0]!==o?(d=o===void 0?{}:o,e[0]=o,e[1]=d):d=e[1];let a=d,f;e[2]!==r?(f=r===void 0?{}:r,e[2]=r,e[3]=f):f=e[3];let m=f,p=i===void 0?mr:i,{currentView:h}=Jo(),g=u?.[h]?.admin??a,C=u?.[h]?.lexical,E;e[4]!==p||e[5]!==C?(E=typeof C=="function"?C(p):C??p,e[4]=p,e[5]=C,e[6]=E):E=e[6];let L=E,{config:x}=Px(),[b,k]=zx(null),_,T;e[7]!==n||e[8]!==x||e[9]!==h||e[10]!==g||e[11]!==L||e[12]!==m||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==c||e[17]!==u?(_=()=>{if(b&&b.view===h)return;let N=u?.[h],w=N?.filterFeatures?N.filterFeatures(n):n,y=[];for(let R of Object.values(w))!R.clientFeatureProvider||!R.clientFeatureProps||y.push(R.clientFeatureProvider(R.clientFeatureProps));let S=Gc({config:x,featureClientImportMap:m,featureClientSchemaMap:l,field:s,schemaPath:c??s.name,unSanitizedEditorConfig:{features:y,lexical:L}});k(fr(S,L,g,h))},T=[g,n,x,m,l,s,b,L,c,h,u],e[7]=n,e[8]=x,e[9]=h,e[10]=g,e[11]=L,e[12]=m,e[13]=l,e[14]=s,e[15]=b,e[16]=c,e[17]=u,e[18]=_,e[19]=T):(_=e[18],T=e[19]),Hx(_,T);let I;return e[20]!==b||e[21]!==t?(I=Ao(jx,{fallback:Ao(Fx,{height:"35vh"}),children:b&&Ox(Gx,{...t,editorConfig:b,key:b.view})}),e[20]=b,e[21]=t,e[22]=I):I=e[22],I};function Vx(...t){return t.filter(Boolean).join(" ")}var Kx=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var Do=new WeakMap;function Wc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function $o(t,e){let o=Do.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Wc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let c=Wc(s);for(let u of n)c!==null&&u([c[0]-i[0],c[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},Do.set(t,o)}return o.listeners.add(e),()=>{Jx(t,e)}}function Jx(t,e){let o=Do.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Do.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Xx(t,e){return $o(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function Yx(t,e){return $o(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function Zx(t,e){return $o(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function qx(t,e){return $o(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as Qx}from"react/compiler-runtime";import{jsx as eC}from"react/jsx-runtime";import"react";var tC=()=>{let t=Qx(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?eC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as oC}from"react/compiler-runtime";import{jsx as nC}from"react/jsx-runtime";import"react";var rC=()=>{let t=oC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?nC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as lC}from"react/compiler-runtime";import{jsx as iC}from"react/jsx-runtime";import"react";var sC=()=>{let t=lC(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?iC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as aC}from"react/compiler-runtime";import{jsx as cC}from"react/jsx-runtime";import"react";var uC=t=>{let e=aC(3),{children:o}=t,{InlineBlockContainer:n}=xe(),r;return e[0]!==n||e[1]!==o?(r=n?cC(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as dC}from"react/jsx-runtime";import"react";var mC=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?dC(n,{...o,children:e}):null};import{c as fC}from"react/compiler-runtime";import{jsx as pC}from"react/jsx-runtime";import"react";var hC=()=>{let t=fC(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?pC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gC}from"react/compiler-runtime";import{jsx as xC}from"react/jsx-runtime";import"react";var CC=()=>{let t=gC(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?xC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as bC}from"qs-esm";var kC=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let c=bC({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${c}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};var Vc={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 Dx}from"react/jsx-runtime";import{CodeField as Ox,useFormFields as Fx}from"@payloadcms/ui";import{useId as Px,useMemo as Bx}from"react";var yo={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var jx=({autoComplete:t,field:e,forceRender:o,languages:n=yo,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,typescript:d,validate:c})=>{let a=Fx(([T])=>T.language),m=a?.value||a?.initialValue||"typescript",f=Px(),h=n[m],p=Bx(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${f}.tsx`:void 0},language:m}}),[e,m,f]),x=`${e.name}-${m}-${h}`;return p&&Dx(Ox,{autoComplete:t,field:p,forceRender:o,onMount:(T,N)=>{N.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),N.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),N.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:N.languages.typescript.JsxEmit.React,moduleResolution:N.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:d?.paths,reactNamespace:"React",target:N.languages.typescript.ScriptTarget[d?.target??"ESNext"],typeRoots:d?.typeRoots??["node_modules/@types"]}),N.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!d?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>d?.fetchTypes&&Array.isArray(d.fetchTypes)&&d.fetchTypes.length>0&&await Promise.all(d.fetchTypes.map(async g=>{let b=await(await fetch(g.url)).text();N.languages.typescript.typescriptDefaults.addExtraLib(b,g.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,validate:c},x)};import{jsx as re,jsxs as Ic}from"react/jsx-runtime";import{useLexicalEditable as Yx}from"@lexical/react/useLexicalEditable";import{ChevronIcon as Zx,Combobox as qx,CopyToClipboard as Qx,PopupList as eC,RenderFields as tC,useForm as oC,useFormFields as Mc,useTranslation as nC}from"@payloadcms/ui";import rC from"react";import{jsx as Sc}from"react/jsx-runtime";import"react";var Hx={16:"M6.646 6.146a.5.5 0 1 0 .708.708l1.5-1.5a.5.5 0 0 0 0-.708l-1.5-1.5a.5.5 0 1 0-.708.708L7.793 5zm-1.292-3a.5.5 0 0 1 0 .708L4.207 5l1.147 1.146a.5.5 0 1 1-.708.708l-1.5-1.5a.5.5 0 0 1 0-.708l1.5-1.5a.5.5 0 0 1 .708 0M10.5 3h1A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5v-3a.5.5 0 0 1 1 0v3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 1 0-1",24:"M16.5 6C17.3284 6 18 6.67157 18 7.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V12.5C6 12.2239 6.22386 12 6.5 12C6.77614 12 7 12.2239 7 12.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V7.5C17 7.22386 16.7761 7 16.5 7H15.5C15.2239 7 15 6.77614 15 6.5C15 6.22386 15.2239 6 15.5 6H16.5ZM8.14648 6.14648C8.34175 5.95122 8.65825 5.95122 8.85352 6.14648C9.04878 6.34175 9.04878 6.65825 8.85352 6.85352L7.20703 8.5L8.85352 10.1465C9.04878 10.3417 9.04878 10.6583 8.85352 10.8535C8.65825 11.0488 8.34175 11.0488 8.14648 10.8535L6.14648 8.85352C5.95122 8.65825 5.95122 8.34175 6.14648 8.14648L8.14648 6.14648ZM11.1465 6.14648C11.3417 5.95122 11.6583 5.95122 11.8535 6.14648L13.8535 8.14648C14.0488 8.34175 14.0488 8.65825 13.8535 8.85352L11.8535 10.8535C11.6583 11.0488 11.3417 11.0488 11.1465 10.8535C10.9512 10.6583 10.9512 10.3417 11.1465 10.1465L12.793 8.5L11.1465 6.85352C10.9512 6.65825 10.9512 6.34175 11.1465 6.14648Z"},Nc=({className:t,size:e=24})=>Sc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Sc("path",{clipRule:"evenodd",d:Hx[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as er}from"react/jsx-runtime";import"react";import{useCollapsible as Wx}from"@payloadcms/ui";import{jsx as Lc}from"react/jsx-runtime";import"react";var Gx="M11.4999 13C11.6325 13 11.7597 13.0527 11.8535 13.1464L14.8535 16.1464C15.0487 16.3417 15.0487 16.6582 14.8535 16.8535C14.6582 17.0487 14.3417 17.0487 14.1464 16.8535L11.4999 14.207L8.85346 16.8535C8.6582 17.0487 8.34169 17.0487 8.14643 16.8535C7.95119 16.6582 7.95119 16.3417 8.14643 16.1464L11.1464 13.1464C11.2402 13.0527 11.3674 13 11.4999 13ZM14.1464 7.14644C14.3417 6.95119 14.6582 6.95118 14.8535 7.14644C15.0487 7.3417 15.0487 7.65821 14.8535 7.85347L11.8535 10.8535C11.7597 10.9472 11.6325 10.9999 11.4999 11C11.3674 10.9999 11.2402 10.9472 11.1464 10.8535L8.14643 7.85347C7.95119 7.65821 7.95119 7.3417 8.14643 7.14644C8.34169 6.9512 8.6582 6.9512 8.85346 7.14644L11.4999 9.79292L14.1464 7.14644Z",Ro=({className:t})=>Lc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Lc("path",{d:Gx,fill:"currentColor"})});import{jsx as yc}from"react/jsx-runtime";import"react";var zx="M11.5 6C11.6326 6 11.7597 6.05272 11.8535 6.14648L14.8535 9.14648C15.0487 9.34175 15.0487 9.65825 14.8535 9.85352C14.6582 10.0488 14.3417 10.0488 14.1464 9.85352L12 7.70703V16.293L14.1464 14.1465C14.3417 13.9512 14.6582 13.9512 14.8535 14.1465C15.0487 14.3417 15.0487 14.6583 14.8535 14.8535L11.8535 17.8535C11.6582 18.0488 11.3417 18.0488 11.1464 17.8535L8.14645 14.8535C7.95119 14.6583 7.95119 14.3417 8.14645 14.1465C8.34171 13.9512 8.65822 13.9512 8.85348 14.1465L11 16.293V7.70703L8.85348 9.85352C8.65822 10.0488 8.34171 10.0488 8.14645 9.85352C7.95118 9.65825 7.95118 9.34175 8.14645 9.14648L11.1464 6.14648C11.2402 6.05272 11.3674 6 11.5 6Z",vo=({className:t})=>yc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:yc("path",{clipRule:"evenodd",d:zx,fill:"currentColor",fillRule:"evenodd"})});var Ux="code-block-collapse-button",Rc=()=>{let{isCollapsed:t,toggle:e}=Wx();return er("button",{className:Ux,onClick:e,type:"button",children:t?er(vo,{}):er(Ro,{})})};import{jsx as tr,jsxs as Vx}from"react/jsx-runtime";import{useCollapsible as Kx,useTranslation as Xx}from"@payloadcms/ui";import"react";var Jx="code-block-floating-collapse-button",vc=()=>{let{isCollapsed:t,toggle:e}=Kx(),{t:o}=Xx();return Vx("button",{className:Jx,onClick:e,type:"button",children:[t?tr(vo,{}):tr(Ro,{}),tr("span",{children:o(t?"general:expand":"general:collapse")})]})};var We="payload-richtext-code-block",lC=t=>{let{languages:e}=t,o=e||yo,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ae(),{setModified:s}=oC(),{t:i}=nC(),{codeField:u}=Mc(([h])=>({codeField:h?.code})),{selectedLanguageField:d,setSelectedLanguage:c}=Mc(([h,p])=>({selectedLanguageField:h?.language,setSelectedLanguage:x=>{p({type:"UPDATE",path:"language",value:x}),s(!0)}})),a=o[d?.value],m=Yx(),f=rC.useMemo(()=>Object.entries(o).map(([h,p])=>({name:`${h} ${p}`,Component:re(eC.Button,{active:!1,disabled:!1,onClick:()=>{c(h)},children:re("span",{className:`${We}__language-code`,"data-language":h,children:p})})})),[o,c]);return re(n,{Actions:Ic("div",{className:`${We}__actions`,children:[re(qx,{"aria-label":i("general:language"),button:Ic("div",{className:`${We}__language-selector-button`,"data-selected-language":d?.value,children:[re("span",{children:a}),re(Zx,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:f,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(Qx,{value:u?.value??""}),re(Rc,{}),m&&re(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:re(vc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${We}__pill`,children:re(Nc,{})}),showDragHandle:!1,showRowNumber:!1,children:re(tC,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as iC}from"react/compiler-runtime";import{jsx as pt}from"react/jsx-runtime";import{FieldContext as sC,FieldPathContext as Ac,ServerFunctionsContext as $c,ShimmerEffect as aC,useServerFunctions as cC}from"@payloadcms/ui";import uC,{useEffect as dC,useRef as mC}from"react";var fC=t=>{let e=iC(10),{name:o,field:n,initialValue:r,label:l,Loading:s,path:i,schemaPath:u,setValue:d,value:c}=t,[a,m]=uC.useState(null),f=cC(),{_internal_renderField:h}=f,[p,x]=u.split(".",2),T=o!==void 0?o:n?.name,N=l!==void 0?l:n?.label,S=i??T??"",g;e[0]!==h||e[1]!==N||e[2]!==T||e[3]!==r||e[4]!==i||e[5]!==u?(g=()=>{(async function(){let{Field:w}=await h({name:T,hidden:!1,initialValue:r??void 0,label:typeof N=="function"?void 0:N,path:i,schemaPath:u});m(w)})()},e[0]=h,e[1]=N,e[2]=T,e[3]=r,e[4]=i,e[5]=u,e[6]=g):g=e[6];let C=g,b=mC(!1),k,_;if(e[7]!==C?(k=()=>{b.current||(b.current=!0,C())},_=[C],e[7]=C,e[8]=k,e[9]=_):(k=e[8],_=e[9]),dC(k,_),!a)return typeof s<"u"?s:pt(aC,{});let A={...f,getFormState:async E=>f.getFormState({...E,collectionSlug:p==="collection"?x:void 0,globalSlug:p==="global"?x:void 0})};if(typeof c>"u"&&!d)return pt($c,{value:{...A},children:pt(Ac,{value:S,children:a},S)});let L={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:c,path:S,setValue:d??pC,showError:!1,value:c};return pt($c,{value:{...A},children:pt(Ac,{value:S,children:pt(sC,{value:L,children:a})},S)})};function pC(){}function Dc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o.root.children.length===0&&o.root.children.push({type:"paragraph",children:[],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),o}var hC=Dc;export{Rt as $createAutoLinkNode,Fe as $createBlockNode,ot as $createHorizontalRuleNode,bt as $createInlineBlockNode,_e as $createLinkNode,Ue as $createRelationshipNode,Re as $createUploadNode,we as $isAutoLinkNode,Ie as $isBlockNode,je as $isHorizontalRuleNode,kt as $isInlineBlockNode,K as $isLinkNode,wn as $isRelationshipNode,Qe as $isUploadNode,iu as AlignFeatureClient,Te as AutoLinkNode,Nx as BlockCollapsible,Rx as BlockEditButton,ce as BlockNode,Mx as BlockRemoveButton,pu as BlockquoteFeatureClient,Pd as BlocksFeatureClient,mm as BoldFeatureClient,se as CAN_USE_DOM,O1 as ChecklistFeatureClient,lC as CodeBlockBlockComponent,jx as CodeComponent,u0 as DETAIL_TYPE_TO_DETAIL,i0 as DOUBLE_LINE_BREAK,w0 as DebugJsxConverterFeatureClient,m0 as ELEMENT_FORMAT_TO_TYPE,d0 as ELEMENT_TYPE_TO_FORMAT,Wc as ENABLE_SLASH_MENU_COMMAND,Hc as EditorConfigProvider,$o as FieldsDrawer,l5 as FixedToolbarFeatureClient,Lf as HeadingFeatureClient,Vf as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,et as INSERT_BLOCK_COMMAND,tt as INSERT_INLINE_BLOCK_COMMAND,r0 as IS_ALL_FORMATTING,ap as IndentFeatureClient,Ex as InlineBlockContainer,hx as InlineBlockEditButton,_x as InlineBlockLabel,Ct as InlineBlockNode,Cx as InlineBlockRemoveButton,Cm as InlineCodeFeatureClient,b5 as InlineToolbarFeatureClient,Sm as ItalicFeatureClient,a0 as LTR_REGEX,N1 as LinkFeatureClient,oe as LinkNode,l0 as NON_BREAKING_SPACE,O as NodeFormat,G1 as OrderedListFeatureClient,Y1 as ParagraphFeatureClient,zc as Point,s0 as RTL_REGEX,Vc as Rect,hh as RelationshipFeatureClient,Ee as RelationshipNode,fC as RenderLexical,rx as RichTextField,Do as RichTextViewProvider,Im as StrikethroughFeatureClient,Om as SubscriptFeatureClient,Hm as SuperscriptFeatureClient,f0 as TEXT_MODE_TO_TYPE,c0 as TEXT_TYPE_TO_FORMAT,p0 as TEXT_TYPE_TO_MODE,fe as TOGGLE_LINK_COMMAND,x2 as TableFeatureClient,qd as TestRecorderFeatureClient,nf as TextStateFeatureClient,Dt as ToolbarButton,Ot as ToolbarDropdown,nm as TreeViewFeatureClient,Vm as UnderlineFeatureClient,X1 as UnorderedListFeatureClient,K2 as UploadFeatureClient,qe as UploadNode,mx as addSwipeDownListener,cx as addSwipeLeftListener,ux as addSwipeRightListener,dx as addSwipeUpListener,hC as buildDefaultEditorState,Dc as buildEditorState,Ec as codeConverterClient,sx as createBlockNode,I as createClientFeature,E0 as defaultColors,qn as defaultEditorLexicalConfig,In as getDOMRangeRect,Kc as getEnabledNodes,$x as getRestPopulateFn,nt as getSelectedNode,Uc as isPoint,ix as joinClasses,Qn as sanitizeClientEditorConfig,Tc as sanitizeClientFeatures,ho as setFloatingElemPosition,ro as setFloatingElemPositionForLinkEditor,J as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,on as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ae as useBlockComponentContext,z as useEditorConfigContext,xe as useInlineBlockComponentContext,Gc as useLexicalDocumentDrawer,$e as useLexicalDrawer,$t as useLexicalListDrawer,Oo as useRichTextView};
64
+ `)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as _C}from"react/jsx-runtime";import{CodeField as TC,useFormFields as EC}from"@payloadcms/ui";import{useId as wC,useMemo as SC}from"react";var Oo={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var NC=({autoComplete:t,field:e,forceRender:o,languages:n=Oo,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:c,typescript:u,validate:d})=>{let a=EC(([C])=>C.language),f=a?.value||a?.initialValue||"typescript",m=wC(),p=n[f],h=SC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:f==="ts"?`file-${e.name}-${m}.tsx`:void 0},language:f}}),[e,f,m]),g=`${e.name}-${f}-${p}`;return h&&_C(TC,{autoComplete:t,field:h,forceRender:o,onMount:(C,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:u?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[u?.target??"ESNext"],typeRoots:u?.typeRoots??["node_modules/@types"]}),E.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!u?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>u?.fetchTypes&&Array.isArray(u.fetchTypes)&&u.fetchTypes.length>0&&await Promise.all(u.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:c,validate:d},g)};import{jsx as le,jsxs as Qc}from"react/jsx-runtime";import{useLexicalEditable as OC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as FC,Combobox as PC,CopyToClipboard as BC,PopupList as jC,RenderFields as HC,useForm as zC,useFormFields as eu,useTranslation as GC}from"@payloadcms/ui";import UC from"react";import{jsx as Kc}from"react/jsx-runtime";import"react";var LC={16:"M6.646 6.146a.5.5 0 1 0 .708.708l1.5-1.5a.5.5 0 0 0 0-.708l-1.5-1.5a.5.5 0 1 0-.708.708L7.793 5zm-1.292-3a.5.5 0 0 1 0 .708L4.207 5l1.147 1.146a.5.5 0 1 1-.708.708l-1.5-1.5a.5.5 0 0 1 0-.708l1.5-1.5a.5.5 0 0 1 .708 0M10.5 3h1A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5v-3a.5.5 0 0 1 1 0v3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 1 0-1",24:"M16.5 6C17.3284 6 18 6.67157 18 7.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V12.5C6 12.2239 6.22386 12 6.5 12C6.77614 12 7 12.2239 7 12.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V7.5C17 7.22386 16.7761 7 16.5 7H15.5C15.2239 7 15 6.77614 15 6.5C15 6.22386 15.2239 6 15.5 6H16.5ZM8.14648 6.14648C8.34175 5.95122 8.65825 5.95122 8.85352 6.14648C9.04878 6.34175 9.04878 6.65825 8.85352 6.85352L7.20703 8.5L8.85352 10.1465C9.04878 10.3417 9.04878 10.6583 8.85352 10.8535C8.65825 11.0488 8.34175 11.0488 8.14648 10.8535L6.14648 8.85352C5.95122 8.65825 5.95122 8.34175 6.14648 8.14648L8.14648 6.14648ZM11.1465 6.14648C11.3417 5.95122 11.6583 5.95122 11.8535 6.14648L13.8535 8.14648C14.0488 8.34175 14.0488 8.65825 13.8535 8.85352L11.8535 10.8535C11.6583 11.0488 11.3417 11.0488 11.1465 10.8535C10.9512 10.6583 10.9512 10.3417 11.1465 10.1465L12.793 8.5L11.1465 6.85352C10.9512 6.65825 10.9512 6.34175 11.1465 6.14648Z"},Jc=({className:t,size:e=24})=>Kc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Kc("path",{clipRule:"evenodd",d:LC[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as pr}from"react/jsx-runtime";import"react";import{useCollapsible as IC}from"@payloadcms/ui";import{jsx as Xc}from"react/jsx-runtime";import"react";var yC="M11.4999 13C11.6325 13 11.7597 13.0527 11.8535 13.1464L14.8535 16.1464C15.0487 16.3417 15.0487 16.6582 14.8535 16.8535C14.6582 17.0487 14.3417 17.0487 14.1464 16.8535L11.4999 14.207L8.85346 16.8535C8.6582 17.0487 8.34169 17.0487 8.14643 16.8535C7.95119 16.6582 7.95119 16.3417 8.14643 16.1464L11.1464 13.1464C11.2402 13.0527 11.3674 13 11.4999 13ZM14.1464 7.14644C14.3417 6.95119 14.6582 6.95118 14.8535 7.14644C15.0487 7.3417 15.0487 7.65821 14.8535 7.85347L11.8535 10.8535C11.7597 10.9472 11.6325 10.9999 11.4999 11C11.3674 10.9999 11.2402 10.9472 11.1464 10.8535L8.14643 7.85347C7.95119 7.65821 7.95119 7.3417 8.14643 7.14644C8.34169 6.9512 8.6582 6.9512 8.85346 7.14644L11.4999 9.79292L14.1464 7.14644Z",Fo=({className:t})=>Xc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Xc("path",{d:yC,fill:"currentColor"})});import{jsx as Yc}from"react/jsx-runtime";import"react";var RC="M11.5 6C11.6326 6 11.7597 6.05272 11.8535 6.14648L14.8535 9.14648C15.0487 9.34175 15.0487 9.65825 14.8535 9.85352C14.6582 10.0488 14.3417 10.0488 14.1464 9.85352L12 7.70703V16.293L14.1464 14.1465C14.3417 13.9512 14.6582 13.9512 14.8535 14.1465C15.0487 14.3417 15.0487 14.6583 14.8535 14.8535L11.8535 17.8535C11.6582 18.0488 11.3417 18.0488 11.1464 17.8535L8.14645 14.8535C7.95119 14.6583 7.95119 14.3417 8.14645 14.1465C8.34171 13.9512 8.65822 13.9512 8.85348 14.1465L11 16.293V7.70703L8.85348 9.85352C8.65822 10.0488 8.34171 10.0488 8.14645 9.85352C7.95118 9.65825 7.95118 9.34175 8.14645 9.14648L11.1464 6.14648C11.2402 6.05272 11.3674 6 11.5 6Z",Po=({className:t})=>Yc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Yc("path",{clipRule:"evenodd",d:RC,fill:"currentColor",fillRule:"evenodd"})});var vC="code-block-collapse-button",Zc=()=>{let{isCollapsed:t,toggle:e}=IC();return pr("button",{className:vC,onClick:e,type:"button",children:t?pr(Po,{}):pr(Fo,{})})};import{jsx as hr,jsxs as MC}from"react/jsx-runtime";import{useCollapsible as AC,useTranslation as DC}from"@payloadcms/ui";import"react";var $C="code-block-floating-collapse-button",qc=()=>{let{isCollapsed:t,toggle:e}=AC(),{t:o}=DC();return MC("button",{className:$C,onClick:e,type:"button",children:[t?hr(Po,{}):hr(Fo,{}),hr("span",{children:o(t?"general:expand":"general:collapse")})]})};var Je="payload-richtext-code-block",WC=t=>{let{languages:e}=t,o=e||Oo,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ae(),{setModified:s}=zC(),{t:i}=GC(),{codeField:c}=eu(([p])=>({codeField:p?.code})),{selectedLanguageField:u,setSelectedLanguage:d}=eu(([p,h])=>({selectedLanguageField:p?.language,setSelectedLanguage:g=>{h({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[u?.value],f=OC(),m=UC.useMemo(()=>Object.entries(o).map(([p,h])=>({name:`${p} ${h}`,Component:le(jC.Button,{active:!1,disabled:!1,onClick:()=>{d(p)},children:le("span",{className:`${Je}__language-code`,"data-language":p,children:h})})})),[o,d]);return le(n,{Actions:Qc("div",{className:`${Je}__actions`,children:[le(PC,{"aria-label":i("general:language"),button:Qc("div",{className:`${Je}__language-selector-button`,"data-selected-language":u?.value,children:[le("span",{children:a}),le(FC,{className:`${Je}__chevron`})]}),buttonType:"custom",className:`${Je}__language-selector`,disabled:!f,entries:m,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),le(BC,{value:c?.value??""}),le(Zc,{}),f&&le(l,{})]}),className:Je,collapsibleProps:{AfterCollapsible:le(qc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:le("div",{className:`${Je}__pill`,children:le(Jc,{})}),showDragHandle:!1,showRowNumber:!1,children:le(HC,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!f})})};import{c as VC}from"react/compiler-runtime";import{jsx as gt}from"react/jsx-runtime";import{FieldContext as KC,FieldPathContext as tu,ServerFunctionsContext as ou,ShimmerEffect as JC,useServerFunctions as XC}from"@payloadcms/ui";import YC,{useEffect as ZC,useRef as qC}from"react";var QC=t=>{let e=VC(10),{name:o,field:n,initialValue:r,label:l,Loading:s,path:i,schemaPath:c,setValue:u,value:d}=t,[a,f]=YC.useState(null),m=XC(),{_internal_renderField:p}=m,[h,g]=c.split(".",2),C=o!==void 0?o:n?.name,E=l!==void 0?l:n?.label,L=i??C??"",x;e[0]!==p||e[1]!==E||e[2]!==C||e[3]!==r||e[4]!==i||e[5]!==c?(x=()=>{(async function(){let{Field:S}=await p({name:C,hidden:!1,initialValue:r??void 0,label:typeof E=="function"?void 0:E,path:i,schemaPath:c});f(S)})()},e[0]=p,e[1]=E,e[2]=C,e[3]=r,e[4]=i,e[5]=c,e[6]=x):x=e[6];let b=x,k=qC(!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]),ZC(_,T),!a)return typeof s<"u"?s:gt(JC,{});let I={...m,getFormState:async w=>m.getFormState({...w,collectionSlug:h==="collection"?g:void 0,globalSlug:h==="global"?g:void 0})};if(typeof d>"u"&&!u)return gt(ou,{value:{...I},children:gt(tu,{value:L,children:a},L)});let N={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:L,setValue:u??eb,showError:!1,value:d};return gt(ou,{value:{...I},children:gt(tu,{value:L,children:gt(KC,{value:N,children:a})},L)})};function eb(){}function nu({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 tb=nu;export{It as $createAutoLinkNode,Fe as $createBlockNode,je as $createHorizontalRuleNode,_t as $createInlineBlockNode,_e as $createLinkNode,We as $createRelationshipNode,ye as $createUploadNode,Ee as $isAutoLinkNode,Ie as $isBlockNode,He as $isHorizontalRuleNode,Tt as $isInlineBlockNode,X as $isLinkNode,Bn as $isRelationshipNode,nt as $isUploadNode,Iu as AlignFeatureClient,Te as AutoLinkNode,mC as BlockCollapsible,hC as BlockEditButton,ue as BlockNode,CC as BlockRemoveButton,Bu as BlockquoteFeatureClient,xm as BlocksFeatureClient,Wm as BoldFeatureClient,se as CAN_USE_DOM,b0 as ChecklistFeatureClient,WC as CodeBlockBlockComponent,NC as CodeComponent,K0 as DETAIL_TYPE_TO_DETAIL,G0 as DOUBLE_LINE_BREAK,ih as DebugJsxConverterFeatureClient,X0 as ELEMENT_FORMAT_TO_TYPE,J0 as ELEMENT_TYPE_TO_FORMAT,gu as ENABLE_SLASH_MENU_COMMAND,mu as EditorConfigProvider,Vo as FieldsDrawer,G5 as FixedToolbarFeatureClient,ip as HeadingFeatureClient,Np as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,rt as INSERT_BLOCK_COMMAND,lt as INSERT_INLINE_BLOCK_COMMAND,H0 as IS_ALL_FORMATTING,Up as IndentFeatureClient,uC as InlineBlockContainer,tC as InlineBlockEditButton,sC as InlineBlockLabel,kt as InlineBlockNode,rC as InlineBlockRemoveButton,Zm as InlineCodeFeatureClient,lg as InlineToolbarFeatureClient,rf as ItalicFeatureClient,W0 as LTR_REGEX,c0 as LinkFeatureClient,ne as LinkNode,z0 as NON_BREAKING_SPACE,O as NodeFormat,S0 as OrderedListFeatureClient,A0 as ParagraphFeatureClient,pu as Point,U0 as RTL_REGEX,xu as Rect,qh as RelationshipFeatureClient,we as RelationshipNode,QC as RenderLexical,Ux as RichTextField,Ko as RichTextViewProvider,df as StrikethroughFeatureClient,gf as SubscriptFeatureClient,_f as SuperscriptFeatureClient,Y0 as TEXT_MODE_TO_TYPE,V0 as TEXT_TYPE_TO_FORMAT,Z0 as TEXT_TYPE_TO_MODE,pe as TOGGLE_LINK_COMMAND,nx as TableFeatureClient,Im as TestRecorderFeatureClient,Ff as TextStateFeatureClient,Ft as ToolbarButton,Pt as ToolbarDropdown,Om as TreeViewFeatureClient,Nf as UnderlineFeatureClient,I0 as UnorderedListFeatureClient,Ax as UploadFeatureClient,ot as UploadNode,qx as addSwipeDownListener,Xx as addSwipeLeftListener,Yx as addSwipeRightListener,Zx as addSwipeUpListener,tb as buildDefaultEditorState,nu as buildEditorState,Vc as codeConverterClient,Kx as createBlockNode,A as createClientFeature,sh as defaultColors,mr as defaultEditorLexicalConfig,Vn as getDOMRangeRect,Cu as getEnabledNodes,kC as getRestPopulateFn,it as getSelectedNode,hu as isPoint,Vx as joinClasses,fr as sanitizeClientEditorConfig,Uc as sanitizeClientFeatures,To as setFloatingElemPosition,co as setFloatingElemPositionForLinkEditor,q as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,kn as toolbarFeatureButtonsGroupWithItems,Q as toolbarFormatGroupWithItems,oe as toolbarTextDropdownGroupWithItems,ae as useBlockComponentContext,U as useEditorConfigContext,xe as useInlineBlockComponentContext,fu as useLexicalDocumentDrawer,De as useLexicalDrawer,Ot as useLexicalListDrawer,Jo as useRichTextView};
65
65
  //# sourceMappingURL=index.js.map