@payloadcms/richtext-lexical 4.0.0-canary.0 → 4.0.0-internal.183b315

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 (308) hide show
  1. package/dist/@types/assets.d.js +2 -0
  2. package/dist/@types/assets.d.js.map +1 -0
  3. package/dist/cell/rscEntry.d.ts.map +1 -1
  4. package/dist/cell/rscEntry.js +5 -5
  5. package/dist/cell/rscEntry.js.map +1 -1
  6. package/dist/exports/client/Field-VYBSMSRY.js +2 -0
  7. package/dist/exports/client/Field-VYBSMSRY.js.map +7 -0
  8. package/dist/exports/client/{RelationshipComponent-RZL743CS.js → RelationshipComponent-YCPAKOL7.js} +1 -1
  9. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  10. package/dist/exports/client/bundled.css +1 -1
  11. package/dist/exports/client/{chunk-XIJE2UCQ.js → chunk-ZYXHC5CY.js} +2 -2
  12. package/dist/exports/client/chunk-ZYXHC5CY.js.map +7 -0
  13. package/dist/exports/client/{component-KESPRYJR.js → component-PHZQBOJE.js} +1 -1
  14. package/dist/exports/client/component-PHZQBOJE.js.map +7 -0
  15. package/dist/exports/client/componentInline-R3EPNYWF.js +2 -0
  16. package/dist/exports/client/index.d.ts +1 -0
  17. package/dist/exports/client/index.d.ts.map +1 -1
  18. package/dist/exports/client/index.js +25 -25
  19. package/dist/exports/client/index.js.map +4 -4
  20. package/dist/exports/server/rsc.browser.d.ts +11 -0
  21. package/dist/exports/server/rsc.browser.d.ts.map +1 -0
  22. package/dist/exports/server/rsc.browser.js +10 -0
  23. package/dist/exports/server/rsc.browser.js.map +1 -0
  24. package/dist/features/blockquote/server/index.d.ts +1 -4
  25. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  26. package/dist/features/blockquote/server/index.js +2 -0
  27. package/dist/features/blockquote/server/index.js.map +1 -1
  28. package/dist/features/blockquote/server/schema.d.ts +8 -0
  29. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  30. package/dist/features/blockquote/server/schema.js +15 -0
  31. package/dist/features/blockquote/server/schema.js.map +1 -0
  32. package/dist/features/blocks/client/component/index.d.ts +1 -1
  33. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  34. package/dist/features/blocks/client/component/index.js +1 -1
  35. package/dist/features/blocks/client/component/index.js.map +1 -1
  36. package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
  37. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  38. package/dist/features/blocks/client/componentInline/index.js +1 -1
  39. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  40. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  41. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  42. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +1 -1
  43. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  44. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  45. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +1 -1
  46. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  47. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  48. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  49. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  50. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  51. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  52. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  53. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  54. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  55. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  56. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  57. package/dist/features/blocks/server/index.d.ts +1 -0
  58. package/dist/features/blocks/server/index.d.ts.map +1 -1
  59. package/dist/features/blocks/server/index.js +20 -66
  60. package/dist/features/blocks/server/index.js.map +1 -1
  61. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  62. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  63. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  64. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  65. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  66. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  67. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  68. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  69. package/dist/features/blocks/server/schema.d.ts +45 -0
  70. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  71. package/dist/features/blocks/server/schema.js +139 -0
  72. package/dist/features/blocks/server/schema.js.map +1 -0
  73. package/dist/features/blocks/server/validate.d.ts +1 -2
  74. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  75. package/dist/features/blocks/server/validate.js.map +1 -1
  76. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  77. package/dist/features/converters/lexicalToHtml/async/types.d.ts +14 -15
  78. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  79. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  80. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  81. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +14 -15
  82. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  83. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  84. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +4 -2
  85. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  86. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  87. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  88. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  89. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  90. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  91. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  92. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  93. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  94. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  95. package/dist/features/experimental_table/server/index.d.ts +1 -6
  96. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  97. package/dist/features/experimental_table/server/index.js +4 -0
  98. package/dist/features/experimental_table/server/index.js.map +1 -1
  99. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  100. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  101. package/dist/features/experimental_table/server/schema.js +107 -0
  102. package/dist/features/experimental_table/server/schema.js.map +1 -0
  103. package/dist/features/heading/server/index.d.ts +2 -4
  104. package/dist/features/heading/server/index.d.ts.map +1 -1
  105. package/dist/features/heading/server/index.js +2 -0
  106. package/dist/features/heading/server/index.js.map +1 -1
  107. package/dist/features/heading/server/schema.d.ts +10 -0
  108. package/dist/features/heading/server/schema.d.ts.map +1 -0
  109. package/dist/features/heading/server/schema.js +37 -0
  110. package/dist/features/heading/server/schema.js.map +1 -0
  111. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  112. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  113. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  114. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  115. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  116. package/dist/features/horizontalRule/server/index.js +2 -0
  117. package/dist/features/horizontalRule/server/index.js.map +1 -1
  118. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  119. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  120. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  121. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  122. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  123. package/dist/features/horizontalRule/server/schema.js +25 -0
  124. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  125. package/dist/features/link/client/index.d.ts.map +1 -1
  126. package/dist/features/link/client/index.js.map +1 -1
  127. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  128. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  129. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  130. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  131. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  132. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  133. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  134. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  135. package/dist/features/link/markdownTransformer.d.ts +1 -1
  136. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  137. package/dist/features/link/markdownTransformer.js.map +1 -1
  138. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  139. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  140. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  141. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  142. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  143. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  144. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  145. package/dist/features/link/nodes/LinkNode.js +2 -1
  146. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  147. package/dist/features/link/server/baseFields.js.map +1 -1
  148. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  149. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  150. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  151. package/dist/features/link/server/index.d.ts +2 -1
  152. package/dist/features/link/server/index.d.ts.map +1 -1
  153. package/dist/features/link/server/index.js +3 -0
  154. package/dist/features/link/server/index.js.map +1 -1
  155. package/dist/features/link/server/schema.d.ts +32 -0
  156. package/dist/features/link/server/schema.d.ts.map +1 -0
  157. package/dist/features/link/server/schema.js +169 -0
  158. package/dist/features/link/server/schema.js.map +1 -0
  159. package/dist/features/link/server/validate.d.ts +1 -1
  160. package/dist/features/link/server/validate.d.ts.map +1 -1
  161. package/dist/features/link/server/validate.js.map +1 -1
  162. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  163. package/dist/features/lists/checklist/server/index.js +3 -0
  164. package/dist/features/lists/checklist/server/index.js.map +1 -1
  165. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  166. package/dist/features/lists/orderedList/server/index.js +3 -0
  167. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  168. package/dist/features/lists/plugin/index.d.ts +0 -9
  169. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  170. package/dist/features/lists/plugin/index.js.map +1 -1
  171. package/dist/features/lists/shared/schema.d.ts +18 -0
  172. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  173. package/dist/features/lists/shared/schema.js +62 -0
  174. package/dist/features/lists/shared/schema.js.map +1 -0
  175. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  176. package/dist/features/lists/unorderedList/server/index.js +3 -0
  177. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  178. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  179. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  180. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  181. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  182. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  183. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  184. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  185. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  186. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  187. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  188. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  189. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  190. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  191. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  192. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  193. package/dist/features/relationship/server/index.d.ts +1 -0
  194. package/dist/features/relationship/server/index.d.ts.map +1 -1
  195. package/dist/features/relationship/server/index.js +2 -0
  196. package/dist/features/relationship/server/index.js.map +1 -1
  197. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  198. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  199. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  200. package/dist/features/relationship/server/schema.d.ts +28 -0
  201. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  202. package/dist/features/relationship/server/schema.js +80 -0
  203. package/dist/features/relationship/server/schema.js.map +1 -0
  204. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  205. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  206. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  207. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  208. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  209. package/dist/features/typesServer.d.ts +17 -40
  210. package/dist/features/typesServer.d.ts.map +1 -1
  211. package/dist/features/typesServer.js.map +1 -1
  212. package/dist/features/upload/client/component/index.d.ts +1 -1
  213. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  214. package/dist/features/upload/client/component/index.js.map +1 -1
  215. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  216. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  217. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  218. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  219. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  220. package/dist/features/upload/client/plugin/index.js.map +1 -1
  221. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  222. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  223. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  224. package/dist/features/upload/server/index.d.ts +1 -0
  225. package/dist/features/upload/server/index.d.ts.map +1 -1
  226. package/dist/features/upload/server/index.js +3 -2
  227. package/dist/features/upload/server/index.js.map +1 -1
  228. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  229. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  230. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  231. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  232. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  233. package/dist/features/upload/server/schema.d.ts +52 -0
  234. package/dist/features/upload/server/schema.d.ts.map +1 -0
  235. package/dist/features/upload/server/schema.js +129 -0
  236. package/dist/features/upload/server/schema.js.map +1 -0
  237. package/dist/features/upload/server/validate.d.ts +1 -1
  238. package/dist/features/upload/server/validate.d.ts.map +1 -1
  239. package/dist/features/upload/server/validate.js.map +1 -1
  240. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  241. package/dist/field/bundled.css +1 -1
  242. package/dist/field/clientEntry.d.ts +29 -0
  243. package/dist/field/clientEntry.d.ts.map +1 -0
  244. package/dist/field/clientEntry.js +86 -0
  245. package/dist/field/clientEntry.js.map +1 -0
  246. package/dist/field/index.css +9 -12
  247. package/dist/field/index.js +1 -1
  248. package/dist/field/index.js.map +1 -1
  249. package/dist/field/rscEntry.d.ts.map +1 -1
  250. package/dist/field/rscEntry.js +2 -0
  251. package/dist/field/rscEntry.js.map +1 -1
  252. package/dist/index.d.ts +8 -5
  253. package/dist/index.d.ts.map +1 -1
  254. package/dist/index.js +47 -4
  255. package/dist/index.js.map +1 -1
  256. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  257. package/dist/lexical/LexicalEditor.js +36 -2
  258. package/dist/lexical/LexicalEditor.js.map +1 -1
  259. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  260. package/dist/lexical/LexicalProvider.js +22 -7
  261. package/dist/lexical/LexicalProvider.js.map +1 -1
  262. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  263. package/dist/lexical/config/client/loader.js +5 -1
  264. package/dist/lexical/config/client/loader.js.map +1 -1
  265. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  266. package/dist/lexical/config/server/sanitize.js +9 -11
  267. package/dist/lexical/config/server/sanitize.js.map +1 -1
  268. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  269. package/dist/types/builtInNodes.d.ts +14 -0
  270. package/dist/types/builtInNodes.d.ts.map +1 -0
  271. package/dist/types/builtInNodes.js +203 -0
  272. package/dist/types/builtInNodes.js.map +1 -0
  273. package/dist/types/index.d.ts +16 -17
  274. package/dist/types/index.d.ts.map +1 -1
  275. package/dist/types/index.js.map +1 -1
  276. package/dist/types/jsonSchemaHelpers.d.ts +30 -0
  277. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  278. package/dist/types/jsonSchemaHelpers.js +58 -0
  279. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  280. package/dist/types/nodeTypes.d.ts +115 -61
  281. package/dist/types/nodeTypes.d.ts.map +1 -1
  282. package/dist/types/nodeTypes.js +3 -2
  283. package/dist/types/nodeTypes.js.map +1 -1
  284. package/dist/types/schema.d.ts.map +1 -1
  285. package/dist/types/schema.js +67 -65
  286. package/dist/types/schema.js.map +1 -1
  287. package/dist/utilities/buildEditorState.d.ts +17 -3
  288. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  289. package/dist/utilities/buildEditorState.js +8 -0
  290. package/dist/utilities/buildEditorState.js.map +1 -1
  291. package/dist/utilities/buildInitialState.d.ts +2 -1
  292. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  293. package/dist/utilities/buildInitialState.js.map +1 -1
  294. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  295. package/dist/utilities/generateImportMap.js +7 -3
  296. package/dist/utilities/generateImportMap.js.map +1 -1
  297. package/package.json +8 -7
  298. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  299. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  300. package/dist/exports/client/RelationshipComponent-RZL743CS.js.map +0 -7
  301. package/dist/exports/client/chunk-XIJE2UCQ.js.map +0 -7
  302. package/dist/exports/client/component-KESPRYJR.js.map +0 -7
  303. package/dist/exports/client/componentInline-R2RSJX4K.js +0 -2
  304. package/dist/features/link/nodes/types.d.ts +0 -27
  305. package/dist/features/link/nodes/types.d.ts.map +0 -1
  306. package/dist/features/link/nodes/types.js +0 -2
  307. package/dist/features/link/nodes/types.js.map +0 -1
  308. /package/dist/exports/client/{componentInline-R2RSJX4K.js.map → componentInline-R3EPNYWF.js.map} +0 -0
@@ -1,26 +1,26 @@
1
- "use client";import{a as ke,c as bt,d as kt,e as _t}from"./chunk-XIJE2UCQ.js";import{a as Qe}from"./chunk-DBWINSQN.js";import{a as Bo,b as et}from"./chunk-UD4DQ4AK.js";import{a as br,b as kr,c as Fe}from"./chunk-5VIL27GI.js";import{a as ru}from"./chunk-WSAPGI3Z.js";import{b as Wt,c as zt,d as se,e as _r,f as Po,g as jo,h as lu,i as iu,k as su,m as au,p as cu}from"./chunk-LH634DPU.js";import{a as nu,b as G}from"./chunk-RJ5MAOKZ.js";function X(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as fu}from"react/compiler-runtime";import{useLexicalComposerContext as hu}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as _e}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as gu}from"@lexical/utils";import{$getSelection as xu,$isElementNode as pe,$isNodeSelection as Cu,$isRangeSelection as Tt,COMMAND_PRIORITY_LOW as bu,FORMAT_ELEMENT_COMMAND as wt}from"lexical";import{useEffect as ku}from"react";import{jsx as Tr}from"react/jsx-runtime";import"react";var uu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.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",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:uu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Sr}from"react/jsx-runtime";import"react";var du="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",Er=({className:t})=>Sr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Sr("path",{clipRule:"evenodd",d:du,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Nr}from"react/jsx-runtime";import"react";var mu="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",Kt=({className:t})=>Nr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Nr("path",{clipRule:"evenodd",d:mu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Lr}from"react/jsx-runtime";import"react";var pu="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",yr=({className:t})=>Lr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Lr("path",{clipRule:"evenodd",d:pu,fill:"currentColor",fillRule:"evenodd"})});var $=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var vr=t=>({type:"dropdown",ChildComponent:Kt,iconOnly:!0,items:t,key:"align",order:30});var Me=t=>pe(t)?t.getFormatType():t.__format,Rr=[vr([{ChildComponent:Kt,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||_e(e))&&Me(e)==="left")continue;let o=e.getParent();if(!((pe(o)||_e(o))&&Me(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:wr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||_e(e))&&Me(e)==="center")continue;let o=e.getParent();if(!((pe(o)||_e(o))&&Me(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:yr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||_e(e))&&Me(e)==="right")continue;let o=e.getParent();if(!((pe(o)||_e(o))&&Me(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:Er,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||_e(e))&&Me(e)==="justify")continue;let o=e.getParent();if(!((pe(o)||_e(o))&&Me(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}])],_u=()=>{let t=fu(3),[e]=hu(),o,n;return t[0]!==e?(o=()=>e.registerCommand(wt,Su,bu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ku(o,n),null},Tu=$({plugins:[{Component:_u,position:"normal"}],toolbarFixed:{groups:Rr},toolbarInline:{groups:Rr}});function wu(t){return(pe(t)||_e(t))&&!t.isInline()}function Su(t){let e=xu();if(!Tt(e)&&!Cu(e))return!1;let o=e.getNodes();for(let n of o){let r=gu(n,wu);r!==null&&r.setFormat(t)}return!0}import{$createQuoteNode as Fr,$isQuoteNode as Dr,QuoteNode as vu}from"@lexical/rich-text";import{$setBlocksType as Br}from"@lexical/selection";import{$getSelection as Pr,$isRangeSelection as Ru}from"lexical";import{jsx as Ir}from"react/jsx-runtime";import"react";var Eu="M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",Ho=({className:t})=>Ir("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ir("path",{d:Eu,fill:"currentColor"})});import{jsx as Mr}from"react/jsx-runtime";import"react";var Nu={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})=>Mr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Mr("path",{clipRule:"evenodd",d:Nu[e],fill:"currentColor",fillRule:"evenodd"})});var te=t=>({type:"dropdown",ChildComponent:St,items:t,key:"text",order:25});import{$createQuoteNode as Lu,$isQuoteNode as $r,QuoteNode as yu}from"@lexical/rich-text";var Ar={type:"element",dependencies:[yu],export:(t,e)=>{if(!$r(t))return null;let o=e(t).split(`
1
+ "use client";import{a as ke,c as bt,d as kt,e as _t}from"./chunk-ZYXHC5CY.js";import{a as Qe}from"./chunk-DBWINSQN.js";import{a as Po,b as et}from"./chunk-UD4DQ4AK.js";import{a as kr,b as _r,c as Fe}from"./chunk-5VIL27GI.js";import{a as su}from"./chunk-WSAPGI3Z.js";import{b as Wt,c as zt,d as se,e as Tr,f as Bo,g as jo,h as au,i as cu,k as uu,m as du,p as pu}from"./chunk-LH634DPU.js";import{a as iu,b as G}from"./chunk-RJ5MAOKZ.js";function X(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as xu}from"react/compiler-runtime";import{useLexicalComposerContext as Cu}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as _e}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as bu}from"@lexical/utils";import{$getSelection as ku,$isElementNode as me,$isNodeSelection as _u,$isRangeSelection as Tt,COMMAND_PRIORITY_LOW as Tu,FORMAT_ELEMENT_COMMAND as wt}from"lexical";import{useEffect as wu}from"react";import{jsx as wr}from"react/jsx-runtime";import"react";var mu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m3 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 15a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Sr=({className:t})=>wr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:wr("path",{clipRule:"evenodd",d:mu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Er}from"react/jsx-runtime";import"react";var fu="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",Nr=({className:t})=>Er("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:Er("path",{clipRule:"evenodd",d:fu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Lr}from"react/jsx-runtime";import"react";var hu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.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",Kt=({className:t})=>Lr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Lr("path",{clipRule:"evenodd",d:hu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as yr}from"react/jsx-runtime";import"react";var gu="M19 7.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5m0 4a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 .5-.5m-.5 3.5a.5.5 0 0 1 0 1h-9a.5.5 0 0 1 0-1z",vr=({className:t})=>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:gu,fill:"currentColor",fillRule:"evenodd"})});var $=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:u,schemaPath:c,unSanitizedEditorConfig:a})=>{let p=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,props:o,resolvedFeatures:u,schemaPath:c,unSanitizedEditorConfig:a});return p.sanitizedClientFeatureProps===null&&(p.sanitizedClientFeatureProps=o),p};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Rr=t=>({type:"dropdown",ChildComponent:Kt,iconOnly:!0,items:t,key:"align",order:30});var Me=t=>me(t)?t.getFormatType():t.__format,Ir=[Rr([{ChildComponent:Kt,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((me(e)||_e(e))&&Me(e)==="left")continue;let o=e.getParent();if(!((me(o)||_e(o))&&Me(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:Sr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((me(e)||_e(e))&&Me(e)==="center")continue;let o=e.getParent();if(!((me(o)||_e(o))&&Me(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:vr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((me(e)||_e(e))&&Me(e)==="right")continue;let o=e.getParent();if(!((me(o)||_e(o))&&Me(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:Nr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((me(e)||_e(e))&&Me(e)==="justify")continue;let o=e.getParent();if(!((me(o)||_e(o))&&Me(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}])],Su=()=>{let t=xu(3),[e]=Cu(),o,n;return t[0]!==e?(o=()=>e.registerCommand(wt,Lu,Tu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),wu(o,n),null},Eu=$({plugins:[{Component:Su,position:"normal"}],toolbarFixed:{groups:Ir},toolbarInline:{groups:Ir}});function Nu(t){return(me(t)||_e(t))&&!t.isInline()}function Lu(t){let e=ku();if(!Tt(e)&&!_u(e))return!1;let o=e.getNodes();for(let n of o){let r=bu(n,Nu);r!==null&&r.setFormat(t)}return!0}import{$createQuoteNode as Pr,$isQuoteNode as Or,QuoteNode as Mu}from"@lexical/rich-text";import{$setBlocksType as Br}from"@lexical/selection";import{$getSelection as jr,$isRangeSelection as $u}from"lexical";import{jsx as Mr}from"react/jsx-runtime";import"react";var yu="M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",Ho=({className:t})=>Mr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Mr("path",{d:yu,fill:"currentColor"})});import{jsx as $r}from"react/jsx-runtime";import"react";var vu={16:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-1 0V4H8.5v8h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1V4H4v1a.5.5 0 0 1-1 0z",24:"M6 6.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V9a.5.5 0 0 1-1 0V7h-4.5v10h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2V7H7v2a.5.5 0 0 1-1 0z"},St=({className:t,size:e=24})=>$r("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:$r("path",{clipRule:"evenodd",d:vu[e],fill:"currentColor",fillRule:"evenodd"})});var te=t=>({type:"dropdown",ChildComponent:St,items:t,key:"text",order:25});import{$createQuoteNode as Ru,$isQuoteNode as Ar,QuoteNode as Iu}from"@lexical/rich-text";var Dr={type:"element",dependencies:[Iu],export:(t,e)=>{if(!Ar(t))return null;let o=e(t).split(`
2
2
  `),n=[];for(let r of o)n.push("> "+r);return n.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let l=t.getPreviousSibling();if($r(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let r=Lu();r.append(...e),t.replace(r),r.select(0,0)}};var Or=[te([{ChildComponent:Ho,isActive:({selection:t})=>{if(!Ru(t))return!1;for(let e of t.getNodes())if(!Dr(e)&&!Dr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Pr();Br(e,()=>Fr())})},order:20}])],Iu=$({markdownTransformers:[Ar],nodes:[vu],slashMenu:{groups:[X([{Icon:Ho,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Pr();Br(e,()=>Fr())})}}])]},toolbarFixed:{groups:Or},toolbarInline:{groups:Or}});import{getTranslation as to}from"@payloadcms/translations";import{jsx as jr}from"react/jsx-runtime";import"react";var Mu="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",Uo=({className:t})=>jr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:jr("path",{d:Mu,fill:"currentColor"})});import{jsx as Hr}from"react/jsx-runtime";import"react";var $u="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Go=({className:t})=>Hr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Hr("path",{clipRule:"evenodd",d:$u,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Au}from"react/jsx-runtime";import"react";function Ur(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let d=i??"Block Image";return()=>Au("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as qr}from"lexical";import{JSOX as Vo}from"jsox";function Jt({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=Du(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function Du(t,e){let o=t[e];return o==='"'?Gr(t,e):o==="'"?Gr(t,e,!0):o==="{"?Fu(t,e):o==="["?Ou(t,e):Pu(t,e)}function Ou(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="["?o++:t[r]==="]"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Vo.parse(`[${n}]`)}}function Gr(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function Fu(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Bu(n)}}function Bu(t){return t[0]!=="{"?Vo.parse(t):Vo.parse(t.replace(/(\w+):/g,'"$1":'))}function Pu(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}="${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,Vr)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Vr)}}`));return e.join(" ")}function ju(t){return t.replace(/"/g,"&quot;")}function Vr(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Xt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",d=e.slice(n),c=!1,u=0,a=0,m=null,p=!1,h=0,f=d[0].slice(0,r.index),g=0,_=n;e:for(let[R,b]of d.entries()){let x=l?b.trim():b,C=0;if(l)for(let T=0;T<b.length&&b[T]===" ";T++)C++;let k=0;for(R===0&&(k=(r.index??0)+r[0].length-C);k<x.length;){let T=x[k],I=x[k+1];if(c){if(T==="`"&&h++,h%2===0)if(T==="<"&&I==="/"){if(u--,u<0){i[i.length-1]===`
4
- `&&(i=i.slice(0,-1)),_=R;for(let N=k;N<x.length;N++)if(x[N]===">"){g=N+1;break}break e}}else if(T==="/"&&I===">"){if(u--,u<0){i[i.length-1]===`
5
- `&&(i=i.slice(0,-1)),_=R,g=k+2;break e}}else T==="<"&&I!=="/"&&u++;i+=T}else{if(T==="{"&&!m?a++:T==="}"&&!m?a--:(T==='"'||T==="'")&&!m?m=T:T===m&&(m=null),T==="/"&&I===">"&&a===0&&!m){p=!0,_=R,g=k+2;break e}else if(T===">"&&a===0&&!m){c=!0,k++;continue}s+=T}k++}if(c?i?.length>0&&R>0&&(i+=`
3
+ `)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let l=t.getPreviousSibling();if(Ar(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let r=Ru();r.append(...e),t.replace(r),r.select(0,0)}};var Fr=[te([{ChildComponent:Ho,isActive:({selection:t})=>{if(!$u(t))return!1;for(let e of t.getNodes())if(!Or(e)&&!Or(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=jr();Br(e,()=>Pr())})},order:20}])],Au=$({markdownTransformers:[Dr],nodes:[Mu],slashMenu:{groups:[X([{Icon:Ho,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=jr();Br(e,()=>Pr())})}}])]},toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{getTranslation as to}from"@payloadcms/translations";import{jsx as Hr}from"react/jsx-runtime";import"react";var Du="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",Uo=({className:t})=>Hr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Hr("path",{d:Du,fill:"currentColor"})});import{jsx as Ur}from"react/jsx-runtime";import"react";var Ou="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Go=({className:t})=>Ur("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:Ur("path",{clipRule:"evenodd",d:Ou,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Fu}from"react/jsx-runtime";import"react";function Gr(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let d=i??"Block Image";return()=>Fu("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Qr}from"lexical";import{JSOX as Vo}from"jsox";function Jt({propsString:t}){let e={},o="",n=!0;for(let r=0;r<t.length;r++){let l=t[r];if(n)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):n=!1):o+=l;else{let s=Pu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function Pu(t,e){let o=t[e];return o==='"'?Vr(t,e):o==="'"?Vr(t,e,!0):o==="{"?ju(t,e):o==="["?Bu(t,e):Uu(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:Vo.parse(`[${n}]`)}}function Vr(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function ju(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Hu(n)}}function Hu(t){return t[0]!=="{"?Vo.parse(t):Vo.parse(t.replace(/(\w+):/g,'"$1":'))}function Uu(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}="${Gu(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,Wr)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Wr)}}`));return e.join(" ")}function Gu(t){return t.replace(/"/g,"&quot;")}function Wr(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Xt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",d=e.slice(n),u=!1,c=0,a=0,p=null,m=!1,h=0,f=d[0].slice(0,r.index),g=0,_=n;e:for(let[R,b]of d.entries()){let x=l?b.trim():b,C=0;if(l)for(let T=0;T<b.length&&b[T]===" ";T++)C++;let k=0;for(R===0&&(k=(r.index??0)+r[0].length-C);k<x.length;){let T=x[k],I=x[k+1];if(u){if(T==="`"&&h++,h%2===0)if(T==="<"&&I==="/"){if(c--,c<0){i[i.length-1]===`
4
+ `&&(i=i.slice(0,-1)),_=R;for(let L=k;L<x.length;L++)if(x[L]===">"){g=L+1;break}break e}}else if(T==="/"&&I===">"){if(c--,c<0){i[i.length-1]===`
5
+ `&&(i=i.slice(0,-1)),_=R,g=k+2;break e}}else T==="<"&&I!=="/"&&c++;i+=T}else{if(T==="{"&&!p?a++:T==="}"&&!p?a--:(T==='"'||T==="'")&&!p?p=T:T===p&&(p=null),T==="/"&&I===">"&&a===0&&!p){m=!0,_=R,g=k+2;break e}else if(T===">"&&a===0&&!p){u=!0,k++;continue}s+=T}k++}if(u?i?.length>0&&R>0&&(i+=`
6
6
  `):s+=`
7
- `,o&&u<0){let T=x.match(o);if(T?.index!==void 0){_=R,g=T.index+T[0].length-1;break}}if(R===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
7
+ `,o&&c<0){let T=x.match(o);if(T?.index!==void 0){_=R,g=T.index+T[0].length-1;break}}if(R===d.length-1&&!t&&!m)throw new Error("End match not found for lines "+e.join(`
8
8
  `)+`
9
9
 
10
- . Start match: `+JSON.stringify(r))}return{afterEndLine:d[_].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:n+_,endlineLastCharIndex:g,propsString:s}}import{jsx as Td}from"react/jsx-runtime";import wd from"bson-objectid";import{$applyNodeReplacement as Sd}from"lexical";import"react";import{DecoratorBlockNode as Hu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Uu}from"@lexical/utils";import Gu from"bson-objectid";import{$applyNodeReplacement as Vu}from"lexical";var Nt=class extends Hu{__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=Wu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Uu(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 Wu(t){return Vu(new Nt({fields:{...t,id:t?.id||new Gu.default().toHexString()}}))}import{jsx as V,jsxs as Lt}from"react/jsx-runtime";import{useLexicalComposerContext as Qu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ed}from"@lexical/react/useLexicalEditable";import{getTranslation as td}from"@payloadcms/translations";import{Button as Jr,Collapsible as od,Drawer as nd,EditDepthProvider as rd,ErrorPill as ld,Form as id,formatDrawerSlug as sd,MoreIcon as ad,Pill as cd,Popup as ud,PopupList as Wo,RenderFields as dd,SectionTitle as md,useConfig as pd,useDocumentForm as fd,useDocumentInfo as Xr,useEditDepth as hd,useFormSubmitted as gd,useServerFunctions as xd,useTranslation as Cd,XIcon as bd}from"@payloadcms/ui";import{abortAndIgnore as zo}from"@payloadcms/ui/shared";import{$getNodeByKey as Yt,$getRoot as kd,SKIP_DOM_SELECTION_TAG as Ko}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as qt,reduceFieldsToValues as Zr}from"payload/shared";import Be,{useCallback as Jo,useEffect as Qt,useMemo as Pe,useRef as Xo}from"react";import{v4 as _d}from"uuid";import{c as zu}from"react/compiler-runtime";import{jsx as Zt,jsxs as Ku}from"react/jsx-runtime";import{useLexicalEditable as Ju}from"@lexical/react/useLexicalEditable";import{RenderFields as Xu,useFormSubmitted as Zu}from"@payloadcms/ui";import Yu,{createContext as qu}from"react";var Wr=qu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>Yu.use(Wr),zr=t=>{let e=zu(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=Zu()&&i>0,a=Ju(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,..._}=f;return Zt(o,{errorCount:i,fieldHasErrors:u,..._,children:g})},e[0]=o,e[1]=i,e[2]=u,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return n?Ku(Wr,{value:h,children:[n,Zt(s,{})]}):Zt(p,{children:Zt(Xu,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function Kr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Yr=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=gd(),{id:d,collectionSlug:c,globalSlug:u}=Xr(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=G(),{fields:g}=fd(),_=Xo(new AbortController),L=hd(),[R,b]=Be.useState(0),{config:x}=pd(),C=sd({slug:`lexical-blocks-create-${f}-${l.id}`,depth:L}),{toggleDrawer:k}=Fe(C),{getDocPreferences:T,setDocFieldPreferences:I}=Xr(),[N]=Qu(),S=ed(),E=l.blockType,{getFormState:w}=xd(),v=`${h}.lexical_internal_feature.blocks.lexical_blocks.${E}.fields`,[y,M]=Be.useState(()=>{let P=p?.[l.id]?.formState;if(!P)return!1;let q=Object.fromEntries(Object.entries(P).map(([U,W])=>[U,U in l?{...W,initialValue:l[U],value:l[U]}:W]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),A=Xo(!1),D=Xo(e);Qt(()=>{A.current?(D.current!==e&&M(!1),D.current=e):A.current=!0},[e]);let[F]=Be.useState(()=>_d()),[B,Y]=Be.useState(()=>{if(!r)return y?._components?.customComponents?.BlockLabel??void 0}),[J,Ze]=Be.useState(()=>{if(!n)return y?._components?.customComponents?.Block??void 0}),Ie=Pe(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):J,[n,o,l,s,J]),Ce=Pe(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):B,[r,o,l,s,B]);Qt(()=>{let P=new AbortController;return l&&!y&&(async()=>{let{state:U}=await w({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:qt(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!S,renderAllFields:!0,schemaPath:v,signal:P.signal});if(U){U.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let W=Zr(qt(U,{excludeFiles:!0}),!0);N.update(()=>{let z=Yt(s);if(z&&$e(z)){let ie=W;ie.blockType=E,z.setFields(ie,!0)}},{tag:Ko}),M(U),r||Y(U._components?.customComponents?.BlockLabel??void 0),n||Ze(U._components?.customComponents?.Block??void 0)}})(),()=>{zo(P)}},[w,v,S,d,r,n,l,N,s,y,c,u,T,g,E]);let[le,be]=Be.useState(p?.[l.id]?.collapsed??!1),Gt=`${h}.lexical_internal_feature.blocks.lexical_blocks.${E}`,ce=a.blocks?.[Gt]?.[0],ee=ce.blockReferences?typeof ce?.blockReferences?.[0]=="string"?x.blocksMap[ce?.blockReferences?.[0]]:ce?.blockReferences?.[0]:ce?.blocks?.[0],{i18n:gt,t:me}=Cd(),xt=Jo(async({formState:P,submit:q})=>{zo(_.current);let U=new AbortController;_.current=U;let{state:W}=await w({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:qt(g,{excludeFiles:!0}),formState:P,globalSlug:u,initialBlockFormState:P,operation:"update",readOnly:!S,renderAllFields:!!q,schemaPath:v,signal:U.signal});if(!W)return P;P.blockName&&(W.blockName=P.blockName);let z=Zr(Kr({fields:qt(W,{excludeFiles:!0})}),!0);if(setTimeout(()=>{N.update(()=>{let ie=Yt(s);if(ie&&$e(ie)){let qe=z;qe.blockType=E,ie.setFields(qe,!0)}},{tag:Ko})},0),q){r||Y(W._components?.customComponents?.BlockLabel??void 0),n||Ze(W._components?.customComponents?.Block??void 0);let ie=0;for(let qe of Object.values(W))qe?.valid===!1&&ie++;b(ie)}return W},[w,d,c,T,u,v,E,g,S,N,s,n,r]);Qt(()=>()=>{zo(_.current)},[]);let Vt=Jo(()=>{N.update(()=>{Yt(s)?.remove()})},[N,s]),[cr,qc]=Be.useState(0);Qt(()=>{let P=()=>{N.getEditorState().read(()=>{let U=kd().getChildren(),W=0;for(let z of U)if($e(z)){if(z.getKey()===s){qc(W);return}W++}})};return P(),N.registerUpdateListener(()=>{P()})},[N,s]);let Ye=ee?.labels?.singular?td(ee.labels.singular,gt):ee?.slug,ur=Jo(P=>{T().then(q=>{let W=q?.fields?.[m.name]?.collapsed,z=W&&W?.length?W:[];P?z.includes(l.id)||z.push(l.id):z.includes(l.id)&&z.splice(z.indexOf(l.id),1),I(m.name,{collapsed:z,hello:"hi"})})},[T,m.name,I,l.id]),dr=Pe(()=>()=>V(Jr,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!S,el:"button",icon:"edit",onClick:P=>(P.preventDefault(),P.stopPropagation(),k(),!1),onMouseDown:P=>{P.preventDefault()},round:!0,size:"medium",tooltip:me("lexical:blocks:inlineBlocks:edit",{label:Ye})}),[o,S,me,Ye,k]),mr=Pe(()=>()=>V(Jr,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!S,icon:"x",onClick:P=>{P.preventDefault(),Vt()},round:!0,tooltip:"Remove Block"}),[o,S,Vt]),Oo=Pe(()=>({Actions:P,children:q,className:U,collapsibleProps:W,disableBlockName:z,editButton:ie,errorCount:qe,fieldHasErrors:Fo,Label:xr,Pill:Cr,removeButton:eu,showDragHandle:tu=!0,showRowNumber:ou=!0})=>V("div",{className:`${o}__container ${o}-${E}`,children:V(od,{actions:typeof P<"u"?P:S?V(ud,{button:V(ad,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",render:({close:Ct})=>Lt(Wo.ButtonGroup,{buttonSize:"medium",children:[(Ie&&ie!==!1||!Ie&&ie)&&V(Wo.Button,{onClick:()=>{k(),Ct()},children:me("general:edit")}),eu!==!1&&Lt(Wo.Button,{onClick:()=>{Vt(),Ct()},children:[V(bd,{}),me("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Fo?`${o}__row--has-errors`:`${o}__row--no-errors`,U].filter(Boolean).join(" "),collapsibleStyle:Fo?"error":"default",dragHandleProps:tu?{id:s,attributes:{role:"button",tabIndex:0},listeners:{}}:void 0,header:V("div",{className:`${o}__block-header`,children:typeof xr<"u"?xr:typeof Ce<"u"?Ce:Lt("div",{className:`${o}__block-label`,children:[ou&&V("span",{className:`${o}__block-number`,children:String(cr+1).padStart(2,"0")}),typeof Cr<"u"?Cr:V(cd,{className:`${o}__block-pill ${o}__block-pill-${E}`,pillStyle:"white",size:"small",children:Ye??E}),!z&&!ee?.admin?.disableBlockName&&V(md,{path:"blockName",readOnly:!S}),Fo&&V(ld,{count:qe??0,i18n:gt,withMessage:!0})]})}),isCollapsed:le,onToggle:Ct=>{ur(Ct),be(Ct)},...W||{},children:q},0)}),[Ie,Ce,Ye,o,ee?.admin?.disableBlockName,E,gt,le,ur,S,s,Vt,cr,me,k]),pr=l?.id,{headerActions:fr,submitRef:hr}=br(),gr=Pe(()=>()=>V(rd,{children:V(nd,{className:"",headerActions:fr,slug:C,title:me(`lexical:blocks:inlineBlocks:${pr?"edit":"create"}`,{label:Ye??me("lexical:blocks:inlineBlocks:label")}),children:y?Lt("div",{className:"fields-drawer",children:[V(dd,{fields:ee?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!S}),V(kr,{submitRef:hr})]}):null})}),[y,C,pr,Ye,me,S,ee?.fields,v,fr,hr]),Qc=Pe(()=>y?V("div",{"data-block-drawer-slug":C,style:{display:"contents"},children:V(id,{beforeSubmit:[async({formState:P})=>await xt({formState:P,submit:!0})],el:"div",fields:ee?.fields??[],initialState:y,onChange:[xt],onSubmit:(P,q)=>{q.blockType=E,N.update(()=>{let U=Yt(s);U&&$e(U)&&U.setFields(q,!0)},{tag:Ko}),k()},submitted:i,uuid:F,children:V(zr,{baseClass:o,BlockDrawer:gr,Collapsible:Oo,CustomBlock:Ie,CustomLabel:Ce,EditButton:dr,errorCount:R,formSchema:ee?.fields??[],initialState:y,nodeKey:s,RemoveButton:mr})})}):null,[Oo,gr,Ie,Ce,E,C,mr,dr,o,N,R,k,ee?.fields,F,y,s,xt,i]);return ee?Qc:V(Oo,{disableBlockName:!0,fieldHasErrors:!0,children:Lt("div",{className:`${o}-not-found`,children:["Error: Block '",E,"' not found in the config but exists in the lexical data"]})})};var ue=class extends Nt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=je(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return Td(Yr,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return Sd(new ue({fields:{...t,id:t?.id||new wd.default().toHexString()}}))}function $e(t){return t instanceof ue}import{createHeadlessEditor as Ed}from"@lexical/headless";function Zo(t,e){return({editorState:n})=>{let r=Ed({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=zt(e)}),l}}import{createHeadlessEditor as Nd}from"@lexical/headless";function eo(t,e){return({markdown:n})=>{let r=Nd({nodes:t});return r.update(()=>{Wt(n,e)},{discrete:!0}),r.getEditorState().toJSON()}}function Ld(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var el=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=Qr(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=Qr(n,!0);r&&(o=o.concat(r))}return o};function Qr(t,e){if(!t.jsx)return null;let o=Ld(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[bt],export:s=>{if(!_t(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Zo(r,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${i.blockType}${u?" "+Et({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+Et({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=Xt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:d,propsString:c}=Xt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=eo(r,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?Jt({propsString:c}):{}});if(a===!1)return;let m=kt({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[ue],export:s=>{if(!$e(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Zo(r,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
11
- `))for(let h of m.split(`
10
+ . Start match: `+JSON.stringify(r))}return{afterEndLine:d[_].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:n+_,endlineLastCharIndex:g,propsString:s}}import{jsx as Ed}from"react/jsx-runtime";import Nd from"bson-objectid";import{$applyNodeReplacement as Ld}from"lexical";import"react";import{DecoratorBlockNode as Vu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Wu}from"@lexical/utils";import zu from"bson-objectid";import{$applyNodeReplacement as Ku}from"lexical";var Nt=class extends Vu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Ju(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Wu(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function Ju(t){return Ku(new Nt({fields:{...t,id:t?.id||new zu.default().toHexString()}}))}import{jsx as V,jsxs as Lt}from"react/jsx-runtime";import{useLexicalComposerContext as od}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as nd}from"@lexical/react/useLexicalEditable";import{getTranslation as rd}from"@payloadcms/translations";import{Button as Xr,Collapsible as ld,Drawer as id,EditDepthProvider as sd,ErrorPill as ad,Form as cd,formatDrawerSlug as ud,MoreIcon as dd,Pill as pd,Popup as md,PopupList as Wo,RenderFields as fd,SectionTitle as hd,useConfig as gd,useDocumentForm as xd,useDocumentInfo as Zr,useEditDepth as Cd,useFormSubmitted as bd,useServerFunctions as kd,useTranslation as _d,XIcon as Td}from"@payloadcms/ui";import{abortAndIgnore as zo}from"@payloadcms/ui/shared";import{$getNodeByKey as Yt,$getRoot as wd,SKIP_DOM_SELECTION_TAG as Ko}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as qt,reduceFieldsToValues as Yr}from"payload/shared";import Pe,{useCallback as Jo,useEffect as Qt,useMemo as Be,useRef as Xo}from"react";import{v4 as Sd}from"uuid";import{c as Xu}from"react/compiler-runtime";import{jsx as Zt,jsxs as Zu}from"react/jsx-runtime";import{useLexicalEditable as Yu}from"@lexical/react/useLexicalEditable";import{RenderFields as qu,useFormSubmitted as Qu}from"@payloadcms/ui";import ed,{createContext as td}from"react";var zr=td({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>ed.use(zr),Kr=t=>{let e=Xu(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,c=Qu()&&i>0,a=Yu(),p;e[0]!==o||e[1]!==i||e[2]!==c?(p=f=>{let{children:g,..._}=f;return Zt(o,{errorCount:i,fieldHasErrors:c,..._,children:g})},e[0]=o,e[1]=i,e[2]=c,e[3]=p):p=e[3];let m=p,h={...l,BlockCollapsible:m};return n?Zu(zr,{value:h,children:[n,Zt(s,{})]}):Zt(m,{children:Zt(qu,{fields:d,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 qr=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=bd(),{id:d,collectionSlug:u,globalSlug:c}=Zr(),{fieldProps:{featureClientSchemaMap:a,field:p,initialLexicalFormState:m,schemaPath:h},uuid:f}=G(),{fields:g}=xd(),_=Xo(new AbortController),S=Cd(),[R,b]=Pe.useState(0),{config:x}=gd(),C=ud({slug:`lexical-blocks-create-${f}-${l.id}`,depth:S}),{toggleDrawer:k}=Fe(C),{getDocPreferences:T,setDocFieldPreferences:I}=Zr(),[L]=od(),E=nd(),N=l.blockType,{getFormState:w}=kd(),v=`${h}.lexical_internal_feature.blocks.lexical_blocks.${N}.fields`,[y,M]=Pe.useState(()=>{let B=m?.[l.id]?.formState;if(!B)return!1;let q=Object.fromEntries(Object.entries(B).map(([U,W])=>[U,U in l?{...W,initialValue:l[U],value:l[U]}:W]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),A=Xo(!1),D=Xo(e);Qt(()=>{A.current?(D.current!==e&&M(!1),D.current=e):A.current=!0},[e]);let[F]=Pe.useState(()=>Sd()),[P,Y]=Pe.useState(()=>{if(!r)return y?._components?.customComponents?.BlockLabel??void 0}),[J,Ze]=Pe.useState(()=>{if(!n)return y?._components?.customComponents?.Block??void 0}),Ie=Be(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):J,[n,o,l,s,J]),Ce=Be(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):P,[r,o,l,s,P]);Qt(()=>{let B=new AbortController;return l&&!y&&(async()=>{let{state:U}=await w({id:d,collectionSlug:u,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:qt(g,{excludeFiles:!0}),globalSlug:c,initialBlockData:l,operation:"update",readOnly:!E,renderAllFields:!0,schemaPath:v,signal:B.signal});if(U){U.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let W=Yr(qt(U,{excludeFiles:!0}),!0);L.update(()=>{let z=Yt(s);if(z&&$e(z)){let ie=W;ie.blockType=N,z.setFields(ie,!0)}},{tag:Ko}),M(U),r||Y(U._components?.customComponents?.BlockLabel??void 0),n||Ze(U._components?.customComponents?.Block??void 0)}})(),()=>{zo(B)}},[w,v,E,d,r,n,l,L,s,y,u,c,T,g,N]);let[le,be]=Pe.useState(m?.[l.id]?.collapsed??!1),Gt=`${h}.lexical_internal_feature.blocks.lexical_blocks.${N}`,ce=a.blocks?.[Gt]?.[0],ee=ce?.blockReferences?typeof ce?.blockReferences?.[0]=="string"?x.blocksMap[ce?.blockReferences?.[0]]:ce?.blockReferences?.[0]:ce?.blocks?.[0],{i18n:gt,t:pe}=_d(),xt=Jo(async({formState:B,submit:q})=>{zo(_.current);let U=new AbortController;_.current=U;let{state:W}=await w({id:d,collectionSlug:u,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:qt(g,{excludeFiles:!0}),formState:B,globalSlug:c,initialBlockFormState:B,operation:"update",readOnly:!E,renderAllFields:!!q,schemaPath:v,signal:U.signal});if(!W)return B;B.blockName&&(W.blockName=B.blockName);let z=Yr(Jr({fields:qt(W,{excludeFiles:!0})}),!0);if(setTimeout(()=>{L.update(()=>{let ie=Yt(s);if(ie&&$e(ie)){let qe=z;qe.blockType=N,ie.setFields(qe,!0)}},{tag:Ko})},0),q){r||Y(W._components?.customComponents?.BlockLabel??void 0),n||Ze(W._components?.customComponents?.Block??void 0);let ie=0;for(let qe of Object.values(W))qe?.valid===!1&&ie++;b(ie)}return W},[w,d,u,T,c,v,N,g,E,L,s,n,r]);Qt(()=>()=>{zo(_.current)},[]);let Vt=Jo(()=>{L.update(()=>{Yt(s)?.remove()})},[L,s]),[ur,tu]=Pe.useState(0);Qt(()=>{let B=()=>{L.getEditorState().read(()=>{let U=wd().getChildren(),W=0;for(let z of U)if($e(z)){if(z.getKey()===s){tu(W);return}W++}})};return B(),L.registerUpdateListener(()=>{B()})},[L,s]);let Ye=ee?.labels?.singular?rd(ee.labels.singular,gt):ee?.slug,dr=Jo(B=>{T().then(q=>{let W=q?.fields?.[p.name]?.collapsed,z=W&&W?.length?W:[];B?z.includes(l.id)||z.push(l.id):z.includes(l.id)&&z.splice(z.indexOf(l.id),1),I(p.name,{collapsed:z,hello:"hi"})})},[T,p.name,I,l.id]),pr=Be(()=>()=>V(Xr,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!E,el:"button",icon:"edit",onClick:B=>(B.preventDefault(),B.stopPropagation(),k(),!1),onMouseDown:B=>{B.preventDefault()},round:!0,size:"medium",tooltip:pe("lexical:blocks:inlineBlocks:edit",{label:Ye})}),[o,E,pe,Ye,k]),mr=Be(()=>()=>V(Xr,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!E,icon:"x",onClick:B=>{B.preventDefault(),Vt()},round:!0,tooltip:"Remove Block"}),[o,E,Vt]),Oo=Be(()=>({Actions:B,children:q,className:U,collapsibleProps:W,disableBlockName:z,editButton:ie,errorCount:qe,fieldHasErrors:Fo,Label:Cr,Pill:br,removeButton:nu,showDragHandle:ru=!0,showRowNumber:lu=!0})=>V("div",{className:`${o}__container ${o}-${N}`,children:V(ld,{actions:typeof B<"u"?B:E?V(md,{button:V(dd,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",render:({close:Ct})=>Lt(Wo.ButtonGroup,{buttonSize:"medium",children:[(Ie&&ie!==!1||!Ie&&ie)&&V(Wo.Button,{onClick:()=>{k(),Ct()},children:pe("general:edit")}),nu!==!1&&Lt(Wo.Button,{onClick:()=>{Vt(),Ct()},children:[V(Td,{}),pe("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Fo?`${o}__row--has-errors`:`${o}__row--no-errors`,U].filter(Boolean).join(" "),collapsibleStyle:Fo?"error":"default",dragHandleProps:ru?{id:s,attributes:{role:"button",tabIndex:0},listeners:{}}:void 0,header:V("div",{className:`${o}__block-header`,children:typeof Cr<"u"?Cr:typeof Ce<"u"?Ce:Lt("div",{className:`${o}__block-label`,children:[lu&&V("span",{className:`${o}__block-number`,children:String(ur+1).padStart(2,"0")}),typeof br<"u"?br:V(pd,{className:`${o}__block-pill ${o}__block-pill-${N}`,pillStyle:"white",size:"small",children:Ye??N}),!z&&!ee?.admin?.disableBlockName&&V(hd,{path:"blockName",readOnly:!E}),Fo&&V(ad,{count:qe??0,i18n:gt,withMessage:!0})]})}),isCollapsed:le,onToggle:Ct=>{dr(Ct),be(Ct)},...W||{},children:q},0)}),[Ie,Ce,Ye,o,ee?.admin?.disableBlockName,N,gt,le,dr,E,s,Vt,ur,pe,k]),fr=l?.id,{headerActions:hr,submitRef:gr}=kr(),xr=Be(()=>()=>V(sd,{children:V(id,{className:"",headerActions:hr,slug:C,title:pe(`lexical:blocks:inlineBlocks:${fr?"edit":"create"}`,{label:Ye??pe("lexical:blocks:inlineBlocks:label")}),children:y?Lt("div",{className:"fields-drawer",children:[V(fd,{fields:ee?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!E}),V(_r,{submitRef:gr})]}):null})}),[y,C,fr,Ye,pe,E,ee?.fields,v,hr,gr]),ou=Be(()=>y?V("div",{"data-block-drawer-slug":C,style:{display:"contents"},children:V(cd,{beforeSubmit:[async({formState:B})=>await xt({formState:B,submit:!0})],el:"div",fields:ee?.fields??[],initialState:y,onChange:[xt],onSubmit:(B,q)=>{q.blockType=N,L.update(()=>{let U=Yt(s);U&&$e(U)&&U.setFields(q,!0)},{tag:Ko}),k()},submitted:i,uuid:F,children:V(Kr,{baseClass:o,BlockDrawer:xr,Collapsible:Oo,CustomBlock:Ie,CustomLabel:Ce,EditButton:pr,errorCount:R,formSchema:ee?.fields??[],initialState:y,nodeKey:s,RemoveButton:mr})})}):null,[Oo,xr,Ie,Ce,N,C,mr,pr,o,L,R,k,ee?.fields,F,y,s,xt,i]);return ee?ou:V(Oo,{disableBlockName:!0,fieldHasErrors:!0,children:Lt("div",{className:`${o}-not-found`,children:["Error: Block '",N,"' not found in the config but exists in the lexical data"]})})};var ue=class extends Nt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=je(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return Ed(qr,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return Ld(new ue({fields:{...t,id:t?.id||new Nd.default().toHexString()}}))}function $e(t){return t instanceof ue}import{createHeadlessEditor as yd}from"@lexical/headless";function Zo(t,e){return({editorState:n})=>{let r=yd({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=zt(e)}),l}}import{createHeadlessEditor as vd}from"@lexical/headless";function eo(t,e){return({markdown:n})=>{let r=vd({nodes:t});return r.update(()=>{Wt(n,e)},{discrete:!0}),r.getEditorState().toJSON()}}function Rd(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=Rd(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[bt],export:s=>{if(!_t(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Zo(r,l),u=t.jsx.export({fields:i,lexicalToMarkdown:d});if(u===!1)return null;if(typeof u=="string")return u;let c=u.props&&Object.keys(u.props)?.length>0,a=u.props??{};return u?.children?.length?`<${i.blockType}${c?" "+Et({props:a}):""}>${u.children}</${i.blockType}>`:`<${i.blockType}${c?" "+Et({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=Xt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:d,propsString:u}=Xt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let c=eo(r,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:c,openMatch:i,props:u?Jt({propsString:u}):{}});if(a===!1)return;let p=kt({blockType:t.slug,...a});s.replace(p)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[ue],export:s=>{if(!$e(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Zo(r,l),u=t.jsx.export({fields:i,lexicalToMarkdown:d});if(u===!1)return null;if(typeof u=="string")return u;let c=u.props&&Object.keys(u.props)?.length>0,a=u.props??{};if(u?.children?.length){let p=u.children,m="";if(p.includes(`
11
+ `))for(let h of p.split(`
12
12
  `)){let f="";!t?.jsx?.doNotTrimChildren&&h!==""&&(f=" "),f+=h+`
13
- `,p+=f}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
- `;return`<${i.blockType}${u?" "+Et({props:a}):""}>
15
- ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+Et({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:d,startMatch:c,transformer:u})=>{let a=typeof u.regExpEnd=="object"&&"regExp"in u.regExpEnd?u.regExpEnd.regExp:u.regExpEnd,m=u.regExpEnd&&typeof u.regExpEnd=="object"&&"optional"in u.regExpEnd?u.regExpEnd.optional:!u.regExpEnd,{afterEndLine:p,beforeStartLine:h,content:f,endLineIndex:g,propsString:_}=Xt({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),L="";if(t?.jsx?.doNotTrimChildren)L=f.endsWith(`
13
+ `,m+=f}else m=(t?.jsx?.doNotTrimChildren?"":" ")+p+`
14
+ `;return`<${i.blockType}${c?" "+Et({props:a}):""}>
15
+ ${m}</${i.blockType}>`}return`<${i.blockType}${c?" "+Et({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:d,startMatch:u,transformer:c})=>{let a=typeof c.regExpEnd=="object"&&"regExp"in c.regExpEnd?c.regExpEnd.regExp:c.regExpEnd,p=c.regExpEnd&&typeof c.regExpEnd=="object"&&"optional"in c.regExpEnd?c.regExpEnd.optional:!c.regExpEnd,{afterEndLine:m,beforeStartLine:h,content:f,endLineIndex:g,propsString:_}=Xt({isEndOptional:p,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:u,trimChildren:!1}),S="";if(t?.jsx?.doNotTrimChildren)S=f.endsWith(`
16
16
  `)?f.slice(0,-1):f;else if(f.includes(`
17
17
  `)){let C=f.split(`
18
- `),k=0;for(let T of C){if(k++,T.startsWith(" "))L+=T.slice(2);else if(T==="")L+=T;else{L=f.endsWith(`
19
- `)?f.slice(0,-1):f;break}L+=k===C.length?"":`
20
- `}}else L=(f.startsWith(" ")?f.slice(2):f)+`
21
- `;if(!t?.jsx?.import)return[!1,d];let R=eo(r,l),b=t.jsx.import({children:L,closeMatch:null,htmlToLexical:null,markdownToLexical:R,openMatch:c,props:_?Jt({propsString:_}):{}});if(b===!1)return[!1,d];let x=je({blockType:t.slug,...b});if(x){let C=null,k=null;if(h?.length){C=R({markdown:h})?.root?.children??[];let T=C?.[0];T&&i.append(qr(T))}if(i.append(x),p?.length){k=R({markdown:p})?.root?.children;let T=i.getChildren()[i.getChildren().length-1],I=qr(k[0])?.getChildren();if(I?.length)for(let N of I)T.append(N)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,d,c,u)=>{if(t?.jsx?.import){if(!u){let g="";if(i)for(let _ of i)g+=_.getTextContent();u=[g]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
22
- `):a=u.join(`
23
- `).trim();let m=d[1]?.trim(),p=eo(r,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?Jt({propsString:m}):{}});if(h===!1)return!1;let f=je({blockType:t.slug,...h});f&&s.append(f);return}return!1}})),n)}import{createCommand as tl}from"lexical";var tt=tl("INSERT_BLOCK_COMMAND"),ot=tl("INSERT_INLINE_BLOCK_COMMAND");import{c as yd}from"react/compiler-runtime";import{useLexicalComposerContext as vd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Rd,$wrapNodeInElement as Id,mergeRegister as Md}from"@lexical/utils";import{formatDrawerSlug as $d,useEditDepth as Ad}from"@payloadcms/ui";import{$createParagraphNode as Dd,$getNodeByKey as Od,$getPreviousSelection as Fd,$getSelection as Bd,$insertNodes as Pd,$isParagraphNode as jd,$isRangeSelection as Hd,$isRootOrShadowRoot as Ud,COMMAND_PRIORITY_EDITOR as ol}from"lexical";import{useEffect as Gd,useState as Vd}from"react";var nl=()=>{let t=yd(12),[e]=vd(),[o,n]=Vd(null),{setCreatedInlineBlock:r,uuid:l}=G(),s=Ad(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=$d({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=Fe(c,!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 Md(e.registerCommand(tt,p=>(e.update(()=>{let h=Bd()||Fd();if(Hd(h)){let f=je(p),{focus:g}=h,_=g.getNode();Rd(f),jd(_)&&!_.__first&&_.remove()}}),!0),ol),e.registerCommand(ot,p=>{if(o){let f=Od(o);return!f||!_t(f)?!1:(f.setFields(p),n(null),!0)}let h=kt(p);return r?.(h),Pd([h]),Ud(h.getParentOrThrow())&&Id(h,Dd).selectEnd(),!0},ol))},t[3]=e,t[4]=r,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==r||t[9]!==o||t[10]!==u?(m=[e,r,o,u],t[7]=e,t[8]=r,t[9]=o,t[10]=u,t[11]=m):m=t[11],Gd(a,m),null};var Wd=$(({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]),d=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=i.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),u=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:el({blocks:c,inlineBlocks:u}),nodes:[ue,bt],plugins:[{Component:nl,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Ur(a,Uo),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?to(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(tt,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:Go,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?to(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ot,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Uo,items:c.map((a,m)=>({isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?to(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(tt,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:Go,items:u.map((a,m)=>({isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?to(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(ot,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Jd}from"react/compiler-runtime";import{jsx as Ue,jsxs as en}from"react/jsx-runtime";import{useLexicalComposerContext as Xd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Zd,$createTextNode as Yd,$getRoot as qd,getDOMSelection as Yo}from"lexical";import*as al from"react";import{useCallback as He,useEffect as qo,useLayoutEffect as ll,useRef as Qo,useState as oo}from"react";var zd=se&&"documentMode"in document?document.documentMode:null,rl=se&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Qb=se&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),e6=se&&"InputEvent"in window&&!zd?"getTargetRanges"in new window.InputEvent("input"):!1,t6=se&&/Version\/[\d.].*Safari/.test(navigator.userAgent),o6=se&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,n6=se&&/Android/.test(navigator.userAgent),r6=se&&/Win/.test(navigator.platform),Kd=se&&/^(?=.*Chrome).*/i.test(navigator.userAgent),l6=se&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Kd;var Qd=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},e1=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},t1=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
18
+ `),k=0;for(let T of C){if(k++,T.startsWith(" "))S+=T.slice(2);else if(T==="")S+=T;else{S=f.endsWith(`
19
+ `)?f.slice(0,-1):f;break}S+=k===C.length?"":`
20
+ `}}else S=(f.startsWith(" ")?f.slice(2):f)+`
21
+ `;if(!t?.jsx?.import)return[!1,d];let R=eo(r,l),b=t.jsx.import({children:S,closeMatch:null,htmlToLexical:null,markdownToLexical:R,openMatch:u,props:_?Jt({propsString:_}):{}});if(b===!1)return[!1,d];let x=je({...b,blockType:t.slug});if(x){let C=null,k=null;if(h?.length){C=R({markdown:h})?.root?.children??[];let T=C?.[0];T&&i.append(Qr(T))}if(i.append(x),m?.length){k=R({markdown:m})?.root?.children;let T=i.getChildren()[i.getChildren().length-1],I=Qr(k[0])?.getChildren();if(I?.length)for(let L of I)T.append(L)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,d,u,c)=>{if(t?.jsx?.import){if(!c){let g="";if(i)for(let _ of i)g+=_.getTextContent();c=[g]}let a="";t?.jsx?.doNotTrimChildren?a=c.join(`
22
+ `):a=c.join(`
23
+ `).trim();let p=d[1]?.trim(),m=eo(r,l),h=t.jsx.import({children:a,closeMatch:u,htmlToLexical:null,markdownToLexical:m,openMatch:d,props:p?Jt({propsString:p}):{}});if(h===!1)return!1;let f=je({...h,blockType:t.slug});f&&s.append(f);return}return!1}})),n)}import{createCommand as ol}from"lexical";var tt=ol("INSERT_BLOCK_COMMAND"),ot=ol("INSERT_INLINE_BLOCK_COMMAND");import{c as Id}from"react/compiler-runtime";import{useLexicalComposerContext as Md}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as $d,$wrapNodeInElement as Ad,mergeRegister as Dd}from"@lexical/utils";import{formatDrawerSlug as Od,useEditDepth as Fd}from"@payloadcms/ui";import{$createParagraphNode as Pd,$getNodeByKey as Bd,$getPreviousSelection as jd,$getSelection as Hd,$insertNodes as Ud,$isParagraphNode as Gd,$isRangeSelection as Vd,$isRootOrShadowRoot as Wd,COMMAND_PRIORITY_EDITOR as nl}from"lexical";import{useEffect as zd,useState as Kd}from"react";var rl=()=>{let t=Id(12),[e]=Md(),[o,n]=Kd(null),{setCreatedInlineBlock:r,uuid:l}=G(),s=Fd(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=Od({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=d):d=t[2];let u=d,{toggleDrawer:c}=Fe(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 Dd(e.registerCommand(tt,m=>(e.update(()=>{let h=Hd()||jd();if(Vd(h)){let f=je(m),{focus:g}=h,_=g.getNode();$d(f),Gd(_)&&!_.__first&&_.remove()}}),!0),nl),e.registerCommand(ot,m=>{if(o){let f=Bd(o);return!f||!_t(f)?!1:(f.setFields(m),n(null),!0)}let h=kt(m);return r?.(h),Ud([h]),Wd(h.getParentOrThrow())&&Ad(h,Pd).selectEnd(),!0},nl))},t[3]=e,t[4]=r,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==r||t[9]!==o||t[10]!==c?(p=[e,r,o,c],t[7]=e,t[8]=r,t[9]=o,t[10]=c,t[11]=p):p=t[11],zd(a,p),null};var Jd=$(({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]),d=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),u=i.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),c=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:tl({blocks:u,inlineBlocks:c}),nodes:[ue,bt],plugins:[{Component:rl,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[u?.length?{items:u.map(a=>({Icon:Gr(a,Uo),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?to(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(tt,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,c?.length?{items:c.map(a=>({Icon:Go,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?to(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(ot,{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:Uo,items:u.map((a,p)=>({isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?to(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(tt,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,c?.length?{type:"dropdown",ChildComponent:Go,items:c.map((a,p)=>({isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?to(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ot,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Yd}from"react/compiler-runtime";import{jsx as Ue,jsxs as en}from"react/jsx-runtime";import{useLexicalComposerContext as qd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Qd,$createTextNode as ep,$getRoot as tp,getDOMSelection as Yo}from"lexical";import*as cl from"react";import{useCallback as He,useEffect as qo,useLayoutEffect as il,useRef as Qo,useState as oo}from"react";var Xd=se&&"documentMode"in document?document.documentMode:null,ll=se&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),r6=se&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),l6=se&&"InputEvent"in window&&!Xd?"getTargetRanges"in new window.InputEvent("input"):!1,i6=se&&/Version\/[\d.].*Safari/.test(navigator.userAgent),s6=se&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,a6=se&&/Android/.test(navigator.userAgent),c6=se&&/Win/.test(navigator.platform),Zd=se&&/^(?=.*Chrome).*/i.test(navigator.userAgent),u6=se&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Zd;var op=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)},np=(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)},rp=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
24
24
  await assertSelection(page, {
25
25
  anchorPath: [${r.anchorPath.toString()}],
26
26
  anchorOffset: ${r.anchorOffset},
@@ -30,7 +30,7 @@ ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+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 o1(t){return t.key.toLowerCase()==="a"&&(rl?t.metaKey:t.ctrlKey)}function n1(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:n,focusOffset:r}=t;return n!==0&&n--,r!==0&&r--,{anchorNode:e,anchorOffset:n,focusNode:o,focusOffset:r}}function il(t,e){let o=t,n=[];for(;o!==e;)o!=null&&n.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return n}var sl=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function r1(t){let[e,o]=oo([]),[n,r]=oo(!1),[,l]=oo(""),[s,i]=oo(""),d=Qo(null),c=Qo(!1),u=Qo(null),a=He(()=>t,[t]),m=He(()=>{let b=t.getRootElement(),x=Yo(t._window);return b==null||x==null||x.anchorNode==null||x.focusNode==null||!b.contains(x.anchorNode)||!b.contains(x.focusNode)?null:`
33
+ );`}};function lp(t){return t.key.toLowerCase()==="a"&&(ll?t.metaKey:t.ctrlKey)}function ip(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 sp(t){let[e,o]=oo([]),[n,r]=oo(!1),[,l]=oo(""),[s,i]=oo(""),d=Qo(null),u=Qo(!1),c=Qo(null),a=He(()=>t,[t]),p=He(()=>{let b=t.getRootElement(),x=Yo(t._window);return b==null||x==null||x.anchorNode==null||x.focusNode==null||!b.contains(x.anchorNode)||!b.contains(x.focusNode)?null:`
34
34
  import {
35
35
  initializeE2E,
36
36
  assertHTMLSnapshot,
@@ -47,20 +47,20 @@ describe('Test case', () => {
47
47
  const {page} = e2e;
48
48
 
49
49
  await page.focus('div[contenteditable="true"]');
50
- ${e.map(t1).join(`
50
+ ${e.map(rp).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=He((b,x)=>{o(C=>{let k=e.length-1,T=e[k];if(T&&T.name===b){if(b==="type")return[...e.slice(0,k),{...T,value:T.value+x}];if(T.value===x)return[...e.slice(0,k),{...T,count:T.count+1}]}return[...C,{name:b,count:1,value:x}]})},[e,o]);ll(()=>{let b=C=>{if(!n)return;let k=C.key;o1(C)?p("selectAll",""):sl.has(k)?p("press",C.key):[...k].length>1?p("keydown",C.key):p("type",C.key)},x=C=>{if(!n)return;let k=C.key;!sl.has(k)&&[...k].length>1&&p("keyup",C.key)};return t.registerRootListener((C,k)=>{k!==null&&(k.removeEventListener("keydown",b),k.removeEventListener("keyup",x)),C!==null&&(C.addEventListener("keydown",b),C.addEventListener("keyup",x))})},[t,n,p]),ll(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),qo(()=>{if(e){let b=m();b!==null&&i(b),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),qo(()=>t.registerUpdateListener(({dirtyElements:x,dirtyLeaves:C,editorState:k})=>{if(!n)return;let T=k._selection,I=d.current,N=c.current;if(I!==T){if(C.size===0&&x.size===0&&!N){let E=Yo(t._window);if(E&&(E.anchorNode==null||E.focusNode==null))return}d.current=T}c.current=!1;let S=m();S!==null&&i(S)}),[t,m,n,p]),qo(()=>n?t.registerUpdateListener(()=>{let x=t.getRootElement();x!==null&&l(x?.innerHTML)}):void 0,[t,n]);let h=He(b=>{n||(b.update(()=>{let x=qd();x.clear();let C=Yd();x.append(Zd().append(C)),C.select()}),o([])),r(x=>!x)},[n]),f=He(()=>{if(!n)return;let b=Yo(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:x,anchorOffset:C,focusNode:k,focusOffset:T}=n1(b),I=a().getRootElement(),N;x!==null&&(N=il(x,I));let S;k!==null&&(S=il(k,I)),p("snapshot",{anchorNode:x,anchorOffset:C,anchorPath:N,focusNode:k,focusOffset:T,focusPath:S})},[p,n,a]),g=He(()=>{Qd(m())},[m]),_=He(()=>{e1("test.js",m())},[m]);return[Ue("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:b=>{h(a()),b.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?en("div",{className:"test-recorder-output",children:[en("div",{className:"test-recorder-toolbar",children:[Ue("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{f(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Ue("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Ue("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{_(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Ue("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var cl=()=>{let t=Jd(3),[e]=Xd(),[o,n]=r1(e),r;return t[0]!==o||t[1]!==n?(r=en(al.Fragment,{children:[Ue("p",{children:"HI"}),o,n,Ue("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var l1=$({plugins:[{Component:cl,position:"bottom"}]});import{c as i1}from"react/compiler-runtime";import{jsx as s1}from"react/jsx-runtime";import{useLexicalComposerContext as a1}from"@lexical/react/LexicalComposerContext.js";import{TreeView as c1}from"@lexical/react/LexicalTreeView.js";import"react";var ul=()=>{let t=i1(2),[e]=a1(),o;return t[0]!==e?(o=s1(c1,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var u1=$({plugins:[{Component:ul,position:"bottom"}]});import{$isTableSelection as m1}from"@lexical/table";import{$isRangeSelection as p1,FORMAT_TEXT_COMMAND as f1}from"lexical";import{jsx as dl}from"react/jsx-runtime";import"react";var d1="M14.5 9.25A1.75 1.75 0 0 1 12.75 11H9.5V7.5h3.25c.966 0 1.75.784 1.75 1.75M8 11V7.5A1.5 1.5 0 0 1 9.5 6h3.25a3.25 3.25 0 0 1 2.418 5.422A3.5 3.5 0 0 1 13.5 18h-4A1.5 1.5 0 0 1 8 16.5zm1.5 1.5v4h4a2 2 0 1 0 0-4z",ml=({className:t})=>dl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:dl("path",{clipRule:"evenodd",d:d1,fill:"currentColor",fillRule:"evenodd"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var pl={type:"text-format",format:["bold","italic"],tag:"***"},fl={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},hl={type:"text-format",format:["bold"],tag:"**"},gl={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var xl=[Z([{ChildComponent:ml,isActive:({selection:t})=>p1(t)||m1(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(f1,"bold")},order:1}])],h1=$(({featureProviderMap:t})=>{let e=[hl,gl];return t.get("italic")&&e.push(fl,pl),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:xl},toolbarInline:{groups:xl}}});import{$isTableSelection as x1}from"@lexical/table";import{$isRangeSelection as C1,FORMAT_TEXT_COMMAND as b1}from"lexical";import{jsx as Cl}from"react/jsx-runtime";import"react";var g1="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",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:g1,fill:"currentColor",fillRule:"evenodd"})});var kl={type:"text-format",format:["code"],tag:"`"};var _l=[Z([{ChildComponent:bl,isActive:({selection:t})=>C1(t)||x1(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(b1,"code")},order:7}])],k1=$({enableFormats:["code"],markdownTransformers:[kl],toolbarFixed:{groups:_l},toolbarInline:{groups:_l}});import{$isTableSelection as T1}from"@lexical/table";import{$isRangeSelection as w1,FORMAT_TEXT_COMMAND as S1}from"lexical";import{jsx as Tl}from"react/jsx-runtime";import"react";var _1="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",wl=({className:t})=>Tl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Tl("path",{clipRule:"evenodd",d:_1,fill:"currentColor",fillRule:"evenodd"})});var Sl={type:"text-format",format:["italic"],tag:"*"},El={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Nl=[Z([{ChildComponent:wl,isActive:({selection:t})=>w1(t)||T1(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(S1,"italic")},order:2}])],E1=$({enableFormats:["italic"],markdownTransformers:[Sl,El],toolbarFixed:{groups:Nl},toolbarInline:{groups:Nl}});import{$isTableSelection as L1}from"@lexical/table";import{$isRangeSelection as y1,FORMAT_TEXT_COMMAND as v1}from"lexical";import{jsx as Ll}from"react/jsx-runtime";import"react";var N1="M15.835 13.5a.27.27 0 0 1 .24.138q.306.554.306 1.316 0 1.01-.543 1.816-.543.8-1.554 1.268-1.01.462-2.409.462-1.323 0-2.295-.419-.972-.424-1.534-1.175a3.2 3.2 0 0 1-.533-1.135c-.082-.326.187-.614.522-.614.299 0 .539.233.625.519q.13.43.415.768.448.524 1.17.8.73.271 1.63.272.996 0 1.764-.32.773-.327 1.215-.906a2.16 2.16 0 0 0 .44-1.348q0-.645-.345-1.09c-.1-.132-.016-.352.15-.352zm-3.846-8q1.215 0 2.142.438.933.43 1.476 1.187.38.518.519 1.134c.07.31-.19.577-.507.577-.286 0-.518-.22-.6-.493q-.22-.738-.875-1.224-.864-.646-2.18-.646-.92 0-1.63.313-.703.308-1.1.85a2.04 2.04 0 0 0-.395 1.237q0 .492.217.874.216.376.588.652.376.278.843.475.474.197.972.338l1.052.288H18.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1h3.94a4.4 4.4 0 0 1-.844-.602q-.844-.781-.844-1.982 0-1.009.562-1.778t1.522-1.2q.959-.438 2.153-.438",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:N1,fill:"currentColor"})});var vl={type:"text-format",format:["strikethrough"],tag:"~~"};var Rl=[Z([{ChildComponent:yl,isActive:({selection:t})=>y1(t)||L1(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(v1,"strikethrough")},order:4}])],R1=$({enableFormats:["strikethrough"],markdownTransformers:[vl],toolbarFixed:{groups:Rl},toolbarInline:{groups:Rl}});import{$isTableSelection as M1}from"@lexical/table";import{$isRangeSelection as $1,FORMAT_TEXT_COMMAND as A1}from"lexical";import{jsx as Il}from"react/jsx-runtime";import"react";var I1="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",Ml=({className:t})=>Il("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Il("path",{d:I1,fill:"currentColor"})});var $l=[Z([{ChildComponent:Ml,isActive:({selection:t})=>$1(t)||M1(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(A1,"subscript")},order:5}])],D1=$({enableFormats:["subscript"],toolbarFixed:{groups:$l},toolbarInline:{groups:$l}});import{$isTableSelection as F1}from"@lexical/table";import{$isRangeSelection as B1,FORMAT_TEXT_COMMAND as P1}from"lexical";import{jsx as Al}from"react/jsx-runtime";import"react";var O1="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",Dl=({className:t})=>Al("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:Al("path",{d:O1,fill:"currentColor"})});var Ol=[Z([{ChildComponent:Dl,isActive:({selection:t})=>B1(t)||F1(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(P1,"superscript")},order:6}])],j1=$({enableFormats:["superscript"],toolbarFixed:{groups:Ol},toolbarInline:{groups:Ol}});import{$isTableSelection as U1}from"@lexical/table";import{$isRangeSelection as G1,FORMAT_TEXT_COMMAND as V1}from"lexical";import{jsx as Fl}from"react/jsx-runtime";import"react";var H1="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",Bl=({className:t})=>Fl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Fl("path",{clipRule:"evenodd",d:H1,fill:"currentColor",fillRule:"evenodd"})});var Pl=[Z([{ChildComponent:Bl,isActive:({selection:t})=>G1(t)||U1(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(V1,"underline")},order:3}])],W1=$({enableFormats:["underline"],toolbarFixed:{groups:Pl},toolbarInline:{groups:Pl}});import{jsx as on}from"react/jsx-runtime";import{jsx as z1}from"react/jsx-runtime";function K1(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var no=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[K1(o),n])):{};return z1("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as J1}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as X1}from"@lexical/selection";import{$getNodeByKey as Z1,$getState as Y1,$setState as q1,createState as Q1,TextNode as em}from"lexical";import{useEffect as tm}from"react";function jl(t){let e=new Map;for(let o in t){let n=t[o],r=Q1(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function tn(t,e,o,n){t.update(()=>{X1(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);q1(r,l.stateConfig,n)})})}function Hl({stateMap:t}){let[e]=J1();return tm(()=>e.registerMutationListener(em,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=Z1(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=Y1(l,d.stateConfig);if(!u){delete s.dataset[c];return}s.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var Ul=(t,e)=>{let o=[];for(let r in t.state){let l=t.state[r];for(let s in l){let i=l[s];o.push({ChildComponent:()=>on(no,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{tn(d,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>on(no,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>on(no,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)tn(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},om=$(({props:t})=>{let e=jl(t.state);return{plugins:[{Component:()=>Hl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Ul(t,e)},toolbarInline:{groups:Ul(t,e)}}});import{c as mm}from"react/compiler-runtime";import{useLexicalComposerContext as pm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as fm,$isHeadingNode as oi,HeadingNode as li}from"@lexical/rich-text";import{$setBlocksType as hm}from"@lexical/selection";import{$getSelection as gm,$isRangeSelection as xm}from"lexical";import{useEffect as Cm}from"react";import{jsx as Gl}from"react/jsx-runtime";import"react";var nm="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 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",Vl=({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:nm,fill:"currentColor"})});import{jsx as Wl}from"react/jsx-runtime";import"react";var rm="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 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",zl=({className:t})=>Wl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Wl("path",{d:rm,fill:"currentColor"})});import{jsx as Kl}from"react/jsx-runtime";import"react";var lm="M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",Jl=({className:t})=>Kl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Kl("path",{d:lm,fill:"currentColor"})});import{jsx as Xl}from"react/jsx-runtime";import"react";var im="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",Zl=({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",{d:im,fill:"currentColor"})});import{jsx as Yl}from"react/jsx-runtime";import"react";var sm="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",ql=({className:t})=>Yl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Yl("path",{d:sm,fill:"currentColor"})});import{jsx as Ql}from"react/jsx-runtime";import"react";var am="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",ei=({className:t})=>Ql("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ql("path",{d:am,fill:"currentColor"})});import{$createHeadingNode as cm,$isHeadingNode as um,HeadingNode as dm}from"@lexical/rich-text";var nn=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var ti=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[dm],export:(r,l)=>{if(!um(r))return null;let s=Number(r.getTag().slice(1));return"#".repeat(s)+" "+l(r)},regExp:n,replace:nn(r=>{let l="h"+r[1]?.length;return cm(l)})}};var ni=t=>{let e=gm();hm(e,()=>fm(t))},ri={h1:Vl,h2:zl,h3:Jl,h4:Zl,h5:ql,h6:ei},bm=$(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((n,r)=>({ChildComponent:ri[n],isActive:({selection:l})=>{if(!xm(l))return!1;for(let s of l.getNodes()){if(oi(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(oi(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(()=>{ni(n)})},order:r+2})))];return{markdownTransformers:[ti(e)],nodes:[li],plugins:[{Component:km,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[X(e.map(n=>({Icon:ri[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(()=>{ni(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),km=t=>{let e=mm(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,[d]=pm(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(li,a=>{l.includes(a.getTag())||a.setTag(i)})},u=[d,l,i],e[4]=d,e[5]=l,e[6]=i,e[7]=c,e[8]=u):(c=e[7],u=e[8]),Cm(c,u),null};import{$isNodeSelection as Bm}from"lexical";import{jsx as ii}from"react/jsx-runtime";import"react";var _m="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",rn=({className:t})=>ii("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ii("path",{d:_m,fill:"currentColor"})});import{jsx as si}from"react/jsx-runtime";import"react";var Tm={16:"M8.5 3.5a.5.5 0 0 0-1 0v4h-4a.5.5 0 0 0 0 1h4v4a.5.5 0 0 0 1 0v-4h4a.5.5 0 0 0 0-1h-4z",24:"M12 6a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 12 6"},ai=({className:t,size:e=24})=>si("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:si("path",{clipRule:"evenodd",d:Tm[e],fill:"currentColor",fillRule:"evenodd"})});var Te=t=>({type:"dropdown",ChildComponent:ai,items:t,key:"add",order:10});import{addClassNamesToElement as wm}from"@lexical/utils";import{$applyNodeReplacement as Sm,createCommand as Em,DecoratorNode as Nm}from"lexical";var vt=Em("INSERT_HORIZONTAL_RULE_COMMAND"),yt=class extends Nm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Lm,priority:0})}}static importJSON(e){return ci()}createDOM(e){let o=document.createElement("hr");return wm(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 Lm(){return{node:ci()}}function ci(){return Sm(new yt)}import{$applyNodeReplacement as ym}from"lexical";import"react";var we=class extends yt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return nt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function nt(){return ym(new we)}function Ge(t){return t instanceof we}var ui={type:"element",dependencies:[we],export:(t,e)=>Ge(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=nt();e&&t.replace(e)}};import{c as vm}from"react/compiler-runtime";import{useLexicalComposerContext as Rm}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as di,$insertNodeToNearestRoot as Im}from"@lexical/utils";import{$getRoot as Mm,$getSelection as mi,$isRangeSelection as pi,$isRootOrShadowRoot as fi,COMMAND_PRIORITY_EDITOR as $m}from"lexical";import{useEffect as Am}from"react";var ln="LexicalEditorTheme__hrSelected",hi=()=>{let t=vm(3),[e]=Rm(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(vt,Dm,$m),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let c=Mm().getChildren(),u=mi(),a=[];for(let b=0;b<c.length;b++){let x=c[b];if(Ge(x)){let C=e.getElementByKey(x.getKey());C&&a.push({element:C,index:b})}}if(a.length===0)return;if(!pi(u)||u.isCollapsed()){for(let{element:b}of a)b.classList.remove(ln);return}let m=u.anchor.getNode(),p=u.focus.getNode(),h=di(m,Om)||m,f=di(p,Fm)||p,g=c.indexOf(h),_=c.indexOf(f);if(g===-1||_===-1)return;let L=Math.min(g,_),R=Math.max(g,_);for(let{element:b,index:x}of a)x>=L&&x<=R?b.classList.add(ln):b.classList.remove(ln)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Am(o,n),null};function Dm(t){let e=mi();if(!pi(e))return!1;if(e.focus.getNode()!==null){let n=nt();Im(n)}return!0}function Om(t){return fi(t.getParent())}function Fm(t){return fi(t.getParent())}var Pm=$({markdownTransformers:[ui],nodes:[we],plugins:[{Component:hi,position:"normal"}],slashMenu:{groups:[X([{Icon:rn,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(vt,void 0)}}])]},toolbarFixed:{groups:[Te([{ChildComponent:rn,isActive:({selection:t})=>{if(!Bm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ge(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(vt,void 0)}}])]}});import{$findMatchingParent as Ni}from"@lexical/utils";import{$isElementNode as qm,INDENT_CONTENT_COMMAND as Qm,OUTDENT_CONTENT_COMMAND as ep}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var jm="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",gi=({className:t})=>sn("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:sn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:sn("path",{clipRule:"evenodd",d:jm,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as xi}from"react/jsx-runtime";import"react";var Hm="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})=>xi("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:xi("path",{clipRule:"evenodd",d:Hm,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Um}from"react/jsx-runtime";import{useLexicalComposerContext as Gm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Vm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Wm,mergeRegister as bi}from"@lexical/utils";import{$getSelection as zm,$isElementNode as wi,$isRangeSelection as Km,COMMAND_PRIORITY_LOW as ki,INDENT_CONTENT_COMMAND as _i,KEY_TAB_COMMAND as Jm,OUTDENT_CONTENT_COMMAND as Xm,TabNode as Zm}from"lexical";import{useEffect as Ti}from"react";var Si=({clientProps:t})=>{let[e]=Gm(),{disabledNodes:o,disableTabNode:n}=t;return Ti(()=>{if(!(!e||!o?.length))return bi(e.registerCommand(_i,()=>Ym(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),ki),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);wi(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),Ti(()=>{if(!(!e||!n))return bi(e.registerCommand(Jm,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?Xm:_i,void 0)),ki),e.registerNodeTransform(Zm,r=>{r.remove()}))},[e,n]),Um(Vm,{})};function Ym(t){let e=zm();if(!Km(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=Wm(l,c=>wi(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),t(i))}return o.size>0}var Ei=t=>({type:"buttons",items:t,key:"indent",order:35});var Li=({disabledNodes:t})=>[Ei([{ChildComponent:gi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>yi(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!Ni(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ep,void 0)},order:1},{ChildComponent:Ci,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>yi(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!Ni(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Qm,void 0)},order:2}])],tp=$(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Si,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Li({disabledNodes:e})},toolbarInline:{groups:Li({disabledNodes:e})}}}),yi=t=>qm(t)&&t.canIndent();import{$findMatchingParent as bf}from"@lexical/utils";import{$getSelection as Cn,$isRangeSelection as cs}from"lexical";import{jsx as vi}from"react/jsx-runtime";import"react";var op={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4436 10.3708C12.6861 10.5041 12.9148 10.6721 13.1204 10.8776C14.2919 12.0492 14.2918 13.9482 13.1204 15.1198L11.1204 17.1198C9.94879 18.2914 8.04975 18.2914 6.87817 17.1198C5.70664 15.9482 5.70661 14.0492 6.87817 12.8776L8.1477 11.6071C8.4098 11.345 8.89329 11.5392 8.97388 11.9011C9.00617 12.0462 8.96861 12.2012 8.86353 12.3063L7.5852 13.5847C6.80417 14.3657 6.80419 15.6317 7.5852 16.4128C8.36625 17.1938 9.63228 17.1938 10.4133 16.4128L12.4133 14.4128C13.1942 13.6317 13.1943 12.3657 12.4133 11.5847C12.4042 11.5755 12.3953 11.5662 12.386 11.5573C12.2925 11.468 12.1984 11.3736 12.1614 11.2497C12.0724 10.9515 12.1448 10.6149 12.3801 10.3796C12.397 10.3628 12.4228 10.3594 12.4436 10.3708ZM12.8782 6.87764C14.0497 5.70615 15.9488 5.70616 17.1204 6.87764C18.2919 8.04919 18.2919 9.94825 17.1204 11.1198L15.8508 12.3903C15.5887 12.6522 15.1053 12.4581 15.0247 12.0964C14.9924 11.9512 15.0308 11.7963 15.136 11.6911L16.4133 10.4128C17.1943 9.63175 17.1943 8.3657 16.4133 7.58467C15.6323 6.80371 14.3662 6.8037 13.5852 7.58467L11.5852 9.58467C10.8046 10.3657 10.8044 11.6319 11.5852 12.4128C11.5943 12.4219 11.6042 12.4303 11.6135 12.4392C11.7064 12.5278 11.7999 12.622 11.8372 12.7448C11.9276 13.044 11.8545 13.3827 11.6184 13.6188C11.6023 13.6347 11.5778 13.6383 11.5579 13.6276C11.3146 13.4942 11.0843 13.3259 10.8782 13.1198C9.7068 11.9484 9.707 10.0492 10.8782 8.87764L12.8782 6.87764Z"},ro=({className:t,size:e=24})=>vi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:vi("path",{d:op[e],fill:"currentColor"})});import{$isAtNodeEnd as Ri}from"@lexical/selection";function rt(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?Ri(o)?n:r:Ri(e)?n:r}var an=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as hp}from"lexical";function cn(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var np=/^(?:[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+)?$/,rp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Ii(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||np.test(t)||rp.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 lp,isHTMLAnchorElement as ip}from"@lexical/utils";import mn from"bson-objectid";import{$applyNodeReplacement as sp,$createTextNode as Mi,$getSelection as ap,$isElementNode as $i,$isRangeSelection as dn,createCommand as cp,ElementNode as up}from"lexical";var dp=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends up{__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:mp,priority:1})}}static importJSON(e){let o=Se({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new mn.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=un(o.rel,"add","noopener")),lp(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!dn(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if($i(n)){let r=Se({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!dp.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,n){let r=this.__fields?.url,l=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=un(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=un(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function mp(t){let e=null;if(ip(t)){let o=t.textContent;o!==null&&o!==""&&(e=Se({id:new mn.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Se({id:t,fields:e}){return sp(new oe({id:t??new mn.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var fe=cp("TOGGLE_LINK_COMMAND");function pn(t){let e=ap();if(!dn(e)&&(t===null||!t.selectedNodes?.length))return;let o=dn(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();K(s)&&(s.getChildren().forEach(d=>{s.insertBefore(d)}),s.remove())});return}if(o?.length===1){let l=o[0],s=K(l)?l:pp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Mi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let n=null,r=null;o?.forEach(l=>{let s=l.getParent();if(!(s===r||s===null||$i(l)&&!l.isInline())){if(K(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Mi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=Se({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 pp(t){return fp(t,e=>K(e))}function fp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function un(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let l=new RegExp(o,"g");r=r.replace(l,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let l=new RegExp(o,"g");n=r.replace(l,"").trim()}return n}var gp=(t,e)=>{let[,o,n]=e,r=Se({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=hp(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},xp=t=>({type:"text-match",dependencies:[oe],export:(e,o)=>{if(!K(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=cn(t.internalDocToHref({linkNode:n.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=cn(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:gp,trigger:")"}),Ai=xp();import{$applyNodeReplacement as Cp,$isElementNode as bp}from"lexical";var Ee=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=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(bp(n)){let r=Rt({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Rt({fields:t}){return Cp(new Ee({id:"",fields:t}))}function Ne(t){return t instanceof Ee}import{c as kp}from"react/compiler-runtime";import{useLexicalComposerContext as _p}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Tp}from"@lexical/utils";import{$createTextNode as Di,$getSelection as wp,$isElementNode as Fi,$isLineBreakNode as Bi,$isNodeSelection as Sp,$isRangeSelection as Ep,$isTextNode as It,TextNode as Np}from"lexical";import{useEffect as Lp}from"react";function Oi(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 Pi(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var yp=/[.,;\s]/;function io(t){return t!==void 0&&yp.test(t)}function ji(t){return io(t[t.length-1])}function hn(t){return io(t[0])}function vp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Hi(t){let e=t.getPreviousSibling();return Fi(e)&&(e=e.getLastDescendant()),e===null||Bi(e)||It(e)&&ji(e.getTextContent())}function Ui(t){let e=t.getNextSibling();return Fi(e)&&(e=e.getFirstDescendant()),e===null||Bi(e)||It(e)&&hn(e.getTextContent())}function Rp(t,e,o,n){return(t>0?io(o[t-1]):Hi(n[0]))?e<o.length?io(o[e]):Ui(n[n.length-1]):!1}function Ip(t,e,o){let n=[],r=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=i;i+a<=e?(n.push(c),s+=a):m>=o?l.push(c):r.push(c),i+=a,d.shift()}return[s,n,r,l]}function Mp(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 d=Di(n.text);d.setFormat(i.getFormat()),d.setDetail(i.getDetail()),d.setStyle(i.getStyle()),l.append(d),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,d;e===0?d=s:[,d]=s.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,h=i,f=i+p;if(h<o)if(f<=o)c.push(a);else{let[g,_]=a.splitText(o-h);g&&c.push(g),u=_}i+=p}),d){let a=wp(),m=a?a.getNodes().find(It):void 0,p=Di(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(Ep(a)?p.select(a.anchor.offset,a.focus.offset):Sp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function $p(t,e,o){let n=[...t],r=n.map(d=>d.getTextContent()).join(""),l=r,s,i=0;for(;(s=Pi(l,e))!=null&&s!==null;){let d=s.index,c=s.length,u=d+c;if(Rp(i+d,i+u,r,n)){let[m,,p,h]=Ip(n,i+d,i+u),f=i+d-m,g=i+u-m,_=Mp(p,f,g,s);n=_?[_,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function fn(t,e,o){let n=t.getChildren(),r=n.length;for(let d=0;d<r;d++){let c=n[d];if(!It(c)||!c.isSimpleText()){lo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Pi(l,e);if(s===null||s.text!==l){lo(t),o(null,t.getFields()?.url??null);return}if(!Hi(t)||!Ui(t)){lo(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let d=t.getFields();d.url=s?.url,t.setFields(d),o(s.url,i??null)}}function Ap(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),l=t.getTextContent();if(Ne(n)){let s=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:")??!1:!1;(!hn(l)||vp(l,s))&&(n.append(t),fn(n,e,o),o(null,n.getFields()?.url??null))}Ne(r)&&!ji(l)&&(lo(r),fn(r,e,o),o(null,r.getFields()?.url??null))}function lo(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function Dp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&It(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Op(t,e,o){let n=kp(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([Ee]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return Tp(t.registerNodeTransform(Np,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(Ne(d))fn(d,e,s);else if(!K(d)){if(i.isSimpleText()&&(hn(i.getTextContent())||!Ne(c))){let u=Dp(i);$p(u,e,s)}Ap(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]),Lp(r,l)}var Fp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Bp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Pp=[Oi(Fp,t=>t.startsWith("http")?t:`https://${t}`),Oi(Bp,t=>`mailto:${t}`)],Gi=()=>{let[t]=_p();return Op(t,Pp),null};import{jsx as jp}from"react/jsx-runtime";import{ClickableLinkPlugin as Hp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Vi=()=>jp(Hp,{});import{jsx as af}from"react/jsx-runtime";import"react";import{createPortal as cf}from"react-dom";import{jsx as ne,jsxs as Ve,Fragment as gn}from"react/jsx-runtime";import{useLexicalComposerContext as Vp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Wp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Zi,mergeRegister as Yi}from"@lexical/utils";import{getTranslation as xn}from"@payloadcms/translations";import{ExternalLinkIcon as qi,formatDrawerSlug as zp,useConfig as Kp,useEditDepth as Jp,useLocale as Xp,useTranslation as Zp,WriteIcon as Yp}from"@payloadcms/ui";import{requests as qp}from"@payloadcms/ui/shared";import{$getSelection as Qi,$isLineBreakNode as Qp,$isRangeSelection as es,COMMAND_PRIORITY_HIGH as ef,COMMAND_PRIORITY_LOW as ts,getDOMSelection as tf,KEY_ESCAPE_COMMAND as of,SELECTION_CHANGE_COMMAND as nf}from"lexical";import{formatAdminURL as rf}from"payload/shared";import lf,{useCallback as os,useEffect as co,useLayoutEffect as sf,useRef as ns,useState as We}from"react";import{jsx as Wi}from"react/jsx-runtime";import"react";var Up="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",zi=({className:t})=>Wi("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:Wi("path",{d:Up,fill:"currentColor"})});import{jsx as Ki}from"react/jsx-runtime";import"react";var Ji={default:"M6 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .496.5h12.008a.5.5 0 0 0 .496-.5v-1A.5.5 0 0 0 18 5zM4.5 6.5a1.5 1.5 0 0 0 1.037 1.427L5.725 10H5a.5.5 0 0 0 0 1h.816l.653 7.181A2 2 0 0 0 8.46 20h7.078a2 2 0 0 0 1.992-1.819L18.184 11H19a.5.5 0 0 0 0-1h-.725l.188-2.073A1.5 1.5 0 0 0 19.5 6.5v-1A1.5 1.5 0 0 0 18 4H6a1.5 1.5 0 0 0-1.5 1.5zm2.965 11.59L6.548 8h10.905l-.918 10.09a1 1 0 0 1-.996.91H8.461a1 1 0 0 1-.996-.91M11 10.5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"},Xi=({className:t,small:e})=>Ki("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:Ki("path",{clipRule:"evenodd",d:e?Ji.small:Ji.default,fill:"currentColor",fillRule:"evenodd"})});function so(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),d=t.top-n,c=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let u=e.scrollWidth,a=i.right-c,m=c-i.left,p;if(u<=a)p=e.getBoundingClientRect();else{let h=m+t.width,f=m>a,_=Math.min(u,f?h:a);_<u&&(e.style.width=`${_}px`,e.style.maxWidth=`${_}px`,e.offsetHeight),f&&(c=t.right-_),p=e.getBoundingClientRect()}d<i.top&&(d+=p.height+t.height+n*2),c+p.width>i.right&&(c=i.right-p.width-r),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Gp}from"lexical";var ao=Gp("TOGGLE_LINK_WITH_MODAL_COMMAND");function rs(t){t.preventDefault()}function ls({anchorElem:t}){let[e]=Vp(),[o,n]=We(),r=ns(null),l=ns(null),[s,i]=We(null),[d,c]=We(null),{fieldProps:{schemaPath:u},uuid:a}=G(),m=Wp(),{config:p,getEntityConfig:h}=Kp(),{i18n:f,t:g}=Zp(),[_,L]=We(),R=Jp(),[b,x]=We(!1),[C,k]=We([]),T=Xp(),[I,N]=We(!1),S=zp({slug:"lexical-rich-text-link-"+a,depth:R}),{toggleDrawer:E}=Fe(S),w=os(()=>{x(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),c(null),k([]),L(void 0)},[x,i,c,k]),v=os(()=>{let y=Qi(),M;if(!es(y)||!y){w();return}let A=rt(y);M=e.getElementByKey(A.getKey())?.getBoundingClientRect();let D=Zi(A,K),F=y.getNodes().filter(le=>!Qp(le)).find(le=>{let be=Zi(le,K);return D&&!D.is(be)||be&&!be.is(D)});if(D==null||F){w();return}n(D);let B=D.getFields(),Y={...B,id:D.getID(),text:D.getTextContent()};if(B?.linkType==="custom")i(B?.url??null),c(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${B?.doc?.relationTo}/${B?.doc?.value}`);let le=B?.doc?.relationTo?h({collectionSlug:B?.doc?.relationTo}):void 0;if(!le)c(B?.label?String(B?.label):null),i(B?.url?String(B?.url):null);else{let be=typeof B.doc?.value=="object"?B.doc.value.id:B.doc?.value,Gt=B.doc?.relationTo;if(!be||!Gt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ar=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(ar),qp.get(rf({apiRoute:p.routes.api,path:`/${Gt}/${be}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:T?.code}}).then(async ce=>{if(!ce.ok)throw new Error(`HTTP error! Status: ${ce.status}`);let ee=await ce.json(),gt=le?.admin?.useAsTitle||"id",me=ee[gt],xt=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${me}`}).replace(/<[^>]*>?/g,"");c(xt)}).catch(()=>{let ce=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${be}`}).replace(/<[^>]*>?/g,"");c(ce)})}}L(Y),x(!0),k(y?y?.getNodes():[]),Ne(D)?N(!0):N(!1);let J=r.current,Ze=tf(e._window),{activeElement:Ie}=document;if(J===null)return;let Ce=e.getRootElement();return Ze!==null&&Ce!==null&&Ce.contains(Ze.anchorNode)?(M||(M=Ze.getRangeAt(0).getBoundingClientRect()),M!=null&&(M.y+=40,l.current=M)):(Ie==null||Ie.className!=="link-input")&&(Ce!==null&&so(null,J,t),i(null),c(null)),!0},[e,w,p.routes.admin,p.routes.api,p.serverURL,h,g,f,T?.code,t]);return co(()=>Yi(e.registerCommand(ao,y=>(e.dispatchCommand(fe,y),v(),E(),!0),ts)),[e,v,E,S]),co(()=>{let y=t.parentElement,M=()=>{e.getEditorState().read(()=>{v()})};return window.addEventListener("resize",M),y?.addEventListener("scroll",M),()=>{window.removeEventListener("resize",M),y?.removeEventListener("scroll",M)}},[t.parentElement,e,v]),co(()=>Yi(e.registerUpdateListener(({editorState:y})=>{y.read(()=>{v()})}),e.registerCommand(nf,()=>(v(),!0),ts),e.registerCommand(of,()=>b?(w(),!0):!1,ef)),[e,v,b,w]),co(()=>{e.getEditorState().read(()=>{v()})},[e,v]),sf(()=>{!b||!r.current||!t||!l.current||so(l.current,r.current,t)},[s,d,b,t,o]),Ve(lf.Fragment,{children:[ne("div",{className:"link-editor","data-theme":"dark",ref:r,children:Ve("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?ne(ro,{}):ne(zi,{}),s&&s.length>0?Ve("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[d!=null&&d.length>0?d:s,o?.__fields.newTab?Ve(gn,{children:[ne(qi,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):d!=null&&d.length>0?Ve(gn,{children:[ne("span",{className:"link-input__label-pure",children:d}),o?.__fields.newTab?Ve(gn,{children:[ne(qi,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):null,m&&Ve("div",{className:"link-input__actions",children:[ne("button",{"aria-label":"Edit link",className:"link-edit",onClick:y=>{y.preventDefault(),E()},onMouseDown:rs,tabIndex:0,type:"button",children:ne(Yp,{})}),!I&&ne("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(fe,null)},onMouseDown:rs,tabIndex:0,type:"button",children:ne(Xi,{small:!0})})]})]})}),ne(Bo,{className:"lexical-link-edit-drawer",data:_,drawerSlug:S,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(y,M)=>{let A=M,D={...A};delete D.text,e.update(()=>{let F=Qi(),B=null;if(es(F)?B=rt(F).getParent():C.length&&(B=C[0]?.getParent()??null),B&&Ne(B)){let Y=Se({fields:D});B.replace(Y,!0)}}),e.dispatchCommand(fe,{fields:D,selectedNodes:C,text:A.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var is=t=>{let{anchorElem:e=document.body}=t;return cf(af(ls,{anchorElem:e}),e)};import{c as uf}from"react/compiler-runtime";import{useLexicalComposerContext as df}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as mf}from"@lexical/utils";import{$getSelection as pf,$isElementNode as ff,$isRangeSelection as hf,COMMAND_PRIORITY_LOW as ss,PASTE_COMMAND as gf}from"lexical";import{useEffect as xf}from"react";var as=t=>{let e=uf(5),{clientProps:o}=t,[n]=df(),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 mf(n.registerCommand(fe,s=>s===null?(pn(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),pn(s),!0),ss),n.registerCommand(gf,s=>{let i=pf();if(!hf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!Ii(d))return!1;if(!i.getNodes().some(Cf)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return n.dispatchCommand(fe,{fields:c,text:null}),s.preventDefault(),!0}return!1},ss))},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]),xf(r,l),null};function Cf(t){return ff(t)}var us=[an([{ChildComponent:ro,isActive:({selection:t})=>{if(cs(t)){let e=rt(t);return bf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(cs(t)&&Cn()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(fe,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=Cn()?.getTextContent(),n=Cn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(ao,{fields:r,selectedNodes:n,text:o})}},order:1}])],kf=$(({props:t})=>({markdownTransformers:[Ai],nodes:[oe,t?.disableAutoLinks===!0?null:Ee].filter(Boolean),plugins:[{Component:as,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Gi,position:"normal"},{Component:Vi,position:"normal"},{Component:is,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:us},toolbarInline:{groups:us}}));import{$isListNode as _n,INSERT_CHECK_LIST_COMMAND as gs,ListItemNode as Mf,ListNode as $f}from"@lexical/list";import{$isRangeSelection as Af}from"lexical";import{jsx as ds}from"react/jsx-runtime";import"react";var _f={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},bn=({className:t,size:e=24})=>ds("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:ds("path",{d:_f[e],fill:"currentColor"})});import{jsx as Tf}from"react/jsx-runtime";import{ListPlugin as wf}from"@lexical/react/LexicalListPlugin.js";import"react";var lt=()=>Tf(wf,{});function uo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function it(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Lf,ListItemNode as yf,ListNode as vf}from"@lexical/list";import{$createListItemNode as Sf,$createListNode as Ef,$isListItemNode as Nf,$isListNode as kn}from"@lexical/list";var ms=4,st=t=>(e,o,n)=>{let r=e.getPreviousSibling(),l=e.getNextSibling(),s=Sf(t==="check"?n[3]==="x":void 0);if(kn(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(kn(r)&&r.getListType()===t)r.append(s),e.remove();else{let d=Ef(t,t==="number"?Number(n[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(n[1].length/ms);i&&s.setIndent(i)},ze=(t,e,o)=>{let n=[],r=t.getChildren(),l=0;for(let s of r)if(Nf(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(kn(u)){n.push(ze(u,e,o+1));continue}}let i=" ".repeat(o*ms),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";n.push(i+c+e(s)),l++}return n.join(`
56
- `)};var ps={type:"element",dependencies:[vf,yf],export:(t,e)=>Lf(t)?ze(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:st("check")};import{jsx as Rf}from"react/jsx-runtime";import{CheckListPlugin as If}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var fs=()=>Rf(If,{});var hs=[te([{ChildComponent:bn,isActive:({selection:t})=>{if(!Af(t))return!1;for(let e of t.getNodes()){if(_n(e)&&e.getListType()==="check")continue;let o=e.getParent();if(_n(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(_n(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(gs,void 0)},order:12}])],Df=$(({featureProviderMap:t})=>{let e=[{Component:fs,position:"normal"}],o=uo("checklist",t);return o&&e.push({Component:lt,position:"normal"}),{markdownTransformers:[ps],nodes:o?[$f,Mf]:[],plugins:e,slashMenu:{groups:[it([{Icon:bn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(gs,void 0)}}])]},toolbarFixed:{groups:hs},toolbarInline:{groups:hs}}});import{$isListNode as wn,INSERT_ORDERED_LIST_COMMAND as ks,ListItemNode as jf,ListNode as Hf}from"@lexical/list";import{$isRangeSelection as Uf}from"lexical";import{jsx as xs}from"react/jsx-runtime";import"react";var Of={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},Tn=({className:t,size:e=24})=>xs("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:xs("path",{clipRule:"evenodd",d:Of[e],fill:"currentColor",fillRule:"evenodd"})});import{$isListNode as Ff,ListItemNode as Bf,ListNode as Pf}from"@lexical/list";var Cs={type:"element",dependencies:[Pf,Bf],export:(t,e)=>Ff(t)?ze(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:st("number")};var bs=[te([{ChildComponent:Tn,isActive:({selection:t})=>{if(!Uf(t))return!1;for(let e of t.getNodes()){if(wn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(wn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(wn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ks,void 0)},order:10}])],Gf=$(({featureProviderMap:t})=>{let e=uo("ordered",t);return{markdownTransformers:[Cs],nodes:e?[Hf,jf]:[],plugins:e?[{Component:lt,position:"normal"}]:[],slashMenu:{groups:[it([{Icon:Tn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(ks,void 0)}}])]},toolbarFixed:{groups:bs},toolbarInline:{groups:bs}}});import{$isListNode as En,INSERT_UNORDERED_LIST_COMMAND as Ss,ListItemNode as Jf,ListNode as Xf}from"@lexical/list";import{$isRangeSelection as Zf}from"lexical";import{jsx as _s}from"react/jsx-runtime";import"react";var Vf="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",Sn=({className:t})=>_s("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:_s("path",{d:Vf,fill:"currentColor"})});import{$isListNode as Wf,ListItemNode as zf,ListNode as Kf}from"@lexical/list";var Ts={type:"element",dependencies:[Kf,zf],export:(t,e)=>Wf(t)?ze(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:st("bullet")};var ws=[te([{ChildComponent:Sn,isActive:({selection:t})=>{if(!Zf(t))return!1;for(let e of t.getNodes()){if(En(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(En(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(En(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ss,void 0)},order:11}])],Yf=$({markdownTransformers:[Ts],nodes:[Xf,Jf],plugins:[{Component:lt,position:"normal"}],slashMenu:{groups:[it([{Icon:Sn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ss,void 0)}}])]},toolbarFixed:{groups:ws},toolbarInline:{groups:ws}});import{$setBlocksType as Ls}from"@lexical/selection";import{$createParagraphNode as ys,$getSelection as vs,$isParagraphNode as Es,$isRangeSelection as qf}from"lexical";var Ns=[te([{ChildComponent:St,isActive:({selection:t})=>{if(!qf(t))return!1;for(let e of t.getNodes())if(!Es(e)&&!Es(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=vs();Ls(e,()=>ys())})},order:1}])],Qf=$({slashMenu:{groups:[X([{Icon:St,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=vs();Ls(e,()=>ys())})}}])]},toolbarFixed:{groups:Ns},toolbarInline:{groups:Ns}});import{c as T0}from"react/compiler-runtime";import{jsx as Xs}from"react/jsx-runtime";import{useLexicalComposerContext as w0}from"@lexical/react/LexicalComposerContext";import{useEffect as S0,useState as E0}from"react";import{jsx as Js,Fragment as _0}from"react/jsx-runtime";import"react";import{jsx as e0}from"react/jsx-runtime";var Rs={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return e0("blockquote",{children:o})}};import{jsx as t0}from"react/jsx-runtime";var Is={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return t0(n,{children:o})}};import{jsx as o0}from"react/jsx-runtime";var Ms={horizontalrule:o0("hr",{})};import{jsx as n0}from"react/jsx-runtime";var $s={linebreak:n0("br",{})};import{jsx as As}from"react/jsx-runtime";var Ds=({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 As("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="#")),As("a",{href:s,rel:r,target:l,children:n})}});import{jsx as at,jsxs as r0,Fragment as l0}from"react/jsx-runtime";import{v4 as i0}from"uuid";var Os={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return at(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=i0();return at("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:r0(l0,{children:[at("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),at("label",{htmlFor:l,children:r}),at("br",{})]})})}else return at("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as Nn}from"react/jsx-runtime";var Fs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Nn("p",{children:o}):Nn("p",{children:Nn("br",{})})}};var Bs={tab:" "};import{jsx as Mt}from"react/jsx-runtime";var Ps={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("div",{className:"lexical-table-container",children:Mt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Mt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return Mt(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ke}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},s0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,a0="\xA0",c0=`
54
+ `},[t,e]),m=He((b,x)=>{o(C=>{let k=e.length-1,T=e[k];if(T&&T.name===b){if(b==="type")return[...e.slice(0,k),{...T,value:T.value+x}];if(T.value===x)return[...e.slice(0,k),{...T,count:T.count+1}]}return[...C,{name:b,count:1,value:x}]})},[e,o]);il(()=>{let b=C=>{if(!n)return;let k=C.key;lp(C)?m("selectAll",""):al.has(k)?m("press",C.key):[...k].length>1?m("keydown",C.key):m("type",C.key)},x=C=>{if(!n)return;let k=C.key;!al.has(k)&&[...k].length>1&&m("keyup",C.key)};return t.registerRootListener((C,k)=>{k!==null&&(k.removeEventListener("keydown",b),k.removeEventListener("keyup",x)),C!==null&&(C.addEventListener("keydown",b),C.addEventListener("keyup",x))})},[t,n,m]),il(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[p]),qo(()=>{if(e){let b=p();b!==null&&i(b),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[p,e]),qo(()=>t.registerUpdateListener(({dirtyElements:x,dirtyLeaves:C,editorState:k})=>{if(!n)return;let T=k._selection,I=d.current,L=u.current;if(I!==T){if(C.size===0&&x.size===0&&!L){let N=Yo(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}d.current=T}u.current=!1;let E=p();E!==null&&i(E)}),[t,p,n,m]),qo(()=>n?t.registerUpdateListener(()=>{let x=t.getRootElement();x!==null&&l(x?.innerHTML)}):void 0,[t,n]);let h=He(b=>{n||(b.update(()=>{let x=tp();x.clear();let C=ep();x.append(Qd().append(C)),C.select()}),o([])),r(x=>!x)},[n]),f=He(()=>{if(!n)return;let b=Yo(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:x,anchorOffset:C,focusNode:k,focusOffset:T}=ip(b),I=a().getRootElement(),L;x!==null&&(L=sl(x,I));let E;k!==null&&(E=sl(k,I)),m("snapshot",{anchorNode:x,anchorOffset:C,anchorPath:L,focusNode:k,focusOffset:T,focusPath:E})},[m,n,a]),g=He(()=>{op(p())},[p]),_=He(()=>{np("test.js",p())},[p]);return[Ue("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:b=>{h(a()),b.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?en("div",{className:"test-recorder-output",children:[en("div",{className:"test-recorder-toolbar",children:[Ue("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{f(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Ue("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Ue("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{_(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Ue("pre",{id:"test-recorder",ref:c,children:s})]}):null]}var ul=()=>{let t=Yd(3),[e]=qd(),[o,n]=sp(e),r;return t[0]!==o||t[1]!==n?(r=en(cl.Fragment,{children:[Ue("p",{children:"HI"}),o,n,Ue("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var ap=$({plugins:[{Component:ul,position:"bottom"}]});import{c as cp}from"react/compiler-runtime";import{jsx as up}from"react/jsx-runtime";import{useLexicalComposerContext as dp}from"@lexical/react/LexicalComposerContext.js";import{TreeView as pp}from"@lexical/react/LexicalTreeView.js";import"react";var dl=()=>{let t=cp(2),[e]=dp(),o;return t[0]!==e?(o=up(pp,{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 mp=$({plugins:[{Component:dl,position:"bottom"}]});import{$isTableSelection as hp}from"@lexical/table";import{$isRangeSelection as gp,FORMAT_TEXT_COMMAND as xp}from"lexical";import{jsx as pl}from"react/jsx-runtime";import"react";var fp="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})=>pl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:pl("path",{clipRule:"evenodd",d:fp,fill:"currentColor",fillRule:"evenodd"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var fl={type:"text-format",format:["bold","italic"],tag:"***"},hl={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},gl={type:"text-format",format:["bold"],tag:"**"},xl={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Cl=[Z([{ChildComponent:ml,isActive:({selection:t})=>gp(t)||hp(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(xp,"bold")},order:1}])],Cp=$(({featureProviderMap:t})=>{let e=[gl,xl];return t.get("italic")&&e.push(hl,fl),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Cl},toolbarInline:{groups:Cl}}});import{$isTableSelection as kp}from"@lexical/table";import{$isRangeSelection as _p,FORMAT_TEXT_COMMAND as Tp}from"lexical";import{jsx as bl}from"react/jsx-runtime";import"react";var bp="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",kl=({className:t})=>bl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:bl("path",{clipRule:"evenodd",d:bp,fill:"currentColor",fillRule:"evenodd"})});var _l={type:"text-format",format:["code"],tag:"`"};var Tl=[Z([{ChildComponent:kl,isActive:({selection:t})=>_p(t)||kp(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Tp,"code")},order:7}])],wp=$({enableFormats:["code"],markdownTransformers:[_l],toolbarFixed:{groups:Tl},toolbarInline:{groups:Tl}});import{$isTableSelection as Ep}from"@lexical/table";import{$isRangeSelection as Np,FORMAT_TEXT_COMMAND as Lp}from"lexical";import{jsx as wl}from"react/jsx-runtime";import"react";var Sp="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",Sl=({className:t})=>wl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:wl("path",{clipRule:"evenodd",d:Sp,fill:"currentColor",fillRule:"evenodd"})});var El={type:"text-format",format:["italic"],tag:"*"},Nl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Ll=[Z([{ChildComponent:Sl,isActive:({selection:t})=>Np(t)||Ep(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Lp,"italic")},order:2}])],yp=$({enableFormats:["italic"],markdownTransformers:[El,Nl],toolbarFixed:{groups:Ll},toolbarInline:{groups:Ll}});import{$isTableSelection as Rp}from"@lexical/table";import{$isRangeSelection as Ip,FORMAT_TEXT_COMMAND as Mp}from"lexical";import{jsx as yl}from"react/jsx-runtime";import"react";var vp="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",vl=({className:t})=>yl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:yl("path",{d:vp,fill:"currentColor"})});var Rl={type:"text-format",format:["strikethrough"],tag:"~~"};var Il=[Z([{ChildComponent:vl,isActive:({selection:t})=>Ip(t)||Rp(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Mp,"strikethrough")},order:4}])],$p=$({enableFormats:["strikethrough"],markdownTransformers:[Rl],toolbarFixed:{groups:Il},toolbarInline:{groups:Il}});import{$isTableSelection as Dp}from"@lexical/table";import{$isRangeSelection as Op,FORMAT_TEXT_COMMAND as Fp}from"lexical";import{jsx as Ml}from"react/jsx-runtime";import"react";var Ap="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",$l=({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",{d:Ap,fill:"currentColor"})});var Al=[Z([{ChildComponent:$l,isActive:({selection:t})=>Op(t)||Dp(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Fp,"subscript")},order:5}])],Pp=$({enableFormats:["subscript"],toolbarFixed:{groups:Al},toolbarInline:{groups:Al}});import{$isTableSelection as jp}from"@lexical/table";import{$isRangeSelection as Hp,FORMAT_TEXT_COMMAND as Up}from"lexical";import{jsx as Dl}from"react/jsx-runtime";import"react";var Bp="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",Ol=({className:t})=>Dl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Dl("path",{d:Bp,fill:"currentColor"})});var Fl=[Z([{ChildComponent:Ol,isActive:({selection:t})=>Hp(t)||jp(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Up,"superscript")},order:6}])],Gp=$({enableFormats:["superscript"],toolbarFixed:{groups:Fl},toolbarInline:{groups:Fl}});import{$isTableSelection as Wp}from"@lexical/table";import{$isRangeSelection as zp,FORMAT_TEXT_COMMAND as Kp}from"lexical";import{jsx as Pl}from"react/jsx-runtime";import"react";var Vp="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",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",{clipRule:"evenodd",d:Vp,fill:"currentColor",fillRule:"evenodd"})});var jl=[Z([{ChildComponent:Bl,isActive:({selection:t})=>zp(t)||Wp(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Kp,"underline")},order:3}])],Jp=$({enableFormats:["underline"],toolbarFixed:{groups:jl},toolbarInline:{groups:jl}});import{jsx as on}from"react/jsx-runtime";import{jsx as Xp}from"react/jsx-runtime";function Zp(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var no=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[Zp(o),n])):{};return Xp("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Yp}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as qp}from"@lexical/selection";import{$getNodeByKey as Qp,$getState as em,$setState as tm,createState as om,TextNode as nm}from"lexical";import{useEffect as rm}from"react";function Hl(t){let e=new Map;for(let o in t){let n=t[o],r=om(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function tn(t,e,o,n){t.update(()=>{qp(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);tm(r,l.stateConfig,n)})})}function Ul({stateMap:t}){let[e]=Yp();return rm(()=>e.registerMutationListener(nm,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=Qp(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,u)=>{let c=em(l,d.stateConfig);if(!c){delete s.dataset[u];return}s.dataset[u]=c;let a=d.stateValues[c]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var Gl=(t,e)=>{let o=[];for(let r in t.state){let l=t.state[r];for(let s in l){let i=l[s];o.push({ChildComponent:()=>on(no,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{tn(d,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>on(no,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>on(no,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)tn(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},lm=$(({props:t})=>{let e=Hl(t.state);return{plugins:[{Component:()=>Ul({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Gl(t,e)},toolbarInline:{groups:Gl(t,e)}}});import{c as hm}from"react/compiler-runtime";import{useLexicalComposerContext as gm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as xm,$isHeadingNode as ni,HeadingNode as ii}from"@lexical/rich-text";import{$setBlocksType as Cm}from"@lexical/selection";import{$getSelection as bm,$isRangeSelection as km}from"lexical";import{useEffect as _m}from"react";import{jsx as Vl}from"react/jsx-runtime";import"react";var im="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",Wl=({className:t})=>Vl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Vl("path",{d:im,fill:"currentColor"})});import{jsx as zl}from"react/jsx-runtime";import"react";var sm="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",Kl=({className:t})=>zl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:zl("path",{d:sm,fill:"currentColor"})});import{jsx as Jl}from"react/jsx-runtime";import"react";var am="M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",Xl=({className:t})=>Jl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Jl("path",{d:am,fill:"currentColor"})});import{jsx as Zl}from"react/jsx-runtime";import"react";var cm="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",Yl=({className:t})=>Zl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Zl("path",{d:cm,fill:"currentColor"})});import{jsx as ql}from"react/jsx-runtime";import"react";var um="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",Ql=({className:t})=>ql("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ql("path",{d:um,fill:"currentColor"})});import{jsx as ei}from"react/jsx-runtime";import"react";var dm="M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",ti=({className:t})=>ei("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ei("path",{d:dm,fill:"currentColor"})});import{$createHeadingNode as pm,$isHeadingNode as mm,HeadingNode as fm}from"@lexical/rich-text";var nn=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var oi=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[fm],export:(r,l)=>{if(!mm(r))return null;let s=Number(r.getTag().slice(1));return"#".repeat(s)+" "+l(r)},regExp:n,replace:nn(r=>{let l="h"+r[1]?.length;return pm(l)})}};var ri=t=>{let e=bm();Cm(e,()=>xm(t))},li={h1:Wl,h2:Kl,h3:Xl,h4:Yl,h5:Ql,h6:ti},Tm=$(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((n,r)=>({ChildComponent:li[n],isActive:({selection:l})=>{if(!km(l))return!1;for(let s of l.getNodes()){if(ni(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(ni(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(()=>{ri(n)})},order:r+2})))];return{markdownTransformers:[oi(e)],nodes:[ii],plugins:[{Component:wm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[X(e.map(n=>({Icon:li[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(()=>{ri(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),wm=t=>{let e=hm(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,[d]=gm(),u,c;return e[4]!==d||e[5]!==l||e[6]!==i?(u=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(ii,a=>{l.includes(a.getTag())||a.setTag(i)})},c=[d,l,i],e[4]=d,e[5]=l,e[6]=i,e[7]=u,e[8]=c):(u=e[7],c=e[8]),_m(u,c),null};import{$isNodeSelection as Hm}from"lexical";import{jsx as si}from"react/jsx-runtime";import"react";var Sm="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",rn=({className:t})=>si("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:si("path",{d:Sm,fill:"currentColor"})});import{jsx as ai}from"react/jsx-runtime";import"react";var Em={16:"M8.5 3.5a.5.5 0 0 0-1 0v4h-4a.5.5 0 0 0 0 1h4v4a.5.5 0 0 0 1 0v-4h4a.5.5 0 0 0 0-1h-4z",24:"M12 6a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 12 6"},ci=({className:t,size:e=24})=>ai("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ai("path",{clipRule:"evenodd",d:Em[e],fill:"currentColor",fillRule:"evenodd"})});var Te=t=>({type:"dropdown",ChildComponent:ci,items:t,key:"add",order:10});import{addClassNamesToElement as Nm}from"@lexical/utils";import{$applyNodeReplacement as Lm,createCommand as ym,DecoratorNode as vm}from"lexical";var vt=ym("INSERT_HORIZONTAL_RULE_COMMAND"),yt=class extends vm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Rm,priority:0})}}static importJSON(e){return ui()}createDOM(e){let o=document.createElement("hr");return Nm(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 Rm(){return{node:ui()}}function ui(){return Lm(new yt)}import{$applyNodeReplacement as Im}from"lexical";import"react";var we=class extends yt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return nt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function nt(){return Im(new we)}function Ge(t){return t instanceof we}var di={type:"element",dependencies:[we],export:(t,e)=>Ge(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=nt();e&&t.replace(e)}};import{c as Mm}from"react/compiler-runtime";import{useLexicalComposerContext as $m}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as pi,$insertNodeToNearestRoot as Am}from"@lexical/utils";import{$getRoot as Dm,$getSelection as mi,$isRangeSelection as fi,$isRootOrShadowRoot as hi,COMMAND_PRIORITY_EDITOR as Om}from"lexical";import{useEffect as Fm}from"react";var ln="LexicalEditorTheme__hrSelected",gi=()=>{let t=Mm(3),[e]=$m(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(vt,Pm,Om),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let u=Dm().getChildren(),c=mi(),a=[];for(let b=0;b<u.length;b++){let x=u[b];if(Ge(x)){let C=e.getElementByKey(x.getKey());C&&a.push({element:C,index:b})}}if(a.length===0)return;if(!fi(c)||c.isCollapsed()){for(let{element:b}of a)b.classList.remove(ln);return}let p=c.anchor.getNode(),m=c.focus.getNode(),h=pi(p,Bm)||p,f=pi(m,jm)||m,g=u.indexOf(h),_=u.indexOf(f);if(g===-1||_===-1)return;let S=Math.min(g,_),R=Math.max(g,_);for(let{element:b,index:x}of a)x>=S&&x<=R?b.classList.add(ln):b.classList.remove(ln)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Fm(o,n),null};function Pm(t){let e=mi();if(!fi(e))return!1;if(e.focus.getNode()!==null){let n=nt();Am(n)}return!0}function Bm(t){return hi(t.getParent())}function jm(t){return hi(t.getParent())}var Um=$({markdownTransformers:[di],nodes:[we],plugins:[{Component:gi,position:"normal"}],slashMenu:{groups:[X([{Icon:rn,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(vt,void 0)}}])]},toolbarFixed:{groups:[Te([{ChildComponent:rn,isActive:({selection:t})=>{if(!Hm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ge(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(vt,void 0)}}])]}});import{$findMatchingParent as Li}from"@lexical/utils";import{$isElementNode as t1,INDENT_CONTENT_COMMAND as o1,OUTDENT_CONTENT_COMMAND as n1}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var Gm="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",xi=({className:t})=>sn("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:sn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:sn("path",{clipRule:"evenodd",d:Gm,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as Ci}from"react/jsx-runtime";import"react";var Vm="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",bi=({className:t})=>Ci("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ci("path",{clipRule:"evenodd",d:Vm,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Wm}from"react/jsx-runtime";import{useLexicalComposerContext as zm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Km}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Jm,mergeRegister as ki}from"@lexical/utils";import{$getSelection as Xm,$isElementNode as Si,$isRangeSelection as Zm,COMMAND_PRIORITY_LOW as _i,INDENT_CONTENT_COMMAND as Ti,KEY_TAB_COMMAND as Ym,OUTDENT_CONTENT_COMMAND as qm,TabNode as Qm}from"lexical";import{useEffect as wi}from"react";var Ei=({clientProps:t})=>{let[e]=zm(),{disabledNodes:o,disableTabNode:n}=t;return wi(()=>{if(!(!e||!o?.length))return ki(e.registerCommand(Ti,()=>e1(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),_i),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);Si(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),wi(()=>{if(!(!e||!n))return ki(e.registerCommand(Ym,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?qm:Ti,void 0)),_i),e.registerNodeTransform(Qm,r=>{r.remove()}))},[e,n]),Wm(Km,{})};function e1(t){let e=Xm();if(!Zm(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=Jm(l,u=>Si(u)&&!u.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),t(i))}return o.size>0}var Ni=t=>({type:"buttons",items:t,key:"indent",order:35});var yi=({disabledNodes:t})=>[Ni([{ChildComponent:xi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>vi(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!Li(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(n1,void 0)},order:1},{ChildComponent:bi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>vi(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!Li(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(o1,void 0)},order:2}])],r1=$(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Ei,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:yi({disabledNodes:e})},toolbarInline:{groups:yi({disabledNodes:e})}}}),vi=t=>t1(t)&&t.canIndent();import{$findMatchingParent as Tf}from"@lexical/utils";import{$getSelection as Cn,$isRangeSelection as us}from"lexical";import{jsx as Ri}from"react/jsx-runtime";import"react";var l1={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4436 10.3708C12.6861 10.5041 12.9148 10.6721 13.1204 10.8776C14.2919 12.0492 14.2918 13.9482 13.1204 15.1198L11.1204 17.1198C9.94879 18.2914 8.04975 18.2914 6.87817 17.1198C5.70664 15.9482 5.70661 14.0492 6.87817 12.8776L8.1477 11.6071C8.4098 11.345 8.89329 11.5392 8.97388 11.9011C9.00617 12.0462 8.96861 12.2012 8.86353 12.3063L7.5852 13.5847C6.80417 14.3657 6.80419 15.6317 7.5852 16.4128C8.36625 17.1938 9.63228 17.1938 10.4133 16.4128L12.4133 14.4128C13.1942 13.6317 13.1943 12.3657 12.4133 11.5847C12.4042 11.5755 12.3953 11.5662 12.386 11.5573C12.2925 11.468 12.1984 11.3736 12.1614 11.2497C12.0724 10.9515 12.1448 10.6149 12.3801 10.3796C12.397 10.3628 12.4228 10.3594 12.4436 10.3708ZM12.8782 6.87764C14.0497 5.70615 15.9488 5.70616 17.1204 6.87764C18.2919 8.04919 18.2919 9.94825 17.1204 11.1198L15.8508 12.3903C15.5887 12.6522 15.1053 12.4581 15.0247 12.0964C14.9924 11.9512 15.0308 11.7963 15.136 11.6911L16.4133 10.4128C17.1943 9.63175 17.1943 8.3657 16.4133 7.58467C15.6323 6.80371 14.3662 6.8037 13.5852 7.58467L11.5852 9.58467C10.8046 10.3657 10.8044 11.6319 11.5852 12.4128C11.5943 12.4219 11.6042 12.4303 11.6135 12.4392C11.7064 12.5278 11.7999 12.622 11.8372 12.7448C11.9276 13.044 11.8545 13.3827 11.6184 13.6188C11.6023 13.6347 11.5778 13.6383 11.5579 13.6276C11.3146 13.4942 11.0843 13.3259 10.8782 13.1198C9.7068 11.9484 9.707 10.0492 10.8782 8.87764L12.8782 6.87764Z"},ro=({className:t,size:e=24})=>Ri("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:Ri("path",{d:l1[e],fill:"currentColor"})});import{$isAtNodeEnd as Ii}from"@lexical/selection";function rt(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?Ii(o)?n:r:Ii(e)?n:r}var an=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as C1}from"lexical";function cn(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var i1=/^(?:[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+)?$/,s1=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Mi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||i1.test(t)||s1.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 a1,isHTMLAnchorElement as c1}from"@lexical/utils";import pn from"bson-objectid";import{$applyNodeReplacement as u1,$createTextNode as $i,$getSelection as d1,$isElementNode as Ai,$isRangeSelection as dn,createCommand as p1,ElementNode as m1}from"lexical";var f1=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends m1{__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:h1,priority:1})}}static importJSON(e){let o=Se({}).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 pn.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=un(o.rel,"add","noopener")),a1(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!dn(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Ai(n)){let r=Se({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!f1.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,n){let r=this.__fields?.url,l=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=un(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=un(o.rel,"remove","noopener"))),!1}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields).setID(o.id)}};function h1(t){let e=null;if(c1(t)){let o=t.textContent;o!==null&&o!==""&&(e=Se({id:new pn.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Se({id:t,fields:e}){return u1(new oe({id:t??new pn.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var fe=p1("TOGGLE_LINK_COMMAND");function mn(t){let e=d1();if(!dn(e)&&(t===null||!t.selectedNodes?.length))return;let o=dn(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();K(s)&&(s.getChildren().forEach(d=>{s.insertBefore(d)}),s.remove())});return}if(o?.length===1){let l=o[0],s=K(l)?l:g1(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append($i(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||Ai(l)&&!l.isInline())){if(K(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append($i(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=Se({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 g1(t){return x1(t,e=>K(e))}function x1(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function un(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let l=new RegExp(o,"g");r=r.replace(l,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let l=new RegExp(o,"g");n=r.replace(l,"").trim()}return n}var b1=(t,e)=>{let[,o,n]=e,r=Se({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=C1(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},k1=t=>({type:"text-match",dependencies:[oe],export:(e,o)=>{if(!K(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=cn(t.internalDocToHref({linkNode:n.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=cn(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:b1,trigger:")"}),Di=k1();import{$applyNodeReplacement as _1,$isElementNode as T1}from"lexical";var Ee=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=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(T1(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 _1(new Ee({id:"",fields:t}))}function Ne(t){return t instanceof Ee}import{c as w1}from"react/compiler-runtime";import{useLexicalComposerContext as S1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as E1}from"@lexical/utils";import{$createTextNode as Oi,$getSelection as N1,$isElementNode as Pi,$isLineBreakNode as Bi,$isNodeSelection as L1,$isRangeSelection as y1,$isTextNode as It,TextNode as v1}from"lexical";import{useEffect as R1}from"react";function Fi(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function ji(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var I1=/[.,;\s]/;function io(t){return t!==void 0&&I1.test(t)}function Hi(t){return io(t[t.length-1])}function hn(t){return io(t[0])}function M1(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ui(t){let e=t.getPreviousSibling();return Pi(e)&&(e=e.getLastDescendant()),e===null||Bi(e)||It(e)&&Hi(e.getTextContent())}function Gi(t){let e=t.getNextSibling();return Pi(e)&&(e=e.getFirstDescendant()),e===null||Bi(e)||It(e)&&hn(e.getTextContent())}function $1(t,e,o,n){return(t>0?io(o[t-1]):Ui(n[0]))?e<o.length?io(o[e]):Gi(n[n.length-1]):!1}function A1(t,e,o){let n=[],r=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let u=d[0],a=u.getTextContent().length,p=i;i+a<=e?(n.push(u),s+=a):p>=o?l.push(u):r.push(u),i+=a,d.shift()}return[s,n,r,l]}function D1(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 d=Oi(n.text);d.setFormat(i.getFormat()),d.setDetail(i.getDetail()),d.setStyle(i.getStyle()),l.append(d),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,d;e===0?d=s:[,d]=s.splitText(e);let u=[],c;if(t.forEach(a=>{let m=a.getTextContent().length,h=i,f=i+m;if(h<o)if(f<=o)u.push(a);else{let[g,_]=a.splitText(o-h);g&&u.push(g),c=_}i+=m}),d){let a=N1(),p=a?a.getNodes().find(It):void 0,m=Oi(d.getTextContent());return m.setFormat(d.getFormat()),m.setDetail(d.getDetail()),m.setStyle(d.getStyle()),l.append(m,...u),p&&p===d&&(y1(a)?m.select(a.anchor.offset,a.focus.offset):L1(a)&&m.select(0,m.getTextContent().length)),d.replace(l),c}}}function O1(t,e,o){let n=[...t],r=n.map(d=>d.getTextContent()).join(""),l=r,s,i=0;for(;(s=ji(l,e))!=null&&s!==null;){let d=s.index,u=s.length,c=d+u;if($1(i+d,i+c,r,n)){let[p,,m,h]=A1(n,i+d,i+c),f=i+d-p,g=i+c-p,_=D1(m,f,g,s);n=_?[_,...h]:h,o(s.url,null),i=0}else i+=c;l=l.substring(c)}}function fn(t,e,o){let n=t.getChildren(),r=n.length;for(let d=0;d<r;d++){let u=n[d];if(!It(u)||!u.isSimpleText()){lo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=ji(l,e);if(s===null||s.text!==l){lo(t),o(null,t.getFields()?.url??null);return}if(!Ui(t)||!Gi(t)){lo(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let d=t.getFields();d.url=s?.url,t.setFields(d),o(s.url,i??null)}}function F1(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),l=t.getTextContent();if(Ne(n)){let s=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:")??!1:!1;(!hn(l)||M1(l,s))&&(n.append(t),fn(n,e,o),o(null,n.getFields()?.url??null))}Ne(r)&&!Hi(l)&&(lo(r),fn(r,e,o),o(null,r.getFields()?.url??null))}function lo(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function P1(t){let e=[t],o=t.getNextSibling();for(;o!==null&&It(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function B1(t,e,o){let n=w1(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([Ee]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return E1(t.registerNodeTransform(v1,i=>{let d=i.getParentOrThrow(),u=i.getPreviousSibling();if(Ne(d))fn(d,e,s);else if(!K(d)){if(i.isSimpleText()&&(hn(i.getTextContent())||!Ne(u))){let c=P1(i);O1(c,e,s)}F1(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]),R1(r,l)}var j1=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,H1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,U1=[Fi(j1,t=>t.startsWith("http")?t:`https://${t}`),Fi(H1,t=>`mailto:${t}`)],Vi=()=>{let[t]=S1();return B1(t,U1),null};import{jsx as G1}from"react/jsx-runtime";import{ClickableLinkPlugin as V1}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Wi=()=>G1(V1,{});import{jsx as df}from"react/jsx-runtime";import"react";import{createPortal as pf}from"react-dom";import{jsx as ne,jsxs as Ve,Fragment as gn}from"react/jsx-runtime";import{useLexicalComposerContext as K1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as J1}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Yi,mergeRegister as qi}from"@lexical/utils";import{getTranslation as xn}from"@payloadcms/translations";import{ExternalLinkIcon as Qi,formatDrawerSlug as X1,useConfig as Z1,useEditDepth as Y1,useLocale as q1,useTranslation as Q1,WriteIcon as ef}from"@payloadcms/ui";import{requests as tf}from"@payloadcms/ui/shared";import{$getSelection as es,$isLineBreakNode as of,$isRangeSelection as ts,COMMAND_PRIORITY_HIGH as nf,COMMAND_PRIORITY_LOW as os,getDOMSelection as rf,KEY_ESCAPE_COMMAND as lf,SELECTION_CHANGE_COMMAND as sf}from"lexical";import{formatAdminURL as af}from"payload/shared";import cf,{useCallback as ns,useEffect as co,useLayoutEffect as uf,useRef as rs,useState as We}from"react";import{jsx as zi}from"react/jsx-runtime";import"react";var W1="M12.5 5C12.6326 5 12.7597 5.05272 12.8535 5.14648L16.8535 9.14648C16.9965 9.28948 17.0393 9.50457 16.9619 9.69141C16.8845 9.87821 16.7022 10 16.5 10H12.5C12.2239 10 12 9.77614 12 9.5V6H8.5C8.22386 6 8 6.22386 8 6.5V17.5C8 17.7761 8.22386 18 8.5 18H15.5C15.7761 18 16 17.7761 16 17.5V11.5C16 11.2239 16.2239 11 16.5 11C16.7761 11 17 11.2239 17 11.5V17.5C17 18.3284 16.3284 19 15.5 19H8.5C7.67157 19 7 18.3284 7 17.5V6.5C7 5.67157 7.67157 5 8.5 5H12.5ZM13 9H15.293L13 6.70703V9Z",Ki=({className:t})=>zi("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:zi("path",{d:W1,fill:"currentColor"})});import{jsx as Ji}from"react/jsx-runtime";import"react";var Xi={default:"M6 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .496.5h12.008a.5.5 0 0 0 .496-.5v-1A.5.5 0 0 0 18 5zM4.5 6.5a1.5 1.5 0 0 0 1.037 1.427L5.725 10H5a.5.5 0 0 0 0 1h.816l.653 7.181A2 2 0 0 0 8.46 20h7.078a2 2 0 0 0 1.992-1.819L18.184 11H19a.5.5 0 0 0 0-1h-.725l.188-2.073A1.5 1.5 0 0 0 19.5 6.5v-1A1.5 1.5 0 0 0 18 4H6a1.5 1.5 0 0 0-1.5 1.5zm2.965 11.59L6.548 8h10.905l-.918 10.09a1 1 0 0 1-.996.91H8.461a1 1 0 0 1-.996-.91M11 10.5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"},Zi=({className:t,small:e})=>Ji("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ji("path",{clipRule:"evenodd",d:e?Xi.small:Xi.default,fill:"currentColor",fillRule:"evenodd"})});function so(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),d=t.top-n,u=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let c=e.scrollWidth,a=i.right-u,p=u-i.left,m;if(c<=a)m=e.getBoundingClientRect();else{let h=p+t.width,f=p>a,_=Math.min(c,f?h:a);_<c&&(e.style.width=`${_}px`,e.style.maxWidth=`${_}px`,e.offsetHeight),f&&(u=t.right-_),m=e.getBoundingClientRect()}d<i.top&&(d+=m.height+t.height+n*2),u+m.width>i.right&&(u=i.right-m.width-r),d-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${d}px)`}import{createCommand as z1}from"lexical";var ao=z1("TOGGLE_LINK_WITH_MODAL_COMMAND");function ls(t){t.preventDefault()}function is({anchorElem:t}){let[e]=K1(),[o,n]=We(),r=rs(null),l=rs(null),[s,i]=We(null),[d,u]=We(null),{fieldProps:{schemaPath:c},uuid:a}=G(),p=J1(),{config:m,getEntityConfig:h}=Z1(),{i18n:f,t:g}=Q1(),[_,S]=We(),R=Y1(),[b,x]=We(!1),[C,k]=We([]),T=q1(),[I,L]=We(!1),E=X1({slug:"lexical-rich-text-link-"+a,depth:R}),{toggleDrawer:N}=Fe(E),w=ns(()=>{x(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),L(!1),i(null),u(null),k([]),S(void 0)},[x,i,u,k]),v=ns(()=>{let y=es(),M;if(!ts(y)||!y){w();return}let A=rt(y);M=e.getElementByKey(A.getKey())?.getBoundingClientRect();let D=Yi(A,K),F=y.getNodes().filter(le=>!of(le)).find(le=>{let be=Yi(le,K);return D&&!D.is(be)||be&&!be.is(D)});if(D==null||F){w();return}n(D);let P=D.getFields(),Y={...P,id:D.getID(),text:D.getTextContent()};if(P?.linkType==="custom")i(P?.url??null),u(null);else{i(`${m.routes.admin==="/"?"":m.routes.admin}/collections/${P?.doc?.relationTo}/${P?.doc?.value}`);let le=P?.doc?.relationTo?h({collectionSlug:P?.doc?.relationTo}):void 0;if(!le)u(P?.label?String(P?.label):null),i(P?.url?String(P?.url):null);else{let be=typeof P.doc?.value=="object"?P.doc.value.id:P.doc?.value,Gt=P.doc?.relationTo;if(!be||!Gt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let cr=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");u(cr),tf.get(af({apiRoute:m.routes.api,path:`/${Gt}/${be}`,serverURL:m.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:T?.code}}).then(async ce=>{if(!ce.ok)throw new Error(`HTTP error! Status: ${ce.status}`);let ee=await ce.json(),gt=le?.admin?.useAsTitle||"id",pe=ee[gt],xt=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${pe}`}).replace(/<[^>]*>?/g,"");u(xt)}).catch(()=>{let ce=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${be}`}).replace(/<[^>]*>?/g,"");u(ce)})}}S(Y),x(!0),k(y?y?.getNodes():[]),Ne(D)?L(!0):L(!1);let J=r.current,Ze=rf(e._window),{activeElement:Ie}=document;if(J===null)return;let Ce=e.getRootElement();return Ze!==null&&Ce!==null&&Ce.contains(Ze.anchorNode)?(M||(M=Ze.getRangeAt(0).getBoundingClientRect()),M!=null&&(M.y+=40,l.current=M)):(Ie==null||Ie.className!=="link-input")&&(Ce!==null&&so(null,J,t),i(null),u(null)),!0},[e,w,m.routes.admin,m.routes.api,m.serverURL,h,g,f,T?.code,t]);return co(()=>qi(e.registerCommand(ao,y=>(e.dispatchCommand(fe,y),v(),N(),!0),os)),[e,v,N,E]),co(()=>{let y=t.parentElement,M=()=>{e.getEditorState().read(()=>{v()})};return window.addEventListener("resize",M),y?.addEventListener("scroll",M),()=>{window.removeEventListener("resize",M),y?.removeEventListener("scroll",M)}},[t.parentElement,e,v]),co(()=>qi(e.registerUpdateListener(({editorState:y})=>{y.read(()=>{v()})}),e.registerCommand(sf,()=>(v(),!0),os),e.registerCommand(lf,()=>b?(w(),!0):!1,nf)),[e,v,b,w]),co(()=>{e.getEditorState().read(()=>{v()})},[e,v]),uf(()=>{!b||!r.current||!t||!l.current||so(l.current,r.current,t)},[s,d,b,t,o]),Ve(cf.Fragment,{children:[ne("div",{className:"link-editor","data-theme":"dark",ref:r,children:Ve("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?ne(ro,{}):ne(Ki,{}),s&&s.length>0?Ve("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[d!=null&&d.length>0?d:s,o?.__fields.newTab?Ve(gn,{children:[ne(Qi,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):d!=null&&d.length>0?Ve(gn,{children:[ne("span",{className:"link-input__label-pure",children:d}),o?.__fields.newTab?Ve(gn,{children:[ne(Qi,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):null,p&&Ve("div",{className:"link-input__actions",children:[ne("button",{"aria-label":"Edit link",className:"link-edit",onClick:y=>{y.preventDefault(),N()},onMouseDown:ls,tabIndex:0,type:"button",children:ne(ef,{})}),!I&&ne("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(fe,null)},onMouseDown:ls,tabIndex:0,type:"button",children:ne(Zi,{small:!0})})]})]})}),ne(Po,{className:"lexical-link-edit-drawer",data:_,drawerSlug:E,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(y,M)=>{let A=M,D={...A};delete D.text,e.update(()=>{let F=es(),P=null;if(ts(F)?P=rt(F).getParent():C.length&&(P=C[0]?.getParent()??null),P&&Ne(P)){let Y=Se({fields:D});P.replace(Y,!0)}}),e.dispatchCommand(fe,{fields:D,selectedNodes:C,text:A.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var ss=t=>{let{anchorElem:e=document.body}=t;return pf(df(is,{anchorElem:e}),e)};import{c as mf}from"react/compiler-runtime";import{useLexicalComposerContext as ff}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as hf}from"@lexical/utils";import{$getSelection as gf,$isElementNode as xf,$isRangeSelection as Cf,COMMAND_PRIORITY_LOW as as,PASTE_COMMAND as bf}from"lexical";import{useEffect as kf}from"react";var cs=t=>{let e=mf(5),{clientProps:o}=t,[n]=ff(),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 hf(n.registerCommand(fe,s=>s===null?(mn(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),mn(s),!0),as),n.registerCommand(bf,s=>{let i=gf();if(!Cf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!Mi(d))return!1;if(!i.getNodes().some(_f)){let u={doc:null,linkType:"custom",newTab:!1,url:d};return n.dispatchCommand(fe,{fields:u,text:null}),s.preventDefault(),!0}return!1},as))},l=[o.defaultLinkType,o.defaultLinkURL,n],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=n,e[3]=r,e[4]=l):(r=e[3],l=e[4]),kf(r,l),null};function _f(t){return xf(t)}var ds=[an([{ChildComponent:ro,isActive:({selection:t})=>{if(us(t)){let e=rt(t);return Tf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(us(t)&&Cn()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(fe,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=Cn()?.getTextContent(),n=Cn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(ao,{fields:r,selectedNodes:n,text:o})}},order:1}])],wf=$(({props:t})=>({markdownTransformers:[Di],nodes:[oe,t?.disableAutoLinks===!0?null:Ee].filter(Boolean),plugins:[{Component:cs,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Vi,position:"normal"},{Component:Wi,position:"normal"},{Component:ss,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ds},toolbarInline:{groups:ds}}));import{$isListNode as _n,INSERT_CHECK_LIST_COMMAND as xs,ListItemNode as Df,ListNode as Of}from"@lexical/list";import{$isRangeSelection as Ff}from"lexical";import{jsx as ps}from"react/jsx-runtime";import"react";var Sf={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},bn=({className:t,size:e=24})=>ps("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:ps("path",{d:Sf[e],fill:"currentColor"})});import{jsx as Ef}from"react/jsx-runtime";import{ListPlugin as Nf}from"@lexical/react/LexicalListPlugin.js";import"react";var lt=()=>Ef(Nf,{});function uo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function it(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Rf,ListItemNode as If,ListNode as Mf}from"@lexical/list";import{$createListItemNode as Lf,$createListNode as yf,$isListItemNode as vf,$isListNode as kn}from"@lexical/list";var ms=4,st=t=>(e,o,n)=>{let r=e.getPreviousSibling(),l=e.getNextSibling(),s=Lf(t==="check"?n[3]==="x":void 0);if(kn(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(kn(r)&&r.getListType()===t)r.append(s),e.remove();else{let d=yf(t,t==="number"?Number(n[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(n[1].length/ms);i&&s.setIndent(i)},ze=(t,e,o)=>{let n=[],r=t.getChildren(),l=0;for(let s of r)if(vf(s)){if(s.getChildrenSize()===1){let c=s.getFirstChild();if(kn(c)){n.push(ze(c,e,o+1));continue}}let i=" ".repeat(o*ms),d=t.getListType(),u=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";n.push(i+u+e(s)),l++}return n.join(`
56
+ `)};var fs={type:"element",dependencies:[Mf,If],export:(t,e)=>Rf(t)?ze(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:st("check")};import{jsx as $f}from"react/jsx-runtime";import{CheckListPlugin as Af}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var hs=()=>$f(Af,{});var gs=[te([{ChildComponent:bn,isActive:({selection:t})=>{if(!Ff(t))return!1;for(let e of t.getNodes()){if(_n(e)&&e.getListType()==="check")continue;let o=e.getParent();if(_n(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(_n(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(xs,void 0)},order:12}])],Pf=$(({featureProviderMap:t})=>{let e=[{Component:hs,position:"normal"}],o=uo("checklist",t);return o&&e.push({Component:lt,position:"normal"}),{markdownTransformers:[fs],nodes:o?[Of,Df]:[],plugins:e,slashMenu:{groups:[it([{Icon:bn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(xs,void 0)}}])]},toolbarFixed:{groups:gs},toolbarInline:{groups:gs}}});import{$isListNode as wn,INSERT_ORDERED_LIST_COMMAND as _s,ListItemNode as Gf,ListNode as Vf}from"@lexical/list";import{$isRangeSelection as Wf}from"lexical";import{jsx as Cs}from"react/jsx-runtime";import"react";var Bf={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},Tn=({className:t,size:e=24})=>Cs("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Cs("path",{clipRule:"evenodd",d:Bf[e],fill:"currentColor",fillRule:"evenodd"})});import{$isListNode as jf,ListItemNode as Hf,ListNode as Uf}from"@lexical/list";var bs={type:"element",dependencies:[Uf,Hf],export:(t,e)=>jf(t)?ze(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:st("number")};var ks=[te([{ChildComponent:Tn,isActive:({selection:t})=>{if(!Wf(t))return!1;for(let e of t.getNodes()){if(wn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(wn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(wn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_s,void 0)},order:10}])],zf=$(({featureProviderMap:t})=>{let e=uo("ordered",t);return{markdownTransformers:[bs],nodes:e?[Vf,Gf]:[],plugins:e?[{Component:lt,position:"normal"}]:[],slashMenu:{groups:[it([{Icon:Tn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(_s,void 0)}}])]},toolbarFixed:{groups:ks},toolbarInline:{groups:ks}}});import{$isListNode as En,INSERT_UNORDERED_LIST_COMMAND as Es,ListItemNode as Yf,ListNode as qf}from"@lexical/list";import{$isRangeSelection as Qf}from"lexical";import{jsx as Ts}from"react/jsx-runtime";import"react";var Kf="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",Sn=({className:t})=>Ts("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:Ts("path",{d:Kf,fill:"currentColor"})});import{$isListNode as Jf,ListItemNode as Xf,ListNode as Zf}from"@lexical/list";var ws={type:"element",dependencies:[Zf,Xf],export:(t,e)=>Jf(t)?ze(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:st("bullet")};var Ss=[te([{ChildComponent:Sn,isActive:({selection:t})=>{if(!Qf(t))return!1;for(let e of t.getNodes()){if(En(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(En(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(En(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Es,void 0)},order:11}])],e0=$({markdownTransformers:[ws],nodes:[qf,Yf],plugins:[{Component:lt,position:"normal"}],slashMenu:{groups:[it([{Icon:Sn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Es,void 0)}}])]},toolbarFixed:{groups:Ss},toolbarInline:{groups:Ss}});import{$setBlocksType as ys}from"@lexical/selection";import{$createParagraphNode as vs,$getSelection as Rs,$isParagraphNode as Ns,$isRangeSelection as t0}from"lexical";var Ls=[te([{ChildComponent:St,isActive:({selection:t})=>{if(!t0(t))return!1;for(let e of t.getNodes())if(!Ns(e)&&!Ns(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Rs();ys(e,()=>vs())})},order:1}])],o0=$({slashMenu:{groups:[X([{Icon:St,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Rs();ys(e,()=>vs())})}}])]},toolbarFixed:{groups:Ls},toolbarInline:{groups:Ls}});import{c as E0}from"react/compiler-runtime";import{jsx as Zs}from"react/jsx-runtime";import{useLexicalComposerContext as N0}from"@lexical/react/LexicalComposerContext";import{useEffect as L0,useState as y0}from"react";import{jsx as Xs,Fragment as S0}from"react/jsx-runtime";import"react";import{jsx as n0}from"react/jsx-runtime";var Is={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return n0("blockquote",{children:o})}};import{jsx as r0}from"react/jsx-runtime";var Ms={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return r0(n,{children:o})}};import{jsx as l0}from"react/jsx-runtime";var $s={horizontalrule:l0("hr",{})};import{jsx as i0}from"react/jsx-runtime";var As={linebreak:i0("br",{})};import{jsx as Ds}from"react/jsx-runtime";var Os=({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 Ds("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="#")),Ds("a",{href:s,rel:r,target:l,children:n})}});import{jsx as at,jsxs as s0,Fragment as a0}from"react/jsx-runtime";import{v4 as c0}from"uuid";var Fs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return at(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=c0();return at("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:s0(a0,{children:[at("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),at("label",{htmlFor:l,children:r}),at("br",{})]})})}else return at("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as Nn}from"react/jsx-runtime";var Ps={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Nn("p",{children:o}):Nn("p",{children:Nn("br",{})})}};var Bs={tab:" "};import{jsx as Mt}from"react/jsx-runtime";var js={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("div",{className:"lexical-table-container",children:Mt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Mt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return Mt(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ke}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},u0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,d0="\xA0",p0=`
57
57
 
58
- `,js="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Hs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",u0=new RegExp("^[^"+Hs+"]*["+js+"]"),d0=new RegExp("^[^"+js+"]*["+Hs+"]"),m0={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},p0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},f0={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},h0={[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"},g0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},x0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Us={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ke("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ke("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ke("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ke("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ke("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ke("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ke("sup",{children:e})),e}};import{jsx as $t}from"react/jsx-runtime";var Gs={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return $t("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return $t("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 d=i?.url;l.push($t("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push($t("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),$t("picture",{children:l})}};var ct={...Fs,...Us,...$s,...Rs,...Ps,...Is,...Ms,...Os,...Ds({}),...Gs,...Bs};import{jsx as po,Fragment as C0}from"react/jsx-runtime";import mo from"react";function Vs(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 b0(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 po("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function Ws(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return mo.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return po("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function k0(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]=Ws(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]=Ws(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=b0(r))}return e}function zs({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(Vs(e)){let l=r?k0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Ks({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return po(C0,{})}function Ks({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,d)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:i,nodesToJSX:p=>Ks({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:r}}),parent:r}):c:u=po("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),mo.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return mo.cloneElement(u,{key:d,style:m})}return mo.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function Ln({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:ct}):i=e:i=ct;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&zs({converters:i,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Js(_0,{children:d}):Js("div",{className:t??"payload-richtext",children:d})}function Zs(){let t=T0(7),[e]=w0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=E0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;r(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),S0(l,s);let i;return t[5]!==n?(i=Xs("div",{className:"debug-jsx-converter",children:Xs(Ln,{converters:ct,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var N0=$({plugins:[{Component:Zs,position:"bottom"}]});var H={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},L0={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as hh}from"lexical";import{jsx as Ys}from"react/jsx-runtime";import"react";var y0="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",yn=({className:t})=>Ys("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ys("path",{d:y0,fill:"currentColor"})});import{jsx as $0}from"react/jsx-runtime";import{$applyNodeReplacement as A0}from"lexical";import*as Qs from"react";import{DecoratorBlockNode as v0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as R0}from"@lexical/utils";import{$applyNodeReplacement as I0}from"lexical";function M0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:qs({relationTo:o,value:e})}:null}var At=class extends v0{__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:M0,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=qs(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return R0(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 qs(t){return I0(new At({data:t}))}var D0=Qs.lazy(()=>import("./RelationshipComponent-RZL743CS.js").then(t=>({default:t.RelationshipComponent})));function O0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Je({relationTo:o,value:e})}:null}var Le=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:O0,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=Je(o);return n.setFormat(e.format),n}decorate(e,o){return $0(D0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Je(t){return A0(new Le({data:t}))}function vn(t){return t instanceof Le}import{c as nh}from"react/compiler-runtime";import{jsx as rh}from"react/jsx-runtime";import{useLexicalComposerContext as lh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ih}from"@lexical/utils";import{$getPreviousSelection as sh,$getSelection as ah,$isParagraphNode as ch,$isRangeSelection as uh,COMMAND_PRIORITY_EDITOR as dh,createCommand as mh}from"lexical";import{useEffect as ph}from"react";import{c as oa}from"react/compiler-runtime";import{jsx as Rn}from"react/jsx-runtime";import{useLexicalComposerContext as na}from"@lexical/react/LexicalComposerContext.js";import{toast as J0}from"@payloadcms/ui";import{$getNodeByKey as X0,COMMAND_PRIORITY_EDITOR as ra}from"lexical";import{useEffect as la,useState as Z0}from"react";import{c as F0}from"react/compiler-runtime";import{jsx as B0}from"react/jsx-runtime";import{useLexicalComposerContext as P0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as j0,useModal as H0}from"@payloadcms/ui";import{$getNodeByKey as ea,$getPreviousSelection as U0,$getRoot as G0,$getSelection as V0,$isRangeSelection as W0,$setSelection as z0}from"lexical";import{useEffect as K0,useState as ta}from"react";var Dt=t=>{let e=F0(23),[o]=P0(),[n,r]=ta(null),[l,s]=ta(!1),[i,d,c]=j0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=H0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let N=V0()??U0();r(N)},e[0]=f):f=e[0];let g=f,_;e[1]!==o||e[2]!==n?(_=()=>{n&&o.update(()=>{if(W0(n)){let{anchor:N,focus:S}=n;ea(N.key)&&ea(S.key)&&z0(n.clone())}else G0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=_):_=e[3];let L=_,R;e[4]!==u?(R=()=>{u()},e[4]=u,e[5]=R):R=e[5];let b=R,x,C;e[6]!==a||e[7]!==h||e[8]!==L||e[9]!==l?(x=()=>{if(!l)return;let N=h[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{L()},1))},C=[h,a,L,l],e[6]=a,e[7]=h,e[8]=L,e[9]=l,e[10]=x,e[11]=C):(x=e[10],C=e[11]),K0(x,C);let k;e[12]!==d?(k=N=>B0(d,{...N,onClick:()=>{g()}}),e[12]=d,e[13]=k):k=e[13];let T;e[14]!==p?(T=()=>{g(),p(),s(!0)},e[14]=p,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==b||e[18]!==m||e[19]!==a||e[20]!==k||e[21]!==T?(I={closeListDrawer:b,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:T},e[16]=i,e[17]=b,e[18]=m,e[19]=a,e[20]=k,e[21]=T,e[22]=I):I=e[22],I};var Y0=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=X0(o);r&&r.replace(Je({relationTo:e,value:n}))}):t.dispatchCommand(In,{relationTo:e,value:n})},q0=t=>{let e=oa(14),{enabledCollectionSlugs:o}=t,[n]=na(),[r,l]=Z0(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:d,ListDrawer:c,openListDrawer:u}=Dt(i),a,m;e[3]!==n||e[4]!==u?(a=()=>n.registerCommand(Qe,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),ra),m=[n,u],e[3]=n,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),la(a,m);let p;e[7]!==d||e[8]!==n||e[9]!==r?(p=g=>{let{collectionSlug:_,doc:L}=g;Y0({editor:n,relationTo:_,replaceNodeKey:r,value:L.id}),d()},e[7]=d,e[8]=n,e[9]=r,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=Rn(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},Q0=()=>{let t=oa(3),[e]=na(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Qe,eh,ra),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),la(o,n),null},ia=({enabledCollectionSlugs:t})=>t?.length?Rn(q0,{enabledCollectionSlugs:t}):Rn(Q0,{});function eh(){return J0.error("No relationship collections enabled"),!0}import{useConfig as th,useEntityVisibility as oh}from"@payloadcms/ui";import*as sa from"react";var fo=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:n=!1}=t||{},{config:{collections:r}}=th(),{visibleEntities:l}=oh();return sa.useMemo(()=>{let i=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of r){let{slug:m,admin:{enableRichTextRelationship:p},upload:h}=a;if(l?.collections.includes(m)){if(n){if(!p||!h)continue}else if(h||!p)continue;c&&!c.has(m)||u&&u.has(m)||(i.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:i}},[r,l,n,o,e])};var In=mh("INSERT_RELATIONSHIP_COMMAND"),aa=t=>{let e=nh(8),{clientProps:o}=t,[n]=lh(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=fo(s),d,c;e[3]!==n?(d=()=>{if(!n.hasNodes([Le]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(In,fh,dh)},c=[n],e[3]=n,e[4]=d,e[5]=c):(d=e[4],c=e[5]),ph(d,c);let u;return e[6]!==i?(u=rh(ia,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function fh(t){let e=ah()||sh();if(uh(e)){let o=Je(t),{focus:n}=e,r=n.getNode();ih(o),ch(r)&&!r.__first&&r.remove()}return!0}var gh=$({nodes:[Le],plugins:[{Component:aa,position:"normal"}],slashMenu:{groups:[X([{Icon:yn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:yn,isActive:({selection:t})=>{if(!hh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]}});import{c as Vh}from"react/compiler-runtime";import{jsx as he,jsxs as Wh}from"react/jsx-runtime";import{useLexicalComposerContext as zh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ca}from"@lexical/react/useLexicalEditable";import{useScrollInfo as Kh,useThrottledEffect as Jh,useTranslation as Xh}from"@payloadcms/ui";import*as Co from"react";import{useMemo as On}from"react";import{jsx as xh,jsxs as Ch}from"react/jsx-runtime";import{Tooltip as bh,useTranslation as kh}from"@payloadcms/ui";import{$addUpdateTag as _h}from"lexical";import{useCallback as ca,useEffect as Th,useMemo as ua,useRef as wh,useState as Sh}from"react";var Mn="toolbar-popup__button",Ot=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=kh(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=G(),[d,c]=Sh(!1),u=wh(null);Th(()=>{u.current?.removeAttribute("data-pressing")},[t]);let a=ua(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,f=>f.toUpperCase()),[s,l,i,r]),m=ua(()=>[Mn,n?"":"disabled",t?"active":"",r.key?`${Mn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),p=ca(()=>{n&&o.focus(()=>{o.update(()=>{_h("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=ca(f=>{f.preventDefault(),f.currentTarget.setAttribute("data-pressing","")},[]);return Ch("button",{"aria-label":a,className:m,"data-button-key":r.key,disabled:!n,onClick:p,onMouseDown:h,onPointerEnter:()=>c(!0),onPointerLeave:()=>{c(!1),u.current?.removeAttribute("data-pressing")},ref:u,type:"button",children:[xh(bh,{className:`${Mn}__tooltip`,show:d,children:a}),e]})};import{c as Ih}from"react/compiler-runtime";import{jsx as ut}from"react/jsx-runtime";import Mh,{useMemo as $h}from"react";import{useTranslation as Ah}from"@payloadcms/ui";import{jsx as Ae,jsxs as da}from"react/jsx-runtime";import{Button as Eh}from"@payloadcms/ui";import{$addUpdateTag as Nh,isDOMNode as Lh}from"lexical";import ho,{useCallback as yh,useEffect as go,useMemo as pa,useRef as $n,useState as An}from"react";import{createPortal as vh}from"react-dom";var ma="toolbar-popup__dropdown-item",fa=ho.createContext(null);function ha({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let d=pa(()=>[ma,n===!1?"disabled":"",t?"active":"",l?.key?`${ma}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),c=$n(null),u=ho.use(fa);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return go(()=>{c?.current!=null&&a(c)},[c,a]),Ae(Eh,{"aria-label":i,buttonStyle:"ghost",className:d,disabled:n===!1,extraButtonProps:{"data-item-key":s},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{Nh("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function Rh({children:t,dropdownKey:e,dropDownRef:o,itemsContainerClassNames:n,onClose:r}){let[l,s]=An(),[i,d]=An(),c=yh(m=>{s(p=>p!=null?[...p,m]:[m])},[s]),u=m=>{if(l==null)return;let{key:p}=m;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&m.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?d(h=>{if(h==null)return l[0];let f=l.indexOf(h)-1;return l[f===-1?l.length-1:f]}):p==="ArrowDown"&&d(h=>h==null?l[0]:l[l.indexOf(h)+1])},a=pa(()=>({registerItem:c}),[c]);return go(()=>{l!=null&&i==null&&d(l[0]),i!=null&&i?.current!=null&&i.current.focus()},[l,i]),Ae(fa,{value:a,children:Ae("div",{className:(n??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":e,"data-theme":"dark",onKeyDown:u,ref:o,children:t})})}function ga({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=$n(null),u=$n(null),[a,m]=An(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};go(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:_,top:L}=f.getBoundingClientRect(),R=window.scrollY||document.documentElement.scrollTop;g.style.top=`${L+R+f.offsetHeight+5}px`,g.style.left=`${Math.min(_-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),go(()=>{let f=u.current;if(f!==null&&a){let g=_=>{let L=_.target;Lh(L)&&(d&&c.current&&c.current.contains(L)||f.contains(L)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=vh(Ae(Rh,{dropdownKey:r,dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return da(ho.Fragment,{children:[da("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":r,disabled:n,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[l&&Ae(l,{}),i&&Ae("span",{className:"toolbar-popup__dropdown-label",children:i}),Ae("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Ae(ho.Fragment,{children:h})]})}var Dn="toolbar-popup__dropdown",Dh=t=>{let e=Ih(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:d}=Ah(),{fieldProps:c}=G(),{featureClientSchemaMap:u,schemaPath:a}=c;if(i.Component){let p;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(p=i?.Component&&ut(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=p):p=e[5],p}let m;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==u||e[10]!==d||e[11]!==s||e[12]!==i||e[13]!==a){let p=i.key,h;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:u,i18n:d,schemaPath:a}):i.label),p.length>25?h=p.substring(0,25)+"...":h=p,m=ut(ha,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?ut(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?p:void 0,children:ut("span",{className:"text",children:h})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=u,e[10]=d,e[11]=s,e[12]=i,e[13]=a,e[14]=m}else m=e[14];return m},Oh=Mh.memo(Dh),Ft=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=n,u=$h(()=>d?.length?d.map(a=>ut(Oh,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[d,r.activeItemKeys,r.enabledItemKeys,t,o]);return ut(ga,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Dn,`${Dn}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Dn}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as Fh}from"@lexical/utils";import{$getSelection as Bh}from"lexical";import{useCallback as Ph,useDeferredValue as jh,useEffect as Hh,useRef as xa,useState as Uh}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 xo(t,e){let[o,n]=Uh(()=>Gh(e)),r=jh(o),l=G(),s=xa(l);s.current=l;let i=xa(e);i.current=e;let d=_r(),c=Ph(()=>{t.getEditorState().read(()=>{let u=Bh();if(!u)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,h=new Map;for(let f of a){let g=[],_=[],L=[],R=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let x of f.items){let C=x.isActive?(!R||g.length<R)&&x.isActive({editor:t,editorConfigContext:m,selection:u}):!1,k=x.isEnabled?x.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;C&&(g.push(x.key),_.push(x)),k&&L.push(x.key),p.set(x.key,{active:C,enabled:k})}let b=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(f.key,{activeItemKeys:g,activeItems:_,enabledGroup:b,enabledItemKeys:L})}n({groupStates:h,itemStates:p})})},[t]);return Hh(()=>{d(c);let u=()=>d(c),a=Fh(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),r}function Zh({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&he(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?he(Ot,{active:t,editor:o,enabled:n,item:r,children:he(r.ChildComponent,{})},r.key):null}function Yh({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=Xh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=G(),c=l.groupStates.get(n.key),u=On(()=>{if(n.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,c?.activeItems]),a=On(()=>{if(n.type!=="dropdown")return;let m=c?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:d}):p.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,c?.activeItems,s,i,d]);return Wh("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&c?he(Ft,{anchorElem:t,editor:e,group:n,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let p=l.itemStates.get(m.key);return he(Zh,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&he("div",{className:"divider"})]},n.key)}function qh({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=Co.useRef(null),s=Ca(),{y:i}=Kh(),d=xo(o,n?.features?.toolbarFixed?.groups),c=On(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return Jh(()=>{if(!c)return;let u=l.current;if(!u)return;let a=u.getBoundingClientRect(),m=c.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),c.classList.remove("fixed-toolbar--hide"),c.classList.add("fixed-toolbar")}},50,[l,c,i]),he("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&he(Co.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((u,a)=>he(Yh,{anchorElem:t,editor:o,editorConfig:n,group:u,index:a,toolbarStates:d},u.key))})})}var ba=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ba(t.parentEditor)}return!1},ka=t=>{let e=Vh(6),{clientProps:o}=t,[n]=zh(),r=G();if(!Ca())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,d=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==r){u=Symbol.for("react.early_return_sentinel");e:{let a=ba(r);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=he(qh,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=r,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var Qh=$({plugins:[{Component:ka,position:"aboveContainer"}]});import{c as e5}from"react/compiler-runtime";import{jsx as ye,jsxs as wa}from"react/jsx-runtime";import{useLexicalComposerContext as t5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as o5}from"@lexical/react/useLexicalEditable";import{mergeRegister as Sa}from"@lexical/utils";import{$getSelection as Ea,$isRangeSelection as _a,$isTextNode as n5,COMMAND_PRIORITY_LOW as r5,getDOMSelection as Na,SELECTION_CHANGE_COMMAND as l5}from"lexical";import{useCallback as ko,useEffect as Bt,useMemo as i5,useRef as Ta,useState as s5}from"react";import"react";import{createPortal as a5}from"react-dom";function Fn(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function bo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),h=d.top-a.height-c,f=d.left-l;s==="center"&&(f=d.left+d.width/2-a.width/2);let g=0;return!e&&h<p.top&&!i&&(g=a.height+d.height+c*2,h+=g),s==="center"?f+a.width>p.right?f=p.right-a.width-l:f<p.left&&(f=p.left+l):f+a.width>p.right&&(f=p.right-a.width-l),f-=m.left,r.style.opacity="1",i&&n!==0?(h-=m.bottom-n+a.height-3,r.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,r.style.transform=`translate(${f}px, ${h}px)`),g}function c5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&ye(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?ye(Ot,{active:t,editor:o,enabled:n,item:r,children:ye(r.ChildComponent,{})},r.key):null}function u5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=G(),s=r.groupStates.get(o.key),i=i5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return wa("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?ye(Ft,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=r.itemStates.get(d.key);return ye(c5,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,n<l.features.toolbarInline?.groups.length-1&&ye("div",{className:"divider"})]},o.key)}function d5({anchorElem:t,editor:e}){let o=Ta(null),n=Ta(null),{editorConfig:r}=G(),l=xo(e,r?.features?.toolbarInline?.groups),s=ko(()=>{if(o?.current){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=ko(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=u.clientX,h=u.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),d=ko(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Bt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=ko(()=>{let u=Ea(),a=Na(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(u!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Fn(a,h),g=bo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&bo({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Bt(()=>{let u=t.parentElement,a=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",a),u&&u.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),u&&u.removeEventListener("scroll",a)}},[e,c,t]),Bt(()=>(e.getEditorState().read(()=>{c()}),Sa(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(l5,()=>(c(),!1),r5))),[e,c]),wa("div",{className:"inline-toolbar-popup",ref:o,children:[ye("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((u,a)=>ye(u5,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function m5(t,e){let o=e5(12),[n,r]=s5(!1),l=o5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Ea(),h=Na(t._window),f=t.getRootElement();if(h!==null&&(!_a(p)||f===null||!f.contains(h.anchorNode))){r(!1);return}if(!_a(p))return;if(p.getTextContent()!==""){let _=p.getNodes(),L=!1;for(let R of _)if(n5(R)){r(!0),L=!0;break}L||r(!1)}else r(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,d,c;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Bt(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>Sa(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Bt(u,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=a5(ye(d5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var La=t=>{let{anchorElem:e}=t,[o]=t5();return m5(o,e)};var p5=$({plugins:[{Component:La,position:"floatingAnchorElem"}]});import{TableCellNode as n2,TableNode as r2,TableRowNode as l2}from"@lexical/table";import{jsx as ya}from"react/jsx-runtime";import"react";var f5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Bn=({className:t,size:e=24})=>ya("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:ya("path",{clipRule:"evenodd",d:f5[e],fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as h5,$createTableNode as g5,$createTableRowNode as x5,$isTableCellNode as va,$isTableNode as Pn,$isTableRowNode as jn,TableCellHeaderStates as _o,TableCellNode as C5,TableNode as b5,TableRowNode as k5}from"@lexical/table";import{$isParagraphNode as _5,$isTextNode as T5}from"lexical";var Ia=/^\|(.+)\|\s?$/,w5=/^(\| ?:?-*:? ?)+\|\s?$/,Ma=({allTransformers:t})=>({type:"element",dependencies:[b5,k5,C5],export:e=>{if(!Pn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!jn(n))continue;let l=!1;for(let s of n.getChildren())va(s)&&(r.push(zt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===_o.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
59
- `)},regExp:Ia,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(w5.test(r)){let a=e.getPreviousSibling();if(!a||!Pn(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!jn(p))return;p.getChildren().forEach(h=>{va(h)&&h.setHeaderStyles(_o.ROW,_o.ROW)}),e.remove();return}let l=Ra(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!_5(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!T5(a))break;let m=Ra(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),s.unshift(m);let p=i.getPreviousSibling();i.remove(),i=p}let c=g5();for(let a of s){let m=x5();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:$a("",t))}let u=e.getPreviousSibling();Pn(u)&&S5(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function S5(t){let e=t.getFirstChild();return jn(e)?e.getChildrenSize():0}var $a=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=h5(_o.NO_STATUS);return Wt(t,e,o),o},Ra=(t,e)=>{let o=t.match(Ia);return!o||!o[1]?null:o[1].split("|").map(n=>$a(n,e))};import{c as N5}from"react/compiler-runtime";import{jsx as j,jsxs as ve}from"react/jsx-runtime";import{useLexicalComposerContext as Pa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as L5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Oa,$deleteTableColumnAtSelection as y5,$deleteTableRowAtSelection as v5,$getNodeTriplet as R5,$getTableCellNodeFromLexicalNode as Fa,$getTableColumnIndexFromTableCellNode as I5,$getTableNodeFromLexicalNodeOrThrow as Oe,$getTableRowIndexFromTableCellNode as M5,$insertTableColumnAtSelection as $5,$insertTableRowAtSelection as A5,$isTableCellNode as ja,$isTableSelection as Pt,$mergeCells as D5,$unmergeCell as O5,getTableElement as Hn,getTableObserverFromTableElement as Un,TableCellHeaderStates as De,TableCellNode as F5}from"@lexical/table";import{mergeRegister as B5}from"@lexical/utils";import{useScrollInfo as P5}from"@payloadcms/ui";import{$getSelection as wo,$isElementNode as j5,$isRangeSelection as Gn,$isTextNode as H5,$setSelection as U5,COMMAND_PRIORITY_CRITICAL as G5,getDOMSelection as V5,isDOMNode as W5,SELECTION_CHANGE_COMMAND as z5}from"lexical";import*as Vn from"react";import{useCallback as de,useEffect as dt,useRef as To,useState as mt}from"react";import{createPortal as Ha}from"react-dom";import{jsx as Aa}from"react/jsx-runtime";import"react";var E5={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"},Da=({className:t,size:e=24})=>Aa("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Aa("path",{clipRule:"evenodd",d:E5[e],fill:"currentColor",fillRule:"evenodd"})});function Ba(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function K5(){let t=wo();if(Gn(t)&&!t.isCollapsed()||Pt(t)&&!t.anchor.is(t.focus)||!Gn(t)&&!Pt(t))return!1;let[e]=R5(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function J5(t){let e=t.getLastDescendant();H5(e)?e.select():j5(e)?e.selectEnd():e!==null&&e.selectNext()}function X5({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Pa(),s=To(null),[i,d]=mt(r),[c,u]=mt({columns:1,rows:1}),[a,m]=mt(!1),[p,h]=mt(!1),{y:f}=P5();dt(()=>l.registerMutationListener(F5,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),dt(()=>{l.getEditorState().read(()=>{let w=wo();if(Pt(w)){let v=Ba(w);u(Ba(w)),m(v.columns>1||v.rows>1)}h(K5())})},[l]),dt(()=>{let w=e.current,v=s.current,y=l.getRootElement();if(w!=null&&v!=null&&y!=null){let M=y.getBoundingClientRect(),A=w.getBoundingClientRect();v.style.opacity="1";let D=v.getBoundingClientRect(),F=5,B=A.right+F;if(B+D.width>window.innerWidth||B+D.width>M.right){let J=A.left-D.width-F;B=(J<0?F:J)+window.pageXOffset}v.style.left=`${B+window.pageXOffset}px`;let Y=A.top;if(Y+D.height>window.innerHeight){let J=A.bottom-D.height;Y=J<0?F:J}v.style.top=`${Y}px`}},[e,s,l,f]),dt(()=>{function w(v){s.current!=null&&e.current!=null&&W5(v.target)&&!s.current.contains(v.target)&&!e.current.contains(v.target)&&n(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[n,e]);let g=de(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i),v=Hn(w,l.getElementByKey(w.getKey()));if(v===null)throw new Error("Expected to find tableElement in DOM");let y=Un(v);y!==null&&y.$clearHighlight(),w.markDirty(),d(i.getLatest())}U5(null)})},[l,i]),_=()=>{l.update(()=>{let w=wo();if(!Pt(w))return;let y=w.getNodes().filter(ja),M=D5(y);M&&(J5(M),o())})},L=()=>{l.update(()=>{O5()})},R=de(w=>{l.update(()=>{for(let v=0;v<c.rows;v++)A5(w);o()})},[l,o,c.rows]),b=de(w=>{l.update(()=>{for(let v=0;v<c.columns;v++)$5(w);o()})},[l,o,c.columns]),x=de(()=>{l.update(()=>{v5(),o()})},[l,o]),C=de(()=>{l.update(()=>{Oe(i).remove(),g(),o()})},[l,i,g,o]),k=de(()=>{l.update(()=>{y5(),o()})},[l,o]),T=de(()=>{l.update(()=>{let w=Oe(i),v=M5(i),[y]=Oa(w,null,null),M=new Set,A=i.getHeaderStyles()^De.ROW;if(y[v])for(let D=0;D<y[v].length;D++){let F=y[v][D];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles(A,De.ROW)))}g(),o()})},[l,i,g,o]),I=de(()=>{l.update(()=>{let w=Oe(i),v=I5(i),[y]=Oa(w,null,null),M=new Set,A=i.getHeaderStyles()^De.COLUMN;if(y)for(let D=0;D<y.length;D++){let F=y?.[D]?.[v];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles(A,De.COLUMN)))}g(),o()})},[l,i,g,o]),N=de(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),S=de(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),E=null;return t&&(a?E=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):p&&(E=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>L(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),Ha(ve("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[E?ve(Vn.Fragment,{children:[E,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:()=>S(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>R(!1),type:"button",children:ve("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>R(!0),type:"button",children:ve("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:ve("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:ve("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>x(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:ve("span",{className:"text",children:[(i.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:ve("span",{className:"text",children:[(i.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Z5({anchorElem:t,cellMerge:e}){let[o]=Pa(),n=To(null),r=To(null),[l,s]=mt(!1),[i,d]=mt(null),c=de(()=>{let a=n.current,m=wo(),p=V5(o._window),h=document.activeElement;function f(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return f();let g=o.getRootElement(),_=null,L=null;if(Gn(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let b=Fa(m.anchor.getNode());if(b==null||(L=o.getElementByKey(b.getKey()),L==null||!b.isAttached()))return f();let x=Oe(b),C=Hn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Un(C),d(b)}else if(Pt(m)){let b=Fa(m.anchor.getNode());if(!ja(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let x=Oe(b),C=Hn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Un(C),L=o.getElementByKey(b.getKey())}else if(!h)return f();if(_===null||L===null)return f();let R=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",R),a.classList.toggle("table-cell-action-button-container--inactive",!R),R){let b=L.getBoundingClientRect(),x=t.getBoundingClientRect(),C=b.top-x.top,k=b.right-x.left;a.style.transform=`translate(${k}px, ${C}px)`}},[o,t]);dt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return B5(o.registerUpdateListener(p),o.registerCommand(z5,p,G5),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=To(i);return dt(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&ve(Vn.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(Da,{})}),l&&j(X5,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Ua=t=>{let e=N5(3),{anchorElem:o}=t,n=L5(),r;return e[0]!==o||e[1]!==n?(r=Ha(n?j(Z5,{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 Y5}from"react/compiler-runtime";import{jsx as Eo,jsxs as q5}from"react/jsx-runtime";import{useLexicalComposerContext as Q5}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as eg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as tg,$getTableNodeFromLexicalNodeOrThrow as Wn,$getTableRowIndexFromTableCellNode as og,$isTableCellNode as Ga,$isTableRowNode as ng,getDOMCellFromTarget as rg,getTableElement as lg,TableNode as Va}from"@lexical/table";import{calculateZoomLevel as Wa,mergeRegister as ig}from"@lexical/utils";import{$getNearestNodeFromDOMNode as zn,isHTMLElement as sg,SKIP_SCROLL_INTO_VIEW_TAG as za}from"lexical";import*as Ja from"react";import{useCallback as jt,useEffect as Kn,useRef as So,useState as pt}from"react";import{createPortal as ag}from"react-dom";var cg=33,Ka=92;function ug({editor:t}){let e=So(null),o=So(null),n=So(null),[r,l]=pt(!1),s=G(),i=So(null),[d,c]=pt(null),[u,a]=pt(null),[m,p]=pt(!1),[h,f]=pt(null),g=jt(()=>{a(null),e.current=null,f(null),i.current=null,n.current=null},[]),_=S=>(S.buttons&1)===1;Kn(()=>{let S=new Set;return ig(t.registerMutationListener(Va,E=>{for(let[w,v]of E)v==="destroyed"?S.delete(w):S.add(w);l(S.size>0)}),t.registerNodeTransform(Va,E=>{if(E.getColWidths())return E;let w=E.getColumnCount(),v=Ka;return E.setColWidths(Array(w).fill(v)),E}))},[t]),Kn(()=>{if(!r)return;let S=y=>{let M=y.target;if(sg(M)){if(h){c({x:y.clientX,y:y.clientY});return}if(p(_(y)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let A=rg(M);A&&u!==A?t.getEditorState().read(()=>{let D=zn(A.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let F=Wn(D),B=lg(F,t.getElementByKey(F.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=M,n.current=B.getBoundingClientRect(),a(A)},{editor:t}):A==null&&g()}}},E=y=>{p(!0)},w=y=>{p(!1)},v=t.registerRootListener((y,M)=>{M?.removeEventListener("mousemove",S),M?.removeEventListener("mousedown",E),M?.removeEventListener("mouseup",w),y?.addEventListener("mousemove",S),y?.addEventListener("mousedown",E),y?.addEventListener("mouseup",w)});return()=>{v()}},[u,h,t,r,g]);let L=S=>S==="bottom",R=jt(S=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let E=zn(u.elem);if(!Ga(E))throw new Error("TableCellResizer: Table cell node not found.");let w=Wn(E),v=og(E),y=w.getChildren(),A=E.getColSpan()===w.getColumnCount()?v:v+E.getRowSpan()-1;if(A>=y.length||A<0)throw new Error("Expected table cell to be inside of table row.");let D=y[A];if(!ng(D))throw new Error("Expected table row");let F=D.getHeight();if(F===void 0){let Y=D.getChildren();F=Math.min(...Y.map(J=>b(J,t)??1/0))}let B=Math.max(F+S,cg);D.setHeight(B)},{tag:za})},[u,t]),b=(S,E)=>E.getElementByKey(S.getKey())?.clientHeight,x=(S,E)=>{let w;return E.forEach(v=>{v.forEach((y,M)=>{y.cell===S&&(w=M)})}),w},C=jt(S=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let E=zn(u.elem);if(!Ga(E))throw new Error("TableCellResizer: Table cell node not found.");let w=Wn(E),[v]=tg(w,null,null),y=x(E,v);if(y===void 0)throw new Error("TableCellResizer: Table column not found.");let M=w.getColWidths();if(!M)return;let A=M[y];if(A===void 0)return;let D=[...M],F=Math.max(A+S,Ka);D[y]=F,w.setColWidths(D)},{tag:za})},[u,t]),k=jt(S=>{let E=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:v,y}=i.current;if(u===null)return;let M=Wa(w.target);if(L(S)){let A=(w.clientY-y)/M;R(A)}else{let A=(w.clientX-v)/M;C(A)}g(),document.removeEventListener("mouseup",E)}};return E},[u,g,C,R]),T=jt(S=>E=>{if(E.preventDefault(),E.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:E.clientX,y:E.clientY},c(i.current),f(S),document.addEventListener("mouseup",k(S))},[u,k]),[I,N]=pt({bottom:null,left:null,right:null,top:null});return Kn(()=>{if(u){let{height:S,left:E,top:w,width:v}=u.elem.getBoundingClientRect(),y=Wa(u.elem),M=10,A={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${M}px`,left:`${window.scrollX+E}px`,top:`${window.scrollY+w+S-M/2}px`,width:`${v}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${S}px`,left:`${window.scrollX+E+v-M/2}px`,top:`${window.scrollY+w}px`,width:`${M}px`}},D=n.current;h&&d&&D&&(L(h)?(A[h].left=`${window.scrollX+D.left}px`,A[h].top=`${window.scrollY+d.y/y}px`,A[h].height="3px",A[h].width=`${D.width}px`):(A[h].top=`${window.scrollY+D.top}px`,A[h].left=`${window.scrollX+d.x/y}px`,A[h].width="3px",A[h].height=`${D.height}px`),A[h].backgroundColor="#adf"),N(A)}else N({bottom:null,left:null,right:null,top:null})},[u,h,d]),Eo("div",{ref:o,children:u!=null&&!m&&q5(Ja.Fragment,{children:[Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var Xa=()=>{let t=Y5(3),[e]=Q5(),o=eg(),n;return t[0]!==e||t[1]!==o?(n=o?ag(Eo(ug,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],n};import{c as Cg}from"react/compiler-runtime";import{jsx as Jn,jsxs as bg,Fragment as kg}from"react/jsx-runtime";import{useLexicalComposerContext as _g}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as nc}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Tg,$getTableColumnIndexFromTableCellNode as wg,$getTableRowIndexFromTableCellNode as Sg,$insertTableColumnAtSelection as Eg,$insertTableRowAtSelection as Ng,$isTableCellNode as Lg,$isTableNode as qa,getTableElement as yg,TableNode as vg}from"@lexical/table";import{$findMatchingParent as Rg,mergeRegister as Ig}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Qa,isHTMLElement as Mg}from"lexical";import{useEffect as ec,useMemo as $g,useRef as tc,useState as No}from"react";import"react";import{createPortal as Ag}from"react-dom";import{c as hg}from"react/compiler-runtime";import{useEffect as gg,useRef as xg}from"react";var dg="Expected a function",mg=Math.max,pg=Math.min;function fg(t,e,o){let n,r,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(dg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?mg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(C){let k=n,T=s;return n=s=void 0,l=C,u=t.apply(T,k),u}function h(C){return l=C,a=setTimeout(_,e),i?p(C):u}function f(C){let k=C-r,T=C-l,I=e-k;return d?pg(I,c-T):I}function g(C){let k=C-r,T=C-l;return r===void 0||k>=e||k<0||d&&T>=c}function _(){let C=Date.now();if(g(C))return L(C);a=setTimeout(_,f(C))}function L(C){return a=void 0,m&&n?p(C):(n=s=void 0,u)}function R(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function b(){return a===void 0?u:L(Date.now())}function x(){let C=Date.now(),k=g(C);if(n=arguments,s=this,r=C,k){if(a===void 0)return h(r);if(d)return clearTimeout(a),a=setTimeout(_,e),p(r)}return a===void 0&&(a=setTimeout(_,e)),u}return x.cancel=R,x.flush=b,x}var Za=fg;function Ya(t,e,o){let n=hg(6),r=xg(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=Za(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),gg(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;r.current&&r.current(...u)},n[5]=i):i=n[5],i}var oc=16;function Dg({anchorElem:t}){let[e]=_g(),o=nc(),n=G(),[r,l]=No(!1),[s,i]=No(!1),[d,c]=No(!1),[u,a]=No({}),m=tc(new Set),p=tc(null),h=Ya(_=>{let{isOutside:L,tableDOMNode:R}=Og(_,n.editorConfig?.lexical);if(L){l(!1),i(!1);return}if(!R)return;p.current=R;let b=null,x=null,C=null;if(e.getEditorState().read(()=>{let A=Qa(R);if(Lg(A)){let D=Rg(A,F=>qa(F));if(!qa(D))return;if(C=yg(D,e.getElementByKey(D.getKey())),C){let F=D.getChildrenSize(),B=D.getChildAtIndex(0)?.getChildrenSize(),Y=Sg(A),J=wg(A);Y===F-1?b=A:J===B-1&&(x=A)}}},{editor:e}),!C)return;let k=C.parentElement;if(!k)return;let{bottom:T,height:I,left:N,right:S,width:E,y:w}=C.getBoundingClientRect(),v=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(v=k.scrollWidth>k.clientWidth);let{left:y,y:M}=t.getBoundingClientRect();b?(i(!1),l(!0),a({height:oc,left:v&&k?k.offsetLeft:N-y,top:T-M+5,width:v&&k?k.offsetWidth:E})):x&&(i(!0),l(!1),a({height:I,left:S-y+5,top:w-M,width:oc}))},50,250),f=$g(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);ec(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),ec(()=>Ig(e.registerMutationListener(vg,_=>{e.getEditorState().read(()=>{let L=!1;for(let[R,b]of _)switch(b){case"created":{m.current.add(R),L=!0;break}case"destroyed":{m.current.delete(R),L=!0;break}default:break}if(L){f.disconnect();for(let R of m.current){let{tableElement:b}=Tg(R);f.observe(b)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=_=>{e.update(()=>{p.current&&(Qa(p.current)?.selectEnd(),_?(Ng(),l(!1)):(Eg(),i(!1)))})};return o?bg(kg,{children:[r&&Jn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Jn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function Og(t,e){let o=t.target;if(Mg(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 rc(t){let e=Cg(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!nc())return null;let l;return e[0]!==n?(l=Ag(Jn(Dg,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as Yn,jsxs as jg}from"react/jsx-runtime";import{useLexicalComposerContext as Hg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Ug}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Gg,TableCellNode as Vg,TableNode as Wg,TableRowNode as zg}from"@lexical/table";import{mergeRegister as Kg}from"@lexical/utils";import{$getSelection as Jg,$isRangeSelection as Xg,$setSelection as Zg,COMMAND_PRIORITY_EDITOR as Yg,createCommand as qg}from"lexical";import{createContext as Qg,use as e2,useCallback as uc,useEffect as dc,useMemo as t2,useRef as o2,useState as Lo}from"react";import*as mc from"react";import{jsx as Q,jsxs as Re}from"react/jsx-runtime";import{useCallback as Xn,useEffect as lc,useRef as Zn,useState as Ht}from"react";import*as ac from"react";import{createPortal as Fg}from"react-dom";var ic=10,sc=7;function Bg(){return Re("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 Pg(){return Re("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 cc({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Ht(0),[d,c]=Ht(0),[u,a]=Ht(""),[m,p]=Ht(""),[h,f]=Ht(null),g=Zn(null),_=Zn(null),L=Zn(null),R=s>0?s:u?parseInt(u,10)||0:5,b=d>0?d:m?parseInt(m,10)||0:5;lc(()=>{o||(i(0),c(0),a(""),p(""),f(null))},[o]),lc(()=>{if(!o)return;let N=S=>{if(S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),n()),S.key==="Enter"&&h){S.preventDefault();let E=parseInt(u,10),w=parseInt(m,10);E>0&&w>0&&r(E,w)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,h,u,m]);let x=Xn((N,S)=>{N>0&&S>0&&r(N,S)},[r]),C=Xn((N,S)=>{i(N),c(S)},[]),k=Xn(()=>{i(0),c(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=sc;N++)for(let S=1;S<=ic;S++){let E=S<=R&&N<=b,w=S<=s&&N<=d,v="table-grid-popup__cell";E&&w?v+=" table-grid-popup__cell--hover":E&&(v+=" table-grid-popup__cell--selected"),T.push(Q("div",{"aria-label":`${S} columns, ${N} rows`,className:v,onClick:()=>x(S,N),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),x(S,N))},onMouseEnter:()=>C(S,N),role:"button",tabIndex:-1},`${N}-${S}`))}let I=s>0&&d>0;return Fg(Re(ac.Fragment,{children:[Q("div",{className:"table-grid-popup__backdrop",onClick:n}),Q("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:Re("div",{className:"table-grid-popup__content",children:[Re("div",{className:"table-grid-popup__header",children:[Re("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(Bg,{})}),Q("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:N=>a(N.target.value),onFocus:()=>f("cols"),placeholder:s>0?String(s):"5",ref:_,type:"number",value:u})]}),Q("span",{className:"table-grid-popup__separator",children:"\xD7"}),Re("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(Pg,{})}),Q("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:N=>p(N.target.value),onFocus:()=>f("rows"),placeholder:d>0?String(d):"5",ref:L,type:"number",value:m})]})]}),Re("div",{className:"table-grid-popup__grid",onMouseLeave:k,children:[T,I&&Re("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/ic*100}%)`,top:`calc(${(d-1)/sc*100}%)`},children:[R," \xD7 ",b]})]})]})})]}),t)}var yo=qg("OPEN_EMBED_DRAWER_COMMAND"),pc=Qg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function fc({children:t}){let[e,o]=Lo({cellEditorConfig:null,cellEditorPlugins:null});return Yn(pc,{value:t2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var hc=()=>{let[t]=Hg(),e=e2(pc),[o,n]=Lo(!1),[r,l]=Lo(null),s=o2(null),[i,d]=Lo(null);dc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;d(m??a.parentElement)}},[t]),dc(()=>{if(!t.hasNodes([Wg,zg,Vg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Kg(t.registerCommand(yo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),p=null;t.getEditorState().read(()=>{let f=Jg();if(Xg(f)){s.current=f.clone();let g=f.anchor.getNode(),_=t.getElementByKey(g.getKey());if(_){let L=_.getBoundingClientRect();L.height>0&&(p={left:L.left-m.left,top:L.bottom-m.top+8})}}});let h=window.getSelection();if(h&&h.rangeCount>0){let g=h.getRangeAt(0).getBoundingClientRect();g.height>0&&(p={left:g.left-m.left,top:g.bottom-m.top+8})}return p||(p={left:0,top:40}),l(p),n(!0),!0},Yg))},[e,t,i]);let c=uc(()=>{n(!1)},[]),u=uc((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&Zg(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(Gg,{columns:String(a),rows:String(m)})},1)},[t]);return jg(mc.Fragment,{children:[Yn(cc,{anchorElem:i,editor:t,isOpen:o,onClose:c,onInsert:u,position:r}),Yn(Ug,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var i2=$({markdownTransformers:[Ma],nodes:[r2,n2,l2],plugins:[{Component:hc,position:"normal"},{Component:Xa,position:"normal"},{Component:Ua,position:"floatingAnchorElem"},{Component:rc,position:"floatingAnchorElem"}],providers:[fc],slashMenu:{groups:[X([{Icon:Bn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:Bn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]}});import{$isNodeSelection as U2}from"lexical";import{jsx as gc}from"react/jsx-runtime";import"react";var s2="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",qn=({className:t})=>gc("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:gc("path",{clipRule:"evenodd",d:s2,fill:"currentColor",fillRule:"evenodd"})});import{jsx as _c}from"react/jsx-runtime";import Tc from"bson-objectid";import{$applyNodeReplacement as p2}from"lexical";import*as wc from"react";import a2 from"bson-objectid";function vo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let n=t.getAttribute("data-lexical-pending-upload-form-id");if(n!=null)return{node:e({data:{pending:{formID:n,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let n=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(n!=null&&r!=null)return{node:e({data:{fields:{},relationTo:r,value:n}})}}return{node:e({data:{pending:{formID:new a2.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as c2}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as u2}from"@lexical/utils";import Cc from"bson-objectid";import{$applyNodeReplacement as d2}from"lexical";var Ut=class extends c2{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>vo(o,xc),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Cc.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=xc({data:o});return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return u2(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function xc({data:t}){return t?.id||(t.id=new Cc.default().toHexString()),d2(new Ut({data:t}))}import{jsx as bc}from"react/jsx-runtime";import{ShimmerEffect as m2}from"@payloadcms/ui";var kc=()=>bc("div",{className:"lexical-upload",children:bc(m2,{height:"95px",width:"203px"})});var f2=wc.lazy(()=>import("./component-KESPRYJR.js").then(t=>({default:t.UploadComponent}))),ge=class extends Ut{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>vo(o,xe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Tc.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=xe({data:o});return n.setFormat(e.format),n}decorate(e,o){return this.__data.pending?_c(kc,{}):_c(f2,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function xe({data:t}){return t?.id||(t.id=new Tc.default().toHexString()),p2(new ge({data:t}))}function ft(t){return t instanceof ge}import{c as T2}from"react/compiler-runtime";import{jsx as w2}from"react/jsx-runtime";import{useLexicalComposerContext as S2}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ac,$insertNodeToNearestRoot as tr,mergeRegister as E2}from"@lexical/utils";import{useBulkUpload as N2,useEffectEvent as L2,useModal as y2}from"@payloadcms/ui";import or from"bson-objectid";import{$createRangeSelection as v2,$getPreviousSelection as vc,$getSelection as Rc,$isParagraphNode as nr,$isRangeSelection as Ic,$setSelection as R2,COMMAND_PRIORITY_EDITOR as I2,COMMAND_PRIORITY_LOW as Mc,createCommand as M2,DROP_COMMAND as $2,getDOMSelectionFromTarget as A2,isHTMLElement as $c,PASTE_COMMAND as D2}from"lexical";import{useEffect as O2}from"react";import{c as Sc}from"react/compiler-runtime";import{jsx as Qn}from"react/jsx-runtime";import{useLexicalComposerContext as Ec}from"@lexical/react/LexicalComposerContext.js";import{toast as h2}from"@payloadcms/ui";import{$getNodeByKey as g2,COMMAND_PRIORITY_EDITOR as Nc}from"lexical";import{useEffect as Lc,useState as x2}from"react";var C2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=g2(o);r&&r.replace(xe({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(er,{fields:null,relationTo:e,value:n})},b2=t=>{let e=Sc(13),{enabledCollectionSlugs:o}=t,[n]=Ec(),[r,l]=x2(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=Dt(s),u,a;e[2]!==n||e[3]!==c?(u=()=>n.registerCommand(et,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Nc),a=[n,c],e[2]=n,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Lc(u,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=f=>{let{collectionSlug:g,doc:_}=f;i(),C2({editor:n,relationTo:g,replaceNodeKey:r,value:_.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,h;return e[10]!==d||e[11]!==p?(h=Qn(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},k2=()=>{let t=Sc(3),[e]=Ec(),o,n;return t[0]!==e?(o=()=>e.registerCommand(et,_2,Nc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Lc(o,n),null},yc=({enabledCollectionSlugs:t})=>t?.length?Qn(b2,{enabledCollectionSlugs:t}):Qn(k2,{});function _2(){return h2.error("No upload collections enabled"),!0}function F2(t){let e=t.target;return!!($c(e)&&!e.closest("code, span.editor-image")&&$c(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function B2(t){let e,o=A2(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var er=M2("INSERT_UPLOAD_COMMAND"),Dc=t=>{let e=T2(21),{clientProps:o}=t,[n]=S2(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l,uploads:!0},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=fo(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=N2(),{isModalOpen:h,openModal:f}=y2(),g;e[3]!==d||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(g=x=>{let{files:C}=x;if(C?.length!==0&&(u(k=>[...k??[],...C.map(P2)]),!h(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{n.update(j2)}),m(k=>{let T=new Map(k.map(H2));n.update(()=>{for(let I of Ac()){let N=I.node;if(ft(N)){let S=N.getData();if(S?.pending){let E=T.get(S.pending?.formID);E&&N.replace(xe({data:{id:new or.default().toHexString(),fields:{},relationTo:E.collectionSlug,value:E.doc.id}}))}}}})}),f(d)}},e[3]=d,e[4]=n,e[5]=i,e[6]=h,e[7]=f,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=g):g=e[13];let _=L2(g),L;e[14]!==n||e[15]!==_?(L=()=>{if(!n.hasNodes([ge]))throw new Error("UploadPlugin: UploadNode not registered on editor");return E2(n.registerNodeTransform(ge,x=>{let C=x.getData();if(!C?.pending)return;(async function(){let I=null,N=C?.pending?.src,S=C?.pending?.formID;if(N?.startsWith("data:")){let E=N.match(/data:(image\/[a-zA-Z]+);base64,/),w=E?E[1]:"image/png",v=N.replace(/^data:image\/[a-zA-Z]+;base64,/,""),y=atob(v),M=new Array(y.length);for(let F=0;F<y.length;F++)M[F]=y.charCodeAt(F);let A=new Uint8Array(M);I={alt:void 0,file:new File([A],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:S}}else if(N?.startsWith("http")||N?.startsWith("https")){let w=await(await fetch(N)).blob(),v=N.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];I={alt:void 0,file:new File([w],v,{type:w.type}),formID:S}}I&&_({files:[I]})})()}),n.registerCommand(er,x=>(n.update(()=>{let C=Rc()||vc();if(Ic(C)){let k=xe({data:{id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}}),{focus:T}=C,I=T.getNode();tr(k),nr(I)&&!I.__first&&I.remove()}}),!0),I2),n.registerCommand(D2,x=>{if(!(x instanceof ClipboardEvent))return!1;let C=x.clipboardData;if(!C?.types?.length||C?.types?.includes("text/html"))return!1;let k=[];return C?.files?.length&&Array.from(C.files).forEach(T=>{k.push({alt:"",file:T,formID:new or.default().toHexString()})}),k.length?(n.update(()=>{let T=Rc()||vc();if(Ic(T))for(let I of k){let N=xe({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:S}=T,E=S.getNode();tr(N),nr(E)&&!E.__first&&E.remove()}}),_({files:k}),!0):!1},Mc),n.registerCommand($2,x=>{if(!(x instanceof DragEvent))return!1;let C=x.dataTransfer;if(!C?.types?.length)return!1;let k=[];return C?.files?.length&&Array.from(C.files).forEach(T=>{k.push({alt:"",file:T,formID:new or.default().toHexString()})}),k.length?(x.preventDefault(),x.stopPropagation(),n.update(()=>{if(F2(x)){let T=B2(x),I=v2();T!=null&&I.applyDOMRange(T),R2(I);for(let N of k){let S=xe({data:{pending:{formID:N.formID,src:URL.createObjectURL(N.file)}}}),{focus:E}=I,w=E.getNode();tr(S),nr(w)&&!w.__first&&w.remove()}}}),_({files:k}),!0):!1},Mc))},e[14]=n,e[15]=_,e[16]=L):L=e[16];let R;e[17]!==n?(R=[n],e[17]=n,e[18]=R):R=e[18],O2(L,R);let b;return e[19]!==i?(b=w2(yc,{enabledCollectionSlugs:i}),e[19]=i,e[20]=b):b=e[20],b};function P2(t){return{file:t.file,formID:t.formID}}function j2(){for(let t of Ac()){let e=t.node;ft(e)&&e.getData()?.pending&&e.remove()}}function H2(t){return[t.formID,t]}var G2=$({nodes:[ge],plugins:[{Component:Dc,position:"normal"}],slashMenu:{groups:[X([{Icon:qn,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:qn,isActive:({selection:t})=>{if(!U2(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ft(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{c as W2}from"react/compiler-runtime";import{jsx as Ro}from"react/jsx-runtime";import{createElement as z2}from"react";import{ShimmerEffect as K2,useConfig as J2}from"@payloadcms/ui";import{lazy as X2,Suspense as Z2,useEffect as Y2,useState as q2}from"react";var Oc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var rr={namespace:"lexical",theme:Oc};function Fc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:i,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as V2}from"payload/shared";var Bc=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?V2(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function lr(t,e,o,n){return{admin:o,features:Bc(t),lexical:e,resolvedFeatureMap:t,view:n}}var Q2=X2(()=>import("./Field-G5Z2HM5Y.js").then(t=>({default:t.RichText}))),ex=t=>Ro(Po,{inheritable:!0,views:t.views,children:Ro(tx,{...t})}),tx=t=>{let e=W2(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let p=m,h=i===void 0?rr:i,{currentView:f}=jo(),g=c?.[f]?.admin??a,_=c?.[f]?.lexical,L;e[4]!==h||e[5]!==_?(L=typeof _=="function"?_(h):_??h,e[4]=h,e[5]=_,e[6]=L):L=e[6];let R=L,{config:b}=J2(),[x,C]=q2(null),k,T;e[7]!==n||e[8]!==b||e[9]!==f||e[10]!==g||e[11]!==R||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==x||e[16]!==d||e[17]!==c?(k=()=>{if(x&&x.view===f)return;let N=c?.[f],S=N?.filterFeatures?N.filterFeatures(n):n,E=[];for(let v of Object.values(S))v.clientFeatureProvider&&E.push(v.clientFeatureProvider(v.clientFeatureProps));let w=Fc({config:b,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:E,lexical:R}});C(lr(w,R,g,f))},T=[g,n,b,p,l,s,x,R,d,f,c],e[7]=n,e[8]=b,e[9]=f,e[10]=g,e[11]=R,e[12]=p,e[13]=l,e[14]=s,e[15]=x,e[16]=d,e[17]=c,e[18]=k,e[19]=T):(k=e[18],T=e[19]),Y2(k,T);let I;return e[20]!==x||e[21]!==t?(I=Ro(Z2,{fallback:Ro(K2,{height:"35vh"}),children:x&&z2(Q2,{...t,editorConfig:x,key:x.view})}),e[20]=x,e[21]=t,e[22]=I):I=e[22],I};function ox(t){return t instanceof HTMLElement}function nx(...t){return t.filter(Boolean).join(" ")}var Io=new WeakMap;function Pc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mo(t,e){let o=Io.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Pc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=Pc(s);for(let c of n)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},Io.set(t,o)}return o.listeners.add(e),()=>{rx(t,e)}}function rx(t,e){let o=Io.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Io.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function lx(t,e){return Mo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function ix(t,e){return Mo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function sx(t,e){return Mo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function ax(t,e){return Mo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as cx}from"react/compiler-runtime";import{jsx as ux}from"react/jsx-runtime";import"react";var dx=()=>{let t=cx(2),{EditButton:e}=ke(),o;return t[0]!==e?(o=e?ux(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as mx}from"react/compiler-runtime";import{jsx as px}from"react/jsx-runtime";import"react";var fx=()=>{let t=mx(2),{RemoveButton:e}=ke(),o;return t[0]!==e?(o=e?px(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as hx}from"react/compiler-runtime";import{jsx as gx}from"react/jsx-runtime";import"react";var xx=()=>{let t=hx(2),{Label:e}=ke(),o;return t[0]!==e?(o=e?gx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Cx}from"react/compiler-runtime";import{jsx as bx}from"react/jsx-runtime";import"react";var kx=t=>{let e=Cx(3),{children:o}=t,{InlineBlockContainer:n}=ke(),r;return e[0]!==n||e[1]!==o?(r=n?bx(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as _x}from"react/jsx-runtime";import"react";var Tx=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?_x(n,{...o,children:e}):null};import{c as wx}from"react/compiler-runtime";import{jsx as Sx}from"react/jsx-runtime";import"react";var Ex=()=>{let t=wx(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?Sx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Nx}from"react/compiler-runtime";import{jsx as Lx}from"react/jsx-runtime";import"react";var yx=()=>{let t=Nx(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?Lx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as vx}from"qs-esm";var Rx=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let d=vx({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var jc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
58
+ `,Hs="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Us="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",m0=new RegExp("^[^"+Us+"]*["+Hs+"]"),f0=new RegExp("^[^"+Hs+"]*["+Us+"]"),h0={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},g0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},x0={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},C0={[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"},b0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},k0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Gs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ke("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ke("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ke("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ke("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ke("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ke("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ke("sup",{children:e})),e}};import{jsx as $t}from"react/jsx-runtime";var Vs={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return $t("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return $t("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 d=i?.url;l.push($t("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push($t("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),$t("picture",{children:l})}};var ct={...Ps,...Gs,...As,...Is,...js,...Ms,...$s,...Fs,...Os({}),...Vs,...Bs};import{jsx as mo,Fragment as _0}from"react/jsx-runtime";import po from"react";function Ws(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 T0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return mo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function zs(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 mo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function w0(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]=zs(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]=zs(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=T0(r))}return e}function Ks({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(Ws(e)){let l=r?w0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Js({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return mo(_0,{})}function Js({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,d)=>{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 c;u?c=typeof u=="function"?u({childIndex:d,converters:t,node:i,nodesToJSX:m=>Js({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...i,parent:r}}),parent:r}):u:c=mo("span",{children:"unknown node"},d);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(c)){if(a.textAlign||a.paddingInlineStart){let p={...a,...c?.props?.style??{}};return po.cloneElement(c,{key:d,style:p})}return po.cloneElement(c,{key:d})}return c}catch(c){return console.error("Error converting lexical node to JSX:",c,"node:",i),null}}).filter(Boolean)}function Ln({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i=e,d={};i?typeof i=="function"?d=i({defaultConverters:ct}):d=i:d=ct;let u=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Ks({converters:d,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Xs(S0,{children:u}):Xs("div",{className:t??"payload-richtext",children:u})}function Ys(){let t=E0(7),[e]=N0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=y0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:u}=d;r(u.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),L0(l,s);let i;return t[5]!==n?(i=Zs("div",{className:"debug-jsx-converter",children:Zs(Ln,{converters:ct,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var v0=$({plugins:[{Component:Ys,position:"bottom"}]});var H={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},R0={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Ch}from"lexical";import{jsx as qs}from"react/jsx-runtime";import"react";var I0="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",yn=({className:t})=>qs("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:qs("path",{d:I0,fill:"currentColor"})});import{jsx as O0}from"react/jsx-runtime";import{$applyNodeReplacement as F0}from"lexical";import*as ea from"react";import{DecoratorBlockNode as M0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as $0}from"@lexical/utils";import{$applyNodeReplacement as A0}from"lexical";function D0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Qs({relationTo:o,value:e})}:null}var At=class extends M0{__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:D0,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=Qs(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return $0(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 Qs(t){return A0(new At({data:t}))}var P0=ea.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function B0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Je({relationTo:o,value:e})}:null}var Le=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:B0,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=Je(o);return n.setFormat(e.format),n}decorate(e,o){return O0(P0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Je(t){return F0(new Le({data:t}))}function vn(t){return t instanceof Le}import{c as ih}from"react/compiler-runtime";import{jsx as sh}from"react/jsx-runtime";import{useLexicalComposerContext as ah}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ch}from"@lexical/utils";import{$getPreviousSelection as uh,$getSelection as dh,$isParagraphNode as ph,$isRangeSelection as mh,COMMAND_PRIORITY_EDITOR as fh,createCommand as hh}from"lexical";import{useEffect as gh}from"react";import{c as na}from"react/compiler-runtime";import{jsx as Rn}from"react/jsx-runtime";import{useLexicalComposerContext as ra}from"@lexical/react/LexicalComposerContext.js";import{toast as Y0}from"@payloadcms/ui";import{$getNodeByKey as q0,COMMAND_PRIORITY_EDITOR as la}from"lexical";import{useEffect as ia,useState as Q0}from"react";import{c as j0}from"react/compiler-runtime";import{jsx as H0}from"react/jsx-runtime";import{useLexicalComposerContext as U0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as G0,useModal as V0}from"@payloadcms/ui";import{$getNodeByKey as ta,$getPreviousSelection as W0,$getRoot as z0,$getSelection as K0,$isRangeSelection as J0,$setSelection as X0}from"lexical";import{useEffect as Z0,useState as oa}from"react";var Dt=t=>{let e=j0(23),[o]=U0(),[n,r]=oa(null),[l,s]=oa(!1),[i,d,u]=G0(t),{closeDrawer:c,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=u,{modalState:h}=V0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let L=K0()??W0();r(L)},e[0]=f):f=e[0];let g=f,_;e[1]!==o||e[2]!==n?(_=()=>{n&&o.update(()=>{if(J0(n)){let{anchor:L,focus:E}=n;ta(L.key)&&ta(E.key)&&X0(n.clone())}else z0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=_):_=e[3];let S=_,R;e[4]!==c?(R=()=>{c()},e[4]=c,e[5]=R):R=e[5];let b=R,x,C;e[6]!==a||e[7]!==h||e[8]!==S||e[9]!==l?(x=()=>{if(!l)return;let L=h[a];L&&!L?.isOpen&&(s(!1),setTimeout(()=>{S()},1))},C=[h,a,S,l],e[6]=a,e[7]=h,e[8]=S,e[9]=l,e[10]=x,e[11]=C):(x=e[10],C=e[11]),Z0(x,C);let k;e[12]!==d?(k=L=>H0(d,{...L,onClick:()=>{g()}}),e[12]=d,e[13]=k):k=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]!==b||e[18]!==p||e[19]!==a||e[20]!==k||e[21]!==T?(I={closeListDrawer:b,isListDrawerOpen:p,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:T},e[16]=i,e[17]=b,e[18]=p,e[19]=a,e[20]=k,e[21]=T,e[22]=I):I=e[22],I};var eh=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=q0(o);r&&r.replace(Je({relationTo:e,value:n}))}):t.dispatchCommand(In,{relationTo:e,value:n})},th=t=>{let e=na(14),{enabledCollectionSlugs:o}=t,[n]=ra(),[r,l]=Q0(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:d,ListDrawer:u,openListDrawer:c}=Dt(i),a,p;e[3]!==n||e[4]!==c?(a=()=>n.registerCommand(Qe,g=>(l(g?.replace?g?.replace.nodeKey:null),c(),!0),la),p=[n,c],e[3]=n,e[4]=c,e[5]=a,e[6]=p):(a=e[5],p=e[6]),ia(a,p);let m;e[7]!==d||e[8]!==n||e[9]!==r?(m=g=>{let{collectionSlug:_,doc:S}=g;eh({editor:n,relationTo:_,replaceNodeKey:r,value:S.id}),d()},e[7]=d,e[8]=n,e[9]=r,e[10]=m):m=e[10];let h=m,f;return e[11]!==u||e[12]!==h?(f=Rn(u,{onSelect:h}),e[11]=u,e[12]=h,e[13]=f):f=e[13],f},oh=()=>{let t=na(3),[e]=ra(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Qe,nh,la),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ia(o,n),null},sa=({enabledCollectionSlugs:t})=>t?.length?Rn(th,{enabledCollectionSlugs:t}):Rn(oh,{});function nh(){return Y0.error("No relationship collections enabled"),!0}import{useConfig as rh,useEntityVisibility as lh}from"@payloadcms/ui";import*as ca from"react";var aa=(t,{disabledCollections:e,enabledCollections:o,uploads:n,visibleSlugs:r})=>{let l=o?.length?new Set(o):null,s=e?.length?new Set(e):null;return t.filter(i=>{let{slug:d,admin:u,upload:c}=i;if(r&&!r.includes(d))return!1;if(n){if(!u?.enableRichTextRelationship||!c)return!1}else if(c||!u?.enableRichTextRelationship)return!1;return!(l&&!l.has(d)||s&&s.has(d))})};var fo=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:n=!1}=t||{},{config:{collections:r}}=rh(),{visibleEntities:l}=lh();return ca.useMemo(()=>{let s=aa(r,{disabledCollections:e,enabledCollections:o,uploads:n,visibleSlugs:l?.collections});return{enabledCollections:s,enabledCollectionSlugs:s.map(i=>i.slug)}},[r,l,n,o,e])};var In=hh("INSERT_RELATIONSHIP_COMMAND"),ua=t=>{let e=ih(8),{clientProps:o}=t,[n]=ah(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=fo(s),d,u;e[3]!==n?(d=()=>{if(!n.hasNodes([Le]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(In,xh,fh)},u=[n],e[3]=n,e[4]=d,e[5]=u):(d=e[4],u=e[5]),gh(d,u);let c;return e[6]!==i?(c=sh(sa,{enabledCollectionSlugs:i}),e[6]=i,e[7]=c):c=e[7],c};function xh(t){let e=dh()||uh();if(mh(e)){let o=Je(t),{focus:n}=e,r=n.getNode();ch(o),ph(r)&&!r.__first&&r.remove()}return!0}var bh=$({nodes:[Le],plugins:[{Component:ua,position:"normal"}],slashMenu:{groups:[X([{Icon:yn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:yn,isActive:({selection:t})=>{if(!Ch(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]}});import{c as Kh}from"react/compiler-runtime";import{jsx as he,jsxs as Jh}from"react/jsx-runtime";import{useLexicalComposerContext as Xh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as ka}from"@lexical/react/useLexicalEditable";import{useScrollInfo as Zh,useThrottledEffect as Yh,useTranslation as qh}from"@payloadcms/ui";import*as Co from"react";import{useMemo as On}from"react";import{jsx as kh,jsxs as _h}from"react/jsx-runtime";import{Tooltip as Th,useTranslation as wh}from"@payloadcms/ui";import{$addUpdateTag as Sh}from"lexical";import{useCallback as da,useEffect as Eh,useMemo as pa,useRef as Nh,useState as Lh}from"react";var Mn="toolbar-popup__button",Ot=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=wh(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=G(),[d,u]=Lh(!1),c=Nh(null);Eh(()=>{c.current?.removeAttribute("data-pressing")},[t]);let a=pa(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,f=>f.toUpperCase()),[s,l,i,r]),p=pa(()=>[Mn,n?"":"disabled",t?"active":"",r.key?`${Mn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),m=da(()=>{n&&o.focus(()=>{o.update(()=>{Sh("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=da(f=>{f.preventDefault(),f.currentTarget.setAttribute("data-pressing","")},[]);return _h("button",{"aria-label":a,className:p,"data-button-key":r.key,disabled:!n,onClick:m,onMouseDown:h,onPointerEnter:()=>u(!0),onPointerLeave:()=>{u(!1),c.current?.removeAttribute("data-pressing")},ref:c,type:"button",children:[kh(Th,{className:`${Mn}__tooltip`,show:d,children:a}),e]})};import{c as Ah}from"react/compiler-runtime";import{jsx as ut}from"react/jsx-runtime";import Dh,{useMemo as Oh}from"react";import{useTranslation as Fh}from"@payloadcms/ui";import{jsx as Ae,jsxs as ma}from"react/jsx-runtime";import{Button as yh}from"@payloadcms/ui";import{$addUpdateTag as vh,isDOMNode as Rh}from"lexical";import ho,{useCallback as Ih,useEffect as go,useMemo as ha,useRef as $n,useState as An}from"react";import{createPortal as Mh}from"react-dom";var fa="toolbar-popup__dropdown-item",ga=ho.createContext(null);function xa({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let d=ha(()=>[fa,n===!1?"disabled":"",t?"active":"",l?.key?`${fa}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),u=$n(null),c=ho.use(ga);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=c;return go(()=>{u?.current!=null&&a(u)},[u,a]),Ae(yh,{"aria-label":i,buttonStyle:"ghost",className:d,disabled:n===!1,extraButtonProps:{"data-item-key":s},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{vh("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:u,tooltip:i,type:"button",children:e})}function $h({children:t,dropdownKey:e,dropDownRef:o,itemsContainerClassNames:n,onClose:r}){let[l,s]=An(),[i,d]=An(),u=Ih(p=>{s(m=>m!=null?[...m,p]:[p])},[s]),c=p=>{if(l==null)return;let{key:m}=p;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&p.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?d(h=>{if(h==null)return l[0];let f=l.indexOf(h)-1;return l[f===-1?l.length-1:f]}):m==="ArrowDown"&&d(h=>h==null?l[0]:l[l.indexOf(h)+1])},a=ha(()=>({registerItem:u}),[u]);return go(()=>{l!=null&&i==null&&d(l[0]),i!=null&&i?.current!=null&&i.current.focus()},[l,i]),Ae(ga,{value:a,children:Ae("div",{className:(n??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":e,"data-theme":"dark",onKeyDown:c,ref:o,children:t})})}function Ca({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let u=$n(null),c=$n(null),[a,p]=An(!1),m=()=>{p(!1),c?.current!=null&&c.current.focus()};go(()=>{let f=c.current,g=u.current;if(a&&f!==null&&g!==null){let{left:_,top:S}=f.getBoundingClientRect(),R=window.scrollY||document.documentElement.scrollTop;g.style.top=`${S+R+f.offsetHeight+5}px`,g.style.left=`${Math.min(_-5,window.innerWidth-g.offsetWidth-20)}px`}},[u,c,a]),go(()=>{let f=c.current;if(f!==null&&a){let g=_=>{let S=_.target;Rh(S)&&(d&&u.current&&u.current.contains(S)||f.contains(S)||p(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[u,c,a,d]);let h=Mh(Ae($h,{dropdownKey:r,dropDownRef:u,itemsContainerClassNames:s,onClose:m,children:o}),document.body);return ma(ho.Fragment,{children:[ma("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":r,disabled:n,onClick:f=>{f.preventDefault(),p(!a)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[l&&Ae(l,{}),i&&Ae("span",{className:"toolbar-popup__dropdown-label",children:i}),Ae("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Ae(ho.Fragment,{children:h})]})}var Dn="toolbar-popup__dropdown",Ph=t=>{let e=Ah(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:d}=Fh(),{fieldProps:u}=G(),{featureClientSchemaMap:c,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&&ut(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let p;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==d||e[11]!==s||e[12]!==i||e[13]!==a){let m=i.key,h;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:d,schemaPath:a}):i.label),m.length>25?h=m.substring(0,25)+"...":h=m,p=ut(xa,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?ut(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?m:void 0,children:ut("span",{className:"text",children:h})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=c,e[10]=d,e[11]=s,e[12]=i,e[13]=a,e[14]=p}else p=e[14];return p},Bh=Dh.memo(Ph),Ft=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:u}=n,c=Oh(()=>d?.length?d.map(a=>ut(Bh,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[d,r.activeItemKeys,r.enabledItemKeys,t,o]);return ut(Ca,{buttonAriaLabel:`${u} dropdown`,buttonClassName:[Dn,`${Dn}-${u}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:u,Icon:l,itemsContainerClassNames:[`${Dn}-items`,...s||[]],label:i,children:c},u)};import{mergeRegister as jh}from"@lexical/utils";import{$getSelection as Hh}from"lexical";import{useCallback as Uh,useDeferredValue as Gh,useEffect as Vh,useRef as ba,useState as Wh}from"react";function zh(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function xo(t,e){let[o,n]=Wh(()=>zh(e)),r=Gh(o),l=G(),s=ba(l);s.current=l;let i=ba(e);i.current=e;let d=Tr(),u=Uh(()=>{t.getEditorState().read(()=>{let c=Hh();if(!c)return;let a=i.current;if(!a?.length)return;let p=s.current,m=new Map,h=new Map;for(let f of a){let g=[],_=[],S=[],R=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let x of f.items){let C=x.isActive?(!R||g.length<R)&&x.isActive({editor:t,editorConfigContext:p,selection:c}):!1,k=x.isEnabled?x.isEnabled({editor:t,editorConfigContext:p,selection:c}):!0;C&&(g.push(x.key),_.push(x)),k&&S.push(x.key),m.set(x.key,{active:C,enabled:k})}let b=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:p,selection:c}):!0;h.set(f.key,{activeItemKeys:g,activeItems:_,enabledGroup:b,enabledItemKeys:S})}n({groupStates:h,itemStates:m})})},[t]);return Vh(()=>{d(u);let c=()=>d(u),a=jh(t.registerUpdateListener(c));return document.addEventListener("mouseup",c),()=>{a(),document.removeEventListener("mouseup",c)}},[t,d,u]),r}function Qh({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&he(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?he(Ot,{active:t,editor:o,enabled:n,item:r,children:he(r.ChildComponent,{})},r.key):null}function e5({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=qh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=G(),u=l.groupStates.get(n.key),c=On(()=>{if(n.type!=="dropdown")return;let p=u?.activeItems?.[0];return p?p.ChildComponent:n.ChildComponent},[n,u?.activeItems]),a=On(()=>{if(n.type!=="dropdown")return;let p=u?.activeItems;if(!p?.length)return;if(p.length>1)return s.t("lexical:general:toolbarItemsActive",{count:p.length});let m=p[0],h=m.key;return m.label&&(h=typeof m.label=="function"?m.label({featureClientSchemaMap:i,i18n:s,schemaPath:d}):m.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,u?.activeItems,s,i,d]);return Jh("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(Ft,{anchorElem:t,editor:e,group:n,groupState:u,Icon:c,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(p=>{let m=l.itemStates.get(p.key);return he(Qh,{active:m?.active??!1,anchorElem:t,editor:e,enabled:m?.enabled??!0,item:p},p.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&he("div",{className:"divider"})]},n.key)}function t5({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=Co.useRef(null),s=ka(),{y:i}=Zh(),d=xo(o,n?.features?.toolbarFixed?.groups),u=On(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return Yh(()=>{if(!u)return;let c=l.current;if(!c)return;let a=c.getBoundingClientRect(),p=u.getBoundingClientRect();if(!(a.bottom<p.top||a.top>p.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),u.classList.remove("fixed-toolbar"),u.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"),u.classList.remove("fixed-toolbar--hide"),u.classList.add("fixed-toolbar")}},50,[l,u,i]),he("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&he(Co.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((c,a)=>he(e5,{anchorElem:t,editor:o,editorConfig:n,group:c,index:a,toolbarStates:d},c.key))})})}var _a=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return _a(t.parentEditor)}return!1},Ta=t=>{let e=Kh(6),{clientProps:o}=t,[n]=Xh(),r=G();if(!ka())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,d=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,u,c;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==r){c=Symbol.for("react.early_return_sentinel");e:{let a=_a(r);if(o?.disableIfParentHasFixedToolbar&&a){c=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){c=null;break e}u=he(t5,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=r,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var o5=$({plugins:[{Component:Ta,position:"aboveContainer"}]});import{c as n5}from"react/compiler-runtime";import{jsx as ye,jsxs as Ea}from"react/jsx-runtime";import{useLexicalComposerContext as r5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as l5}from"@lexical/react/useLexicalEditable";import{mergeRegister as Na}from"@lexical/utils";import{$getSelection as La,$isRangeSelection as wa,$isTextNode as i5,COMMAND_PRIORITY_LOW as s5,getDOMSelection as ya,SELECTION_CHANGE_COMMAND as a5}from"lexical";import{useCallback as ko,useEffect as Pt,useMemo as c5,useRef as Sa,useState as u5}from"react";import"react";import{createPortal as d5}from"react-dom";function Fn(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function bo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:u=10}=t,c=o.parentElement;if(d===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),p=o.getBoundingClientRect(),m=c.getBoundingClientRect(),h=d.top-a.height-u,f=d.left-l;s==="center"&&(f=d.left+d.width/2-a.width/2);let g=0;return!e&&h<m.top&&!i&&(g=a.height+d.height+u*2,h+=g),s==="center"?f+a.width>m.right?f=m.right-a.width-l:f<m.left&&(f=m.left+l):f+a.width>m.right&&(f=m.right-a.width-l),f-=p.left,r.style.opacity="1",i&&n!==0?(h-=p.bottom-n+a.height-3,r.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=p.top,r.style.transform=`translate(${f}px, ${h}px)`),g}function p5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&ye(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?ye(Ot,{active:t,editor:o,enabled:n,item:r,children:ye(r.ChildComponent,{})},r.key):null}function m5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=G(),s=r.groupStates.get(o.key),i=c5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return Ea("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?ye(Ft,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let u=r.itemStates.get(d.key);return ye(p5,{active:u?.active??!1,anchorElem:t,editor:e,enabled:u?.enabled??!0,item:d},d.key)}):null,n<l.features.toolbarInline?.groups.length-1&&ye("div",{className:"divider"})]},o.key)}function f5({anchorElem:t,editor:e}){let o=Sa(null),n=Sa(null),{editorConfig:r}=G(),l=xo(e,r?.features?.toolbarInline?.groups),s=ko(()=>{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=ko(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let a=o.current.style.opacity==="0",p=o.current.style.pointerEvents==="none";if(!a||!p){let m=c.clientX,h=c.clientY,f=document.elementFromPoint(m,h);o.current.contains(f)||s()}}},[s]),d=ko(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Pt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let u=ko(()=>{let c=La(),a=ya(e._window);if(o.current===null)return;let p=t.querySelector(":scope > .link-editor"),m=p!==null&&"style"in p&&p?.style?.opacity==="1",h=e.getRootElement();if(c!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Fn(a,h),g=bo({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&bo({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Pt(()=>{let c=t.parentElement,a=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",a),c&&c.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),c&&c.removeEventListener("scroll",a)}},[e,u,t]),Pt(()=>(e.getEditorState().read(()=>{u()}),Na(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(a5,()=>(u(),!1),s5))),[e,u]),Ea("div",{className:"inline-toolbar-popup",ref:o,children:[ye("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,a)=>ye(m5,{anchorElem:t,editor:e,group:c,index:a,toolbarStates:l},c.key))]})}function h5(t,e){let o=n5(12),[n,r]=u5(!1),l=l5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=La(),h=ya(t._window),f=t.getRootElement();if(h!==null&&(!wa(m)||f===null||!f.contains(h.anchorNode))){r(!1);return}if(!wa(m))return;if(m.getTextContent()!==""){let _=m.getNodes(),S=!1;for(let R of _)if(i5(R)){r(!0),S=!0;break}S||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,d,u;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=d,o[4]=u):(d=o[3],u=o[4]),Pt(d,u);let c,a;if(o[5]!==t||o[6]!==i?(c=()=>Na(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=a):(c=o[7],a=o[8]),Pt(c,a),!n||!l)return null;let p;return o[9]!==e||o[10]!==t?(p=d5(ye(f5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=p):p=o[11],p}var va=t=>{let{anchorElem:e}=t,[o]=r5();return h5(o,e)};var g5=$({plugins:[{Component:va,position:"floatingAnchorElem"}]});import{TableCellNode as i2,TableNode as s2,TableRowNode as a2}from"@lexical/table";import{jsx as Ra}from"react/jsx-runtime";import"react";var x5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Pn=({className:t,size:e=24})=>Ra("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ra("path",{clipRule:"evenodd",d:x5[e],fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as C5,$createTableNode as b5,$createTableRowNode as k5,$isTableCellNode as Ia,$isTableNode as Bn,$isTableRowNode as jn,TableCellHeaderStates as _o,TableCellNode as _5,TableNode as T5,TableRowNode as w5}from"@lexical/table";import{$isParagraphNode as S5,$isTextNode as E5}from"lexical";var $a=/^\|(.+)\|\s?$/,N5=/^(\| ?:?-*:? ?)+\|\s?$/,Aa=({allTransformers:t})=>({type:"element",dependencies:[T5,w5,_5],export:e=>{if(!Bn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!jn(n))continue;let l=!1;for(let s of n.getChildren())Ia(s)&&(r.push(zt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===_o.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
59
+ `)},regExp:$a,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(N5.test(r)){let a=e.getPreviousSibling();if(!a||!Bn(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!jn(m))return;m.getChildren().forEach(h=>{Ia(h)&&h.setHeaderStyles(_o.ROW,_o.ROW)}),e.remove();return}let l=Ma(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!S5(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!E5(a))break;let p=Ma(a.getTextContent(),t);if(p==null)break;d=Math.max(d,p.length),s.unshift(p);let m=i.getPreviousSibling();i.remove(),i=m}let u=b5();for(let a of s){let p=k5();u.append(p);for(let m=0;m<d;m++)p.append(m<a.length?a[m]:Da("",t))}let c=e.getPreviousSibling();Bn(c)&&L5(c)===d?(c.append(...u.getChildren()),e.remove()):e.replace(u),u.selectEnd()}});function L5(t){let e=t.getFirstChild();return jn(e)?e.getChildrenSize():0}var Da=(t,e)=>{t=t.replace(/\\n/g,`
60
+ `);let o=C5(_o.NO_STATUS);return Wt(t,e,o),o},Ma=(t,e)=>{let o=t.match($a);return!o||!o[1]?null:o[1].split("|").map(n=>Da(n,e))};import{c as v5}from"react/compiler-runtime";import{jsx as j,jsxs as ve}from"react/jsx-runtime";import{useLexicalComposerContext as Ha}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as R5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Pa,$deleteTableColumnAtSelection as I5,$deleteTableRowAtSelection as M5,$getNodeTriplet as $5,$getTableCellNodeFromLexicalNode as Ba,$getTableColumnIndexFromTableCellNode as A5,$getTableNodeFromLexicalNodeOrThrow as Oe,$getTableRowIndexFromTableCellNode as D5,$insertTableColumnAtSelection as O5,$insertTableRowAtSelection as F5,$isTableCellNode as Ua,$isTableSelection as Bt,$mergeCells as P5,$unmergeCell as B5,getTableElement as Hn,getTableObserverFromTableElement as Un,TableCellHeaderStates as De,TableCellNode as j5}from"@lexical/table";import{mergeRegister as H5}from"@lexical/utils";import{useScrollInfo as U5}from"@payloadcms/ui";import{$getSelection as wo,$isElementNode as G5,$isRangeSelection as Gn,$isTextNode as V5,$setSelection as W5,COMMAND_PRIORITY_CRITICAL as z5,getDOMSelection as K5,isDOMNode as J5,SELECTION_CHANGE_COMMAND as X5}from"lexical";import*as Vn from"react";import{useCallback as de,useEffect as dt,useRef as To,useState as pt}from"react";import{createPortal as Ga}from"react-dom";import{jsx as Oa}from"react/jsx-runtime";import"react";var y5={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"},Fa=({className:t,size:e=24})=>Oa("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Oa("path",{clipRule:"evenodd",d:y5[e],fill:"currentColor",fillRule:"evenodd"})});function ja(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Z5(){let t=wo();if(Gn(t)&&!t.isCollapsed()||Bt(t)&&!t.anchor.is(t.focus)||!Gn(t)&&!Bt(t))return!1;let[e]=$5(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Y5(t){let e=t.getLastDescendant();V5(e)?e.select():G5(e)?e.selectEnd():e!==null&&e.selectNext()}function q5({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Ha(),s=To(null),[i,d]=pt(r),[u,c]=pt({columns:1,rows:1}),[a,p]=pt(!1),[m,h]=pt(!1),{y:f}=U5();dt(()=>l.registerMutationListener(j5,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),dt(()=>{l.getEditorState().read(()=>{let w=wo();if(Bt(w)){let v=ja(w);c(ja(w)),p(v.columns>1||v.rows>1)}h(Z5())})},[l]),dt(()=>{let w=e.current,v=s.current,y=l.getRootElement();if(w!=null&&v!=null&&y!=null){let M=y.getBoundingClientRect(),A=w.getBoundingClientRect();v.style.opacity="1";let D=v.getBoundingClientRect(),F=5,P=A.right+F;if(P+D.width>window.innerWidth||P+D.width>M.right){let J=A.left-D.width-F;P=(J<0?F:J)+window.pageXOffset}v.style.left=`${P+window.pageXOffset}px`;let Y=A.top;if(Y+D.height>window.innerHeight){let J=A.bottom-D.height;Y=J<0?F:J}v.style.top=`${Y}px`}},[e,s,l,f]),dt(()=>{function w(v){s.current!=null&&e.current!=null&&J5(v.target)&&!s.current.contains(v.target)&&!e.current.contains(v.target)&&n(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[n,e]);let g=de(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i),v=Hn(w,l.getElementByKey(w.getKey()));if(v===null)throw new Error("Expected to find tableElement in DOM");let y=Un(v);y!==null&&y.$clearHighlight(),w.markDirty(),d(i.getLatest())}W5(null)})},[l,i]),_=()=>{l.update(()=>{let w=wo();if(!Bt(w))return;let y=w.getNodes().filter(Ua),M=P5(y);M&&(Y5(M),o())})},S=()=>{l.update(()=>{B5()})},R=de(w=>{l.update(()=>{for(let v=0;v<u.rows;v++)F5(w);o()})},[l,o,u.rows]),b=de(w=>{l.update(()=>{for(let v=0;v<u.columns;v++)O5(w);o()})},[l,o,u.columns]),x=de(()=>{l.update(()=>{M5(),o()})},[l,o]),C=de(()=>{l.update(()=>{Oe(i).remove(),g(),o()})},[l,i,g,o]),k=de(()=>{l.update(()=>{I5(),o()})},[l,o]),T=de(()=>{l.update(()=>{let w=Oe(i),v=D5(i),[y]=Pa(w,null,null),M=new Set,A=i.getHeaderStyles()^De.ROW;if(y[v])for(let D=0;D<y[v].length;D++){let F=y[v][D];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles(A,De.ROW)))}g(),o()})},[l,i,g,o]),I=de(()=>{l.update(()=>{let w=Oe(i),v=A5(i),[y]=Pa(w,null,null),M=new Set,A=i.getHeaderStyles()^De.COLUMN;if(y)for(let D=0;D<y.length;D++){let F=y?.[D]?.[v];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles(A,De.COLUMN)))}g(),o()})},[l,i,g,o]),L=de(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),E=de(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),N=null;return t&&(a?N=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):m&&(N=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>S(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),Ga(ve("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[N?ve(Vn.Fragment,{children:[N,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>L(),type:"button",children:j("span",{className:"text",children:"Toggle row striping"})}),j("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>E(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>R(!1),type:"button",children:ve("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:()=>R(!0),type:"button",children:ve("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:()=>b(!1),type:"button",children:ve("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:()=>b(!0),type:"button",children:ve("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:()=>k(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>x(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:ve("span",{className:"text",children:[(i.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:ve("span",{className:"text",children:[(i.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Q5({anchorElem:t,cellMerge:e}){let[o]=Ha(),n=To(null),r=To(null),[l,s]=pt(!1),[i,d]=pt(null),u=de(()=>{let a=n.current,p=wo(),m=K5(o._window),h=document.activeElement;function f(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(p==null||a==null)return f();let g=o.getRootElement(),_=null,S=null;if(Gn(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let b=Ba(p.anchor.getNode());if(b==null||(S=o.getElementByKey(b.getKey()),S==null||!b.isAttached()))return f();let x=Oe(b),C=Hn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Un(C),d(b)}else if(Bt(p)){let b=Ba(p.anchor.getNode());if(!Ua(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let x=Oe(b),C=Hn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Un(C),S=o.getElementByKey(b.getKey())}else if(!h)return f();if(_===null||S===null)return f();let R=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",R),a.classList.toggle("table-cell-action-button-container--inactive",!R),R){let b=S.getBoundingClientRect(),x=t.getBoundingClientRect(),C=b.top-x.top,k=b.right-x.left;a.style.transform=`translate(${k}px, ${C}px)`}},[o,t]);dt(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(u)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return H5(o.registerUpdateListener(m),o.registerCommand(X5,m,z5),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",m),h&&(h.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let c=To(i);return dt(()=>{c.current!==i&&s(!1),c.current=i},[c,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&ve(Vn.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(Fa,{})}),l&&j(q5,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Va=t=>{let e=v5(3),{anchorElem:o}=t,n=R5(),r;return e[0]!==o||e[1]!==n?(r=Ga(n?j(Q5,{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 eg}from"react/compiler-runtime";import{jsx as Eo,jsxs as tg}from"react/jsx-runtime";import{useLexicalComposerContext as og}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ng}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as rg,$getTableNodeFromLexicalNodeOrThrow as Wn,$getTableRowIndexFromTableCellNode as lg,$isTableCellNode as Wa,$isTableRowNode as ig,getDOMCellFromTarget as sg,getTableElement as ag,TableNode as za}from"@lexical/table";import{calculateZoomLevel as Ka,mergeRegister as cg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as zn,isHTMLElement as ug,SKIP_SCROLL_INTO_VIEW_TAG as Ja}from"lexical";import*as Za from"react";import{useCallback as jt,useEffect as Kn,useRef as So,useState as mt}from"react";import{createPortal as dg}from"react-dom";var pg=33,Xa=92;function mg({editor:t}){let e=So(null),o=So(null),n=So(null),[r,l]=mt(!1),s=G(),i=So(null),[d,u]=mt(null),[c,a]=mt(null),[p,m]=mt(!1),[h,f]=mt(null),g=jt(()=>{a(null),e.current=null,f(null),i.current=null,n.current=null},[]),_=E=>(E.buttons&1)===1;Kn(()=>{let E=new Set;return cg(t.registerMutationListener(za,N=>{for(let[w,v]of N)v==="destroyed"?E.delete(w):E.add(w);l(E.size>0)}),t.registerNodeTransform(za,N=>{if(N.getColWidths())return N;let w=N.getColumnCount(),v=Xa;return N.setColWidths(Array(w).fill(v)),N}))},[t]),Kn(()=>{if(!r)return;let E=y=>{let M=y.target;if(ug(M)){if(h){u({x:y.clientX,y:y.clientY});return}if(m(_(y)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let A=sg(M);A&&c!==A?t.getEditorState().read(()=>{let D=zn(A.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let F=Wn(D),P=ag(F,t.getElementByKey(F.getKey()));if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=M,n.current=P.getBoundingClientRect(),a(A)},{editor:t}):A==null&&g()}}},N=y=>{m(!0)},w=y=>{m(!1)},v=t.registerRootListener((y,M)=>{M?.removeEventListener("mousemove",E),M?.removeEventListener("mousedown",N),M?.removeEventListener("mouseup",w),y?.addEventListener("mousemove",E),y?.addEventListener("mousedown",N),y?.addEventListener("mouseup",w)});return()=>{v()}},[c,h,t,r,g]);let S=E=>E==="bottom",R=jt(E=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=zn(c.elem);if(!Wa(N))throw new Error("TableCellResizer: Table cell node not found.");let w=Wn(N),v=lg(N),y=w.getChildren(),A=N.getColSpan()===w.getColumnCount()?v:v+N.getRowSpan()-1;if(A>=y.length||A<0)throw new Error("Expected table cell to be inside of table row.");let D=y[A];if(!ig(D))throw new Error("Expected table row");let F=D.getHeight();if(F===void 0){let Y=D.getChildren();F=Math.min(...Y.map(J=>b(J,t)??1/0))}let P=Math.max(F+E,pg);D.setHeight(P)},{tag:Ja})},[c,t]),b=(E,N)=>N.getElementByKey(E.getKey())?.clientHeight,x=(E,N)=>{let w;return N.forEach(v=>{v.forEach((y,M)=>{y.cell===E&&(w=M)})}),w},C=jt(E=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=zn(c.elem);if(!Wa(N))throw new Error("TableCellResizer: Table cell node not found.");let w=Wn(N),[v]=rg(w,null,null),y=x(N,v);if(y===void 0)throw new Error("TableCellResizer: Table column not found.");let M=w.getColWidths();if(!M)return;let A=M[y];if(A===void 0)return;let D=[...M],F=Math.max(A+E,Xa);D[y]=F,w.setColWidths(D)},{tag:Ja})},[c,t]),k=jt(E=>{let N=w=>{if(w.preventDefault(),w.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:v,y}=i.current;if(c===null)return;let M=Ka(w.target);if(S(E)){let A=(w.clientY-y)/M;R(A)}else{let A=(w.clientX-v)/M;C(A)}g(),document.removeEventListener("mouseup",N)}};return N},[c,g,C,R]),T=jt(E=>N=>{if(N.preventDefault(),N.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");i.current={x:N.clientX,y:N.clientY},u(i.current),f(E),document.addEventListener("mouseup",k(E))},[c,k]),[I,L]=mt({bottom:null,left:null,right:null,top:null});return Kn(()=>{if(c){let{height:E,left:N,top:w,width:v}=c.elem.getBoundingClientRect(),y=Ka(c.elem),M=10,A={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${M}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+w+E-M/2}px`,width:`${v}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${E}px`,left:`${window.scrollX+N+v-M/2}px`,top:`${window.scrollY+w}px`,width:`${M}px`}},D=n.current;h&&d&&D&&(S(h)?(A[h].left=`${window.scrollX+D.left}px`,A[h].top=`${window.scrollY+d.y/y}px`,A[h].height="3px",A[h].width=`${D.width}px`):(A[h].top=`${window.scrollY+D.top}px`,A[h].left=`${window.scrollX+d.x/y}px`,A[h].width="3px",A[h].height=`${D.height}px`),A[h].backgroundColor="#adf"),L(A)}else L({bottom:null,left:null,right:null,top:null})},[c,h,d]),Eo("div",{ref:o,children:c!=null&&!p&&tg(Za.Fragment,{children:[Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var Ya=()=>{let t=eg(3),[e]=og(),o=ng(),n;return t[0]!==e||t[1]!==o?(n=o?dg(Eo(mg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],n};import{c as _g}from"react/compiler-runtime";import{jsx as Jn,jsxs as Tg,Fragment as wg}from"react/jsx-runtime";import{useLexicalComposerContext as Sg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as lc}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Eg,$getTableColumnIndexFromTableCellNode as Ng,$getTableRowIndexFromTableCellNode as Lg,$insertTableColumnAtSelection as yg,$insertTableRowAtSelection as vg,$isTableCellNode as Rg,$isTableNode as ec,getTableElement as Ig,TableNode as Mg}from"@lexical/table";import{$findMatchingParent as $g,mergeRegister as Ag}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tc,isHTMLElement as Dg}from"lexical";import{useEffect as oc,useMemo as Og,useRef as nc,useState as No}from"react";import"react";import{createPortal as Fg}from"react-dom";import{c as Cg}from"react/compiler-runtime";import{useEffect as bg,useRef as kg}from"react";var fg="Expected a function",hg=Math.max,gg=Math.min;function xg(t,e,o){let n,r,l=0,s,i=!1,d=!1,u,c,a,p=!0;if(typeof t!="function")throw new TypeError(fg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,u=d?hg(o.maxWait||0,e):u,p="trailing"in o?!!o.trailing:p);function m(C){let k=n,T=s;return n=s=void 0,l=C,c=t.apply(T,k),c}function h(C){return l=C,a=setTimeout(_,e),i?m(C):c}function f(C){let k=C-r,T=C-l,I=e-k;return d?gg(I,u-T):I}function g(C){let k=C-r,T=C-l;return r===void 0||k>=e||k<0||d&&T>=u}function _(){let C=Date.now();if(g(C))return S(C);a=setTimeout(_,f(C))}function S(C){return a=void 0,p&&n?m(C):(n=s=void 0,c)}function R(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function b(){return a===void 0?c:S(Date.now())}function x(){let C=Date.now(),k=g(C);if(n=arguments,s=this,r=C,k){if(a===void 0)return h(r);if(d)return clearTimeout(a),a=setTimeout(_,e),m(r)}return a===void 0&&(a=setTimeout(_,e)),c}return x.cancel=R,x.flush=b,x}var qa=xg;function Qa(t,e,o){let n=Cg(6),r=kg(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=qa(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]),bg(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...u)=>{let c=u;r.current&&r.current(...c)},n[5]=i):i=n[5],i}var rc=16;function Pg({anchorElem:t}){let[e]=Sg(),o=lc(),n=G(),[r,l]=No(!1),[s,i]=No(!1),[d,u]=No(!1),[c,a]=No({}),p=nc(new Set),m=nc(null),h=Qa(_=>{let{isOutside:S,tableDOMNode:R}=Bg(_,n.editorConfig?.lexical);if(S){l(!1),i(!1);return}if(!R)return;m.current=R;let b=null,x=null,C=null;if(e.getEditorState().read(()=>{let A=tc(R);if(Rg(A)){let D=$g(A,F=>ec(F));if(!ec(D))return;if(C=Ig(D,e.getElementByKey(D.getKey())),C){let F=D.getChildrenSize(),P=D.getChildAtIndex(0)?.getChildrenSize(),Y=Lg(A),J=Ng(A);Y===F-1?b=A:J===P-1&&(x=A)}}},{editor:e}),!C)return;let k=C.parentElement;if(!k)return;let{bottom:T,height:I,left:L,right:E,width:N,y:w}=C.getBoundingClientRect(),v=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(v=k.scrollWidth>k.clientWidth);let{left:y,y:M}=t.getBoundingClientRect();b?(i(!1),l(!0),a({height:rc,left:v&&k?k.offsetLeft:L-y,top:T-M+5,width:v&&k?k.offsetWidth:N})):x&&(i(!0),l(!1),a({height:I,left:E-y+5,top:w-M,width:rc}))},50,250),f=Og(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);oc(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),oc(()=>Ag(e.registerMutationListener(Mg,_=>{e.getEditorState().read(()=>{let S=!1;for(let[R,b]of _)switch(b){case"created":{p.current.add(R),S=!0;break}case"destroyed":{p.current.delete(R),S=!0;break}default:break}if(S){f.disconnect();for(let R of p.current){let{tableElement:b}=Eg(R);f.observe(b)}u(p.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=_=>{e.update(()=>{m.current&&(tc(m.current)?.selectEnd(),_?(vg(),l(!1)):(yg(),i(!1)))})};return o?Tg(wg,{children:[r&&Jn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...c},type:"button"}),s&&Jn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...c},type:"button"})]}):null}function Bg(t,e){let o=t.target;if(Dg(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 ic(t){let e=_g(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!lc())return null;let l;return e[0]!==n?(l=Fg(Jn(Pg,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as Yn,jsxs as Gg}from"react/jsx-runtime";import{useLexicalComposerContext as Vg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Wg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as zg,TableCellNode as Kg,TableNode as Jg,TableRowNode as Xg}from"@lexical/table";import{mergeRegister as Zg}from"@lexical/utils";import{$getSelection as Yg,$isRangeSelection as qg,$setSelection as Qg,COMMAND_PRIORITY_EDITOR as e2,createCommand as t2}from"lexical";import{createContext as o2,use as n2,useCallback as pc,useEffect as mc,useMemo as r2,useRef as l2,useState as Lo}from"react";import*as fc from"react";import{jsx as Q,jsxs as Re}from"react/jsx-runtime";import{useCallback as Xn,useEffect as sc,useRef as Zn,useState as Ht}from"react";import*as uc from"react";import{createPortal as jg}from"react-dom";var ac=10,cc=7;function Hg(){return Re("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 Ug(){return Re("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 dc({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Ht(0),[d,u]=Ht(0),[c,a]=Ht(""),[p,m]=Ht(""),[h,f]=Ht(null),g=Zn(null),_=Zn(null),S=Zn(null),R=s>0?s:c?parseInt(c,10)||0:5,b=d>0?d:p?parseInt(p,10)||0:5;sc(()=>{o||(i(0),u(0),a(""),m(""),f(null))},[o]),sc(()=>{if(!o)return;let L=E=>{if(E.key==="Escape"&&(E.preventDefault(),E.stopPropagation(),n()),E.key==="Enter"&&h){E.preventDefault();let N=parseInt(c,10),w=parseInt(p,10);N>0&&w>0&&r(N,w)}};return document.addEventListener("keydown",L,!0),()=>document.removeEventListener("keydown",L,!0)},[o,n,r,h,c,p]);let x=Xn((L,E)=>{L>0&&E>0&&r(L,E)},[r]),C=Xn((L,E)=>{i(L),u(E)},[]),k=Xn(()=>{i(0),u(0)},[]);if(!o||!l||!t)return null;let T=[];for(let L=1;L<=cc;L++)for(let E=1;E<=ac;E++){let N=E<=R&&L<=b,w=E<=s&&L<=d,v="table-grid-popup__cell";N&&w?v+=" table-grid-popup__cell--hover":N&&(v+=" table-grid-popup__cell--selected"),T.push(Q("div",{"aria-label":`${E} columns, ${L} rows`,className:v,onClick:()=>x(E,L),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),x(E,L))},onMouseEnter:()=>C(E,L),role:"button",tabIndex:-1},`${L}-${E}`))}let I=s>0&&d>0;return jg(Re(uc.Fragment,{children:[Q("div",{className:"table-grid-popup__backdrop",onClick:n}),Q("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:Re("div",{className:"table-grid-popup__content",children:[Re("div",{className:"table-grid-popup__header",children:[Re("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(Hg,{})}),Q("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:L=>a(L.target.value),onFocus:()=>f("cols"),placeholder:s>0?String(s):"5",ref:_,type:"number",value:c})]}),Q("span",{className:"table-grid-popup__separator",children:"\xD7"}),Re("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(Ug,{})}),Q("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:L=>m(L.target.value),onFocus:()=>f("rows"),placeholder:d>0?String(d):"5",ref:S,type:"number",value:p})]})]}),Re("div",{className:"table-grid-popup__grid",onMouseLeave:k,children:[T,I&&Re("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/ac*100}%)`,top:`calc(${(d-1)/cc*100}%)`},children:[R," \xD7 ",b]})]})]})})]}),t)}var yo=t2("OPEN_EMBED_DRAWER_COMMAND"),hc=o2({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function gc({children:t}){let[e,o]=Lo({cellEditorConfig:null,cellEditorPlugins:null});return Yn(hc,{value:r2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var xc=()=>{let[t]=Vg(),e=n2(hc),[o,n]=Lo(!1),[r,l]=Lo(null),s=l2(null),[i,d]=Lo(null);mc(()=>{let a=t.getRootElement();if(a){let p=a.closest(".editor")??null;d(p??a.parentElement)}},[t]),mc(()=>{if(!t.hasNodes([Jg,Xg,Kg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Zg(t.registerCommand(yo,()=>{let a=i;if(!a)return!0;let p=a.getBoundingClientRect(),m=null;t.getEditorState().read(()=>{let f=Yg();if(qg(f)){s.current=f.clone();let g=f.anchor.getNode(),_=t.getElementByKey(g.getKey());if(_){let S=_.getBoundingClientRect();S.height>0&&(m={left:S.left-p.left,top:S.bottom-p.top+8})}}});let h=window.getSelection();if(h&&h.rangeCount>0){let g=h.getRangeAt(0).getBoundingClientRect();g.height>0&&(m={left:g.left-p.left,top:g.bottom-p.top+8})}return m||(m={left:0,top:40}),l(m),n(!0),!0},e2))},[e,t,i]);let u=pc(()=>{n(!1)},[]),c=pc((a,p)=>{n(!1),t.focus(),t.update(()=>{s.current&&Qg(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(zg,{columns:String(a),rows:String(p)})},1)},[t]);return Gg(fc.Fragment,{children:[Yn(dc,{anchorElem:i,editor:t,isOpen:o,onClose:u,onInsert:c,position:r}),Yn(Wg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var c2=$({markdownTransformers:[Aa],nodes:[s2,i2,a2],plugins:[{Component:xc,position:"normal"},{Component:Ya,position:"normal"},{Component:Va,position:"floatingAnchorElem"},{Component:ic,position:"floatingAnchorElem"}],providers:[gc],slashMenu:{groups:[X([{Icon:Pn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:Pn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]}});import{$isNodeSelection as W2}from"lexical";import{jsx as Cc}from"react/jsx-runtime";import"react";var u2="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",qn=({className:t})=>Cc("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:Cc("path",{clipRule:"evenodd",d:u2,fill:"currentColor",fillRule:"evenodd"})});import{jsx as wc}from"react/jsx-runtime";import Sc from"bson-objectid";import{$applyNodeReplacement as g2}from"lexical";import*as Ec from"react";import d2 from"bson-objectid";function vo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let n=t.getAttribute("data-lexical-pending-upload-form-id");if(n!=null)return{node:e({data:{pending:{formID:n,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let n=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(n!=null&&r!=null)return{node:e({data:{fields:{},relationTo:r,value:n}})}}return{node:e({data:{pending:{formID:new d2.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as p2}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as m2}from"@lexical/utils";import kc from"bson-objectid";import{$applyNodeReplacement as f2}from"lexical";var Ut=class extends p2{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>vo(o,bc),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new kc.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=bc({data:o});return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return m2(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function bc({data:t}){return t?.id||(t.id=new kc.default().toHexString()),f2(new Ut({data:t}))}import{jsx as _c}from"react/jsx-runtime";import{ShimmerEffect as h2}from"@payloadcms/ui";var Tc=()=>_c("div",{className:"lexical-upload",children:_c(h2,{height:"95px",width:"203px"})});var x2=Ec.lazy(()=>import("./component-PHZQBOJE.js").then(t=>({default:t.UploadComponent}))),ge=class extends Ut{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>vo(o,xe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Sc.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=xe({data:o});return n.setFormat(e.format),n}decorate(e,o){return this.__data.pending?wc(Tc,{}):wc(x2,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function xe({data:t}){return t?.id||(t.id=new Sc.default().toHexString()),g2(new ge({data:t}))}function ft(t){return t instanceof ge}import{c as E2}from"react/compiler-runtime";import{jsx as N2}from"react/jsx-runtime";import{useLexicalComposerContext as L2}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Oc,$insertNodeToNearestRoot as tr,mergeRegister as y2}from"@lexical/utils";import{useBulkUpload as v2,useEffectEvent as R2,useModal as I2}from"@payloadcms/ui";import or from"bson-objectid";import{$createRangeSelection as M2,$getPreviousSelection as Ic,$getSelection as Mc,$isParagraphNode as nr,$isRangeSelection as $c,$setSelection as $2,COMMAND_PRIORITY_EDITOR as A2,COMMAND_PRIORITY_LOW as Ac,createCommand as D2,DROP_COMMAND as O2,getDOMSelectionFromTarget as F2,isHTMLElement as Dc,PASTE_COMMAND as P2}from"lexical";import{useEffect as B2}from"react";import{c as Nc}from"react/compiler-runtime";import{jsx as Qn}from"react/jsx-runtime";import{useLexicalComposerContext as Lc}from"@lexical/react/LexicalComposerContext.js";import{toast as C2}from"@payloadcms/ui";import{$getNodeByKey as b2,COMMAND_PRIORITY_EDITOR as yc}from"lexical";import{useEffect as vc,useState as k2}from"react";var _2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=b2(o);r&&r.replace(xe({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(er,{fields:null,relationTo:e,value:n})},T2=t=>{let e=Nc(13),{enabledCollectionSlugs:o}=t,[n]=Lc(),[r,l]=k2(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:u}=Dt(s),c,a;e[2]!==n||e[3]!==u?(c=()=>n.registerCommand(et,f=>(l(f?.replace?f?.replace.nodeKey:null),u(),!0),yc),a=[n,u],e[2]=n,e[3]=u,e[4]=c,e[5]=a):(c=e[4],a=e[5]),vc(c,a);let p;e[6]!==i||e[7]!==n||e[8]!==r?(p=f=>{let{collectionSlug:g,doc:_}=f;i(),_2({editor:n,relationTo:g,replaceNodeKey:r,value:_.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=p):p=e[9];let m=p,h;return e[10]!==d||e[11]!==m?(h=Qn(d,{onSelect:m}),e[10]=d,e[11]=m,e[12]=h):h=e[12],h},w2=()=>{let t=Nc(3),[e]=Lc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(et,S2,yc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),vc(o,n),null},Rc=({enabledCollectionSlugs:t})=>t?.length?Qn(T2,{enabledCollectionSlugs:t}):Qn(w2,{});function S2(){return C2.error("No upload collections enabled"),!0}function j2(t){let e=t.target;return!!(Dc(e)&&!e.closest("code, span.editor-image")&&Dc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function H2(t){let e,o=F2(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var er=D2("INSERT_UPLOAD_COMMAND"),Fc=t=>{let e=E2(21),{clientProps:o}=t,[n]=L2(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l,uploads:!0},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=fo(s),{drawerSlug:d,setCollectionSlug:u,setInitialForms:c,setOnCancel:a,setOnSuccess:p,setSelectableCollections:m}=v2(),{isModalOpen:h,openModal:f}=I2(),g;e[3]!==d||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==u||e[9]!==c||e[10]!==a||e[11]!==p||e[12]!==m?(g=x=>{let{files:C}=x;if(C?.length!==0&&(c(k=>[...k??[],...C.map(U2)]),!h(d))){if(!i.length||!i[0])return;u(i[0]),m(i),a(()=>{n.update(G2)}),p(k=>{let T=new Map(k.map(V2));n.update(()=>{for(let I of Oc()){let L=I.node;if(ft(L)){let E=L.getData();if(E?.pending){let N=T.get(E.pending?.formID);N&&L.replace(xe({data:{id:new or.default().toHexString(),fields:{},relationTo:N.collectionSlug,value:N.doc.id}}))}}}})}),f(d)}},e[3]=d,e[4]=n,e[5]=i,e[6]=h,e[7]=f,e[8]=u,e[9]=c,e[10]=a,e[11]=p,e[12]=m,e[13]=g):g=e[13];let _=R2(g),S;e[14]!==n||e[15]!==_?(S=()=>{if(!n.hasNodes([ge]))throw new Error("UploadPlugin: UploadNode not registered on editor");return y2(n.registerNodeTransform(ge,x=>{let C=x.getData();if(!C?.pending)return;(async function(){let I=null,L=C?.pending?.src,E=C?.pending?.formID;if(L?.startsWith("data:")){let N=L.match(/data:(image\/[a-zA-Z]+);base64,/),w=N?N[1]:"image/png",v=L.replace(/^data:image\/[a-zA-Z]+;base64,/,""),y=atob(v),M=new Array(y.length);for(let F=0;F<y.length;F++)M[F]=y.charCodeAt(F);let A=new Uint8Array(M);I={alt:void 0,file:new File([A],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:E}}else if(L?.startsWith("http")||L?.startsWith("https")){let w=await(await fetch(L)).blob(),v=L.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];I={alt:void 0,file:new File([w],v,{type:w.type}),formID:E}}I&&_({files:[I]})})()}),n.registerCommand(er,x=>(n.update(()=>{let C=Mc()||Ic();if($c(C)){let k=xe({data:{id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}}),{focus:T}=C,I=T.getNode();tr(k),nr(I)&&!I.__first&&I.remove()}}),!0),A2),n.registerCommand(P2,x=>{if(!(x instanceof ClipboardEvent))return!1;let C=x.clipboardData;if(!C?.types?.length||C?.types?.includes("text/html"))return!1;let k=[];return C?.files?.length&&Array.from(C.files).forEach(T=>{k.push({alt:"",file:T,formID:new or.default().toHexString()})}),k.length?(n.update(()=>{let T=Mc()||Ic();if($c(T))for(let I of k){let L=xe({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:E}=T,N=E.getNode();tr(L),nr(N)&&!N.__first&&N.remove()}}),_({files:k}),!0):!1},Ac),n.registerCommand(O2,x=>{if(!(x instanceof DragEvent))return!1;let C=x.dataTransfer;if(!C?.types?.length)return!1;let k=[];return C?.files?.length&&Array.from(C.files).forEach(T=>{k.push({alt:"",file:T,formID:new or.default().toHexString()})}),k.length?(x.preventDefault(),x.stopPropagation(),n.update(()=>{if(j2(x)){let T=H2(x),I=M2();T!=null&&I.applyDOMRange(T),$2(I);for(let L of k){let E=xe({data:{pending:{formID:L.formID,src:URL.createObjectURL(L.file)}}}),{focus:N}=I,w=N.getNode();tr(E),nr(w)&&!w.__first&&w.remove()}}}),_({files:k}),!0):!1},Ac))},e[14]=n,e[15]=_,e[16]=S):S=e[16];let R;e[17]!==n?(R=[n],e[17]=n,e[18]=R):R=e[18],B2(S,R);let b;return e[19]!==i?(b=N2(Rc,{enabledCollectionSlugs:i}),e[19]=i,e[20]=b):b=e[20],b};function U2(t){return{file:t.file,formID:t.formID}}function G2(){for(let t of Oc()){let e=t.node;ft(e)&&e.getData()?.pending&&e.remove()}}function V2(t){return[t.formID,t]}var z2=$({nodes:[ge],plugins:[{Component:Fc,position:"normal"}],slashMenu:{groups:[X([{Icon:qn,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:qn,isActive:({selection:t})=>{if(!W2(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ft(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{jsx as rx}from"react/jsx-runtime";import{getFromImportMap as Hc}from"payload/shared";import{useMemo as lx}from"react";import{c as J2}from"react/compiler-runtime";import{jsx as Ro}from"react/jsx-runtime";import{createElement as X2}from"react";import{ShimmerEffect as Z2,useConfig as Y2}from"@payloadcms/ui";import{lazy as q2,Suspense as Q2,useEffect as ex,useState as tx}from"react";var Pc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var rr={namespace:"lexical",theme:Pc};function Bc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map,i=[];for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null){console.warn("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected. Skipping feature.");continue}s.set(c.clientFeatureProps.featureKey,c),i.push(c)}l.features=i,l.features=l.features.sort((c,a)=>c.clientFeatureProps.order-a.clientFeatureProps.order);let d=new Map,u=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:d,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;a.key=c.clientFeatureProps.featureKey,a.order=u,d.set(c.clientFeatureProps.featureKey,a),u++}return d}import{deepMerge as K2}from"payload/shared";var jc=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?K2(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function lr(t,e,o,n){return{admin:o,features:jc(t),lexical:e,resolvedFeatureMap:t,view:n}}var ox=q2(()=>import("./Field-VYBSMSRY.js").then(t=>({default:t.RichText}))),ir=t=>Ro(Bo,{inheritable:!0,views:t.views,children:Ro(nx,{...t})}),nx=t=>{let e=J2(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d,views:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let a=c,p;e[2]!==r?(p=r===void 0?{}:r,e[2]=r,e[3]=p):p=e[3];let m=p,h=i===void 0?rr:i,{currentView:f}=jo(),g=u?.[f]?.admin??a,_=u?.[f]?.lexical,S;e[4]!==h||e[5]!==_?(S=typeof _=="function"?_(h):_??h,e[4]=h,e[5]=_,e[6]=S):S=e[6];let R=S,{config:b}=Y2(),[x,C]=tx(null),k,T;e[7]!==n||e[8]!==b||e[9]!==f||e[10]!==g||e[11]!==R||e[12]!==m||e[13]!==l||e[14]!==s||e[15]!==x||e[16]!==d||e[17]!==u?(k=()=>{if(x&&x.view===f)return;let L=u?.[f],E=L?.filterFeatures?L.filterFeatures(n):n,N=[];for(let v of Object.values(E))!v.clientFeatureProvider||!v.clientFeatureProps||N.push(v.clientFeatureProvider(v.clientFeatureProps));let w=Bc({config:b,featureClientImportMap:m,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:N,lexical:R}});C(lr(w,R,g,f))},T=[g,n,b,m,l,s,x,R,d,f,u],e[7]=n,e[8]=b,e[9]=f,e[10]=g,e[11]=R,e[12]=m,e[13]=l,e[14]=s,e[15]=x,e[16]=d,e[17]=u,e[18]=k,e[19]=T):(k=e[18],T=e[19]),ex(k,T);let I;return e[20]!==x||e[21]!==t?(I=Ro(Q2,{fallback:Ro(Z2,{height:"35vh"}),children:x&&X2(ox,{...t,editorConfig:x,key:x.view})}),e[20]=x,e[21]=t,e[22]=I):I=e[22],I};var ix=t=>{let{featureClientSchemaMap:e={},features:o={},field:n,forceRender:r,importMap:l,path:s,permissions:i,readOnly:d,schemaPath:u}=t,{clientFeatures:c,featureClientImportMap:a}=lx(()=>{let p={},m={},h=Object.entries(o).sort(([,f],[,g])=>f.order-g.order);for(let[f,g]of h){if(p[f]={},g.ClientFeature){let _=Hc({importMap:l,PayloadComponent:g.ClientFeature,schemaPath:"lexical-clientComponent",silent:!0});if(_){let S={...g.clientFeatureProps??{},featureKey:g.key,order:g.order};typeof g.ClientFeature=="object"&&g.ClientFeature.clientProps&&(S.clientProps=g.ClientFeature.clientProps),p[f]={clientFeatureProps:S,clientFeatureProvider:_}}}if(g.componentImports&&typeof g.componentImports=="object")for(let[_,S]of Object.entries(g.componentImports)){let R=Hc({importMap:l,PayloadComponent:S,schemaPath:"lexical-clientComponent",silent:!0});R&&(m[`${f}.${_}`]=R)}}return{clientFeatures:p,featureClientImportMap:m}},[o,l]);return rx(ir,{clientFeatures:c,featureClientImportMap:a,featureClientSchemaMap:e,field:n,forceRender:r,path:s,permissions:i,readOnly:d,schemaPath:u})};function sx(t){return t instanceof HTMLElement}function ax(...t){return t.filter(Boolean).join(" ")}var Io=new WeakMap;function Uc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mo(t,e){let o=Io.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Uc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=Uc(s);for(let u of n)d!==null&&u([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},Io.set(t,o)}return o.listeners.add(e),()=>{cx(t,e)}}function cx(t,e){let o=Io.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Io.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function ux(t,e){return Mo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function dx(t,e){return Mo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function px(t,e){return Mo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function mx(t,e){return Mo(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 hx}from"react/jsx-runtime";import"react";var gx=()=>{let t=fx(2),{EditButton:e}=ke(),o;return t[0]!==e?(o=e?hx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as xx}from"react/compiler-runtime";import{jsx as Cx}from"react/jsx-runtime";import"react";var bx=()=>{let t=xx(2),{RemoveButton:e}=ke(),o;return t[0]!==e?(o=e?Cx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as kx}from"react/compiler-runtime";import{jsx as _x}from"react/jsx-runtime";import"react";var Tx=()=>{let t=kx(2),{Label:e}=ke(),o;return t[0]!==e?(o=e?_x(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as wx}from"react/compiler-runtime";import{jsx as Sx}from"react/jsx-runtime";import"react";var Ex=t=>{let e=wx(3),{children:o}=t,{InlineBlockContainer:n}=ke(),r;return e[0]!==n||e[1]!==o?(r=n?Sx(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as Nx}from"react/jsx-runtime";import"react";var Lx=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?Nx(n,{...o,children:e}):null};import{c as yx}from"react/compiler-runtime";import{jsx as vx}from"react/jsx-runtime";import"react";var Rx=()=>{let t=yx(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?vx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Ix}from"react/compiler-runtime";import{jsx as Mx}from"react/jsx-runtime";import"react";var $x=()=>{let t=Ix(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?Mx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Ax}from"qs-esm";var Dx=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let d=Ax({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(c=>c.json())};var Gc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
61
61
  `)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
62
62
  `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let n=o?.[1];return t.startsWith(`
63
63
  `)&&(t=t.slice(1)),t.endsWith(`
64
64
  `)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
65
- `)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as Ix}from"react/jsx-runtime";import{CodeField as Mx,useFormFields as $x}from"@payloadcms/ui";import{useId as Ax,useMemo as Dx}from"react";var $o={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 Ox=({autoComplete:t,field:e,forceRender:o,languages:n=$o,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=$x(([_])=>_.language),m=a?.value||a?.initialValue||"typescript",p=Ax(),h=n[m],f=Dx(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),g=`${e.name}-${m}-${h}`;return f&&Ix(Mx,{autoComplete:t,field:f,forceRender:o,onMount:(_,L)=>{L.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),L.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),L.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:L.languages.typescript.JsxEmit.React,moduleResolution:L.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:L.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),L.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async b=>{let C=await(await fetch(b.url)).text();L.languages.typescript.typescriptDefaults.addExtraLib(C,b.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},g)};import{jsx as re,jsxs as Kc}from"react/jsx-runtime";import{useLexicalEditable as zx}from"@lexical/react/useLexicalEditable";import{ChevronIcon as Kx,Combobox as Jx,CopyToClipboard as Xx,PopupList as Zx,RenderFields as Yx,useForm as qx,useFormFields as Jc,useTranslation as Qx}from"@payloadcms/ui";import eC from"react";import{jsx as Hc}from"react/jsx-runtime";import"react";var Fx={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"},Uc=({className:t,size:e=24})=>Hc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Hc("path",{clipRule:"evenodd",d:Fx[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as ir}from"react/jsx-runtime";import"react";import{useCollapsible as Hx}from"@payloadcms/ui";import{jsx as Gc}from"react/jsx-runtime";import"react";var Bx="M11.4999 13C11.6325 13 11.7597 13.0527 11.8535 13.1464L14.8535 16.1464C15.0487 16.3417 15.0487 16.6582 14.8535 16.8535C14.6582 17.0487 14.3417 17.0487 14.1464 16.8535L11.4999 14.207L8.85346 16.8535C8.6582 17.0487 8.34169 17.0487 8.14643 16.8535C7.95119 16.6582 7.95119 16.3417 8.14643 16.1464L11.1464 13.1464C11.2402 13.0527 11.3674 13 11.4999 13ZM14.1464 7.14644C14.3417 6.95119 14.6582 6.95118 14.8535 7.14644C15.0487 7.3417 15.0487 7.65821 14.8535 7.85347L11.8535 10.8535C11.7597 10.9472 11.6325 10.9999 11.4999 11C11.3674 10.9999 11.2402 10.9472 11.1464 10.8535L8.14643 7.85347C7.95119 7.65821 7.95119 7.3417 8.14643 7.14644C8.34169 6.9512 8.6582 6.9512 8.85346 7.14644L11.4999 9.79292L14.1464 7.14644Z",Ao=({className:t})=>Gc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Gc("path",{d:Bx,fill:"currentColor"})});import{jsx as Vc}from"react/jsx-runtime";import"react";var Px="M11.5 6C11.6326 6 11.7597 6.05272 11.8535 6.14648L14.8535 9.14648C15.0487 9.34175 15.0487 9.65825 14.8535 9.85352C14.6582 10.0488 14.3417 10.0488 14.1464 9.85352L12 7.70703V16.293L14.1464 14.1465C14.3417 13.9512 14.6582 13.9512 14.8535 14.1465C15.0487 14.3417 15.0487 14.6583 14.8535 14.8535L11.8535 17.8535C11.6582 18.0488 11.3417 18.0488 11.1464 17.8535L8.14645 14.8535C7.95119 14.6583 7.95119 14.3417 8.14645 14.1465C8.34171 13.9512 8.65822 13.9512 8.85348 14.1465L11 16.293V7.70703L8.85348 9.85352C8.65822 10.0488 8.34171 10.0488 8.14645 9.85352C7.95118 9.65825 7.95118 9.34175 8.14645 9.14648L11.1464 6.14648C11.2402 6.05272 11.3674 6 11.5 6Z",Do=({className:t})=>Vc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Vc("path",{clipRule:"evenodd",d:Px,fill:"currentColor",fillRule:"evenodd"})});var jx="code-block-collapse-button",Wc=()=>{let{isCollapsed:t,toggle:e}=Hx();return ir("button",{className:jx,onClick:e,type:"button",children:t?ir(Do,{}):ir(Ao,{})})};import{jsx as sr,jsxs as Ux}from"react/jsx-runtime";import{useCollapsible as Gx,useTranslation as Vx}from"@payloadcms/ui";import"react";var Wx="code-block-floating-collapse-button",zc=()=>{let{isCollapsed:t,toggle:e}=Gx(),{t:o}=Vx();return Ux("button",{className:Wx,onClick:e,type:"button",children:[t?sr(Do,{}):sr(Ao,{}),sr("span",{children:o(t?"general:expand":"general:collapse")})]})};var Xe="payload-richtext-code-block",tC=t=>{let{languages:e}=t,o=e||$o,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ae(),{setModified:s}=qx(),{t:i}=Qx(),{codeField:d}=Jc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=Jc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=zx(),p=eC.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:re(Zx.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:re("span",{className:`${Xe}__language-code`,"data-language":h,children:f})})})),[o,u]);return re(n,{Actions:Kc("div",{className:`${Xe}__actions`,children:[re(Jx,{button:Kc("div",{className:`${Xe}__language-selector-button`,"data-selected-language":c?.value,children:[re("span",{children:a}),re(Kx,{className:`${Xe}__chevron`})]}),buttonType:"custom",className:`${Xe}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(Xx,{value:d?.value??""}),re(Wc,{}),m&&re(l,{})]}),className:Xe,collapsibleProps:{AfterCollapsible:re(zc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${Xe}__pill`,children:re(Uc,{})}),showDragHandle:!1,showRowNumber:!1,children:re(Yx,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as oC}from"react/compiler-runtime";import{jsx as ht}from"react/jsx-runtime";import{FieldContext as nC,FieldPathContext as Xc,ServerFunctionsContext as Zc,ShimmerEffect as rC,useServerFunctions as lC}from"@payloadcms/ui";import iC,{useEffect as sC,useRef as aC}from"react";var cC=t=>{let e=oC(9),{field:o,initialValue:n,Loading:r,path:l,schemaPath:s,setValue:i,value:d}=t,[c,u]=iC.useState(null),a=lC(),{_internal_renderField:m}=a,[p,h]=s.split(".",2),f=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==m||e[1]!==o||e[2]!==n||e[3]!==l||e[4]!==s?(g=()=>{(async function(){let{Field:I}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:n??void 0,path:l,schemaPath:s});u(I)})()},e[0]=m,e[1]=o,e[2]=n,e[3]=l,e[4]=s,e[5]=g):g=e[5];let _=g,L=aC(!1),R,b;if(e[6]!==_?(R=()=>{L.current||(L.current=!0,_())},b=[_],e[6]=_,e[7]=R,e[8]=b):(R=e[7],b=e[8]),sC(R,b),!c)return typeof r<"u"?r:ht(rC,{});let x={...a,getFormState:async k=>a.getFormState({...k,collectionSlug:p==="collection"?h:void 0,globalSlug:p==="global"?h:void 0})};if(typeof d>"u"&&!i)return ht(Zc,{value:{...x},children:ht(Xc,{value:f,children:c},f)});let C={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:f,setValue:i??uC,showError:!1,value:d};return ht(Zc,{value:{...x},children:ht(Xc,{value:f,children:ht(nC,{value:C,children:c})},f)})};function uC(){}function Yc({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 dC=Yc;export{Rt as $createAutoLinkNode,je as $createBlockNode,nt as $createHorizontalRuleNode,kt as $createInlineBlockNode,Se as $createLinkNode,Je as $createRelationshipNode,xe as $createUploadNode,Ne as $isAutoLinkNode,$e as $isBlockNode,Ge as $isHorizontalRuleNode,_t as $isInlineBlockNode,K as $isLinkNode,vn as $isRelationshipNode,ft as $isUploadNode,Tu as AlignFeatureClient,Ee as AutoLinkNode,Tx as BlockCollapsible,Ex as BlockEditButton,ue as BlockNode,yx as BlockRemoveButton,Iu as BlockquoteFeatureClient,Wd as BlocksFeatureClient,h1 as BoldFeatureClient,se as CAN_USE_DOM,Df as ChecklistFeatureClient,tC as CodeBlockBlockComponent,Ox as CodeComponent,p0 as DETAIL_TYPE_TO_DETAIL,c0 as DOUBLE_LINE_BREAK,N0 as DebugJsxConverterFeatureClient,h0 as ELEMENT_FORMAT_TO_TYPE,f0 as ELEMENT_TYPE_TO_FORMAT,su as ENABLE_SLASH_MENU_COMMAND,nu as EditorConfigProvider,Bo as FieldsDrawer,Qh as FixedToolbarFeatureClient,bm as HeadingFeatureClient,Pm as HorizontalRuleFeatureClient,we as HorizontalRuleNode,tt as INSERT_BLOCK_COMMAND,ot as INSERT_INLINE_BLOCK_COMMAND,s0 as IS_ALL_FORMATTING,tp as IndentFeatureClient,kx as InlineBlockContainer,dx as InlineBlockEditButton,xx as InlineBlockLabel,bt as InlineBlockNode,fx as InlineBlockRemoveButton,k1 as InlineCodeFeatureClient,p5 as InlineToolbarFeatureClient,E1 as ItalicFeatureClient,d0 as LTR_REGEX,kf as LinkFeatureClient,oe as LinkNode,a0 as NON_BREAKING_SPACE,O as NodeFormat,Gf as OrderedListFeatureClient,Qf as ParagraphFeatureClient,lu as Point,u0 as RTL_REGEX,au as Rect,gh as RelationshipFeatureClient,Le as RelationshipNode,cC as RenderLexical,ex as RichTextField,Po as RichTextViewProvider,R1 as StrikethroughFeatureClient,D1 as SubscriptFeatureClient,j1 as SuperscriptFeatureClient,g0 as TEXT_MODE_TO_TYPE,m0 as TEXT_TYPE_TO_FORMAT,x0 as TEXT_TYPE_TO_MODE,fe as TOGGLE_LINK_COMMAND,i2 as TableFeatureClient,l1 as TestRecorderFeatureClient,om as TextStateFeatureClient,Ot as ToolbarButton,Ft as ToolbarDropdown,u1 as TreeViewFeatureClient,W1 as UnderlineFeatureClient,Yf as UnorderedListFeatureClient,G2 as UploadFeatureClient,ge as UploadNode,ax as addSwipeDownListener,lx as addSwipeLeftListener,ix as addSwipeRightListener,sx as addSwipeUpListener,dC as buildDefaultEditorState,Yc as buildEditorState,jc as codeConverterClient,nn as createBlockNode,$ as createClientFeature,L0 as defaultColors,rr as defaultEditorLexicalConfig,Fn as getDOMRangeRect,cu as getEnabledNodes,Rx as getRestPopulateFn,rt as getSelectedNode,ox as isHTMLElement,iu as isPoint,nx as joinClasses,lr as sanitizeClientEditorConfig,Bc as sanitizeClientFeatures,bo as setFloatingElemPosition,so as setFloatingElemPositionForLinkEditor,X as slashMenuBasicGroupWithItems,Te as toolbarAddDropdownGroupWithItems,an as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ae as useBlockComponentContext,G as useEditorConfigContext,ke as useInlineBlockComponentContext,ru as useLexicalDocumentDrawer,Fe as useLexicalDrawer,Dt as useLexicalListDrawer,jo as useRichTextView};
65
+ `)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as Ox}from"react/jsx-runtime";import{CodeField as Fx,useFormFields as Px}from"@payloadcms/ui";import{useId as Bx,useMemo as jx}from"react";var $o={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 Hx=({autoComplete:t,field:e,forceRender:o,languages:n=$o,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:u,validate:c})=>{let a=Px(([_])=>_.language),p=a?.value||a?.initialValue||"typescript",m=Bx(),h=n[p],f=jx(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:p==="ts"?`file-${e.name}-${m}.tsx`:void 0},language:p}}),[e,p,m]),g=`${e.name}-${p}-${h}`;return f&&Ox(Fx,{autoComplete:t,field:f,forceRender:o,onMount:(_,S)=>{S.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),S.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),S.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:S.languages.typescript.JsxEmit.React,moduleResolution:S.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:u?.paths,reactNamespace:"React",target:S.languages.typescript.ScriptTarget[u?.target??"ESNext"],typeRoots:u?.typeRoots??["node_modules/@types"]}),S.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 b=>{let C=await(await fetch(b.url)).text();S.languages.typescript.typescriptDefaults.addExtraLib(C,b.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:c},g)};import{jsx as re,jsxs as Zc}from"react/jsx-runtime";import{useLexicalEditable as Yx}from"@lexical/react/useLexicalEditable";import{ChevronIcon as qx,Combobox as Qx,CopyToClipboard as eC,PopupList as tC,RenderFields as oC,useForm as nC,useFormFields as Yc,useTranslation as rC}from"@payloadcms/ui";import lC from"react";import{jsx as Vc}from"react/jsx-runtime";import"react";var Ux={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"},Wc=({className:t,size:e=24})=>Vc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Vc("path",{clipRule:"evenodd",d:Ux[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as sr}from"react/jsx-runtime";import"react";import{useCollapsible as zx}from"@payloadcms/ui";import{jsx as zc}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",Ao=({className:t})=>zc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:zc("path",{d:Gx,fill:"currentColor"})});import{jsx as Kc}from"react/jsx-runtime";import"react";var Vx="M11.5 6C11.6326 6 11.7597 6.05272 11.8535 6.14648L14.8535 9.14648C15.0487 9.34175 15.0487 9.65825 14.8535 9.85352C14.6582 10.0488 14.3417 10.0488 14.1464 9.85352L12 7.70703V16.293L14.1464 14.1465C14.3417 13.9512 14.6582 13.9512 14.8535 14.1465C15.0487 14.3417 15.0487 14.6583 14.8535 14.8535L11.8535 17.8535C11.6582 18.0488 11.3417 18.0488 11.1464 17.8535L8.14645 14.8535C7.95119 14.6583 7.95119 14.3417 8.14645 14.1465C8.34171 13.9512 8.65822 13.9512 8.85348 14.1465L11 16.293V7.70703L8.85348 9.85352C8.65822 10.0488 8.34171 10.0488 8.14645 9.85352C7.95118 9.65825 7.95118 9.34175 8.14645 9.14648L11.1464 6.14648C11.2402 6.05272 11.3674 6 11.5 6Z",Do=({className:t})=>Kc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Kc("path",{clipRule:"evenodd",d:Vx,fill:"currentColor",fillRule:"evenodd"})});var Wx="code-block-collapse-button",Jc=()=>{let{isCollapsed:t,toggle:e}=zx();return sr("button",{className:Wx,onClick:e,type:"button",children:t?sr(Do,{}):sr(Ao,{})})};import{jsx as ar,jsxs as Kx}from"react/jsx-runtime";import{useCollapsible as Jx,useTranslation as Xx}from"@payloadcms/ui";import"react";var Zx="code-block-floating-collapse-button",Xc=()=>{let{isCollapsed:t,toggle:e}=Jx(),{t:o}=Xx();return Kx("button",{className:Zx,onClick:e,type:"button",children:[t?ar(Do,{}):ar(Ao,{}),ar("span",{children:o(t?"general:expand":"general:collapse")})]})};var Xe="payload-richtext-code-block",iC=t=>{let{languages:e}=t,o=e||$o,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ae(),{setModified:s}=nC(),{t:i}=rC(),{codeField:d}=Yc(([h])=>({codeField:h?.code})),{selectedLanguageField:u,setSelectedLanguage:c}=Yc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[u?.value],p=Yx(),m=lC.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:re(tC.Button,{active:!1,disabled:!1,onClick:()=>{c(h)},children:re("span",{className:`${Xe}__language-code`,"data-language":h,children:f})})})),[o,c]);return re(n,{Actions:Zc("div",{className:`${Xe}__actions`,children:[re(Qx,{"aria-label":i("general:language"),button:Zc("div",{className:`${Xe}__language-selector-button`,"data-selected-language":u?.value,children:[re("span",{children:a}),re(qx,{className:`${Xe}__chevron`})]}),buttonType:"custom",className:`${Xe}__language-selector`,disabled:!p,entries:m,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(eC,{value:d?.value??""}),re(Jc,{}),p&&re(l,{})]}),className:Xe,collapsibleProps:{AfterCollapsible:re(Xc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${Xe}__pill`,children:re(Wc,{})}),showDragHandle:!1,showRowNumber:!1,children:re(oC,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!p})})};import{c as sC}from"react/compiler-runtime";import{jsx as ht}from"react/jsx-runtime";import{FieldContext as aC,FieldPathContext as qc,ServerFunctionsContext as Qc,ShimmerEffect as cC,useServerFunctions as uC}from"@payloadcms/ui";import dC,{useEffect as pC,useRef as mC}from"react";var fC=t=>{let e=sC(9),{field:o,initialValue:n,Loading:r,path:l,schemaPath:s,setValue:i,value:d}=t,[u,c]=dC.useState(null),a=uC(),{_internal_renderField:p}=a,[m,h]=s.split(".",2),f=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==p||e[1]!==o||e[2]!==n||e[3]!==l||e[4]!==s?(g=()=>{(async function(){let{Field:I}=await p({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:n??void 0,path:l,schemaPath:s});c(I)})()},e[0]=p,e[1]=o,e[2]=n,e[3]=l,e[4]=s,e[5]=g):g=e[5];let _=g,S=mC(!1),R,b;if(e[6]!==_?(R=()=>{S.current||(S.current=!0,_())},b=[_],e[6]=_,e[7]=R,e[8]=b):(R=e[7],b=e[8]),pC(R,b),!u)return typeof r<"u"?r:ht(cC,{});let x={...a,getFormState:async k=>a.getFormState({...k,collectionSlug:m==="collection"?h:void 0,globalSlug:m==="global"?h:void 0})};if(typeof d>"u"&&!i)return ht(Qc,{value:{...x},children:ht(qc,{value:f,children:u},f)});let C={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:f,setValue:i??hC,showError:!1,value:d};return ht(Qc,{value:{...x},children:ht(qc,{value:f,children:ht(aC,{value:C,children:u})},f)})};function hC(){}function eu({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 gC=eu;export{Rt as $createAutoLinkNode,je as $createBlockNode,nt as $createHorizontalRuleNode,kt as $createInlineBlockNode,Se as $createLinkNode,Je as $createRelationshipNode,xe as $createUploadNode,Ne as $isAutoLinkNode,$e as $isBlockNode,Ge as $isHorizontalRuleNode,_t as $isInlineBlockNode,K as $isLinkNode,vn as $isRelationshipNode,ft as $isUploadNode,Eu as AlignFeatureClient,Ee as AutoLinkNode,Lx as BlockCollapsible,Rx as BlockEditButton,ue as BlockNode,$x as BlockRemoveButton,Au as BlockquoteFeatureClient,Jd as BlocksFeatureClient,Cp as BoldFeatureClient,se as CAN_USE_DOM,Pf as ChecklistFeatureClient,ix as ClientEntryLexicalField,iC as CodeBlockBlockComponent,Hx as CodeComponent,g0 as DETAIL_TYPE_TO_DETAIL,p0 as DOUBLE_LINE_BREAK,v0 as DebugJsxConverterFeatureClient,C0 as ELEMENT_FORMAT_TO_TYPE,x0 as ELEMENT_TYPE_TO_FORMAT,uu as ENABLE_SLASH_MENU_COMMAND,iu as EditorConfigProvider,Po as FieldsDrawer,o5 as FixedToolbarFeatureClient,Tm as HeadingFeatureClient,Um as HorizontalRuleFeatureClient,we as HorizontalRuleNode,tt as INSERT_BLOCK_COMMAND,ot as INSERT_INLINE_BLOCK_COMMAND,u0 as IS_ALL_FORMATTING,r1 as IndentFeatureClient,Ex as InlineBlockContainer,gx as InlineBlockEditButton,Tx as InlineBlockLabel,bt as InlineBlockNode,bx as InlineBlockRemoveButton,wp as InlineCodeFeatureClient,g5 as InlineToolbarFeatureClient,yp as ItalicFeatureClient,f0 as LTR_REGEX,wf as LinkFeatureClient,oe as LinkNode,d0 as NON_BREAKING_SPACE,O as NodeFormat,zf as OrderedListFeatureClient,o0 as ParagraphFeatureClient,au as Point,m0 as RTL_REGEX,du as Rect,bh as RelationshipFeatureClient,Le as RelationshipNode,fC as RenderLexical,ir as RichTextField,Bo as RichTextViewProvider,$p as StrikethroughFeatureClient,Pp as SubscriptFeatureClient,Gp as SuperscriptFeatureClient,b0 as TEXT_MODE_TO_TYPE,h0 as TEXT_TYPE_TO_FORMAT,k0 as TEXT_TYPE_TO_MODE,fe as TOGGLE_LINK_COMMAND,c2 as TableFeatureClient,ap as TestRecorderFeatureClient,lm as TextStateFeatureClient,Ot as ToolbarButton,Ft as ToolbarDropdown,mp as TreeViewFeatureClient,Jp as UnderlineFeatureClient,e0 as UnorderedListFeatureClient,z2 as UploadFeatureClient,ge as UploadNode,mx as addSwipeDownListener,ux as addSwipeLeftListener,dx as addSwipeRightListener,px as addSwipeUpListener,gC as buildDefaultEditorState,eu as buildEditorState,Gc as codeConverterClient,nn as createBlockNode,$ as createClientFeature,R0 as defaultColors,rr as defaultEditorLexicalConfig,Fn as getDOMRangeRect,pu as getEnabledNodes,Dx as getRestPopulateFn,rt as getSelectedNode,sx as isHTMLElement,cu as isPoint,ax as joinClasses,lr as sanitizeClientEditorConfig,jc as sanitizeClientFeatures,bo as setFloatingElemPosition,so as setFloatingElemPositionForLinkEditor,X as slashMenuBasicGroupWithItems,Te as toolbarAddDropdownGroupWithItems,an as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ae as useBlockComponentContext,G as useEditorConfigContext,ke as useInlineBlockComponentContext,su as useLexicalDocumentDrawer,Fe as useLexicalDrawer,Dt as useLexicalListDrawer,jo as useRichTextView};
66
66
  //# sourceMappingURL=index.js.map