@payloadcms/richtext-lexical 3.89.0-internal.95c9cba → 3.90.0

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 (195) hide show
  1. package/dist/exports/client/{Field-J6MIUIWP.js → Field-YZR46UCY.js} +1 -1
  2. package/dist/exports/client/{Field-J6MIUIWP.js.map → Field-YZR46UCY.js.map} +1 -1
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-OSMEE5HW.js +2 -0
  5. package/dist/exports/client/chunk-OSMEE5HW.js.map +7 -0
  6. package/dist/exports/client/component-UBRNPIQ6.js +2 -0
  7. package/dist/exports/client/component-UBRNPIQ6.js.map +7 -0
  8. package/dist/exports/client/index.js +21 -21
  9. package/dist/exports/client/index.js.map +4 -4
  10. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  11. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  12. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  13. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  14. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  15. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  16. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  17. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  18. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  19. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  20. package/dist/features/converters/lexicalToJSX/Component/nodeTags.spec.js +114 -0
  21. package/dist/features/converters/lexicalToJSX/Component/nodeTags.spec.js.map +1 -0
  22. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  23. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  24. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  25. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  26. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  27. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  28. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  29. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  30. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  31. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  32. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  33. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +16 -43
  34. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  35. package/dist/features/heading/constants.d.ts +2 -0
  36. package/dist/features/heading/constants.d.ts.map +1 -0
  37. package/dist/features/heading/constants.js +2 -0
  38. package/dist/features/heading/constants.js.map +1 -0
  39. package/dist/features/heading/server/index.d.ts.map +1 -1
  40. package/dist/features/heading/server/index.js +8 -2
  41. package/dist/features/heading/server/index.js.map +1 -1
  42. package/dist/features/heading/server/validate.d.ts +6 -0
  43. package/dist/features/heading/server/validate.d.ts.map +1 -0
  44. package/dist/features/heading/server/validate.js +15 -0
  45. package/dist/features/heading/server/validate.js.map +1 -0
  46. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  47. package/dist/features/lists/checklist/server/index.js +5 -2
  48. package/dist/features/lists/checklist/server/index.js.map +1 -1
  49. package/dist/features/lists/htmlConverter.d.ts.map +1 -1
  50. package/dist/features/lists/htmlConverter.js +6 -3
  51. package/dist/features/lists/htmlConverter.js.map +1 -1
  52. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  53. package/dist/features/lists/orderedList/server/index.js +5 -2
  54. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  55. package/dist/features/lists/shared/constants.d.ts +2 -0
  56. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  57. package/dist/features/lists/shared/constants.js +2 -0
  58. package/dist/features/lists/shared/constants.js.map +1 -0
  59. package/dist/features/lists/shared/validate.d.ts +5 -0
  60. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  61. package/dist/features/lists/shared/validate.js +15 -0
  62. package/dist/features/lists/shared/validate.js.map +1 -0
  63. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  64. package/dist/features/lists/unorderedList/server/index.js +5 -2
  65. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  66. package/dist/features/relationship/client/index.d.ts +2 -2
  67. package/dist/features/relationship/client/index.d.ts.map +1 -1
  68. package/dist/features/relationship/client/index.js.map +1 -1
  69. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  70. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  71. package/dist/features/relationship/client/plugins/index.js +27 -31
  72. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  73. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  74. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  75. package/dist/features/relationship/client/utils/useEnabledRelationships.js +52 -50
  76. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  77. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  78. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  79. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  80. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  81. package/dist/features/relationship/server/index.d.ts +8 -1
  82. package/dist/features/relationship/server/index.d.ts.map +1 -1
  83. package/dist/features/relationship/server/index.js +28 -11
  84. package/dist/features/relationship/server/index.js.map +1 -1
  85. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +7 -0
  86. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  87. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +23 -0
  88. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  89. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  90. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  91. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  92. package/dist/features/upload/client/component/index.js +2 -1
  93. package/dist/features/upload/client/component/index.js.map +1 -1
  94. package/dist/features/upload/client/index.d.ts +3 -2
  95. package/dist/features/upload/client/index.d.ts.map +1 -1
  96. package/dist/features/upload/client/index.js.map +1 -1
  97. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  98. package/dist/features/upload/client/plugin/index.js +47 -52
  99. package/dist/features/upload/client/plugin/index.js.map +1 -1
  100. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  101. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  102. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  103. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  104. package/dist/features/upload/server/index.d.ts +6 -2
  105. package/dist/features/upload/server/index.d.ts.map +1 -1
  106. package/dist/features/upload/server/index.js +21 -14
  107. package/dist/features/upload/server/index.js.map +1 -1
  108. package/dist/features/upload/server/validate.d.ts +2 -2
  109. package/dist/features/upload/server/validate.d.ts.map +1 -1
  110. package/dist/features/upload/server/validate.js +3 -0
  111. package/dist/features/upload/server/validate.js.map +1 -1
  112. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  113. package/dist/field/Diff/converters/listitem/index.js +2 -1
  114. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  115. package/dist/field/Diff/index.d.ts.map +1 -1
  116. package/dist/field/Diff/index.js +1 -0
  117. package/dist/field/Diff/index.js.map +1 -1
  118. package/dist/field/RenderLexical/index.d.ts +3 -1
  119. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  120. package/dist/field/RenderLexical/index.js +23 -23
  121. package/dist/field/RenderLexical/index.js.map +1 -1
  122. package/dist/field/bundled.css +1 -1
  123. package/dist/index.d.ts +1 -1
  124. package/dist/index.js +1 -1
  125. package/dist/index.js.map +1 -1
  126. package/dist/lexical/LexicalEditor.js.map +1 -1
  127. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  128. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  129. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  130. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  131. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  132. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  133. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  134. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  135. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  136. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  137. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  138. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  139. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  140. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  141. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  142. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  143. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  144. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  145. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  146. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  147. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  148. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  149. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  150. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  151. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  152. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  153. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  154. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  155. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  156. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  157. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  158. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  159. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  160. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  161. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  162. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  163. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  164. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  165. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  166. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  167. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  168. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  169. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  170. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  171. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  172. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  173. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  174. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  175. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  176. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  177. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  178. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  179. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  180. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  181. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  182. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  183. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  184. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  185. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  186. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  187. package/package.json +94 -24
  188. package/dist/exports/client/chunk-FWFDJAJ5.js +0 -2
  189. package/dist/exports/client/chunk-FWFDJAJ5.js.map +0 -7
  190. package/dist/exports/client/component-BAAVC34S.js +0 -2
  191. package/dist/exports/client/component-BAAVC34S.js.map +0 -7
  192. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  193. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  194. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  195. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
@@ -1,26 +1,26 @@
1
- "use client";import{a as xe,c as xt,d as Ct,e as bt}from"./chunk-XFA5M7FY.js";import{a as ze}from"./chunk-DBWINSQN.js";import{a as kt,b as Ze}from"./chunk-FWFDJAJ5.js";import{a as ge}from"./chunk-INBEEENE.js";import{a as Lc}from"./chunk-F26IQ5RE.js";import{b as Zt,c as Yt,d as ne,e as xn,f as Go,g as Vo,h as yc,i as Rc,k as Ic,m as vc,p as Mc}from"./chunk-QAW5QKEM.js";import{a as Nc,b as W}from"./chunk-BZZVLW4U.js";function z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Fc}from"react/compiler-runtime";import{useLexicalComposerContext as Pc}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as Ce}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Bc}from"@lexical/utils";import{$getSelection as jc,$isElementNode as ce,$isNodeSelection as Hc,$isRangeSelection as _t,COMMAND_PRIORITY_LOW as Uc,FORMAT_ELEMENT_COMMAND as Tt}from"lexical";import{useEffect as Wc}from"react";import{jsx as Jo,jsxs as Dc}from"react/jsx-runtime";import"react";var Cn=()=>Dc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Jo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Jo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Jo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ko,jsxs as $c}from"react/jsx-runtime";import"react";var bn=()=>$c("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ko("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Xo,jsxs as Oc}from"react/jsx-runtime";import"react";var qt=()=>Oc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Xo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Xo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Xo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as zo,jsxs as Ac}from"react/jsx-runtime";import"react";var kn=()=>Ac("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[zo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var M=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,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 n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var _n=t=>({type:"dropdown",ChildComponent:qt,items:t,key:"align",order:30});var De=t=>ce(t)?t.getFormatType():t.__format,Tn=[_n([{ChildComponent:qt,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&De(e)==="left")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&De(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"left")},order:1},{ChildComponent:Cn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&De(e)==="center")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&De(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"center")},order:2},{ChildComponent:kn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&De(e)==="right")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&De(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"right")},order:3},{ChildComponent:bn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&De(e)==="justify")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&De(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"justify")},order:4}])],Gc=()=>{let t=Fc(3),[e]=Pc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Tt,Kc,Uc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Wc(o,r),null},Vc=M({plugins:[{Component:Gc,position:"normal"}],toolbarFixed:{groups:Tn},toolbarInline:{groups:Tn}});function Jc(t){return(ce(t)||Ce(t))&&!t.isInline()}function Kc(t){let e=jc();if(!_t(e)&&!Hc(e))return!1;let o=e.getNodes();for(let r of o){let n=Bc(r,Jc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as Rn,$isQuoteNode as Ln,QuoteNode as Zc}from"@lexical/rich-text";import{$setBlocksType as In}from"@lexical/selection";import{$getSelection as vn,$isRangeSelection as Yc}from"lexical";import{jsx as wn}from"react/jsx-runtime";import"react";var Zo=()=>wn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:wn("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Sn}from"react/jsx-runtime";import"react";var wt=()=>Sn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Sn("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var ee=t=>({type:"dropdown",ChildComponent:wt,items:t,key:"text",order:25});import{$createQuoteNode as Xc,$isQuoteNode as En,QuoteNode as zc}from"@lexical/rich-text";var Nn={type:"element",dependencies:[zc],export:(t,e)=>{if(!En(t))return null;let o=e(t).split(`
1
+ "use client";import{a as he,c as xt,d as Ct,e as bt}from"./chunk-XFA5M7FY.js";import{a as Ke}from"./chunk-DBWINSQN.js";import{a as kt,b as Je,c as Xe,d as ve,e as Ze}from"./chunk-OSMEE5HW.js";import{a as fe}from"./chunk-INBEEENE.js";import{a as bc}from"./chunk-F26IQ5RE.js";import{b as Xt,c as Zt,d as ne,e as hn,f as Uo,g as Go,h as kc,i as _c,k as Tc,m as wc,p as Sc}from"./chunk-QAW5QKEM.js";import{a as Cc,b as G}from"./chunk-BZZVLW4U.js";function X(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Rc}from"react/compiler-runtime";import{useLexicalComposerContext as Ic}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as ge}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as vc}from"@lexical/utils";import{$getSelection as Mc,$isElementNode as ce,$isNodeSelection as $c,$isRangeSelection as _t,COMMAND_PRIORITY_LOW as Dc,FORMAT_ELEMENT_COMMAND as Tt}from"lexical";import{useEffect as Ac}from"react";import{jsx as Wo,jsxs as Ec}from"react/jsx-runtime";import"react";var gn=()=>Ec("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Vo,jsxs as Nc}from"react/jsx-runtime";import"react";var xn=()=>Nc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Vo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Vo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Vo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as zo,jsxs as Lc}from"react/jsx-runtime";import"react";var Yt=()=>Lc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[zo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ko,jsxs as yc}from"react/jsx-runtime";import"react";var Cn=()=>yc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ko("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var M=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,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 n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var bn=t=>({type:"dropdown",ChildComponent:Yt,items:t,key:"align",order:30});var Me=t=>ce(t)?t.getFormatType():t.__format,kn=[bn([{ChildComponent:Yt,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||ge(e))&&Me(e)==="left")continue;let o=e.getParent();if(!((ce(o)||ge(o))&&Me(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"left")},order:1},{ChildComponent:gn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||ge(e))&&Me(e)==="center")continue;let o=e.getParent();if(!((ce(o)||ge(o))&&Me(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"center")},order:2},{ChildComponent:Cn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||ge(e))&&Me(e)==="right")continue;let o=e.getParent();if(!((ce(o)||ge(o))&&Me(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"right")},order:3},{ChildComponent:xn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||ge(e))&&Me(e)==="justify")continue;let o=e.getParent();if(!((ce(o)||ge(o))&&Me(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"justify")},order:4}])],Oc=()=>{let t=Rc(3),[e]=Ic(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Tt,Bc,Dc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ac(o,r),null},Fc=M({plugins:[{Component:Oc,position:"normal"}],toolbarFixed:{groups:kn},toolbarInline:{groups:kn}});function Pc(t){return(ce(t)||ge(t))&&!t.isInline()}function Bc(t){let e=Mc();if(!_t(e)&&!$c(e))return!1;let o=e.getNodes();for(let r of o){let n=vc(r,Pc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as Ln,$isQuoteNode as En,QuoteNode as Uc}from"@lexical/rich-text";import{$setBlocksType as yn}from"@lexical/selection";import{$getSelection as Rn,$isRangeSelection as Gc}from"lexical";import{jsx as _n}from"react/jsx-runtime";import"react";var Jo=()=>_n("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_n("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Tn}from"react/jsx-runtime";import"react";var wt=()=>Tn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tn("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var ee=t=>({type:"dropdown",ChildComponent:wt,items:t,key:"text",order:25});import{$createQuoteNode as jc,$isQuoteNode as wn,QuoteNode as Hc}from"@lexical/rich-text";var Sn={type:"element",dependencies:[Hc],export:(t,e)=>{if(!wn(t))return null;let o=e(t).split(`
2
2
  `),r=[];for(let n of o)r.push("> "+n);return r.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(En(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Xc();n.append(...e),t.replace(n),n.select(0,0)}};var yn=[ee([{ChildComponent:Zo,isActive:({selection:t})=>{if(!Yc(t))return!1;for(let e of t.getNodes())if(!Ln(e)&&!Ln(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=vn();In(e,()=>Rn())})},order:20}])],qc=M({markdownTransformers:[Nn],nodes:[Zc],slashMenu:{groups:[z([{Icon:Zo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=vn();In(e,()=>Rn())})}}])]},toolbarFixed:{groups:yn},toolbarInline:{groups:yn}});import{getTranslation as ao}from"@payloadcms/translations";import{jsx as Yo,jsxs as Qc}from"react/jsx-runtime";import"react";var Qt=()=>Qc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Mn}from"react/jsx-runtime";import"react";var eo=()=>Mn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Mn("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as eu}from"react/jsx-runtime";import"react";function to(t,e){let{admin:o,imageAltText:r,imageURL:n}=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=n,i=r),!s)return e;let d=i??"Block Image";return()=>eu("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Wn}from"lexical";import{JSOX as qo}from"jsox";function oo({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let s=tu(t,n);e[o]=s.value,n=s.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function tu(t,e){let o=t[e];return o==='"'?Dn(t,e):o==="'"?Dn(t,e,!0):o==="{"?ru(t,e):o==="["?ou(t,e):lu(t,e)}function ou(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:qo.parse(`[${r}]`)}}function Dn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function ru(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:nu(r)}}function nu(t){return t[0]!=="{"?qo.parse(t):qo.parse(t.replace(/(\w+):/g,'"$1":'))}function lu(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function St({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${iu(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,$n)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,$n)}}`));return e.join(" ")}function iu(t){return t.replace(/"/g,"&quot;")}function $n(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function ro({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let s="",i="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,h=0,f=d[0].slice(0,n.index),g=0,k=r;e:for(let[y,T]of d.entries()){let C=l?T.trim():T,x=0;if(l)for(let _=0;_<T.length&&T[_]===" ";_++)x++;let b=0;for(y===0&&(b=(n.index??0)+n[0].length-x);b<C.length;){let _=C[b],D=C[b+1];if(c){if(_==="`"&&h++,h%2===0)if(_==="<"&&D==="/"){if(u--,u<0){i[i.length-1]===`
4
- `&&(i=i.slice(0,-1)),k=y;for(let v=b;v<C.length;v++)if(C[v]===">"){g=v+1;break}break e}}else if(_==="/"&&D===">"){if(u--,u<0){i[i.length-1]===`
5
- `&&(i=i.slice(0,-1)),k=y,g=b+2;break e}}else _==="<"&&D!=="/"&&u++;i+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&D===">"&&a===0&&!m){p=!0,k=y,g=b+2;break e}else if(_===">"&&a===0&&!m){c=!0,b++;continue}s+=_}b++}if(c?i?.length>0&&y>0&&(i+=`
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(wn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=jc();n.append(...e),t.replace(n),n.select(0,0)}};var Nn=[ee([{ChildComponent:Jo,isActive:({selection:t})=>{if(!Gc(t))return!1;for(let e of t.getNodes())if(!En(e)&&!En(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Rn();yn(e,()=>Ln())})},order:20}])],Wc=M({markdownTransformers:[Sn],nodes:[Uc],slashMenu:{groups:[X([{Icon:Jo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Rn();yn(e,()=>Ln())})}}])]},toolbarFixed:{groups:Nn},toolbarInline:{groups:Nn}});import{getTranslation as so}from"@payloadcms/translations";import{jsx as Xo,jsxs as Vc}from"react/jsx-runtime";import"react";var qt=()=>Vc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Xo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Xo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Xo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as In}from"react/jsx-runtime";import"react";var Qt=()=>In("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:In("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as zc}from"react/jsx-runtime";import"react";function eo(t,e){let{admin:o,imageAltText:r,imageURL:n}=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=n,i=r),!s)return e;let d=i??"Block Image";return()=>zc("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Hn}from"lexical";import{JSOX as Zo}from"jsox";function to({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let s=Kc(t,n);e[o]=s.value,n=s.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Kc(t,e){let o=t[e];return o==='"'?vn(t,e):o==="'"?vn(t,e,!0):o==="{"?Xc(t,e):o==="["?Jc(t,e):Yc(t,e)}function Jc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Zo.parse(`[${r}]`)}}function vn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function Xc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Zc(r)}}function Zc(t){return t[0]!=="{"?Zo.parse(t):Zo.parse(t.replace(/(\w+):/g,'"$1":'))}function Yc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function St({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${qc(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,Mn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,Mn)}}`));return e.join(" ")}function qc(t){return t.replace(/"/g,"&quot;")}function Mn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function oo({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let s="",i="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,h=0,f=d[0].slice(0,n.index),g=0,T=r;e:for(let[S,x]of d.entries()){let b=l?x.trim():x,C=0;if(l)for(let _=0;_<x.length&&x[_]===" ";_++)C++;let k=0;for(S===0&&(k=(n.index??0)+n[0].length-C);k<b.length;){let _=b[k],$=b[k+1];if(c){if(_==="`"&&h++,h%2===0)if(_==="<"&&$==="/"){if(u--,u<0){i[i.length-1]===`
4
+ `&&(i=i.slice(0,-1)),T=S;for(let v=k;v<b.length;v++)if(b[v]===">"){g=v+1;break}break e}}else if(_==="/"&&$===">"){if(u--,u<0){i[i.length-1]===`
5
+ `&&(i=i.slice(0,-1)),T=S,g=k+2;break e}}else _==="<"&&$!=="/"&&u++;i+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&$===">"&&a===0&&!m){p=!0,T=S,g=k+2;break e}else if(_===">"&&a===0&&!m){c=!0,k++;continue}s+=_}k++}if(c?i?.length>0&&S>0&&(i+=`
6
6
  `):s+=`
7
- `,o&&u<0){let _=C.match(o);if(_?.index!==void 0){k=y,g=_.index+_[0].length-1;break}}if(y===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
7
+ `,o&&u<0){let _=b.match(o);if(_?.index!==void 0){T=S,g=_.index+_[0].length-1;break}}if(S===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
8
8
  `)+`
9
9
 
10
- . Start match: `+JSON.stringify(n))}return{afterEndLine:d[k].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:r+k,endlineLastCharIndex:g,propsString:s}}import{jsx as Bu}from"react/jsx-runtime";import ju from"bson-objectid";import{$applyNodeReplacement as Hu}from"lexical";import"react";import{DecoratorBlockNode as su}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as au}from"@lexical/utils";import cu from"bson-objectid";import{$applyNodeReplacement as uu}from"lexical";var Et=class extends su{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=du(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return au(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 r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function du(t){return uu(new Et({fields:{...t,id:t?.id||new cu.default().toHexString()}}))}import{jsx as V,jsxs as Nt,Fragment as Pn}from"react/jsx-runtime";import{useLexicalComposerContext as bu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ku}from"@lexical/react/useLexicalEditable";import{getTranslation as _u}from"@payloadcms/translations";import{Button as Bn,Collapsible as Tu,Drawer as wu,EditDepthProvider as Su,ErrorPill as Eu,Form as Nu,formatDrawerSlug as Lu,FormSubmit as yu,Pill as Ru,RenderFields as Iu,SectionTitle as vu,useConfig as Mu,useDocumentForm as Du,useDocumentInfo as jn,useEditDepth as $u,useFormSubmitted as Ou,useServerFunctions as Au,useTranslation as Fu}from"@payloadcms/ui";import{abortAndIgnore as Qo}from"@payloadcms/ui/shared";import{$getNodeByKey as lo,SKIP_DOM_SELECTION_TAG as er}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as io,reduceFieldsToValues as Hn}from"payload/shared";import Ye,{useCallback as tr,useEffect as or,useMemo as Fe,useRef as rr}from"react";import{v4 as Pu}from"uuid";import{c as mu}from"react/compiler-runtime";import{jsx as no,jsxs as pu}from"react/jsx-runtime";import{useLexicalEditable as fu}from"@lexical/react/useLexicalEditable";import{RenderFields as hu,useFormSubmitted as gu}from"@payloadcms/ui";import xu,{createContext as Cu}from"react";var On=Cu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),le=()=>xu.use(On),An=t=>{let e=mu(4),{Collapsible:o,CustomBlock:r,CustomLabel:n,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=gu()&&i>0,a=fu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,...k}=f;return no(o,{errorCount:i,fieldHasErrors:u,...k,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 r?pu(On,{value:h,children:[r,no(s,{})]}):no(p,{children:no(hu,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function Fn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Un=t=>{let{cacheBuster:e,className:o,CustomBlock:r,CustomLabel:n,formData:l,nodeKey:s}=t,i=Ou(),{id:d,collectionSlug:c,globalSlug:u}=jn(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=W(),{fields:g}=Du(),k=rr(new AbortController),E=$u(),[y,T]=Ye.useState(0),{config:C}=Mu(),x=Lu({slug:`lexical-blocks-create-${f}-${l.id}`,depth:E}),{toggleDrawer:b}=ge(x),{getDocPreferences:_,setDocFieldPreferences:D}=jn(),[v]=bu(),L=ku(),S=l.blockType,{getFormState:w}=Au(),N=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}.fields`,[I,$]=Ye.useState(()=>{let U=p?.[l.id]?.formState;if(!U)return!1;let Q=Object.fromEntries(Object.entries(U).map(([G,J])=>[G,G in l?{...J,initialValue:l[G],value:l[G]}:J]));return Q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},Q}),R=rr(!1),O=rr(e);or(()=>{R.current?(O.current!==e&&$(!1),O.current=e):R.current=!0},[e]);let[F]=Ye.useState(()=>Pu()),[j,X]=Ye.useState(()=>{if(!n)return I?._components?.customComponents?.BlockLabel??void 0}),[P,Ke]=Ye.useState(()=>{if(!r)return I?._components?.customComponents?.Block??void 0}),ye=Fe(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:le}):P,[r,o,l,s,P]),fe=Fe(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:le}):j,[n,o,l,s,j]);or(()=>{let U=new AbortController;return l&&!I&&(async()=>{let{state:G}=await w({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:io(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!L,renderAllFields:!0,schemaPath:N,signal:U.signal});if(G){G.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let J=Hn(io(G,{excludeFiles:!0}),!0);v.update(()=>{let Y=lo(s);if(Y&&Pe(Y)){let re=J;re.blockType=S,Y.setFields(re,!0)}},{tag:er}),$(G),n||X(G._components?.customComponents?.BlockLabel??void 0),r||Ke(G._components?.customComponents?.Block??void 0)}})(),()=>{Qo(U)}},[w,N,L,d,n,r,l,v,s,I,c,u,_,g,S]);let[ft,ht]=Ye.useState(p?.[l.id]?.collapsed??!1),ie=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}`,Ie=a.blocks?.[ie]?.[0],q=Ie.blockReferences?typeof Ie?.blockReferences?.[0]=="string"?C.blocksMap[Ie?.blockReferences?.[0]]:Ie?.blockReferences?.[0]:Ie?.blocks?.[0],{i18n:he,t:ve}=Fu(),gt=tr(async({formState:U,submit:Q})=>{Qo(k.current);let G=new AbortController;k.current=G;let{state:J}=await w({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:io(g,{excludeFiles:!0}),formState:U,globalSlug:u,initialBlockFormState:U,operation:"update",readOnly:!L,renderAllFields:!!Q,schemaPath:N,signal:G.signal});if(!J)return U;U.blockName&&(J.blockName=U.blockName);let Y=Hn(Fn({fields:io(J,{excludeFiles:!0})}),!0);if(setTimeout(()=>{v.update(()=>{let re=lo(s);if(re&&Pe(re)){let Xe=Y;Xe.blockType=S,re.setFields(Xe,!0)}},{tag:er})},0),Q){n||X(J._components?.customComponents?.BlockLabel??void 0),r||Ke(J._components?.customComponents?.Block??void 0);let re=0;for(let Xe of Object.values(J))Xe?.valid===!1&&re++;T(re)}return J},[w,d,c,_,u,N,S,g,L,v,s,r,n]);or(()=>()=>{Qo(k.current)},[]);let Kt=tr(()=>{v.update(()=>{lo(s)?.remove()})},[v,s]),Me=q?.labels?.singular?_u(q.labels.singular,he):q?.slug,dn=tr(U=>{_().then(Q=>{let J=Q?.fields?.[m.name]?.collapsed,Y=J&&J?.length?J:[];U?Y.includes(l.id)||Y.push(l.id):Y.includes(l.id)&&Y.splice(Y.indexOf(l.id),1),D(m.name,{collapsed:Y,hello:"hi"})})},[_,m.name,D,l.id]),Xt=Fe(()=>()=>V(Bn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!L,el:"button",icon:"edit",onClick:U=>(U.preventDefault(),U.stopPropagation(),b(),!1),onMouseDown:U=>{U.preventDefault()},round:!0,size:"small",tooltip:ve("lexical:blocks:inlineBlocks:edit",{label:Me})}),[o,L,ve,Me,b]),zt=Fe(()=>()=>V(Bn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!L,icon:"x",onClick:U=>{U.preventDefault(),Kt()},round:!0,tooltip:"Remove Block"}),[o,L,Kt]),Uo=Fe(()=>({Actions:U,children:Q,className:G,collapsibleProps:J,disableBlockName:Y,editButton:re,errorCount:Xe,fieldHasErrors:Wo,Label:fn,Pill:hn,removeButton:Ec})=>V("div",{className:`${o}__container ${o}-${S}`,children:V(Tu,{className:[`${o}__row`,Wo?`${o}__row--has-errors`:`${o}__row--no-errors`,G].filter(Boolean).join(" "),collapsibleStyle:Wo?"error":"default",header:Nt("div",{className:`${o}__block-header`,children:[typeof fn<"u"?fn:typeof fe<"u"?fe:Nt("div",{className:`${o}__block-label`,children:[typeof hn<"u"?hn:V(Ru,{className:`${o}__block-pill ${o}__block-pill-${S}`,pillStyle:"white",size:"small",children:Me??S}),!Y&&!q?.admin?.disableBlockName&&V(vu,{path:"blockName",readOnly:!L}),Wo&&V(Eu,{count:Xe??0,i18n:he,withMessage:!0})]}),V("div",{className:`${o}__block-actions`,children:typeof U<"u"?U:Nt(Pn,{children:[ye&&re!==!1||!ye&&re?V(Xt,{}):null,Ec!==!1&&L?V(zt,{}):null]})})]}),isCollapsed:ft,onToggle:gn=>{dn(gn),ht(gn)},...J||{},children:Q},0)}),[ye,fe,Xt,zt,Me,o,q?.admin?.disableBlockName,S,he,ft,dn,L]),mn=l?.id,pn=Fe(()=>()=>V(Su,{children:V(wu,{className:"",slug:x,title:ve(`lexical:blocks:inlineBlocks:${mn?"edit":"create"}`,{label:Me??ve("lexical:blocks:inlineBlocks:label")}),children:I?Nt(Pn,{children:[V(Iu,{fields:q?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:!0,readOnly:!L}),V(yu,{programmaticSubmit:!0,children:ve("fields:saveChanges")})]}):null})}),[I,x,mn,Me,ve,L,q?.fields,N]),Sc=Fe(()=>I?V("div",{"data-block-drawer-slug":x,style:{display:"contents"},children:V(Nu,{beforeSubmit:[async({formState:U})=>await gt({formState:U,submit:!0})],el:"div",fields:q?.fields??[],initialState:I,onChange:[gt],onSubmit:(U,Q)=>{Q.blockType=S,v.update(()=>{let G=lo(s);G&&Pe(G)&&G.setFields(Q,!0)},{tag:er}),b()},submitted:i,uuid:F,children:V(An,{baseClass:o,BlockDrawer:pn,Collapsible:Uo,CustomBlock:ye,CustomLabel:fe,EditButton:Xt,errorCount:y,formSchema:q?.fields??[],initialState:I,nodeKey:s,RemoveButton:zt})})}):null,[Uo,pn,ye,fe,S,x,zt,Xt,o,v,y,b,q?.fields,F,I,s,gt,i]);return q?Sc:V(Uo,{disableBlockName:!0,fieldHasErrors:!0,children:Nt("div",{className:`${o}-not-found`,children:["Error: Block '",S,"' not found in the config but exists in the lexical data"]})})};var se=class extends Et{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Be(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,r,n]){return Bu(Un,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:r,CustomLabel:n,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return Hu(new se({fields:{...t,id:t?.id||new ju.default().toHexString()}}))}function Pe(t){return t instanceof se}import{createHeadlessEditor as Uu}from"@lexical/headless";function nr(t,e){return({editorState:r})=>{let n=Uu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return n.getEditorState().read(()=>{l=Yt(e)}),l}}import{createHeadlessEditor as Wu}from"@lexical/headless";function so(t,e){return({markdown:r})=>{let n=Wu({nodes:t});return n.update(()=>{Zt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Gu(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Vn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Gn(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Gn(r,!0);n&&(o=o.concat(n))}return o};function Gn(t,e){if(!t.jsx)return null;let o=Gu(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[xt],export:s=>{if(!bt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=nr(n,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?" "+St({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+St({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=ro({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}=ro({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=so(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?oo({propsString:c}):{}});if(a===!1)return;let m=Ct({blockType:t.slug,...a});s.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[se],export:s=>{if(!Pe(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=nr(n,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(`
10
+ . Start match: `+JSON.stringify(n))}return{afterEndLine:d[T].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:r+T,endlineLastCharIndex:g,propsString:s}}import{jsx as vu}from"react/jsx-runtime";import Mu from"bson-objectid";import{$applyNodeReplacement as $u}from"lexical";import"react";import{DecoratorBlockNode as Qc}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as eu}from"@lexical/utils";import tu from"bson-objectid";import{$applyNodeReplacement as ou}from"lexical";var Et=class extends Qc{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=ru(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return eu(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 r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function ru(t){return ou(new Et({fields:{...t,id:t?.id||new tu.default().toHexString()}}))}import{jsx as V,jsxs as Nt,Fragment as On}from"react/jsx-runtime";import{useLexicalComposerContext as du}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as mu}from"@lexical/react/useLexicalEditable";import{getTranslation as pu}from"@payloadcms/translations";import{Button as Fn,Collapsible as fu,Drawer as hu,EditDepthProvider as gu,ErrorPill as xu,Form as Cu,formatDrawerSlug as bu,FormSubmit as ku,Pill as _u,RenderFields as Tu,SectionTitle as wu,useConfig as Su,useDocumentForm as Eu,useDocumentInfo as Pn,useEditDepth as Nu,useFormSubmitted as Lu,useServerFunctions as yu,useTranslation as Ru}from"@payloadcms/ui";import{abortAndIgnore as Yo}from"@payloadcms/ui/shared";import{$getNodeByKey as no,SKIP_DOM_SELECTION_TAG as qo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as lo,reduceFieldsToValues as Bn}from"payload/shared";import Ye,{useCallback as Qo,useEffect as er,useMemo as Ae,useRef as tr}from"react";import{v4 as Iu}from"uuid";import{c as nu}from"react/compiler-runtime";import{jsx as ro,jsxs as lu}from"react/jsx-runtime";import{useLexicalEditable as iu}from"@lexical/react/useLexicalEditable";import{RenderFields as su,useFormSubmitted as au}from"@payloadcms/ui";import cu,{createContext as uu}from"react";var $n=uu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),le=()=>cu.use($n),Dn=t=>{let e=nu(4),{Collapsible:o,CustomBlock:r,CustomLabel:n,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=au()&&i>0,a=iu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,...T}=f;return ro(o,{errorCount:i,fieldHasErrors:u,...T,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 r?lu($n,{value:h,children:[r,ro(s,{})]}):ro(p,{children:ro(su,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function An({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var jn=t=>{let{cacheBuster:e,className:o,CustomBlock:r,CustomLabel:n,formData:l,nodeKey:s}=t,i=Lu(),{id:d,collectionSlug:c,globalSlug:u}=Pn(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=G(),{fields:g}=Eu(),T=tr(new AbortController),E=Nu(),[S,x]=Ye.useState(0),{config:b}=Su(),C=bu({slug:`lexical-blocks-create-${f}-${l.id}`,depth:E}),{toggleDrawer:k}=fe(C),{getDocPreferences:_,setDocFieldPreferences:$}=Pn(),[v]=du(),N=mu(),L=l.blockType,{getFormState:w}=yu(),y=`${h}.lexical_internal_feature.blocks.lexical_blocks.${L}.fields`,[I,D]=Ye.useState(()=>{let U=p?.[l.id]?.formState;if(!U)return!1;let Q=Object.fromEntries(Object.entries(U).map(([W,z])=>[W,W in l?{...z,initialValue:l[W],value:l[W]}:z]));return Q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},Q}),R=tr(!1),A=tr(e);er(()=>{R.current?(A.current!==e&&D(!1),A.current=e):R.current=!0},[e]);let[H]=Ye.useState(()=>Iu()),[B,J]=Ye.useState(()=>{if(!n)return I?._components?.customComponents?.BlockLabel??void 0}),[F,Ve]=Ye.useState(()=>{if(!r)return I?._components?.customComponents?.Block??void 0}),Ne=Ae(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:le}):F,[r,o,l,s,F]),me=Ae(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:le}):B,[n,o,l,s,B]);er(()=>{let U=new AbortController;return l&&!I&&(async()=>{let{state:W}=await w({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:lo(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!N,renderAllFields:!0,schemaPath:y,signal:U.signal});if(W){W.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let z=Bn(lo(W,{excludeFiles:!0}),!0);v.update(()=>{let Y=no(s);if(Y&&Oe(Y)){let re=z;re.blockType=L,Y.setFields(re,!0)}},{tag:qo}),D(W),n||J(W._components?.customComponents?.BlockLabel??void 0),r||Ve(W._components?.customComponents?.Block??void 0)}})(),()=>{Yo(U)}},[w,y,N,d,n,r,l,v,s,I,c,u,_,g,L]);let[ft,ht]=Ye.useState(p?.[l.id]?.collapsed??!1),ie=`${h}.lexical_internal_feature.blocks.lexical_blocks.${L}`,ye=a.blocks?.[ie]?.[0],q=ye.blockReferences?typeof ye?.blockReferences?.[0]=="string"?b.blocksMap[ye?.blockReferences?.[0]]:ye?.blockReferences?.[0]:ye?.blocks?.[0],{i18n:pe,t:Re}=Ru(),gt=Qo(async({formState:U,submit:Q})=>{Yo(T.current);let W=new AbortController;T.current=W;let{state:z}=await w({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:lo(g,{excludeFiles:!0}),formState:U,globalSlug:u,initialBlockFormState:U,operation:"update",readOnly:!N,renderAllFields:!!Q,schemaPath:y,signal:W.signal});if(!z)return U;U.blockName&&(z.blockName=U.blockName);let Y=Bn(An({fields:lo(z,{excludeFiles:!0})}),!0);if(setTimeout(()=>{v.update(()=>{let re=no(s);if(re&&Oe(re)){let ze=Y;ze.blockType=L,re.setFields(ze,!0)}},{tag:qo})},0),Q){n||J(z._components?.customComponents?.BlockLabel??void 0),r||Ve(z._components?.customComponents?.Block??void 0);let re=0;for(let ze of Object.values(z))ze?.valid===!1&&re++;x(re)}return z},[w,d,c,_,u,y,L,g,N,v,s,r,n]);er(()=>()=>{Yo(T.current)},[]);let zt=Qo(()=>{v.update(()=>{no(s)?.remove()})},[v,s]),Ie=q?.labels?.singular?pu(q.labels.singular,pe):q?.slug,cn=Qo(U=>{_().then(Q=>{let z=Q?.fields?.[m.name]?.collapsed,Y=z&&z?.length?z:[];U?Y.includes(l.id)||Y.push(l.id):Y.includes(l.id)&&Y.splice(Y.indexOf(l.id),1),$(m.name,{collapsed:Y,hello:"hi"})})},[_,m.name,$,l.id]),Kt=Ae(()=>()=>V(Fn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!N,el:"button",icon:"edit",onClick:U=>(U.preventDefault(),U.stopPropagation(),k(),!1),onMouseDown:U=>{U.preventDefault()},round:!0,size:"small",tooltip:Re("lexical:blocks:inlineBlocks:edit",{label:Ie})}),[o,N,Re,Ie,k]),Jt=Ae(()=>()=>V(Fn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!N,icon:"x",onClick:U=>{U.preventDefault(),zt()},round:!0,tooltip:"Remove Block"}),[o,N,zt]),jo=Ae(()=>({Actions:U,children:Q,className:W,collapsibleProps:z,disableBlockName:Y,editButton:re,errorCount:ze,fieldHasErrors:Ho,Label:mn,Pill:pn,removeButton:xc})=>V("div",{className:`${o}__container ${o}-${L}`,children:V(fu,{className:[`${o}__row`,Ho?`${o}__row--has-errors`:`${o}__row--no-errors`,W].filter(Boolean).join(" "),collapsibleStyle:Ho?"error":"default",header:Nt("div",{className:`${o}__block-header`,children:[typeof mn<"u"?mn:typeof me<"u"?me:Nt("div",{className:`${o}__block-label`,children:[typeof pn<"u"?pn:V(_u,{className:`${o}__block-pill ${o}__block-pill-${L}`,pillStyle:"white",size:"small",children:Ie??L}),!Y&&!q?.admin?.disableBlockName&&V(wu,{path:"blockName",readOnly:!N}),Ho&&V(xu,{count:ze??0,i18n:pe,withMessage:!0})]}),V("div",{className:`${o}__block-actions`,children:typeof U<"u"?U:Nt(On,{children:[Ne&&re!==!1||!Ne&&re?V(Kt,{}):null,xc!==!1&&N?V(Jt,{}):null]})})]}),isCollapsed:ft,onToggle:fn=>{cn(fn),ht(fn)},...z||{},children:Q},0)}),[Ne,me,Kt,Jt,Ie,o,q?.admin?.disableBlockName,L,pe,ft,cn,N]),un=l?.id,dn=Ae(()=>()=>V(gu,{children:V(hu,{className:"",slug:C,title:Re(`lexical:blocks:inlineBlocks:${un?"edit":"create"}`,{label:Ie??Re("lexical:blocks:inlineBlocks:label")}),children:I?Nt(On,{children:[V(Tu,{fields:q?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:y,permissions:!0,readOnly:!N}),V(ku,{programmaticSubmit:!0,children:Re("fields:saveChanges")})]}):null})}),[I,C,un,Ie,Re,N,q?.fields,y]),gc=Ae(()=>I?V("div",{"data-block-drawer-slug":C,style:{display:"contents"},children:V(Cu,{beforeSubmit:[async({formState:U})=>await gt({formState:U,submit:!0})],el:"div",fields:q?.fields??[],initialState:I,onChange:[gt],onSubmit:(U,Q)=>{Q.blockType=L,v.update(()=>{let W=no(s);W&&Oe(W)&&W.setFields(Q,!0)},{tag:qo}),k()},submitted:i,uuid:H,children:V(Dn,{baseClass:o,BlockDrawer:dn,Collapsible:jo,CustomBlock:Ne,CustomLabel:me,EditButton:Kt,errorCount:S,formSchema:q?.fields??[],initialState:I,nodeKey:s,RemoveButton:Jt})})}):null,[jo,dn,Ne,me,L,C,Jt,Kt,o,v,S,k,q?.fields,H,I,s,gt,i]);return q?gc:V(jo,{disableBlockName:!0,fieldHasErrors:!0,children:Nt("div",{className:`${o}-not-found`,children:["Error: Block '",L,"' not found in the config but exists in the lexical data"]})})};var se=class extends Et{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Fe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,r,n]){return vu(jn,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:r,CustomLabel:n,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Fe(t){return $u(new se({fields:{...t,id:t?.id||new Mu.default().toHexString()}}))}function Oe(t){return t instanceof se}import{createHeadlessEditor as Du}from"@lexical/headless";function or(t,e){return({editorState:r})=>{let n=Du({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return n.getEditorState().read(()=>{l=Zt(e)}),l}}import{createHeadlessEditor as Au}from"@lexical/headless";function io(t,e){return({markdown:r})=>{let n=Au({nodes:t});return n.update(()=>{Xt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Ou(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Gn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Un(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Un(r,!0);n&&(o=o.concat(n))}return o};function Un(t,e){if(!t.jsx)return null;let o=Ou(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[xt],export:s=>{if(!bt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=or(n,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?" "+St({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+St({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=oo({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}=oo({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=io(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?to({propsString:c}):{}});if(a===!1)return;let m=Ct({blockType:t.slug,...a});s.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[se],export:s=>{if(!Oe(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=or(n,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
11
  `))for(let h of m.split(`
12
12
  `)){let f="";!t?.jsx?.doNotTrimChildren&&h!==""&&(f=" "),f+=h+`
13
13
  `,p+=f}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
14
  `;return`<${i.blockType}${u?" "+St({props:a}):""}>
15
- ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+St({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:k}=ro({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=f.endsWith(`
15
+ ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+St({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:T}=oo({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=f.endsWith(`
16
16
  `)?f.slice(0,-1):f;else if(f.includes(`
17
- `)){let x=f.split(`
18
- `),b=0;for(let _ of x){if(b++,_.startsWith(" "))E+=_.slice(2);else if(_==="")E+=_;else{E=f.endsWith(`
19
- `)?f.slice(0,-1):f;break}E+=b===x.length?"":`
17
+ `)){let C=f.split(`
18
+ `),k=0;for(let _ of C){if(k++,_.startsWith(" "))E+=_.slice(2);else if(_==="")E+=_;else{E=f.endsWith(`
19
+ `)?f.slice(0,-1):f;break}E+=k===C.length?"":`
20
20
  `}}else E=(f.startsWith(" ")?f.slice(2):f)+`
21
- `;if(!t?.jsx?.import)return[!1,d];let y=so(n,l),T=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:y,openMatch:c,props:k?oo({propsString:k}):{}});if(T===!1)return[!1,d];let C=Be({blockType:t.slug,...T});if(C){let x=null,b=null;if(h?.length){x=y({markdown:h})?.root?.children??[];let _=x?.[0];_&&i.append(Wn(_))}if(i.append(C),p?.length){b=y({markdown:p})?.root?.children;let _=i.getChildren()[i.getChildren().length-1],D=Wn(b[0])?.getChildren();if(D?.length)for(let v of D)_.append(v)}}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 k of i)g+=k.getTextContent();u=[g]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
21
+ `;if(!t?.jsx?.import)return[!1,d];let S=io(n,l),x=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:S,openMatch:c,props:T?to({propsString:T}):{}});if(x===!1)return[!1,d];let b=Fe({blockType:t.slug,...x});if(b){let C=null,k=null;if(h?.length){C=S({markdown:h})?.root?.children??[];let _=C?.[0];_&&i.append(Hn(_))}if(i.append(b),p?.length){k=S({markdown:p})?.root?.children;let _=i.getChildren()[i.getChildren().length-1],$=Hn(k[0])?.getChildren();if($?.length)for(let v of $)_.append(v)}}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 T of i)g+=T.getTextContent();u=[g]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
22
22
  `):a=u.join(`
23
- `).trim();let m=d[1]?.trim(),p=so(n,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?oo({propsString:m}):{}});if(h===!1)return!1;let f=Be({blockType:t.slug,...h});f&&s.append(f);return}return!1}})),r)}import{createCommand as Jn}from"lexical";var qe=Jn("INSERT_BLOCK_COMMAND"),Qe=Jn("INSERT_INLINE_BLOCK_COMMAND");import{c as Vu}from"react/compiler-runtime";import{useLexicalComposerContext as Ju}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ku,$wrapNodeInElement as Xu,mergeRegister as zu}from"@lexical/utils";import{formatDrawerSlug as Zu,useEditDepth as Yu}from"@payloadcms/ui";import{$createParagraphNode as qu,$getNodeByKey as Qu,$getPreviousSelection as ed,$getSelection as td,$insertNodes as od,$isParagraphNode as rd,$isRangeSelection as nd,$isRootOrShadowRoot as ld,COMMAND_PRIORITY_EDITOR as Kn}from"lexical";import{useEffect as id,useState as sd}from"react";var Xn=()=>{let t=Vu(12),[e]=Ju(),[o,r]=sd(null),{setCreatedInlineBlock:n,uuid:l}=W(),s=Yu(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=Zu({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=ge(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([se]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return zu(e.registerCommand(qe,p=>(e.update(()=>{let h=td()||ed();if(nd(h)){let f=Be(p),{focus:g}=h,k=g.getNode();Ku(f),rd(k)&&!k.__first&&k.remove()}}),!0),Kn),e.registerCommand(Qe,p=>{if(o){let f=Qu(o);return!f||!bt(f)?!1:(f.setFields(p),r(null),!0)}let h=Ct(p);return n?.(h),od([h]),ld(h.getParentOrThrow())&&Xu(h,qu).selectEnd(),!0},Kn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==u?(m=[e,n,o,u],t[7]=e,t[8]=n,t[9]=o,t[10]=u,t[11]=m):m=t[11],id(a,m),null};var ad=M(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").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:Vn({blocks:c,inlineBlocks:u}),nodes:[se,xt],plugins:[{Component:Xn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:to(a,Qt),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?ao(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:eo,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?ao(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Qe,{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:Qt,items:c.map((a,m)=>({ChildComponent:to(a,Qt),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?ao(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(qe,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:eo,items:u.map((a,m)=>({ChildComponent:to(a,eo),isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?ao(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Qe,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as dd}from"react/compiler-runtime";import{jsx as He,jsxs as ar}from"react/jsx-runtime";import{useLexicalComposerContext as md}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as pd,$createTextNode as fd,$getRoot as hd,getDOMSelection as lr}from"lexical";import*as Qn from"react";import{useCallback as je,useEffect as ir,useLayoutEffect as Zn,useRef as sr,useState as co}from"react";var cd=ne&&"documentMode"in document?document.documentMode:null,zn=ne&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),u6=ne&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),d6=ne&&"InputEvent"in window&&!cd?"getTargetRanges"in new window.InputEvent("input"):!1,m6=ne&&/Version\/[\d.].*Safari/.test(navigator.userAgent),p6=ne&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,f6=ne&&/Android/.test(navigator.userAgent),h6=ne&&/Win/.test(navigator.platform),ud=ne&&/^(?=.*Chrome).*/i.test(navigator.userAgent),g6=ne&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ud;var gd=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)},xd=(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)},Cd=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
23
+ `).trim();let m=d[1]?.trim(),p=io(n,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?to({propsString:m}):{}});if(h===!1)return!1;let f=Fe({blockType:t.slug,...h});f&&s.append(f);return}return!1}})),r)}import{createCommand as Wn}from"lexical";var qe=Wn("INSERT_BLOCK_COMMAND"),Qe=Wn("INSERT_INLINE_BLOCK_COMMAND");import{c as Fu}from"react/compiler-runtime";import{useLexicalComposerContext as Pu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Bu,$wrapNodeInElement as ju,mergeRegister as Hu}from"@lexical/utils";import{formatDrawerSlug as Uu,useEditDepth as Gu}from"@payloadcms/ui";import{$createParagraphNode as Wu,$getNodeByKey as Vu,$getPreviousSelection as zu,$getSelection as Ku,$insertNodes as Ju,$isParagraphNode as Xu,$isRangeSelection as Zu,$isRootOrShadowRoot as Yu,COMMAND_PRIORITY_EDITOR as Vn}from"lexical";import{useEffect as qu,useState as Qu}from"react";var zn=()=>{let t=Fu(12),[e]=Pu(),[o,r]=Qu(null),{setCreatedInlineBlock:n,uuid:l}=G(),s=Gu(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=Uu({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]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([se]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Hu(e.registerCommand(qe,p=>(e.update(()=>{let h=Ku()||zu();if(Zu(h)){let f=Fe(p),{focus:g}=h,T=g.getNode();Bu(f),Xu(T)&&!T.__first&&T.remove()}}),!0),Vn),e.registerCommand(Qe,p=>{if(o){let f=Vu(o);return!f||!bt(f)?!1:(f.setFields(p),r(null),!0)}let h=Ct(p);return n?.(h),Ju([h]),Yu(h.getParentOrThrow())&&ju(h,Wu).selectEnd(),!0},Vn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==u?(m=[e,n,o,u],t[7]=e,t[8]=n,t[9]=o,t[10]=u,t[11]=m):m=t[11],qu(a,m),null};var ed=M(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").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:Gn({blocks:c,inlineBlocks:u}),nodes:[se,xt],plugins:[{Component:zn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:eo(a,qt),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?so(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:Qt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?so(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Qe,{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:qt,items:c.map((a,m)=>({ChildComponent:eo(a,qt),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?so(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(qe,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:Qt,items:u.map((a,m)=>({ChildComponent:eo(a,Qt),isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?so(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Qe,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as rd}from"react/compiler-runtime";import{jsx as Be,jsxs as ir}from"react/jsx-runtime";import{useLexicalComposerContext as nd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ld,$createTextNode as id,$getRoot as sd,getDOMSelection as rr}from"lexical";import*as Yn from"react";import{useCallback as Pe,useEffect as nr,useLayoutEffect as Jn,useRef as lr,useState as ao}from"react";var td=ne&&"documentMode"in document?document.documentMode:null,Kn=ne&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),t6=ne&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),o6=ne&&"InputEvent"in window&&!td?"getTargetRanges"in new window.InputEvent("input"):!1,r6=ne&&/Version\/[\d.].*Safari/.test(navigator.userAgent),n6=ne&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,l6=ne&&/Android/.test(navigator.userAgent),i6=ne&&/Win/.test(navigator.platform),od=ne&&/^(?=.*Chrome).*/i.test(navigator.userAgent),s6=ne&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!od;var ad=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)},cd=(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)},ud=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
24
24
  await assertSelection(page, {
25
25
  anchorPath: [${n.anchorPath.toString()}],
26
26
  anchorOffset: ${n.anchorOffset},
@@ -30,7 +30,7 @@ ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+St({props:a}):""}/>`},handl
30
30
  `;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
31
31
  `);default:return` await repeat(${t.count}, async () => {
32
32
  ${o}
33
- );`}};function bd(t){return t.key.toLowerCase()==="a"&&(zn?t.metaKey:t.ctrlKey)}function kd(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function Yn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var qn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function _d(t){let[e,o]=co([]),[r,n]=co(!1),[,l]=co(""),[s,i]=co(""),d=sr(null),c=sr(!1),u=sr(null),a=je(()=>t,[t]),m=je(()=>{let T=t.getRootElement(),C=lr(t._window);return T==null||C==null||C.anchorNode==null||C.focusNode==null||!T.contains(C.anchorNode)||!T.contains(C.focusNode)?null:`
33
+ );`}};function dd(t){return t.key.toLowerCase()==="a"&&(Kn?t.metaKey:t.ctrlKey)}function md(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function Xn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var Zn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function pd(t){let[e,o]=ao([]),[r,n]=ao(!1),[,l]=ao(""),[s,i]=ao(""),d=lr(null),c=lr(!1),u=lr(null),a=Pe(()=>t,[t]),m=Pe(()=>{let x=t.getRootElement(),b=rr(t._window);return x==null||b==null||b.anchorNode==null||b.focusNode==null||!x.contains(b.anchorNode)||!x.contains(b.focusNode)?null:`
34
34
  import {
35
35
  initializeE2E,
36
36
  assertHTMLSnapshot,
@@ -47,20 +47,20 @@ describe('Test case', () => {
47
47
  const {page} = e2e;
48
48
 
49
49
  await page.focus('div[contenteditable="true"]');
50
- ${e.map(Cd).join(`
50
+ ${e.map(ud).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=je((T,C)=>{o(x=>{let b=e.length-1,_=e[b];if(_&&_.name===T){if(T==="type")return[...e.slice(0,b),{..._,value:_.value+C}];if(_.value===C)return[...e.slice(0,b),{..._,count:_.count+1}]}return[...x,{name:T,count:1,value:C}]})},[e,o]);Zn(()=>{let T=x=>{if(!r)return;let b=x.key;bd(x)?p("selectAll",""):qn.has(b)?p("press",x.key):[...b].length>1?p("keydown",x.key):p("type",x.key)},C=x=>{if(!r)return;let b=x.key;!qn.has(b)&&[...b].length>1&&p("keyup",x.key)};return t.registerRootListener((x,b)=>{b!==null&&(b.removeEventListener("keydown",T),b.removeEventListener("keyup",C)),x!==null&&(x.addEventListener("keydown",T),x.addEventListener("keyup",C))})},[t,r,p]),Zn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),ir(()=>{if(e){let T=m();T!==null&&i(T),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),ir(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:x,editorState:b})=>{if(!r)return;let _=b._selection,D=d.current,v=c.current;if(D!==_){if(x.size===0&&C.size===0&&!v){let S=lr(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}d.current=_}c.current=!1;let L=m();L!==null&&i(L)}),[t,m,r,p]),ir(()=>r?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,r]);let h=je(T=>{r||(T.update(()=>{let C=hd();C.clear();let x=fd();C.append(pd().append(x)),x.select()}),o([])),n(C=>!C)},[r]),f=je(()=>{if(!r)return;let T=lr(t._window);if(T===null||T.anchorNode==null||T.focusNode==null)return;let{anchorNode:C,anchorOffset:x,focusNode:b,focusOffset:_}=kd(T),D=a().getRootElement(),v;C!==null&&(v=Yn(C,D));let L;b!==null&&(L=Yn(b,D)),p("snapshot",{anchorNode:C,anchorOffset:x,anchorPath:v,focusNode:b,focusOffset:_,focusPath:L})},[p,r,a]),g=je(()=>{gd(m())},[m]),k=je(()=>{xd("test.js",m())},[m]);return[He("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:T=>{h(a()),T.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?ar("div",{className:"test-recorder-output",children:[ar("div",{className:"test-recorder-toolbar",children:[He("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:T=>{f(),T.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),He("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:T=>{g(),T.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),He("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:T=>{k(),T.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),He("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var el=()=>{let t=dd(3),[e]=md(),[o,r]=_d(e),n;return t[0]!==o||t[1]!==r?(n=ar(Qn.Fragment,{children:[He("p",{children:"HI"}),o,r,He("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Td=M({plugins:[{Component:el,position:"bottom"}]});import{c as wd}from"react/compiler-runtime";import{jsx as Sd}from"react/jsx-runtime";import{useLexicalComposerContext as Ed}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Nd}from"@lexical/react/LexicalTreeView.js";import"react";var tl=()=>{let t=wd(2),[e]=Ed(),o;return t[0]!==e?(o=Sd(Nd,{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 Ld=M({plugins:[{Component:tl,position:"bottom"}]});import{$isTableSelection as yd}from"@lexical/table";import{$isRangeSelection as Rd,FORMAT_TEXT_COMMAND as Id}from"lexical";import{jsx as ol}from"react/jsx-runtime";import"react";var rl=()=>ol("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ol("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var nl={type:"text-format",format:["bold","italic"],tag:"***"},ll={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},il={type:"text-format",format:["bold"],tag:"**"},sl={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var al=[Z([{ChildComponent:rl,isActive:({selection:t})=>Rd(t)||yd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Id,"bold")},order:1}])],vd=M(({featureProviderMap:t})=>{let e=[il,sl];return t.get("italic")&&e.push(ll,nl),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:al},toolbarInline:{groups:al}}});import{$isTableSelection as Dd}from"@lexical/table";import{$isRangeSelection as $d,FORMAT_TEXT_COMMAND as Od}from"lexical";import{jsx as cl,jsxs as Md}from"react/jsx-runtime";import"react";var ul=()=>Md("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[cl("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),cl("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var dl={type:"text-format",format:["code"],tag:"`"};var ml=[Z([{ChildComponent:ul,isActive:({selection:t})=>$d(t)||Dd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Od,"code")},order:7}])],Ad=M({enableFormats:["code"],markdownTransformers:[dl],toolbarFixed:{groups:ml},toolbarInline:{groups:ml}});import{$isTableSelection as Fd}from"@lexical/table";import{$isRangeSelection as Pd,FORMAT_TEXT_COMMAND as Bd}from"lexical";import{jsx as pl}from"react/jsx-runtime";import"react";var fl=()=>pl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:pl("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var hl={type:"text-format",format:["italic"],tag:"*"},gl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var xl=[Z([{ChildComponent:fl,isActive:({selection:t})=>Pd(t)||Fd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Bd,"italic")},order:2}])],jd=M({enableFormats:["italic"],markdownTransformers:[hl,gl],toolbarFixed:{groups:xl},toolbarInline:{groups:xl}});import{$isTableSelection as Ud}from"@lexical/table";import{$isRangeSelection as Wd,FORMAT_TEXT_COMMAND as Gd}from"lexical";import{jsx as Cl,jsxs as Hd}from"react/jsx-runtime";import"react";var bl=()=>Hd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Cl("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),Cl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var kl={type:"text-format",format:["strikethrough"],tag:"~~"};var _l=[Z([{ChildComponent:bl,isActive:({selection:t})=>Wd(t)||Ud(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Gd,"strikethrough")},order:4}])],Vd=M({enableFormats:["strikethrough"],markdownTransformers:[kl],toolbarFixed:{groups:_l},toolbarInline:{groups:_l}});import{$isTableSelection as Jd}from"@lexical/table";import{$isRangeSelection as Kd,FORMAT_TEXT_COMMAND as Xd}from"lexical";import{jsx as Tl}from"react/jsx-runtime";import"react";var wl=()=>Tl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Sl=[Z([{ChildComponent:wl,isActive:({selection:t})=>Kd(t)||Jd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Xd,"subscript")},order:5}])],zd=M({enableFormats:["subscript"],toolbarFixed:{groups:Sl},toolbarInline:{groups:Sl}});import{$isTableSelection as Zd}from"@lexical/table";import{$isRangeSelection as Yd,FORMAT_TEXT_COMMAND as qd}from"lexical";import{jsx as El}from"react/jsx-runtime";import"react";var Nl=()=>El("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Ll=[Z([{ChildComponent:Nl,isActive:({selection:t})=>Yd(t)||Zd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(qd,"superscript")},order:6}])],Qd=M({enableFormats:["superscript"],toolbarFixed:{groups:Ll},toolbarInline:{groups:Ll}});import{$isTableSelection as tm}from"@lexical/table";import{$isRangeSelection as om,FORMAT_TEXT_COMMAND as rm}from"lexical";import{jsx as yl,jsxs as em}from"react/jsx-runtime";import"react";var Rl=()=>em("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[yl("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),yl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Il=[Z([{ChildComponent:Rl,isActive:({selection:t})=>om(t)||tm(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(rm,"underline")},order:3}])],nm=M({enableFormats:["underline"],toolbarFixed:{groups:Il},toolbarInline:{groups:Il}});import{jsx as ur}from"react/jsx-runtime";import{jsx as lm}from"react/jsx-runtime";function im(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var uo=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[im(o),r])):{};return lm("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as sm}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as am}from"@lexical/selection";import{$getNodeByKey as cm,$getState as um,$setState as dm,createState as mm,TextNode as pm}from"lexical";import{useEffect as fm}from"react";function vl(t){let e=new Map;for(let o in t){let r=t[o],n=mm(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function cr(t,e,o,r){t.update(()=>{am(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);dm(n,l.stateConfig,r)})})}function Ml({stateMap:t}){let[e]=sm();return fm(()=>e.registerMutationListener(pm,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=cm(r),s=e.getElementByKey(r);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=um(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 Dl=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let s in l){let i=l[s];o.push({ChildComponent:()=>ur(uo,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{cr(d,e,n,s)}})}}return[{type:"dropdown",ChildComponent:()=>ur(uo,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>ur(uo,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)cr(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},hm=M(({props:t})=>{let e=vl(t.state);return{plugins:[{Component:()=>Ml({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Dl(t,e)},toolbarInline:{groups:Dl(t,e)}}});import{c as bm}from"react/compiler-runtime";import{useLexicalComposerContext as km}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as _m,$isHeadingNode as Kl,HeadingNode as Zl}from"@lexical/rich-text";import{$setBlocksType as Tm}from"@lexical/selection";import{$getSelection as wm,$isRangeSelection as Sm}from"lexical";import{useEffect as Em}from"react";import{jsx as $l}from"react/jsx-runtime";import"react";var Ol=()=>$l("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$l("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Al}from"react/jsx-runtime";import"react";var Fl=()=>Al("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Al("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as Pl}from"react/jsx-runtime";import"react";var Bl=()=>Pl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Pl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as jl}from"react/jsx-runtime";import"react";var Hl=()=>jl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Ul}from"react/jsx-runtime";import"react";var Wl=()=>Ul("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ul("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as Gl}from"react/jsx-runtime";import"react";var Vl=()=>Gl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Gl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as gm,$isHeadingNode as xm,HeadingNode as Cm}from"@lexical/rich-text";var dr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Jl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Cm],export:(n,l)=>{if(!xm(n))return null;let s=Number(n.getTag().slice(1));return"#".repeat(s)+" "+l(n)},regExp:r,replace:dr(n=>{let l="h"+n[1]?.length;return gm(l)})}};var Xl=t=>{let e=wm();Tm(e,()=>_m(t))},zl={h1:Ol,h2:Fl,h3:Bl,h4:Hl,h5:Wl,h6:Vl},Nm=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((r,n)=>({ChildComponent:zl[r],isActive:({selection:l})=>{if(!Sm(l))return!1;for(let s of l.getNodes()){if(Kl(s)&&s.getTag()===r)continue;let i=s.getParent();if(!(Kl(i)&&i.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Xl(r)})},order:n+2})))];return{markdownTransformers:[Jl(e)],nodes:[Zl],plugins:[{Component:Lm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:zl[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{Xl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),Lm=t=>{let e=bm(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[d]=km(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(Zl,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]),Em(c,u),null};import{$isNodeSelection as Wm}from"lexical";import{jsx as Yl}from"react/jsx-runtime";import"react";var mr=()=>Yl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as ql,jsxs as ym}from"react/jsx-runtime";import"react";var Ql=()=>ym("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ql("path",{d:"M5 10h10",stroke:"currentColor"}),ql("path",{d:"M10 15V5",stroke:"currentColor"})]});var be=t=>({type:"dropdown",ChildComponent:Ql,items:t,key:"add",order:10});import{addClassNamesToElement as Rm}from"@lexical/utils";import{$applyNodeReplacement as Im,createCommand as vm,DecoratorNode as Mm}from"lexical";var yt=vm("INSERT_HORIZONTAL_RULE_COMMAND"),Lt=class extends Mm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Dm,priority:0})}}static importJSON(e){return ei()}createDOM(e){let o=document.createElement("hr");return Rm(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 Dm(){return{node:ei()}}function ei(){return Im(new Lt)}import{$applyNodeReplacement as $m}from"lexical";import"react";var ke=class extends Lt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return et()}decorate(){return null}exportJSON(){return super.exportJSON()}};function et(){return $m(new ke)}function Rt(t){return t instanceof ke}var ti={type:"element",dependencies:[ke],export:(t,e)=>Rt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=et();e&&t.replace(e)}};import{c as Om}from"react/compiler-runtime";import{useLexicalComposerContext as Am}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Fm}from"@lexical/utils";import{$getSelection as Pm,$isRangeSelection as Bm,COMMAND_PRIORITY_EDITOR as jm}from"lexical";import{useEffect as Hm}from"react";var oi=()=>{let t=Om(3),[e]=Am(),o,r;return t[0]!==e?(o=()=>e.registerCommand(yt,Um,jm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Hm(o,r),null};function Um(t){let e=Pm();if(!Bm(e))return!1;if(e.focus.getNode()!==null){let r=et();Fm(r)}return!0}var Gm=M({markdownTransformers:[ti],nodes:[ke],plugins:[{Component:oi,position:"normal"}],slashMenu:{groups:[z([{Icon:mr,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:mr,isActive:({selection:t})=>{if(!Wm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Rt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]}});import{$findMatchingParent as mi}from"@lexical/utils";import{$isElementNode as rp,INDENT_CONTENT_COMMAND as np,OUTDENT_CONTENT_COMMAND as lp}from"lexical";import{jsx as mo,jsxs as Vm}from"react/jsx-runtime";import"react";var ri=()=>Vm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mo("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as po,jsxs as Jm}from"react/jsx-runtime";import"react";var ni=()=>Jm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[po("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),po("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),po("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),po("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Km}from"react/jsx-runtime";import{useLexicalComposerContext as Xm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as zm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Zm,mergeRegister as li}from"@lexical/utils";import{$getSelection as Ym,$isElementNode as ci,$isRangeSelection as qm,COMMAND_PRIORITY_LOW as ii,INDENT_CONTENT_COMMAND as si,KEY_TAB_COMMAND as Qm,OUTDENT_CONTENT_COMMAND as ep,TabNode as tp}from"lexical";import{useEffect as ai}from"react";var ui=({clientProps:t})=>{let[e]=Xm(),{disabledNodes:o,disableTabNode:r}=t;return ai(()=>{if(!(!e||!o?.length))return li(e.registerCommand(si,()=>op(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),ii),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[s]of n){let i=l._nodeMap.get(s);ci(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),ai(()=>{if(!(!e||!r))return li(e.registerCommand(Qm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?ep:si,void 0)),ii),e.registerNodeTransform(tp,n=>{n.remove()}))},[e,r]),Km(zm,{})};function op(t){let e=Ym();if(!qm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],s=l.getKey();if(o.has(s))continue;let i=Zm(l,c=>ci(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 di=t=>({type:"buttons",items:t,key:"indent",order:35});var pi=({disabledNodes:t})=>[di([{ChildComponent:ri,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>fi(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!mi(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(lp,void 0)},order:1},{ChildComponent:ni,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>fi(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!mi(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(np,void 0)},order:2}])],ip=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ui,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:pi({disabledNodes:e})},toolbarInline:{groups:pi({disabledNodes:e})}}}),fi=t=>rp(t)&&t.canIndent();import{$findMatchingParent as Sf}from"@lexical/utils";import{$getSelection as wr,$isRangeSelection as Vi}from"lexical";import{jsx as hi}from"react/jsx-runtime";import"react";var gi=()=>hi("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:hi("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as xi}from"@lexical/selection";function tt(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?xi(o)?r:n:xi(e)?r:n}var pr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as bp}from"lexical";function fr(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 sp=/^(?:[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+)?$/,ap=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Ci(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||sp.test(t)||ap.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 cp,isHTMLAnchorElement as up}from"@lexical/utils";import xr from"bson-objectid";import{$applyNodeReplacement as dp,$createTextNode as bi,$getSelection as mp,$isElementNode as ki,$isRangeSelection as gr,createCommand as pp,ElementNode as fp}from"lexical";var hp=new Set(["http:","https:","mailto:","sms:","tel:"]),te=class extends fp{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:gp,priority:1})}}static importJSON(e){let o=_e({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new xr.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=hr(o.rel,"add","noopener")),cp(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!gr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(ki(r)){let n=_e({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!hp.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=hr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=hr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function gp(t){let e=null;if(up(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new xr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function _e({id:t,fields:e}){return dp(new te({id:t??new xr.default().toHexString(),fields:e}))}function K(t){return t instanceof te}var ue=pp("TOGGLE_LINK_COMMAND");function Cr(t){let e=mp();if(!gr(e)&&(t===null||!t.selectedNodes?.length))return;let o=gr(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:xp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(bi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let s=l.getParent();if(!(s===n||s===null||ki(l)&&!l.isInline())){if(K(s)){n=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(bi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(r)||(r=s,n=_e({fields:t.fields}),K(s)?l.getPreviousSibling()===null?s.insertBefore(n):s.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let i=l.getChildren();n.append(...i)}l.remove();return}n!==null&&n.append(l)}})}function xp(t){return Cp(t,e=>K(e))}function Cp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function hr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var kp=(t,e)=>{let[,o,r]=e,n=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=bp(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},_p=t=>({type:"text-match",dependencies:[te],export:(e,o)=>{if(!K(e))return null;let r=e,n=r.getFields(),l;return n.linkType==="internal"?t?.internalDocToHref?l=fr(t.internalDocToHref({linkNode:r.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=fr(n.url??""),`[${o(r)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:kp,trigger:")"}),_i=_p();import{$applyNodeReplacement as Tp,$isElementNode as wp}from"lexical";var Te=class extends te{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=It({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(wp(r)){let n=It({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function It({fields:t}){return Tp(new Te({id:"",fields:t}))}function we(t){return t instanceof Te}import{c as Sp}from"react/compiler-runtime";import{useLexicalComposerContext as Ep}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Np}from"@lexical/utils";import{$createTextNode as Ti,$getSelection as Lp,$isElementNode as Si,$isLineBreakNode as Ei,$isNodeSelection as yp,$isRangeSelection as Rp,$isTextNode as vt,TextNode as Ip}from"lexical";import{useEffect as vp}from"react";function wi(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function Ni(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Mp=/[.,;\s]/;function ho(t){return t!==void 0&&Mp.test(t)}function Li(t){return ho(t[t.length-1])}function kr(t){return ho(t[0])}function Dp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function yi(t){let e=t.getPreviousSibling();return Si(e)&&(e=e.getLastDescendant()),e===null||Ei(e)||vt(e)&&Li(e.getTextContent())}function Ri(t){let e=t.getNextSibling();return Si(e)&&(e=e.getFirstDescendant()),e===null||Ei(e)||vt(e)&&kr(e.getTextContent())}function $p(t,e,o,r){return(t>0?ho(o[t-1]):yi(r[0]))?e<o.length?ho(o[e]):Ri(r[r.length-1]):!1}function Op(t,e,o){let r=[],n=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=i;i+a<=e?(r.push(c),s+=a):m>=o?l.push(c):n.push(c),i+=a,d.shift()}return[s,r,n,l]}function Ap(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=It({fields:n});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let d=Ti(r.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,k]=a.splitText(o-h);g&&c.push(g),u=k}i+=p}),d){let a=Lp(),m=a?a.getNodes().find(vt):void 0,p=Ti(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(Rp(a)?p.select(a.anchor.offset,a.focus.offset):yp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function Fp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,s,i=0;for(;(s=Ni(l,e))!=null&&s!==null;){let d=s.index,c=s.length,u=d+c;if($p(i+d,i+u,n,r)){let[m,,p,h]=Op(r,i+d,i+u),f=i+d-m,g=i+u-m,k=Ap(p,f,g,s);r=k?[k,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function br(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!vt(c)||!c.isSimpleText()){fo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Ni(l,e);if(s===null||s.text!==l){fo(t),o(null,t.getFields()?.url??null);return}if(!yi(t)||!Ri(t)){fo(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 Pp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(we(r)){let s=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!kr(l)||Dp(l,s))&&(r.append(t),br(r,e,o),o(null,r.getFields()?.url??null))}we(n)&&!Li(l)&&(fo(n),br(n,e,o),o(null,n.getFields()?.url??null))}function fo(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function Bp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&vt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function jp(t,e,o){let r=Sp(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([Te]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return Np(t.registerNodeTransform(Ip,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(we(d))br(d,e,s);else if(!K(d)){if(i.isSimpleText()&&(kr(i.getTextContent())||!we(c))){let u=Bp(i);Fp(u,e,s)}Pp(i,e,s)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),vp(n,l)}var Hp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Up=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Wp=[wi(Hp,t=>t.startsWith("http")?t:`https://${t}`),wi(Up,t=>`mailto:${t}`)],Ii=()=>{let[t]=Ep();return jp(t,Wp),null};import{jsx as Gp}from"react/jsx-runtime";import{ClickableLinkPlugin as Vp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var vi=()=>Gp(Vp,{});import{jsx as pf}from"react/jsx-runtime";import"react";import{createPortal as ff}from"react-dom";import{jsx as Se,jsxs as Mt,Fragment as Kp}from"react/jsx-runtime";import{useLexicalComposerContext as Xp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as zp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Mi,mergeRegister as Di}from"@lexical/utils";import{getTranslation as _r}from"@payloadcms/translations";import{CloseMenuIcon as Zp,EditIcon as Yp,ExternalLinkIcon as $i,formatDrawerSlug as qp,useConfig as Qp,useEditDepth as ef,useLocale as tf,useModal as of,useTranslation as rf}from"@payloadcms/ui";import{requests as nf}from"@payloadcms/ui/shared";import{$getSelection as Oi,$isLineBreakNode as lf,$isRangeSelection as Ai,COMMAND_PRIORITY_HIGH as sf,COMMAND_PRIORITY_LOW as Fi,getDOMSelection as af,KEY_ESCAPE_COMMAND as cf,SELECTION_CHANGE_COMMAND as uf}from"lexical";import{formatAdminURL as df}from"payload/shared";import Pi,{useCallback as Bi,useEffect as Co,useLayoutEffect as mf,useRef as Tr,useState as Ue}from"react";function go(t,e,o,r=10,n=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-r,c=t.left-n;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,k=Math.min(u,f?h:a);k<u&&(e.style.width=`${k}px`,e.style.maxWidth=`${k}px`,e.offsetHeight),f&&(c=t.right-k),p=e.getBoundingClientRect()}d<i.top&&(d+=p.height+t.height+r*2),c+p.width>i.right&&(c=i.right-p.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Jp}from"lexical";var xo=Jp("TOGGLE_LINK_WITH_MODAL_COMMAND");function ji(t){t.preventDefault()}function Hi({anchorElem:t}){let[e]=Xp(),[o,r]=Ue(),n=Tr(null),l=Tr(null),[s,i]=Ue(null),[d,c]=Ue(null),{fieldProps:{schemaPath:u},uuid:a}=W(),m=zp(),{config:p,getEntityConfig:h}=Qp(),{i18n:f,t:g}=rf(),[k,E]=Ue(),y=ef(),[T,C]=Ue(!1),[x,b]=Ue([]),_=tf(),[D,v]=Ue(!1),L=qp({slug:"lexical-rich-text-link-"+a,depth:y}),{modalState:S}=of(),w=Tr(!1);w.current=!!S[L]?.isOpen;let{toggleDrawer:N}=ge(L),I=Bi(()=>{C(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),v(!1),w.current||(i(null),c(null),b([]),E(void 0))},[]),$=Bi(()=>{let R=Oi(),O;if(!Ai(R)||!R){I();return}let F=tt(R);O=e.getElementByKey(F.getKey())?.getBoundingClientRect();let j=Mi(F,K),X=R.getNodes().filter(ie=>!lf(ie)).find(ie=>{let Re=Mi(ie,K);return j&&!j.is(Re)||Re&&!Re.is(j)});if(j==null||X){I();return}r(j);let P=j.getFields(),Ke={...P,id:j.getID(),text:j.getTextContent()};if(P?.linkType==="custom")i(P?.url??null),c(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${P?.doc?.relationTo}/${P?.doc?.value}`);let ie=P?.doc?.relationTo?h({collectionSlug:P?.doc?.relationTo}):void 0;if(!ie)c(P?.label?String(P?.label):null),i(P?.url?String(P?.url):null);else{let Re=typeof P.doc?.value=="object"?P.doc.value.id:P.doc?.value,Ie=P.doc?.relationTo;if(!Re||!Ie)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let q=g("fields:linkedTo",{label:`${_r(ie.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(q),nf.get(df({apiRoute:p.routes.api,path:`/${Ie}/${Re}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:_?.code}}).then(async he=>{if(!he.ok)throw new Error(`HTTP error! Status: ${he.status}`);let ve=await he.json(),gt=ie?.admin?.useAsTitle||"id",Kt=ve[gt],Me=g("fields:linkedTo",{label:`${_r(ie.labels.singular,f)} - ${Kt}`}).replace(/<[^>]*>?/g,"");c(Me)}).catch(()=>{let he=g("fields:linkedTo",{label:`${_r(ie.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${Re}`}).replace(/<[^>]*>?/g,"");c(he)})}}C(!0),w.current||(E(Ke),b(R?R?.getNodes():[])),we(j)?v(!0):v(!1);let ye=n.current,fe=af(e._window),{activeElement:ft}=document;if(ye===null)return;let ht=e.getRootElement();return fe!==null&&ht!==null&&ht.contains(fe.anchorNode)?(O||(O=fe.getRangeAt(0).getBoundingClientRect()),O!=null&&(O.y+=40,l.current=O)):(ft==null||ft.className!=="link-input")&&(ht!==null&&go(null,ye,t),i(null),c(null)),!0},[e,I,p.routes.admin,p.routes.api,p.serverURL,h,g,f,_?.code,t]);return Co(()=>Di(e.registerCommand(xo,R=>(e.dispatchCommand(ue,R),$(),N(),!0),Fi)),[e,$,N,L]),Co(()=>{let R=t.parentElement,O=()=>{e.getEditorState().read(()=>{$()})};return window.addEventListener("resize",O),R?.addEventListener("scroll",O),()=>{window.removeEventListener("resize",O),R?.removeEventListener("scroll",O)}},[t.parentElement,e,$]),Co(()=>Di(e.registerUpdateListener(({editorState:R})=>{R.read(()=>{$()})}),e.registerCommand(uf,()=>($(),!0),Fi),e.registerCommand(cf,()=>T?(I(),!0):!1,sf)),[e,$,T,I]),Co(()=>{e.getEditorState().read(()=>{$()})},[e,$]),mf(()=>{!T||!n.current||!t||!l.current||go(l.current,n.current,t)},[s,d,T,t,o]),Mt(Pi.Fragment,{children:[Se("div",{className:"link-editor",ref:n,children:Mt("div",{className:"link-input",children:[s&&s.length>0?Mt("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Se($i,{}):null,d!=null&&d.length>0?d:s]}):d!=null&&d.length>0?Mt(Kp,{children:[o?.__fields.newTab?Se($i,{}):null,Se("span",{className:"link-input__label-pure",children:d})]}):null,m&&Mt(Pi.Fragment,{children:[Se("button",{"aria-label":"Edit link",className:"link-edit",onClick:R=>{R.preventDefault(),N()},onMouseDown:ji,tabIndex:0,type:"button",children:Se(Yp,{})}),!D&&Se("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ue,null)},onMouseDown:ji,tabIndex:0,type:"button",children:Se(Zp,{})})]})]})}),Se(kt,{className:"lexical-link-edit-drawer",data:k,drawerSlug:L,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(R,O)=>{let F=O,j={...F};delete j.text,e.update(()=>{let X=Oi(),P=null;if(Ai(X)?P=tt(X).getParent():x.length&&(P=x[0]?.getParent()??null),P&&we(P)){let Ke=_e({fields:j});P.replace(Ke,!0)}}),e.dispatchCommand(ue,{fields:j,selectedNodes:x,text:F.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Ui=t=>{let{anchorElem:e=document.body}=t;return ff(pf(Hi,{anchorElem:e}),e)};import{c as hf}from"react/compiler-runtime";import{useLexicalComposerContext as gf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as xf}from"@lexical/utils";import{$getSelection as Cf,$isElementNode as bf,$isRangeSelection as kf,COMMAND_PRIORITY_LOW as Wi,PASTE_COMMAND as _f}from"lexical";import{useEffect as Tf}from"react";var Gi=t=>{let e=hf(5),{clientProps:o}=t,[r]=gf(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([te]))throw new Error("LinkPlugin: LinkNode not registered on editor");return xf(r.registerCommand(ue,s=>s===null?(Cr(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),Cr(s),!0),Wi),r.registerCommand(_f,s=>{let i=Cf();if(!kf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!Ci(d))return!1;if(!i.getNodes().some(wf)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ue,{fields:c,text:null}),s.preventDefault(),!0}return!1},Wi))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Tf(n,l),null};function wf(t){return bf(t)}var Ji=[pr([{ChildComponent:gi,isActive:({selection:t})=>{if(Vi(t)){let e=tt(t);return Sf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(Vi(t)&&wr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ue,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=wr()?.getTextContent(),r=wr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(xo,{fields:n,selectedNodes:r,text:o})}},order:1}])],Ef=M(({props:t})=>({markdownTransformers:[_i],nodes:[te,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:Gi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Ii,position:"normal"},{Component:vi,position:"normal"},{Component:Ui,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ji},toolbarInline:{groups:Ji}}));import{$isListNode as Nr,INSERT_CHECK_LIST_COMMAND as qi,ListItemNode as Ff,ListNode as Pf}from"@lexical/list";import{$isRangeSelection as Bf}from"lexical";import{jsx as Ki,jsxs as Nf}from"react/jsx-runtime";import"react";var Sr=()=>Nf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ki("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ki("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lf}from"react/jsx-runtime";import{ListPlugin as yf}from"@lexical/react/LexicalListPlugin.js";import"react";var ot=()=>Lf(yf,{});function bo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function rt(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Mf,ListItemNode as Df,ListNode as $f}from"@lexical/list";import{$createListItemNode as Rf,$createListNode as If,$isListItemNode as vf,$isListNode as Er}from"@lexical/list";var Xi=4,nt=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),s=Rf(t==="check"?r[3]==="x":void 0);if(Er(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(Er(n)&&n.getListType()===t)n.append(s),e.remove();else{let d=If(t,t==="number"?Number(r[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(r[1].length/Xi);i&&s.setIndent(i)},We=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let s of n)if(vf(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(Er(u)){r.push(We(u,e,o+1));continue}}let i=" ".repeat(o*Xi),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";r.push(i+c+e(s)),l++}return r.join(`
56
- `)};var zi={type:"element",dependencies:[$f,Df],export:(t,e)=>Mf(t)?We(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:nt("check")};import{jsx as Of}from"react/jsx-runtime";import{CheckListPlugin as Af}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Zi=()=>Of(Af,{});var Yi=[ee([{ChildComponent:Sr,isActive:({selection:t})=>{if(!Bf(t))return!1;for(let e of t.getNodes()){if(Nr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Nr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Nr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(qi,void 0)},order:12}])],jf=M(({featureProviderMap:t})=>{let e=[{Component:Zi,position:"normal"}],o=bo("checklist",t);return o&&e.push({Component:ot,position:"normal"}),{markdownTransformers:[zi],nodes:o?[Pf,Ff]:[],plugins:e,slashMenu:{groups:[rt([{Icon:Sr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(qi,void 0)}}])]},toolbarFixed:{groups:Yi},toolbarInline:{groups:Yi}}});import{$isListNode as yr,INSERT_ORDERED_LIST_COMMAND as ts,ListItemNode as Vf,ListNode as Jf}from"@lexical/list";import{$isRangeSelection as Kf}from"lexical";import{jsx as Dt,jsxs as Hf}from"react/jsx-runtime";import"react";var Lr=()=>Hf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Dt("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),Dt("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),Dt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Dt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Dt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Uf,ListItemNode as Wf,ListNode as Gf}from"@lexical/list";var Qi={type:"element",dependencies:[Gf,Wf],export:(t,e)=>Uf(t)?We(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:nt("number")};var es=[ee([{ChildComponent:Lr,isActive:({selection:t})=>{if(!Kf(t))return!1;for(let e of t.getNodes()){if(yr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(yr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(yr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ts,void 0)},order:10}])],Xf=M(({featureProviderMap:t})=>{let e=bo("ordered",t);return{markdownTransformers:[Qi],nodes:e?[Jf,Vf]:[],plugins:e?[{Component:ot,position:"normal"}]:[],slashMenu:{groups:[rt([{Icon:Lr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(ts,void 0)}}])]},toolbarFixed:{groups:es},toolbarInline:{groups:es}}});import{$isListNode as Ir,INSERT_UNORDERED_LIST_COMMAND as ns,ListItemNode as Qf,ListNode as e0}from"@lexical/list";import{$isRangeSelection as t0}from"lexical";import{jsx as lt,jsxs as zf}from"react/jsx-runtime";import"react";var Rr=()=>zf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[lt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),lt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),lt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Zf,ListItemNode as Yf,ListNode as qf}from"@lexical/list";var os={type:"element",dependencies:[qf,Yf],export:(t,e)=>Zf(t)?We(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:nt("bullet")};var rs=[ee([{ChildComponent:Rr,isActive:({selection:t})=>{if(!t0(t))return!1;for(let e of t.getNodes()){if(Ir(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Ir(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Ir(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ns,void 0)},order:11}])],o0=M({markdownTransformers:[os],nodes:[e0,Qf],plugins:[{Component:ot,position:"normal"}],slashMenu:{groups:[rt([{Icon:Rr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ns,void 0)}}])]},toolbarFixed:{groups:rs},toolbarInline:{groups:rs}});import{jsx as r0}from"react/jsx-runtime";import{addClassNamesToElement as n0}from"@lexical/utils";import{$applyNodeReplacement as l0,DecoratorNode as i0}from"lexical";import*as ls from"react";var s0=ls.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),$t=class extends i0{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return a0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return n0(o,"unknownConverted"),o}decorate(){return r0(s0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function a0({data:t}){return l0(new $t({data:t}))}var c0=M(()=>({nodes:[$t]}));import{jsx as u0}from"react/jsx-runtime";import{addClassNamesToElement as d0}from"@lexical/utils";import{$applyNodeReplacement as m0,DecoratorNode as p0}from"lexical";import*as is from"react";var f0=is.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Ot=class extends p0{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return h0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return d0(o,"unknownConverted"),o}decorate(){return u0(f0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function h0({data:t}){return m0(new Ot({data:t}))}var g0=M(()=>({nodes:[Ot]}));import{$setBlocksType as cs}from"@lexical/selection";import{$createParagraphNode as us,$getSelection as ds,$isParagraphNode as ss,$isRangeSelection as x0}from"lexical";var as=[ee([{ChildComponent:wt,isActive:({selection:t})=>{if(!x0(t))return!1;for(let e of t.getNodes())if(!ss(e)&&!ss(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ds();cs(e,()=>us())})},order:1}])],C0=M({slashMenu:{groups:[z([{Icon:wt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ds();cs(e,()=>us())})}}])]},toolbarFixed:{groups:as},toolbarInline:{groups:as}});import{c as H0}from"react/compiler-runtime";import{jsx as vs}from"react/jsx-runtime";import{useLexicalComposerContext as U0}from"@lexical/react/LexicalComposerContext";import{useEffect as W0,useState as G0}from"react";import{jsx as Is,Fragment as j0}from"react/jsx-runtime";import"react";import{jsx as b0}from"react/jsx-runtime";var ms={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return b0("blockquote",{children:o})}};import{jsx as k0}from"react/jsx-runtime";var ps={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return k0(r,{children:o})}};import{jsx as _0}from"react/jsx-runtime";var fs={horizontalrule:_0("hr",{})};import{jsx as T0}from"react/jsx-runtime";var hs={linebreak:T0("br",{})};import{jsx as gs}from"react/jsx-runtime";var xs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return gs("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=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="#")),gs("a",{href:s,rel:n,target:l,children:r})}});import{jsx as it,jsxs as w0,Fragment as S0}from"react/jsx-runtime";import{v4 as E0}from"uuid";var Cs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return it(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=E0();return it("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:w0(S0,{children:[it("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),it("label",{htmlFor:l,children:n}),it("br",{})]})})}else return it("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as vr}from"react/jsx-runtime";var bs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?vr("p",{children:o}):vr("p",{children:vr("br",{})})}};var ks={tab:" "};import{jsx as At}from"react/jsx-runtime";var _s={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return At("div",{className:"lexical-table-container",children:At("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:At("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return At(r,{className:`lexical-table-cell ${n}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return At("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ge}from"react/jsx-runtime";import"react";var A={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},N0=A.IS_BOLD|A.IS_ITALIC|A.IS_STRIKETHROUGH|A.IS_UNDERLINE|A.IS_CODE|A.IS_SUBSCRIPT|A.IS_SUPERSCRIPT|A.IS_HIGHLIGHT,L0="\xA0",y0=`
54
+ `},[t,e]),p=Pe((x,b)=>{o(C=>{let k=e.length-1,_=e[k];if(_&&_.name===x){if(x==="type")return[...e.slice(0,k),{..._,value:_.value+b}];if(_.value===b)return[...e.slice(0,k),{..._,count:_.count+1}]}return[...C,{name:x,count:1,value:b}]})},[e,o]);Jn(()=>{let x=C=>{if(!r)return;let k=C.key;dd(C)?p("selectAll",""):Zn.has(k)?p("press",C.key):[...k].length>1?p("keydown",C.key):p("type",C.key)},b=C=>{if(!r)return;let k=C.key;!Zn.has(k)&&[...k].length>1&&p("keyup",C.key)};return t.registerRootListener((C,k)=>{k!==null&&(k.removeEventListener("keydown",x),k.removeEventListener("keyup",b)),C!==null&&(C.addEventListener("keydown",x),C.addEventListener("keyup",b))})},[t,r,p]),Jn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),nr(()=>{if(e){let x=m();x!==null&&i(x),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),nr(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:C,editorState:k})=>{if(!r)return;let _=k._selection,$=d.current,v=c.current;if($!==_){if(C.size===0&&b.size===0&&!v){let L=rr(t._window);if(L&&(L.anchorNode==null||L.focusNode==null))return}d.current=_}c.current=!1;let N=m();N!==null&&i(N)}),[t,m,r,p]),nr(()=>r?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,r]);let h=Pe(x=>{r||(x.update(()=>{let b=sd();b.clear();let C=id();b.append(ld().append(C)),C.select()}),o([])),n(b=>!b)},[r]),f=Pe(()=>{if(!r)return;let x=rr(t._window);if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:b,anchorOffset:C,focusNode:k,focusOffset:_}=md(x),$=a().getRootElement(),v;b!==null&&(v=Xn(b,$));let N;k!==null&&(N=Xn(k,$)),p("snapshot",{anchorNode:b,anchorOffset:C,anchorPath:v,focusNode:k,focusOffset:_,focusPath:N})},[p,r,a]),g=Pe(()=>{ad(m())},[m]),T=Pe(()=>{cd("test.js",m())},[m]);return[Be("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:x=>{h(a()),x.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?ir("div",{className:"test-recorder-output",children:[ir("div",{className:"test-recorder-toolbar",children:[Be("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{f(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{g(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{T(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Be("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var qn=()=>{let t=rd(3),[e]=nd(),[o,r]=pd(e),n;return t[0]!==o||t[1]!==r?(n=ir(Yn.Fragment,{children:[Be("p",{children:"HI"}),o,r,Be("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var fd=M({plugins:[{Component:qn,position:"bottom"}]});import{c as hd}from"react/compiler-runtime";import{jsx as gd}from"react/jsx-runtime";import{useLexicalComposerContext as xd}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Cd}from"@lexical/react/LexicalTreeView.js";import"react";var Qn=()=>{let t=hd(2),[e]=xd(),o;return t[0]!==e?(o=gd(Cd,{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 bd=M({plugins:[{Component:Qn,position:"bottom"}]});import{$isTableSelection as kd}from"@lexical/table";import{$isRangeSelection as _d,FORMAT_TEXT_COMMAND as Td}from"lexical";import{jsx as el}from"react/jsx-runtime";import"react";var tl=()=>el("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:el("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var ol={type:"text-format",format:["bold","italic"],tag:"***"},rl={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},nl={type:"text-format",format:["bold"],tag:"**"},ll={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var il=[Z([{ChildComponent:tl,isActive:({selection:t})=>_d(t)||kd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Td,"bold")},order:1}])],wd=M(({featureProviderMap:t})=>{let e=[nl,ll];return t.get("italic")&&e.push(rl,ol),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:il},toolbarInline:{groups:il}}});import{$isTableSelection as Ed}from"@lexical/table";import{$isRangeSelection as Nd,FORMAT_TEXT_COMMAND as Ld}from"lexical";import{jsx as sl,jsxs as Sd}from"react/jsx-runtime";import"react";var al=()=>Sd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[sl("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),sl("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var cl={type:"text-format",format:["code"],tag:"`"};var ul=[Z([{ChildComponent:al,isActive:({selection:t})=>Nd(t)||Ed(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Ld,"code")},order:7}])],yd=M({enableFormats:["code"],markdownTransformers:[cl],toolbarFixed:{groups:ul},toolbarInline:{groups:ul}});import{$isTableSelection as Rd}from"@lexical/table";import{$isRangeSelection as Id,FORMAT_TEXT_COMMAND as vd}from"lexical";import{jsx as dl}from"react/jsx-runtime";import"react";var ml=()=>dl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dl("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var pl={type:"text-format",format:["italic"],tag:"*"},fl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var hl=[Z([{ChildComponent:ml,isActive:({selection:t})=>Id(t)||Rd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(vd,"italic")},order:2}])],Md=M({enableFormats:["italic"],markdownTransformers:[pl,fl],toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{$isTableSelection as Dd}from"@lexical/table";import{$isRangeSelection as Ad,FORMAT_TEXT_COMMAND as Od}from"lexical";import{jsx as gl,jsxs as $d}from"react/jsx-runtime";import"react";var xl=()=>$d("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[gl("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),gl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Cl={type:"text-format",format:["strikethrough"],tag:"~~"};var bl=[Z([{ChildComponent:xl,isActive:({selection:t})=>Ad(t)||Dd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Od,"strikethrough")},order:4}])],Fd=M({enableFormats:["strikethrough"],markdownTransformers:[Cl],toolbarFixed:{groups:bl},toolbarInline:{groups:bl}});import{$isTableSelection as Pd}from"@lexical/table";import{$isRangeSelection as Bd,FORMAT_TEXT_COMMAND as jd}from"lexical";import{jsx as kl}from"react/jsx-runtime";import"react";var _l=()=>kl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:kl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Tl=[Z([{ChildComponent:_l,isActive:({selection:t})=>Bd(t)||Pd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(jd,"subscript")},order:5}])],Hd=M({enableFormats:["subscript"],toolbarFixed:{groups:Tl},toolbarInline:{groups:Tl}});import{$isTableSelection as Ud}from"@lexical/table";import{$isRangeSelection as Gd,FORMAT_TEXT_COMMAND as Wd}from"lexical";import{jsx as wl}from"react/jsx-runtime";import"react";var Sl=()=>wl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:wl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var El=[Z([{ChildComponent:Sl,isActive:({selection:t})=>Gd(t)||Ud(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Wd,"superscript")},order:6}])],Vd=M({enableFormats:["superscript"],toolbarFixed:{groups:El},toolbarInline:{groups:El}});import{$isTableSelection as Kd}from"@lexical/table";import{$isRangeSelection as Jd,FORMAT_TEXT_COMMAND as Xd}from"lexical";import{jsx as Nl,jsxs as zd}from"react/jsx-runtime";import"react";var Ll=()=>zd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Nl("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),Nl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var yl=[Z([{ChildComponent:Ll,isActive:({selection:t})=>Jd(t)||Kd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Xd,"underline")},order:3}])],Zd=M({enableFormats:["underline"],toolbarFixed:{groups:yl},toolbarInline:{groups:yl}});import{jsx as ar}from"react/jsx-runtime";import{jsx as Yd}from"react/jsx-runtime";function qd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var co=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[qd(o),r])):{};return Yd("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Qd}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as em}from"@lexical/selection";import{$getNodeByKey as tm,$getState as om,$setState as rm,createState as nm,TextNode as lm}from"lexical";import{useEffect as im}from"react";function Rl(t){let e=new Map;for(let o in t){let r=t[o],n=nm(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function sr(t,e,o,r){t.update(()=>{em(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);rm(n,l.stateConfig,r)})})}function Il({stateMap:t}){let[e]=Qd();return im(()=>e.registerMutationListener(lm,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=tm(r),s=e.getElementByKey(r);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=om(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 vl=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let s in l){let i=l[s];o.push({ChildComponent:()=>ar(co,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{sr(d,e,n,s)}})}}return[{type:"dropdown",ChildComponent:()=>ar(co,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>ar(co,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)sr(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},sm=M(({props:t})=>{let e=Rl(t.state);return{plugins:[{Component:()=>Il({stateMap:e}),position:"normal"}],toolbarFixed:{groups:vl(t,e)},toolbarInline:{groups:vl(t,e)}}});import{c as dm}from"react/compiler-runtime";import{useLexicalComposerContext as mm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as pm,$isHeadingNode as Vl,HeadingNode as Jl}from"@lexical/rich-text";import{$setBlocksType as fm}from"@lexical/selection";import{$getSelection as hm,$isRangeSelection as gm}from"lexical";import{useEffect as xm}from"react";import{jsx as Ml}from"react/jsx-runtime";import"react";var $l=()=>Ml("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ml("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Dl}from"react/jsx-runtime";import"react";var Al=()=>Dl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Dl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as Ol}from"react/jsx-runtime";import"react";var Fl=()=>Ol("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ol("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as Pl}from"react/jsx-runtime";import"react";var Bl=()=>Pl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Pl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as jl}from"react/jsx-runtime";import"react";var Hl=()=>jl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as Ul}from"react/jsx-runtime";import"react";var Gl=()=>Ul("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ul("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as am,$isHeadingNode as cm,HeadingNode as um}from"@lexical/rich-text";var cr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Wl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[um],export:(n,l)=>{if(!cm(n))return null;let s=Number(n.getTag().slice(1));return"#".repeat(s)+" "+l(n)},regExp:r,replace:cr(n=>{let l="h"+n[1]?.length;return am(l)})}};var zl=t=>{let e=hm();fm(e,()=>pm(t))},Kl={h1:$l,h2:Al,h3:Fl,h4:Bl,h5:Hl,h6:Gl},Cm=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((r,n)=>({ChildComponent:Kl[r],isActive:({selection:l})=>{if(!gm(l))return!1;for(let s of l.getNodes()){if(Vl(s)&&s.getTag()===r)continue;let i=s.getParent();if(!(Vl(i)&&i.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{zl(r)})},order:n+2})))];return{markdownTransformers:[Wl(e)],nodes:[Jl],plugins:[{Component:bm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[X(e.map(r=>({Icon:Kl[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{zl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),bm=t=>{let e=dm(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[d]=mm(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(Jl,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]),xm(c,u),null};import{$isNodeSelection as Am}from"lexical";import{jsx as Xl}from"react/jsx-runtime";import"react";var ur=()=>Xl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Xl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Zl,jsxs as km}from"react/jsx-runtime";import"react";var Yl=()=>km("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Zl("path",{d:"M5 10h10",stroke:"currentColor"}),Zl("path",{d:"M10 15V5",stroke:"currentColor"})]});var xe=t=>({type:"dropdown",ChildComponent:Yl,items:t,key:"add",order:10});import{addClassNamesToElement as _m}from"@lexical/utils";import{$applyNodeReplacement as Tm,createCommand as wm,DecoratorNode as Sm}from"lexical";var yt=wm("INSERT_HORIZONTAL_RULE_COMMAND"),Lt=class extends Sm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Em,priority:0})}}static importJSON(e){return ql()}createDOM(e){let o=document.createElement("hr");return _m(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function Em(){return{node:ql()}}function ql(){return Tm(new Lt)}import{$applyNodeReplacement as Nm}from"lexical";import"react";var Ce=class extends Lt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return et()}decorate(){return null}exportJSON(){return super.exportJSON()}};function et(){return Nm(new Ce)}function Rt(t){return t instanceof Ce}var Ql={type:"element",dependencies:[Ce],export:(t,e)=>Rt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=et();e&&t.replace(e)}};import{c as Lm}from"react/compiler-runtime";import{useLexicalComposerContext as ym}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Rm}from"@lexical/utils";import{$getSelection as Im,$isRangeSelection as vm,COMMAND_PRIORITY_EDITOR as Mm}from"lexical";import{useEffect as $m}from"react";var ei=()=>{let t=Lm(3),[e]=ym(),o,r;return t[0]!==e?(o=()=>e.registerCommand(yt,Dm,Mm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),$m(o,r),null};function Dm(t){let e=Im();if(!vm(e))return!1;if(e.focus.getNode()!==null){let r=et();Rm(r)}return!0}var Om=M({markdownTransformers:[Ql],nodes:[Ce],plugins:[{Component:ei,position:"normal"}],slashMenu:{groups:[X([{Icon:ur,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:ur,isActive:({selection:t})=>{if(!Am(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Rt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]}});import{$findMatchingParent as ui}from"@lexical/utils";import{$isElementNode as Xm,INDENT_CONTENT_COMMAND as Zm,OUTDENT_CONTENT_COMMAND as Ym}from"lexical";import{jsx as uo,jsxs as Fm}from"react/jsx-runtime";import"react";var ti=()=>Fm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[uo("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as mo,jsxs as Pm}from"react/jsx-runtime";import"react";var oi=()=>Pm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mo("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Bm}from"react/jsx-runtime";import{useLexicalComposerContext as jm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Hm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Um,mergeRegister as ri}from"@lexical/utils";import{$getSelection as Gm,$isElementNode as si,$isRangeSelection as Wm,COMMAND_PRIORITY_LOW as ni,INDENT_CONTENT_COMMAND as li,KEY_TAB_COMMAND as Vm,OUTDENT_CONTENT_COMMAND as zm,TabNode as Km}from"lexical";import{useEffect as ii}from"react";var ai=({clientProps:t})=>{let[e]=jm(),{disabledNodes:o,disableTabNode:r}=t;return ii(()=>{if(!(!e||!o?.length))return ri(e.registerCommand(li,()=>Jm(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),ni),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[s]of n){let i=l._nodeMap.get(s);si(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),ii(()=>{if(!(!e||!r))return ri(e.registerCommand(Vm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?zm:li,void 0)),ni),e.registerNodeTransform(Km,n=>{n.remove()}))},[e,r]),Bm(Hm,{})};function Jm(t){let e=Gm();if(!Wm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],s=l.getKey();if(o.has(s))continue;let i=Um(l,c=>si(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 ci=t=>({type:"buttons",items:t,key:"indent",order:35});var di=({disabledNodes:t})=>[ci([{ChildComponent:ti,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>mi(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ui(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ym,void 0)},order:1},{ChildComponent:oi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>mi(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ui(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Zm,void 0)},order:2}])],qm=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ai,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:di({disabledNodes:e})},toolbarInline:{groups:di({disabledNodes:e})}}}),mi=t=>Xm(t)&&t.canIndent();import{$findMatchingParent as gf}from"@lexical/utils";import{$getSelection as _r,$isRangeSelection as Gi}from"lexical";import{jsx as pi}from"react/jsx-runtime";import"react";var fi=()=>pi("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:pi("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as hi}from"@lexical/selection";function tt(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?hi(o)?r:n:hi(e)?r:n}var dr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as dp}from"lexical";function mr(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 Qm=/^(?:[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+)?$/,ep=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function gi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||Qm.test(t)||ep.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 tp,isHTMLAnchorElement as op}from"@lexical/utils";import hr from"bson-objectid";import{$applyNodeReplacement as rp,$createTextNode as xi,$getSelection as np,$isElementNode as Ci,$isRangeSelection as fr,createCommand as lp,ElementNode as ip}from"lexical";var sp=new Set(["http:","https:","mailto:","sms:","tel:"]),te=class extends ip{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:ap,priority:1})}}static importJSON(e){let o=be({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new hr.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=pr(o.rel,"add","noopener")),tp(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!fr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Ci(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!sp.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=pr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=pr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function ap(t){let e=null;if(op(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new hr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return rp(new te({id:t??new hr.default().toHexString(),fields:e}))}function K(t){return t instanceof te}var ue=lp("TOGGLE_LINK_COMMAND");function gr(t){let e=np();if(!fr(e)&&(t===null||!t.selectedNodes?.length))return;let o=fr(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:cp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(xi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let s=l.getParent();if(!(s===n||s===null||Ci(l)&&!l.isInline())){if(K(s)){n=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(xi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(r)||(r=s,n=be({fields:t.fields}),K(s)?l.getPreviousSibling()===null?s.insertBefore(n):s.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let i=l.getChildren();n.append(...i)}l.remove();return}n!==null&&n.append(l)}})}function cp(t){return up(t,e=>K(e))}function up(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function pr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var mp=(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=dp(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},pp=t=>({type:"text-match",dependencies:[te],export:(e,o)=>{if(!K(e))return null;let r=e,n=r.getFields(),l;return n.linkType==="internal"?t?.internalDocToHref?l=mr(t.internalDocToHref({linkNode:r.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=mr(n.url??""),`[${o(r)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:mp,trigger:")"}),bi=pp();import{$applyNodeReplacement as fp,$isElementNode as hp}from"lexical";var ke=class extends te{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=It({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(hp(r)){let n=It({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function It({fields:t}){return fp(new ke({id:"",fields:t}))}function _e(t){return t instanceof ke}import{c as gp}from"react/compiler-runtime";import{useLexicalComposerContext as xp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cp}from"@lexical/utils";import{$createTextNode as ki,$getSelection as bp,$isElementNode as Ti,$isLineBreakNode as wi,$isNodeSelection as kp,$isRangeSelection as _p,$isTextNode as vt,TextNode as Tp}from"lexical";import{useEffect as wp}from"react";function _i(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function Si(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Sp=/[.,;\s]/;function fo(t){return t!==void 0&&Sp.test(t)}function Ei(t){return fo(t[t.length-1])}function Cr(t){return fo(t[0])}function Ep(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ni(t){let e=t.getPreviousSibling();return Ti(e)&&(e=e.getLastDescendant()),e===null||wi(e)||vt(e)&&Ei(e.getTextContent())}function Li(t){let e=t.getNextSibling();return Ti(e)&&(e=e.getFirstDescendant()),e===null||wi(e)||vt(e)&&Cr(e.getTextContent())}function Np(t,e,o,r){return(t>0?fo(o[t-1]):Ni(r[0]))?e<o.length?fo(o[e]):Li(r[r.length-1]):!1}function Lp(t,e,o){let r=[],n=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=i;i+a<=e?(r.push(c),s+=a):m>=o?l.push(c):n.push(c),i+=a,d.shift()}return[s,r,n,l]}function yp(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=It({fields:n});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let d=ki(r.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,T]=a.splitText(o-h);g&&c.push(g),u=T}i+=p}),d){let a=bp(),m=a?a.getNodes().find(vt):void 0,p=ki(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(_p(a)?p.select(a.anchor.offset,a.focus.offset):kp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function Rp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,s,i=0;for(;(s=Si(l,e))!=null&&s!==null;){let d=s.index,c=s.length,u=d+c;if(Np(i+d,i+u,n,r)){let[m,,p,h]=Lp(r,i+d,i+u),f=i+d-m,g=i+u-m,T=yp(p,f,g,s);r=T?[T,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function xr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!vt(c)||!c.isSimpleText()){po(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Si(l,e);if(s===null||s.text!==l){po(t),o(null,t.getFields()?.url??null);return}if(!Ni(t)||!Li(t)){po(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 Ip(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(_e(r)){let s=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Cr(l)||Ep(l,s))&&(r.append(t),xr(r,e,o),o(null,r.getFields()?.url??null))}_e(n)&&!Ei(l)&&(po(n),xr(n,e,o),o(null,n.getFields()?.url??null))}function po(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function vp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&vt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Mp(t,e,o){let r=gp(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return Cp(t.registerNodeTransform(Tp,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(_e(d))xr(d,e,s);else if(!K(d)){if(i.isSimpleText()&&(Cr(i.getTextContent())||!_e(c))){let u=vp(i);Rp(u,e,s)}Ip(i,e,s)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),wp(n,l)}var $p=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Dp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ap=[_i($p,t=>t.startsWith("http")?t:`https://${t}`),_i(Dp,t=>`mailto:${t}`)],yi=()=>{let[t]=xp();return Mp(t,Ap),null};import{jsx as Op}from"react/jsx-runtime";import{ClickableLinkPlugin as Fp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ri=()=>Op(Fp,{});import{jsx as nf}from"react/jsx-runtime";import"react";import{createPortal as lf}from"react-dom";import{jsx as Te,jsxs as Mt,Fragment as Bp}from"react/jsx-runtime";import{useLexicalComposerContext as jp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Hp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Ii,mergeRegister as vi}from"@lexical/utils";import{getTranslation as br}from"@payloadcms/translations";import{CloseMenuIcon as Up,EditIcon as Gp,ExternalLinkIcon as Mi,formatDrawerSlug as Wp,useConfig as Vp,useEditDepth as zp,useLocale as Kp,useModal as Jp,useTranslation as Xp}from"@payloadcms/ui";import{requests as Zp}from"@payloadcms/ui/shared";import{$getSelection as $i,$isLineBreakNode as Yp,$isRangeSelection as Di,COMMAND_PRIORITY_HIGH as qp,COMMAND_PRIORITY_LOW as Ai,getDOMSelection as Qp,KEY_ESCAPE_COMMAND as ef,SELECTION_CHANGE_COMMAND as tf}from"lexical";import{formatAdminURL as of}from"payload/shared";import Oi,{useCallback as Fi,useEffect as xo,useLayoutEffect as rf,useRef as kr,useState as je}from"react";function ho(t,e,o,r=10,n=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-r,c=t.left-n;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,T=Math.min(u,f?h:a);T<u&&(e.style.width=`${T}px`,e.style.maxWidth=`${T}px`,e.offsetHeight),f&&(c=t.right-T),p=e.getBoundingClientRect()}d<i.top&&(d+=p.height+t.height+r*2),c+p.width>i.right&&(c=i.right-p.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Pp}from"lexical";var go=Pp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Pi(t){t.preventDefault()}function Bi({anchorElem:t}){let[e]=jp(),[o,r]=je(),n=kr(null),l=kr(null),[s,i]=je(null),[d,c]=je(null),{fieldProps:{schemaPath:u},uuid:a}=G(),m=Hp(),{config:p,getEntityConfig:h}=Vp(),{i18n:f,t:g}=Xp(),[T,E]=je(),S=zp(),[x,b]=je(!1),[C,k]=je([]),_=Kp(),[$,v]=je(!1),N=Wp({slug:"lexical-rich-text-link-"+a,depth:S}),{modalState:L}=Jp(),w=kr(!1);w.current=!!L[N]?.isOpen;let{toggleDrawer:y}=fe(N),I=Fi(()=>{b(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),v(!1),w.current||(i(null),c(null),k([]),E(void 0))},[]),D=Fi(()=>{let R=$i(),A;if(!Di(R)||!R){I();return}let H=tt(R);A=e.getElementByKey(H.getKey())?.getBoundingClientRect();let B=Ii(H,K),J=R.getNodes().filter(ie=>!Yp(ie)).find(ie=>{let Le=Ii(ie,K);return B&&!B.is(Le)||Le&&!Le.is(B)});if(B==null||J){I();return}r(B);let F=B.getFields(),Ve={...F,id:B.getID(),text:B.getTextContent()};if(F?.linkType==="custom")i(F?.url??null),c(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${F?.doc?.relationTo}/${F?.doc?.value}`);let ie=F?.doc?.relationTo?h({collectionSlug:F?.doc?.relationTo}):void 0;if(!ie)c(F?.label?String(F?.label):null),i(F?.url?String(F?.url):null);else{let Le=typeof F.doc?.value=="object"?F.doc.value.id:F.doc?.value,ye=F.doc?.relationTo;if(!Le||!ye)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let q=g("fields:linkedTo",{label:`${br(ie.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(q),Zp.get(of({apiRoute:p.routes.api,path:`/${ye}/${Le}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:_?.code}}).then(async pe=>{if(!pe.ok)throw new Error(`HTTP error! Status: ${pe.status}`);let Re=await pe.json(),gt=ie?.admin?.useAsTitle||"id",zt=Re[gt],Ie=g("fields:linkedTo",{label:`${br(ie.labels.singular,f)} - ${zt}`}).replace(/<[^>]*>?/g,"");c(Ie)}).catch(()=>{let pe=g("fields:linkedTo",{label:`${br(ie.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${Le}`}).replace(/<[^>]*>?/g,"");c(pe)})}}b(!0),w.current||(E(Ve),k(R?R?.getNodes():[])),_e(B)?v(!0):v(!1);let Ne=n.current,me=Qp(e._window),{activeElement:ft}=document;if(Ne===null)return;let ht=e.getRootElement();return me!==null&&ht!==null&&ht.contains(me.anchorNode)?(A||(A=me.getRangeAt(0).getBoundingClientRect()),A!=null&&(A.y+=40,l.current=A)):(ft==null||ft.className!=="link-input")&&(ht!==null&&ho(null,Ne,t),i(null),c(null)),!0},[e,I,p.routes.admin,p.routes.api,p.serverURL,h,g,f,_?.code,t]);return xo(()=>vi(e.registerCommand(go,R=>(e.dispatchCommand(ue,R),D(),y(),!0),Ai)),[e,D,y,N]),xo(()=>{let R=t.parentElement,A=()=>{e.getEditorState().read(()=>{D()})};return window.addEventListener("resize",A),R?.addEventListener("scroll",A),()=>{window.removeEventListener("resize",A),R?.removeEventListener("scroll",A)}},[t.parentElement,e,D]),xo(()=>vi(e.registerUpdateListener(({editorState:R})=>{R.read(()=>{D()})}),e.registerCommand(tf,()=>(D(),!0),Ai),e.registerCommand(ef,()=>x?(I(),!0):!1,qp)),[e,D,x,I]),xo(()=>{e.getEditorState().read(()=>{D()})},[e,D]),rf(()=>{!x||!n.current||!t||!l.current||ho(l.current,n.current,t)},[s,d,x,t,o]),Mt(Oi.Fragment,{children:[Te("div",{className:"link-editor",ref:n,children:Mt("div",{className:"link-input",children:[s&&s.length>0?Mt("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Te(Mi,{}):null,d!=null&&d.length>0?d:s]}):d!=null&&d.length>0?Mt(Bp,{children:[o?.__fields.newTab?Te(Mi,{}):null,Te("span",{className:"link-input__label-pure",children:d})]}):null,m&&Mt(Oi.Fragment,{children:[Te("button",{"aria-label":"Edit link",className:"link-edit",onClick:R=>{R.preventDefault(),y()},onMouseDown:Pi,tabIndex:0,type:"button",children:Te(Gp,{})}),!$&&Te("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ue,null)},onMouseDown:Pi,tabIndex:0,type:"button",children:Te(Up,{})})]})]})}),Te(kt,{className:"lexical-link-edit-drawer",data:T,drawerSlug:N,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(R,A)=>{let H=A,B={...H};delete B.text,e.update(()=>{let J=$i(),F=null;if(Di(J)?F=tt(J).getParent():C.length&&(F=C[0]?.getParent()??null),F&&_e(F)){let Ve=be({fields:B});F.replace(Ve,!0)}}),e.dispatchCommand(ue,{fields:B,selectedNodes:C,text:H.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var ji=t=>{let{anchorElem:e=document.body}=t;return lf(nf(Bi,{anchorElem:e}),e)};import{c as sf}from"react/compiler-runtime";import{useLexicalComposerContext as af}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as cf}from"@lexical/utils";import{$getSelection as uf,$isElementNode as df,$isRangeSelection as mf,COMMAND_PRIORITY_LOW as Hi,PASTE_COMMAND as pf}from"lexical";import{useEffect as ff}from"react";var Ui=t=>{let e=sf(5),{clientProps:o}=t,[r]=af(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([te]))throw new Error("LinkPlugin: LinkNode not registered on editor");return cf(r.registerCommand(ue,s=>s===null?(gr(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),gr(s),!0),Hi),r.registerCommand(pf,s=>{let i=uf();if(!mf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!gi(d))return!1;if(!i.getNodes().some(hf)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ue,{fields:c,text:null}),s.preventDefault(),!0}return!1},Hi))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),ff(n,l),null};function hf(t){return df(t)}var Wi=[dr([{ChildComponent:fi,isActive:({selection:t})=>{if(Gi(t)){let e=tt(t);return gf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(Gi(t)&&_r()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ue,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=_r()?.getTextContent(),r=_r()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(go,{fields:n,selectedNodes:r,text:o})}},order:1}])],xf=M(({props:t})=>({markdownTransformers:[bi],nodes:[te,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:Ui,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:yi,position:"normal"},{Component:Ri,position:"normal"},{Component:ji,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Wi},toolbarInline:{groups:Wi}}));import{$isListNode as Sr,INSERT_CHECK_LIST_COMMAND as Zi,ListItemNode as Rf,ListNode as If}from"@lexical/list";import{$isRangeSelection as vf}from"lexical";import{jsx as Vi,jsxs as Cf}from"react/jsx-runtime";import"react";var Tr=()=>Cf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Vi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Vi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as bf}from"react/jsx-runtime";import{ListPlugin as kf}from"@lexical/react/LexicalListPlugin.js";import"react";var ot=()=>bf(kf,{});function Co(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function rt(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Sf,ListItemNode as Ef,ListNode as Nf}from"@lexical/list";import{$createListItemNode as _f,$createListNode as Tf,$isListItemNode as wf,$isListNode as wr}from"@lexical/list";var zi=4,nt=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),s=_f(t==="check"?r[3]==="x":void 0);if(wr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(wr(n)&&n.getListType()===t)n.append(s),e.remove();else{let d=Tf(t,t==="number"?Number(r[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(r[1].length/zi);i&&s.setIndent(i)},He=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let s of n)if(wf(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(wr(u)){r.push(He(u,e,o+1));continue}}let i=" ".repeat(o*zi),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";r.push(i+c+e(s)),l++}return r.join(`
56
+ `)};var Ki={type:"element",dependencies:[Nf,Ef],export:(t,e)=>Sf(t)?He(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:nt("check")};import{jsx as Lf}from"react/jsx-runtime";import{CheckListPlugin as yf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Ji=()=>Lf(yf,{});var Xi=[ee([{ChildComponent:Tr,isActive:({selection:t})=>{if(!vf(t))return!1;for(let e of t.getNodes()){if(Sr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Sr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Sr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Zi,void 0)},order:12}])],Mf=M(({featureProviderMap:t})=>{let e=[{Component:Ji,position:"normal"}],o=Co("checklist",t);return o&&e.push({Component:ot,position:"normal"}),{markdownTransformers:[Ki],nodes:o?[If,Rf]:[],plugins:e,slashMenu:{groups:[rt([{Icon:Tr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(Zi,void 0)}}])]},toolbarFixed:{groups:Xi},toolbarInline:{groups:Xi}}});import{$isListNode as Nr,INSERT_ORDERED_LIST_COMMAND as Qi,ListItemNode as Ff,ListNode as Pf}from"@lexical/list";import{$isRangeSelection as Bf}from"lexical";import{jsx as $t,jsxs as $f}from"react/jsx-runtime";import"react";var Er=()=>$f("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$t("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),$t("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),$t("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Df,ListItemNode as Af,ListNode as Of}from"@lexical/list";var Yi={type:"element",dependencies:[Of,Af],export:(t,e)=>Df(t)?He(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:nt("number")};var qi=[ee([{ChildComponent:Er,isActive:({selection:t})=>{if(!Bf(t))return!1;for(let e of t.getNodes()){if(Nr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Nr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Nr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qi,void 0)},order:10}])],jf=M(({featureProviderMap:t})=>{let e=Co("ordered",t);return{markdownTransformers:[Yi],nodes:e?[Pf,Ff]:[],plugins:e?[{Component:ot,position:"normal"}]:[],slashMenu:{groups:[rt([{Icon:Er,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Qi,void 0)}}])]},toolbarFixed:{groups:qi},toolbarInline:{groups:qi}}});import{$isListNode as yr,INSERT_UNORDERED_LIST_COMMAND as os,ListItemNode as Vf,ListNode as zf}from"@lexical/list";import{$isRangeSelection as Kf}from"lexical";import{jsx as lt,jsxs as Hf}from"react/jsx-runtime";import"react";var Lr=()=>Hf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[lt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),lt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),lt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Uf,ListItemNode as Gf,ListNode as Wf}from"@lexical/list";var es={type:"element",dependencies:[Wf,Gf],export:(t,e)=>Uf(t)?He(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:nt("bullet")};var ts=[ee([{ChildComponent:Lr,isActive:({selection:t})=>{if(!Kf(t))return!1;for(let e of t.getNodes()){if(yr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(yr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(yr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(os,void 0)},order:11}])],Jf=M({markdownTransformers:[es],nodes:[zf,Vf],plugins:[{Component:ot,position:"normal"}],slashMenu:{groups:[rt([{Icon:Lr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(os,void 0)}}])]},toolbarFixed:{groups:ts},toolbarInline:{groups:ts}});import{jsx as Xf}from"react/jsx-runtime";import{addClassNamesToElement as Zf}from"@lexical/utils";import{$applyNodeReplacement as Yf,DecoratorNode as qf}from"lexical";import*as rs from"react";var Qf=rs.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Dt=class extends qf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return e0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Zf(o,"unknownConverted"),o}decorate(){return Xf(Qf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function e0({data:t}){return Yf(new Dt({data:t}))}var t0=M(()=>({nodes:[Dt]}));import{jsx as o0}from"react/jsx-runtime";import{addClassNamesToElement as r0}from"@lexical/utils";import{$applyNodeReplacement as n0,DecoratorNode as l0}from"lexical";import*as ns from"react";var i0=ns.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),At=class extends l0{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return s0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return r0(o,"unknownConverted"),o}decorate(){return o0(i0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function s0({data:t}){return n0(new At({data:t}))}var a0=M(()=>({nodes:[At]}));import{$setBlocksType as ss}from"@lexical/selection";import{$createParagraphNode as as,$getSelection as cs,$isParagraphNode as ls,$isRangeSelection as c0}from"lexical";var is=[ee([{ChildComponent:wt,isActive:({selection:t})=>{if(!c0(t))return!1;for(let e of t.getNodes())if(!ls(e)&&!ls(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=cs();ss(e,()=>as())})},order:1}])],u0=M({slashMenu:{groups:[X([{Icon:wt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=cs();ss(e,()=>as())})}}])]},toolbarFixed:{groups:is},toolbarInline:{groups:is}});import{c as $0}from"react/compiler-runtime";import{jsx as vs}from"react/jsx-runtime";import{useLexicalComposerContext as D0}from"@lexical/react/LexicalComposerContext";import{useEffect as A0,useState as O0}from"react";import{jsx as Is,Fragment as M0}from"react/jsx-runtime";import"react";import{jsx as d0}from"react/jsx-runtime";var us={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return d0("blockquote",{children:o})}};import{jsx as m0}from"react/jsx-runtime";var ds=new Set(["h1","h2","h3","h4","h5","h6"]);var ms={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=ds.has(t.tag)?t.tag:"h1";return m0(r,{children:o})}};import{jsx as p0}from"react/jsx-runtime";var ps={horizontalrule:p0("hr",{})};import{jsx as f0}from"react/jsx-runtime";var fs={linebreak:f0("br",{})};import{jsx as hs}from"react/jsx-runtime";var gs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return hs("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=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="#")),hs("a",{href:s,rel:n,target:l,children:r})}});import{jsx as it,jsxs as h0,Fragment as g0}from"react/jsx-runtime";import{v4 as x0}from"uuid";var xs=new Set(["ol","ul"]);var Cs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=xs.has(t.tag)?t.tag:"ul";return it(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=x0();return it("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:h0(g0,{children:[it("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),it("label",{htmlFor:l,children:n}),it("br",{})]})})}else return it("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as Rr}from"react/jsx-runtime";var bs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Rr("p",{children:o}):Rr("p",{children:Rr("br",{})})}};var ks={tab:" "};import{jsx as Ot}from"react/jsx-runtime";var _s={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Ot("div",{className:"lexical-table-container",children:Ot("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Ot("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`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 Ot(r,{className:`lexical-table-cell ${n}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Ot("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ue}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},C0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,b0="\xA0",k0=`
57
57
 
58
- `,Ts="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ws="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",R0=new RegExp("^[^"+ws+"]*["+Ts+"]"),I0=new RegExp("^[^"+Ts+"]*["+ws+"]"),v0={bold:A.IS_BOLD,code:A.IS_CODE,highlight:A.IS_HIGHLIGHT,italic:A.IS_ITALIC,strikethrough:A.IS_STRIKETHROUGH,subscript:A.IS_SUBSCRIPT,superscript:A.IS_SUPERSCRIPT,underline:A.IS_UNDERLINE},M0={directionless:A.IS_DIRECTIONLESS,unmergeable:A.IS_UNMERGEABLE},D0={center:A.IS_ALIGN_CENTER,end:A.IS_ALIGN_END,justify:A.IS_ALIGN_JUSTIFY,left:A.IS_ALIGN_LEFT,right:A.IS_ALIGN_RIGHT,start:A.IS_ALIGN_START},$0={[A.IS_ALIGN_CENTER]:"center",[A.IS_ALIGN_END]:"end",[A.IS_ALIGN_JUSTIFY]:"justify",[A.IS_ALIGN_LEFT]:"left",[A.IS_ALIGN_RIGHT]:"right",[A.IS_ALIGN_START]:"start"},O0={normal:A.IS_NORMAL,segmented:A.IS_SEGMENTED,token:A.IS_TOKEN},A0={[A.IS_NORMAL]:"normal",[A.IS_SEGMENTED]:"segmented",[A.IS_TOKEN]:"token"};var Ss={text:({node:t})=>{let e=t.text;return t.format&A.IS_BOLD&&(e=Ge("strong",{children:e})),t.format&A.IS_ITALIC&&(e=Ge("em",{children:e})),t.format&A.IS_STRIKETHROUGH&&(e=Ge("span",{style:{textDecoration:"line-through"},children:e})),t.format&A.IS_UNDERLINE&&(e=Ge("span",{style:{textDecoration:"underline"},children:e})),t.format&A.IS_CODE&&(e=Ge("code",{children:e})),t.format&A.IS_SUBSCRIPT&&(e=Ge("sub",{children:e})),t.format&A.IS_SUPERSCRIPT&&(e=Ge("sup",{children:e})),e}};import{jsx as Ft}from"react/jsx-runtime";var Es={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=e.fields?.alt||o?.alt||"",n=o.url;if(!o.mimeType.startsWith("image"))return Ft("a",{href:n,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Ft("img",{alt:r,height:o.height,src:n,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(Ft("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(Ft("img",{alt:r,height:o?.height,src:n,width:o?.width},"image")),Ft("picture",{children:l})}};var st={...bs,...Ss,...hs,...ms,..._s,...ps,...fs,...Cs,...xs({}),...Es,...ks};import{jsx as _o,Fragment as F0}from"react/jsx-runtime";import ko from"react";function Ns(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!o}function P0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let r=typeof t.html=="function"?t.html(o):t.html;return _o("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function Ls(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,r={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return ko.createElement(t.Block,r)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},r=typeof t.html=="function"?t.html(o):t.html;return _o("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function B0(t){let e={};for(let[o,r]of Object.entries(t)){if(!r||typeof r!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Ls(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Ls(i))}continue}let n=r;(n.Component||n.html)&&(e[o]=P0(n))}return e}function ys({converters:t,data:e,disableIndent:o,disableTextAlign:r,nodeMap:n}){if(Ns(e)){let l=n?B0(n):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Rs({converters:s,disableIndent:o,disableTextAlign:r,nodes:e.root.children,parent:e.root})}return _o(F0,{})}function Rs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.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=>Rs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:n}}),parent:n}):c:u=_o("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`),ko.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return ko.cloneElement(u,{key:d,style:m})}return ko.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function Mr({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:st}):i=e:i=st;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ys({converters:i,data:o,disableIndent:n,disableTextAlign:l,nodeMap:s});return r?Is(j0,{children:d}):Is("div",{className:t??"payload-richtext",children:d})}function Ms(){let t=H0(7),[e]=U0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=G0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),W0(l,s);let i;return t[5]!==r?(i=vs("div",{className:"debug-jsx-converter",children:vs(Mr,{converters:st,data:r})}),t[5]=r,t[6]=i):i=t[6],i}var V0=M({plugins:[{Component:Ms,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)"}},J0={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 $1}from"lexical";import{jsx as Pt,jsxs as K0}from"react/jsx-runtime";import"react";var Dr=()=>K0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pt("g",{clipPath:"url(#clip0_4397_10817)",children:Pt("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),Pt("defs",{children:Pt("clipPath",{id:"clip0_4397_10817",children:Pt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as q0}from"react/jsx-runtime";import{$applyNodeReplacement as Q0}from"lexical";import*as $s from"react";import{DecoratorBlockNode as X0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as z0}from"@lexical/utils";import{$applyNodeReplacement as Z0}from"lexical";function Y0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ds({relationTo:o,value:e})}:null}var Bt=class extends X0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:Y0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Ds(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return z0(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 Ds(t){return Z0(new Bt({data:t}))}var e1=$s.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function t1(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ve({relationTo:o,value:e})}:null}var Ee=class extends Bt{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:t1,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Ve(o);return r.setFormat(e.format),r}decorate(e,o){return q0(e1,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ve(t){return Q0(new Ee({data:t}))}function $r(t){return t instanceof Ee}import{c as T1}from"react/compiler-runtime";import{jsx as w1}from"react/jsx-runtime";import{useLexicalComposerContext as S1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as E1}from"@lexical/utils";import{$getPreviousSelection as N1,$getSelection as L1,$isParagraphNode as y1,$isRangeSelection as R1,COMMAND_PRIORITY_EDITOR as I1,createCommand as v1}from"lexical";import{useEffect as M1}from"react";import{c as Fs}from"react/compiler-runtime";import{jsx as Or}from"react/jsx-runtime";import{useLexicalComposerContext as Ps}from"@lexical/react/LexicalComposerContext.js";import{toast as p1}from"@payloadcms/ui";import{$getNodeByKey as f1,COMMAND_PRIORITY_EDITOR as Bs}from"lexical";import{useEffect as js,useState as h1}from"react";import{c as o1}from"react/compiler-runtime";import{jsx as r1}from"react/jsx-runtime";import{useLexicalComposerContext as n1}from"@lexical/react/LexicalComposerContext";import{useListDrawer as l1,useModal as i1}from"@payloadcms/ui";import{$getNodeByKey as Os,$getPreviousSelection as s1,$getRoot as a1,$getSelection as c1,$isRangeSelection as u1,$setSelection as d1}from"lexical";import{useEffect as m1,useState as As}from"react";var jt=t=>{let e=o1(23),[o]=n1(),[r,n]=As(null),[l,s]=As(!1),[i,d,c]=l1(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=i1(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let v=c1()??s1();n(v)},e[0]=f):f=e[0];let g=f,k;e[1]!==o||e[2]!==r?(k=()=>{r&&o.update(()=>{if(u1(r)){let{anchor:v,focus:L}=r;Os(v.key)&&Os(L.key)&&d1(r.clone())}else a1().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=k):k=e[3];let E=k,y;e[4]!==u?(y=()=>{u()},e[4]=u,e[5]=y):y=e[5];let T=y,C,x;e[6]!==a||e[7]!==h||e[8]!==E||e[9]!==l?(C=()=>{if(!l)return;let v=h[a];v&&!v?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},x=[h,a,E,l],e[6]=a,e[7]=h,e[8]=E,e[9]=l,e[10]=C,e[11]=x):(C=e[10],x=e[11]),m1(C,x);let b;e[12]!==d?(b=v=>r1(d,{...v,onClick:()=>{g()}}),e[12]=d,e[13]=b):b=e[13];let _;e[14]!==p?(_=()=>{g(),p(),s(!0)},e[14]=p,e[15]=_):_=e[15];let D;return e[16]!==i||e[17]!==T||e[18]!==m||e[19]!==a||e[20]!==b||e[21]!==_?(D={closeListDrawer:T,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:b,openListDrawer:_},e[16]=i,e[17]=T,e[18]=m,e[19]=a,e[20]=b,e[21]=_,e[22]=D):D=e[22],D};var g1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=f1(o);n&&n.replace(Ve({relationTo:e,value:r}))}):t.dispatchCommand(Ar,{relationTo:e,value:r})},x1=t=>{let e=Fs(14),{enabledCollectionSlugs:o}=t,[r]=Ps(),[n,l]=h1(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}=jt(i),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(ze,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),Bs),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),js(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=g=>{let{collectionSlug:k,doc:E}=g;g1({editor:r,relationTo:k,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=Or(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},C1=()=>{let t=Fs(3),[e]=Ps(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ze,b1,Bs),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),js(o,r),null},Hs=({enabledCollectionSlugs:t})=>t?.length?Or(x1,{enabledCollectionSlugs:t}):Or(C1,{});function b1(){return p1.error("No relationship collections enabled"),!0}import{useConfig as k1,useEntityVisibility as _1}from"@payloadcms/ui";import*as Us from"react";var To=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=k1(),{visibleEntities:l}=_1();return Us.useMemo(()=>{let i=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:h}=a;if(l?.collections.includes(m)){if(r){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}},[n,l,r,o,e])};var Ar=v1("INSERT_RELATIONSHIP_COMMAND"),Ws=t=>{let e=T1(8),{clientProps:o}=t,[r]=S1(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=To(s),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([Ee]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Ar,D1,I1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),M1(d,c);let u;return e[6]!==i?(u=w1(Hs,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function D1(t){let e=L1()||N1();if(R1(e)){let o=Ve(t),{focus:r}=e,n=r.getNode();E1(o),y1(n)&&!n.__first&&n.remove()}return!0}var O1=M({nodes:[Ee],plugins:[{Component:Ws,position:"normal"}],slashMenu:{groups:[z([{Icon:Dr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Dr,isActive:({selection:t})=>{if(!$1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return $r(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]}});import{c as ih}from"react/compiler-runtime";import{jsx as de,jsxs as sh}from"react/jsx-runtime";import{useLexicalComposerContext as ah}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as qs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as ch,useThrottledEffect as uh,useTranslation as dh}from"@payloadcms/ui";import*as No from"react";import{useMemo as jr}from"react";import{c as A1}from"react/compiler-runtime";import{jsx as F1}from"react/jsx-runtime";import{$addUpdateTag as P1}from"lexical";import"react";var Gs="toolbar-popup__button",Ht=t=>{let e=A1(14),{active:o,children:r,editor:n,enabled:l,item:s}=t,i=o===void 0?!1:o,d=l===void 0?!0:l,c=d?"":"disabled",u=i?"active":"",a=s.key?`${Gs}-${s.key}`:"",m;e[0]!==c||e[1]!==u||e[2]!==a?(m=[Gs,c,u,a].filter(Boolean),e[0]=c,e[1]=u,e[2]=a,e[3]=m):m=e[3];let p=m.join(" "),h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==s?(h=()=>{d&&n.focus(()=>{n.update(B1),s.onSelect?.({editor:n,isActive:i})})},e[4]=i,e[5]=n,e[6]=d,e[7]=s,e[8]=h):h=e[8];let f=h,g=j1,k;return e[9]!==r||e[10]!==p||e[11]!==f||e[12]!==s.key?(k=F1("button",{className:p,"data-button-key":s.key,onClick:f,onMouseDown:g,type:"button",children:r}),e[9]=r,e[10]=p,e[11]=f,e[12]=s.key,e[13]=k):k=e[13],k};function B1(){P1("toolbar")}function j1(t){t.preventDefault()}import{c as K1}from"react/compiler-runtime";import{jsx as at}from"react/jsx-runtime";import X1,{useMemo as z1}from"react";import{useTranslation as Z1}from"@payloadcms/ui";import{jsx as $e,jsxs as Vs}from"react/jsx-runtime";import{Button as H1}from"@payloadcms/ui";import{$addUpdateTag as U1,isDOMNode as W1}from"lexical";import wo,{useCallback as G1,useEffect as So,useMemo as Ks,useRef as Fr,useState as Pr}from"react";import{createPortal as V1}from"react-dom";var Js="toolbar-popup__dropdown-item",Xs=wo.createContext(null);function zs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:s,tooltip:i}){let d=Ks(()=>[Js,r===!1?"disabled":"",t?"active":"",l?.key?`${Js}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Fr(null),u=wo.use(Xs);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return So(()=>{c?.current!=null&&a(c)},[c,a]),$e(H1,{"aria-label":i,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":s},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{U1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function J1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Pr(),[s,i]=Pr(),d=G1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?i(p=>{if(p==null)return n[0];let h=n.indexOf(p)-1;return n[h===-1?n.length-1:h]}):m==="ArrowDown"&&i(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=Ks(()=>({registerItem:d}),[d]);return So(()=>{n!=null&&s==null&&i(n[0]),s!=null&&s?.current!=null&&s.current.focus()},[n,s]),$e(Xs,{value:u,children:$e("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Zs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=Fr(null),u=Fr(null),[a,m]=Pr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};So(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:k,top:E}=f.getBoundingClientRect(),y=window.scrollY||document.documentElement.scrollTop;g.style.top=`${E+y+f.offsetHeight+5}px`,g.style.left=`${Math.min(k-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),So(()=>{let f=u.current;if(f!==null&&a){let g=k=>{let E=k.target;W1(E)&&(d&&c.current&&c.current.contains(E)||f.contains(E)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=V1($e(J1,{dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return Vs(wo.Fragment,{children:[Vs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[l&&$e(l,{}),i&&$e("span",{className:"toolbar-popup__dropdown-label",children:i}),$e("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&$e(wo.Fragment,{children:h})]})}var Br="toolbar-popup__dropdown",Y1=t=>{let e=K1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:s}=t,{i18n:i}=Z1(),{fieldProps:d}=W(),{featureClientSchemaMap:c,schemaPath:u}=d;if(s.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==s?(m=s?.Component&&at(s.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:s},s.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==i||e[11]!==s||e[12]!==u){let m=s.key,p;s.label&&(m=typeof s.label=="function"?s.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):s.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=at(zs,{active:o,editor:n,enabled:l,Icon:s?.ChildComponent?at(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:at("span",{className:"text",children:p})},s.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=i,e[11]=s,e[12]=u,e[13]=a}else a=e[13];return a},q1=X1.memo(Y1),Ut=({anchorElem:t,classNames:e,editor:o,group:r,groupState:n,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=r,u=z1(()=>d?.length?d.map(a=>at(q1,{active:n.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:n.enabledItemKeys.includes(a.key),item:a},a.key)):null,[d,n.activeItemKeys,n.enabledItemKeys,t,o]);return at(Zs,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Br,`${Br}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!n.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Br}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as Q1}from"@lexical/utils";import{$getSelection as eh}from"lexical";import{useCallback as th,useDeferredValue as oh,useEffect as rh,useRef as Ys,useState as nh}from"react";function lh(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let r of t){let n=[];for(let l of r.items)e.set(l.key,{active:!1,enabled:!0}),n.push(l.key);o.set(r.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:n})}return{groupStates:o,itemStates:e}}function Eo(t,e){let[o,r]=nh(()=>lh(e)),n=oh(o),l=W(),s=Ys(l);s.current=l;let i=Ys(e);i.current=e;let d=xn(),c=th(()=>{t.getEditorState().read(()=>{let u=eh();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=[],k=[],E=[],y=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let C of f.items){let x=C.isActive?(!y||g.length<y)&&C.isActive({editor:t,editorConfigContext:m,selection:u}):!1,b=C.isEnabled?C.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;x&&(g.push(C.key),k.push(C)),b&&E.push(C.key),p.set(C.key,{active:x,enabled:b})}let T=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(f.key,{activeItemKeys:g,activeItems:k,enabledGroup:T,enabledItemKeys:E})}r({groupStates:h,itemStates:p})})},[t]);return rh(()=>{d(c);let u=()=>d(c),a=Q1(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),n}function mh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&de(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?de(Ht,{active:t,editor:o,enabled:r,item:n,children:de(n.ChildComponent,{})},n.key):null}function ph({anchorElem:t,editor:e,editorConfig:o,group:r,index:n,toolbarStates:l}){let{i18n:s}=dh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=W(),c=l.groupStates.get(r.key),u=jr(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:r.ChildComponent},[r,c?.activeItems]),a=jr(()=>{if(r.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},[r,c?.activeItems,s,i,d]);return sh("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,"data-toolbar-group-key":r.key,children:[r.type==="dropdown"&&r.items.length&&c?de(Ut,{anchorElem:t,editor:e,group:r,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,r.type==="buttons"&&r.items.length?r.items.map(m=>{let p=l.itemStates.get(m.key);return de(mh,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,n<o.features.toolbarFixed?.groups.length-1&&de("div",{className:"divider"})]},r.key)}function fh({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=No.useRef(null),s=qs(),{y:i}=ch(),d=Eo(o,r?.features?.toolbarFixed?.groups),c=jr(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let a=n.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return uh(()=>{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]),de("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&de(No.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,a)=>de(ph,{anchorElem:t,editor:o,editorConfig:r,group:u,index:a,toolbarStates:d},u.key))})})}var Qs=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Qs(t.parentEditor)}return!1},ea=t=>{let e=ih(6),{clientProps:o}=t,[r]=ah(),n=W();if(!qs())return null;let{editorConfig:s}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=Qs(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=de(fh,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var hh=M({plugins:[{Component:ea,position:"aboveContainer"}]});import{c as gh}from"react/compiler-runtime";import{jsx as Ne,jsxs as ra}from"react/jsx-runtime";import{useLexicalComposerContext as xh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ch}from"@lexical/react/useLexicalEditable";import{mergeRegister as na}from"@lexical/utils";import{$getSelection as la,$isRangeSelection as ta,$isTextNode as bh,COMMAND_PRIORITY_LOW as kh,getDOMSelection as ia,SELECTION_CHANGE_COMMAND as _h}from"lexical";import{useCallback as yo,useEffect as Wt,useMemo as Th,useRef as oa,useState as wh}from"react";import"react";import{createPortal as Sh}from"react-dom";function Hr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function Lo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.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,n.style.opacity="1",i&&r!==0?(h-=m.bottom-r+a.height-3,n.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,n.style.transform=`translate(${f}px, ${h}px)`),g}function Eh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&Ne(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?Ne(Ht,{active:t,editor:o,enabled:r,item:n,children:Ne(n.ChildComponent,{})},n.key):null}function Nh({anchorElem:t,editor:e,group:o,index:r,toolbarStates:n}){let{editorConfig:l}=W(),s=n.groupStates.get(o.key),i=Th(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return ra("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Ne(Ut,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=n.itemStates.get(d.key);return Ne(Eh,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,r<l.features.toolbarInline?.groups.length-1&&Ne("div",{className:"divider"})]},o.key)}function Lh({anchorElem:t,editor:e}){let o=oa(null),r=oa(null),{editorConfig:n}=W(),l=Eo(e,n?.features?.toolbarInline?.groups),s=yo(()=>{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=yo(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=yo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Wt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=yo(()=>{let u=la(),a=ia(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=Hr(a,h),g=Lo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Lo({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Wt(()=>{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]),Wt(()=>(e.getEditorState().read(()=>{c()}),na(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(_h,()=>(c(),!1),kh))),[e,c]),ra("div",{className:"inline-toolbar-popup",ref:o,children:[Ne("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,a)=>Ne(Nh,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function yh(t,e){let o=gh(12),[r,n]=wh(!1),l=Ch(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=la(),h=ia(t._window),f=t.getRootElement();if(h!==null&&(!ta(p)||f===null||!f.contains(h.anchorNode))){n(!1);return}if(!ta(p))return;if(p.getTextContent()!==""){let k=p.getNodes(),E=!1;for(let y of k)if(bh(y)){n(!0),E=!0;break}E||n(!1)}else n(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){n(!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]),Wt(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>na(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Wt(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=Sh(Ne(Lh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var sa=t=>{let{anchorElem:e}=t,[o]=xh();return yh(o,e)};var Rh=M({plugins:[{Component:sa,position:"floatingAnchorElem"}]});import{TableCellNode as Cx,TableNode as bx,TableRowNode as kx}from"@lexical/table";import{jsx as aa}from"react/jsx-runtime";import"react";var Ur=()=>aa("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:aa("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as Ih,$createTableNode as vh,$createTableRowNode as Mh,$isTableCellNode as ca,$isTableNode as Wr,$isTableRowNode as Gr,TableCellHeaderStates as Ro,TableCellNode as Dh,TableNode as $h,TableRowNode as Oh}from"@lexical/table";import{$isParagraphNode as Ah,$isTextNode as Fh}from"lexical";var da=/^\|(.+)\|\s?$/,Ph=/^(\| ?:?-*:? ?)+\|\s?$/,ma=({allTransformers:t})=>({type:"element",dependencies:[$h,Oh,Dh],export:e=>{if(!Wr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Gr(r))continue;let l=!1;for(let s of r.getChildren())ca(s)&&(n.push(Yt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===Ro.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(s=>"---").join(" | ")} |`)}return o.join(`
59
- `)},regExp:da,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(Ph.test(n)){let a=e.getPreviousSibling();if(!a||!Wr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Gr(p))return;p.getChildren().forEach(h=>{ca(h)&&h.setHeaderStyles(Ro.ROW,Ro.ROW)}),e.remove();return}let l=ua(n,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!Ah(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!Fh(a))break;let m=ua(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=vh();for(let a of s){let m=Mh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:pa("",t))}let u=e.getPreviousSibling();Wr(u)&&Bh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function Bh(t){let e=t.getFirstChild();return Gr(e)?e.getChildrenSize():0}var pa=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=Ih(Ro.NO_STATUS);return Zt(t,e,o),o},ua=(t,e)=>{let o=t.match(da);return!o||!o[1]?null:o[1].split("|").map(r=>pa(r,e))};import{c as Hh}from"react/compiler-runtime";import{jsx as B,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as Ca}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Uh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ha,$deleteTableColumnAtSelection as Wh,$deleteTableRowAtSelection as Gh,$getNodeTriplet as Vh,$getTableCellNodeFromLexicalNode as ga,$getTableColumnIndexFromTableCellNode as Jh,$getTableNodeFromLexicalNodeOrThrow as Ae,$getTableRowIndexFromTableCellNode as Kh,$insertTableColumnAtSelection as Xh,$insertTableRowAtSelection as zh,$isTableCellNode as ba,$isTableSelection as Gt,$mergeCells as Zh,$unmergeCell as Yh,getTableElement as Jr,getTableObserverFromTableElement as Kr,TableCellHeaderStates as Oe,TableCellNode as qh}from"@lexical/table";import{mergeRegister as Qh}from"@lexical/utils";import{useScrollInfo as eg}from"@payloadcms/ui";import{$getSelection as vo,$isElementNode as tg,$isRangeSelection as Xr,$isTextNode as og,$setSelection as rg,COMMAND_PRIORITY_CRITICAL as ng,getDOMSelection as lg,isDOMNode as ig,SELECTION_CHANGE_COMMAND as sg}from"lexical";import*as zr from"react";import{useCallback as ae,useEffect as ct,useRef as Io,useState as ut}from"react";import{createPortal as ka}from"react-dom";import{jsx as Vr,jsxs as jh}from"react/jsx-runtime";import"react";var fa=()=>jh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Vr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Vr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Vr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function xa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function ag(){let t=vo();if(Xr(t)&&!t.isCollapsed()||Gt(t)&&!t.anchor.is(t.focus)||!Xr(t)&&!Gt(t))return!1;let[e]=Vh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function cg(t){let e=t.getLastDescendant();og(e)?e.select():tg(e)?e.selectEnd():e!==null&&e.selectNext()}function ug({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Ca(),s=Io(null),[i,d]=ut(n),[c,u]=ut({columns:1,rows:1}),[a,m]=ut(!1),[p,h]=ut(!1),{y:f}=eg();ct(()=>l.registerMutationListener(qh,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),ct(()=>{l.getEditorState().read(()=>{let w=vo();if(Gt(w)){let N=xa(w);u(xa(w)),m(N.columns>1||N.rows>1)}h(ag())})},[l]),ct(()=>{let w=e.current,N=s.current,I=l.getRootElement();if(w!=null&&N!=null&&I!=null){let $=I.getBoundingClientRect(),R=w.getBoundingClientRect();N.style.opacity="1";let O=N.getBoundingClientRect(),F=5,j=R.right+F;if(j+O.width>window.innerWidth||j+O.width>$.right){let P=R.left-O.width-F;j=(P<0?F:P)+window.pageXOffset}N.style.left=`${j+window.pageXOffset}px`;let X=R.top;if(X+O.height>window.innerHeight){let P=R.bottom-O.height;X=P<0?F:P}N.style.top=`${X}px`}},[e,s,l,f]),ct(()=>{function w(N){s.current!=null&&e.current!=null&&ig(N.target)&&!s.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let g=ae(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i),N=Jr(w,l.getElementByKey(w.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let I=Kr(N);I!==null&&I.$clearHighlight(),w.markDirty(),d(i.getLatest())}rg(null)})},[l,i]),k=()=>{l.update(()=>{let w=vo();if(!Gt(w))return;let I=w.getNodes().filter(ba),$=Zh(I);$&&(cg($),o())})},E=()=>{l.update(()=>{Yh()})},y=ae(w=>{l.update(()=>{for(let N=0;N<c.rows;N++)zh(w);o()})},[l,o,c.rows]),T=ae(w=>{l.update(()=>{for(let N=0;N<c.columns;N++)Xh(w);o()})},[l,o,c.columns]),C=ae(()=>{l.update(()=>{Gh(),o()})},[l,o]),x=ae(()=>{l.update(()=>{Ae(i).remove(),g(),o()})},[l,i,g,o]),b=ae(()=>{l.update(()=>{Wh(),o()})},[l,o]),_=ae(()=>{l.update(()=>{let w=Ae(i),N=Kh(i),[I]=ha(w,null,null),$=new Set,R=i.getHeaderStyles()^Oe.ROW;if(I[N])for(let O=0;O<I[N].length;O++){let F=I[N][O];F?.cell&&($.has(F.cell)||($.add(F.cell),F.cell.setHeaderStyles(R,Oe.ROW)))}g(),o()})},[l,i,g,o]),D=ae(()=>{l.update(()=>{let w=Ae(i),N=Jh(i),[I]=ha(w,null,null),$=new Set,R=i.getHeaderStyles()^Oe.COLUMN;if(I)for(let O=0;O<I.length;O++){let F=I?.[O]?.[N];F?.cell&&($.has(F.cell)||($.add(F.cell),F.cell.setHeaderStyles(R,Oe.COLUMN)))}g(),o()})},[l,i,g,o]),v=ae(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),L=ae(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),S=null;return t&&(a?S=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):p&&(S=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),ka(Le("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[S?Le(zr.Fragment,{children:[S,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>v(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>L(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>y(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>y(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>T(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>T(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>b(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>_(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&Oe.ROW)===Oe.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&Oe.COLUMN)===Oe.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function dg({anchorElem:t,cellMerge:e}){let[o]=Ca(),r=Io(null),n=Io(null),[l,s]=ut(!1),[i,d]=ut(null),c=ae(()=>{let a=r.current,m=vo(),p=lg(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(),k=null,E=null;if(Xr(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let T=ga(m.anchor.getNode());if(T==null||(E=o.getElementByKey(T.getKey()),E==null||!T.isAttached()))return f();let C=Ae(T),x=Jr(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Kr(x),d(T)}else if(Gt(m)){let T=ga(m.anchor.getNode());if(!ba(T))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=Ae(T),x=Jr(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Kr(x),E=o.getElementByKey(T.getKey())}else if(!h)return f();if(k===null||E===null)return f();let y=!k||!k.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",y),a.classList.toggle("table-cell-action-button-container--inactive",!y),y){let T=E.getBoundingClientRect(),C=t.getBoundingClientRect(),x=T.top-C.top,b=T.right-C.left;a.style.transform=`translate(${b}px, ${x}px)`}},[o,t]);ct(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Qh(o.registerUpdateListener(p),o.registerCommand(sg,p,ng),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=Io(i);return ct(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),B("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&Le(zr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:B(fa,{})}),l&&B(ug,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var _a=t=>{let e=Hh(3),{anchorElem:o}=t,r=Uh(),n;return e[0]!==o||e[1]!==r?(n=ka(r?B(dg,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as mg}from"react/compiler-runtime";import{jsx as Do,jsxs as pg}from"react/jsx-runtime";import{useLexicalComposerContext as fg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as hg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as gg,$getTableNodeFromLexicalNodeOrThrow as Zr,$getTableRowIndexFromTableCellNode as xg,$isTableCellNode as Ta,$isTableRowNode as Cg,getDOMCellFromTarget as bg,getTableElement as kg,TableNode as wa}from"@lexical/table";import{calculateZoomLevel as Sa,mergeRegister as _g}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Yr,isHTMLElement as Tg,SKIP_SCROLL_INTO_VIEW_TAG as Ea}from"lexical";import*as La from"react";import{useCallback as Vt,useEffect as qr,useRef as Mo,useState as dt}from"react";import{createPortal as wg}from"react-dom";var Sg=33,Na=92;function Eg({editor:t}){let e=Mo(null),o=Mo(null),r=Mo(null),[n,l]=dt(!1),s=W(),i=Mo(null),[d,c]=dt(null),[u,a]=dt(null),[m,p]=dt(!1),[h,f]=dt(null),g=Vt(()=>{a(null),e.current=null,f(null),i.current=null,r.current=null},[]),k=L=>(L.buttons&1)===1;qr(()=>{let L=new Set;return _g(t.registerMutationListener(wa,S=>{for(let[w,N]of S)N==="destroyed"?L.delete(w):L.add(w);l(L.size>0)}),t.registerNodeTransform(wa,S=>{if(S.getColWidths())return S;let w=S.getColumnCount(),N=Na;return S.setColWidths(Array(w).fill(N)),S}))},[t]),qr(()=>{if(!n)return;let L=I=>{let $=I.target;if(Tg($)){if(h){c({x:I.clientX,y:I.clientY});return}if(p(k(I)),!(o.current&&o.current.contains($))&&e.current!==$){e.current=$;let R=bg($);R&&u!==R?t.getEditorState().read(()=>{let O=Yr(R.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let F=Zr(O),j=kg(F,t.getElementByKey(F.getKey()));if(!j)throw new Error("TableCellResizer: Table element not found.");e.current=$,r.current=j.getBoundingClientRect(),a(R)},{editor:t}):R==null&&g()}}},S=I=>{p(!0)},w=I=>{p(!1)},N=t.registerRootListener((I,$)=>{$?.removeEventListener("mousemove",L),$?.removeEventListener("mousedown",S),$?.removeEventListener("mouseup",w),I?.addEventListener("mousemove",L),I?.addEventListener("mousedown",S),I?.addEventListener("mouseup",w)});return()=>{N()}},[u,h,t,n,g]);let E=L=>L==="bottom",y=Vt(L=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Yr(u.elem);if(!Ta(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Zr(S),N=xg(S),I=w.getChildren(),R=S.getColSpan()===w.getColumnCount()?N:N+S.getRowSpan()-1;if(R>=I.length||R<0)throw new Error("Expected table cell to be inside of table row.");let O=I[R];if(!Cg(O))throw new Error("Expected table row");let F=O.getHeight();if(F===void 0){let X=O.getChildren();F=Math.min(...X.map(P=>T(P,t)??1/0))}let j=Math.max(F+L,Sg);O.setHeight(j)},{tag:Ea})},[u,t]),T=(L,S)=>S.getElementByKey(L.getKey())?.clientHeight,C=(L,S)=>{let w;return S.forEach(N=>{N.forEach((I,$)=>{I.cell===L&&(w=$)})}),w},x=Vt(L=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Yr(u.elem);if(!Ta(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Zr(S),[N]=gg(w,null,null),I=C(S,N);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let $=w.getColWidths();if(!$)return;let R=$[I];if(R===void 0)return;let O=[...$],F=Math.max(R+L,Na);O[I]=F,w.setColWidths(O)},{tag:Ea})},[u,t]),b=Vt(L=>{let S=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:N,y:I}=i.current;if(u===null)return;let $=Sa(w.target);if(E(L)){let R=(w.clientY-I)/$;y(R)}else{let R=(w.clientX-N)/$;x(R)}g(),document.removeEventListener("mouseup",S)}};return S},[u,g,x,y]),_=Vt(L=>S=>{if(S.preventDefault(),S.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},c(i.current),f(L),document.addEventListener("mouseup",b(L))},[u,b]),[D,v]=dt({bottom:null,left:null,right:null,top:null});return qr(()=>{if(u){let{height:L,left:S,top:w,width:N}=u.elem.getBoundingClientRect(),I=Sa(u.elem),$=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${$}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+w+L-$/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${L}px`,left:`${window.scrollX+S+N-$/2}px`,top:`${window.scrollY+w}px`,width:`${$}px`}},O=r.current;h&&d&&O&&(E(h)?(R[h].left=`${window.scrollX+O.left}px`,R[h].top=`${window.scrollY+d.y/I}px`,R[h].height="3px",R[h].width=`${O.width}px`):(R[h].top=`${window.scrollY+O.top}px`,R[h].left=`${window.scrollX+d.x/I}px`,R[h].width="3px",R[h].height=`${O.height}px`),R[h].backgroundColor="#adf"),v(R)}else v({bottom:null,left:null,right:null,top:null})},[u,h,d]),Do("div",{ref:o,children:u!=null&&!m&&pg(La.Fragment,{children:[Do("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:D.right||void 0}),Do("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:D.bottom||void 0})]})})}var ya=()=>{let t=mg(3),[e]=fg(),o=hg(),r;return t[0]!==e||t[1]!==o?(r=o?wg(Do(Eg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Dg}from"react/compiler-runtime";import{jsx as Qr,jsxs as $g,Fragment as Og}from"react/jsx-runtime";import{useLexicalComposerContext as Ag}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Aa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Fg,$getTableColumnIndexFromTableCellNode as Pg,$getTableRowIndexFromTableCellNode as Bg,$insertTableColumnAtSelection as jg,$insertTableRowAtSelection as Hg,$isTableCellNode as Ug,$isTableNode as va,getTableElement as Wg,TableNode as Gg}from"@lexical/table";import{$findMatchingParent as Vg,mergeRegister as Jg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ma,isHTMLElement as Kg}from"lexical";import{useEffect as Da,useMemo as Xg,useRef as $a,useState as $o}from"react";import"react";import{createPortal as zg}from"react-dom";import{c as Ig}from"react/compiler-runtime";import{useEffect as vg,useRef as Mg}from"react";var Ng="Expected a function",Lg=Math.max,yg=Math.min;function Rg(t,e,o){let r,n,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(Ng);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?Lg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(x){let b=r,_=s;return r=s=void 0,l=x,u=t.apply(_,b),u}function h(x){return l=x,a=setTimeout(k,e),i?p(x):u}function f(x){let b=x-n,_=x-l,D=e-b;return d?yg(D,c-_):D}function g(x){let b=x-n,_=x-l;return n===void 0||b>=e||b<0||d&&_>=c}function k(){let x=Date.now();if(g(x))return E(x);a=setTimeout(k,f(x))}function E(x){return a=void 0,m&&r?p(x):(r=s=void 0,u)}function y(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function T(){return a===void 0?u:E(Date.now())}function C(){let x=Date.now(),b=g(x);if(r=arguments,s=this,n=x,b){if(a===void 0)return h(n);if(d)return clearTimeout(a),a=setTimeout(k,e),p(n)}return a===void 0&&(a=setTimeout(k,e)),u}return C.cancel=y,C.flush=T,C}var Ra=Rg;function Ia(t,e,o){let r=Ig(6),n=Mg(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Ra(t,e,{maxWait:o}),()=>{n.current?.cancel()}),s=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=s):(l=r[3],s=r[4]),vg(l,s);let i;return r[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=i):i=r[5],i}var Oa=20;function Zg({anchorElem:t}){let[e]=Ag(),o=Aa(),r=W(),[n,l]=$o(!1),[s,i]=$o(!1),[d,c]=$o(!1),[u,a]=$o({}),m=$a(new Set),p=$a(null),h=Ia(k=>{let{isOutside:E,tableDOMNode:y}=Yg(k,r.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!y)return;p.current=y;let T=null,C=null,x=null;if(e.getEditorState().read(()=>{let R=Ma(y);if(Ug(R)){let O=Vg(R,F=>va(F));if(!va(O))return;if(x=Wg(O,e.getElementByKey(O.getKey())),x){let F=O.getChildrenSize(),j=O.getChildAtIndex(0)?.getChildrenSize(),X=Bg(R),P=Pg(R);X===F-1?T=R:P===j-1&&(C=R)}}},{editor:e}),!x)return;let b=x.parentElement;if(!b)return;let{bottom:_,height:D,left:v,right:L,width:S,y:w}=x.getBoundingClientRect(),N=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(N=b.scrollWidth>b.clientWidth);let{left:I,y:$}=t.getBoundingClientRect();T?(i(!1),l(!0),a({height:Oa,left:N&&b?b.offsetLeft:v-I,top:_-$+5,width:N&&b?b.offsetWidth:S})):C&&(i(!0),l(!1),a({height:D,left:L-I+5,top:w-$,width:Oa}))},50,250),f=Xg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Da(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Da(()=>Jg(e.registerMutationListener(Gg,k=>{e.getEditorState().read(()=>{let E=!1;for(let[y,T]of k)switch(T){case"created":{m.current.add(y),E=!0;break}case"destroyed":{m.current.delete(y),E=!0;break}default:break}if(E){f.disconnect();for(let y of m.current){let{tableElement:T}=Fg(y);f.observe(T)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=k=>{e.update(()=>{p.current&&(Ma(p.current)?.selectEnd(),k?(Hg(),l(!1)):(jg(),i(!1)))})};return o?$g(Og,{children:[n&&Qr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Qr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function Yg(t,e){let o=t.target;if(Kg(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Fa(t){let e=Dg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Aa())return null;let l;return e[0]!==r?(l=zg(Qr(Zg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as qg}from"react/compiler-runtime";import{jsx as en,jsxs as Qg}from"react/jsx-runtime";import{useLexicalComposerContext as ex}from"@lexical/react/LexicalComposerContext";import{TablePlugin as tx}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ox,TableCellNode as rx,TableNode as nx,TableRowNode as lx}from"@lexical/table";import{mergeRegister as ix}from"@lexical/utils";import{formatDrawerSlug as sx,useEditDepth as ax}from"@payloadcms/ui";import{$getSelection as cx,$isRangeSelection as ux,COMMAND_PRIORITY_EDITOR as dx,createCommand as mx}from"lexical";import{createContext as px,use as fx,useEffect as hx,useMemo as gx,useState as xx}from"react";import*as Pa from"react";var Oo=mx("OPEN_EMBED_DRAWER_COMMAND"),Ba=px({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ja({children:t}){let[e,o]=xx({cellEditorConfig:null,cellEditorPlugins:null});return en(Ba,{value:gx(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ha=()=>{let t=qg(16),[e]=ex(),o=fx(Ba),r=ax(),{fieldProps:n,uuid:l}=W(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=sx({slug:i,depth:r}),t[0]=r,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=ge(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([nx,lx,rx]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return ix(e.registerCommand(Oo,()=>{let f=null;return e.getEditorState().read(()=>{let g=cx();ux(g)&&(f=g)}),f&&u(),!0},dx))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],hx(a,m);let p;t[10]!==e?(p=(f,g)=>{!g.columns||!g.rows||e.dispatchCommand(ox,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let h;return t[12]!==c||t[13]!==s||t[14]!==p?(h=Qg(Pa.Fragment,{children:[en(kt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),en(tx,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=h):h=t[15],h};var _x=M({markdownTransformers:[ma],nodes:[bx,Cx,kx],plugins:[{Component:Ha,position:"normal"},{Component:ya,position:"normal"},{Component:_a,position:"floatingAnchorElem"},{Component:Fa,position:"floatingAnchorElem"}],providers:[ja],slashMenu:{groups:[z([{Icon:Ur,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Oo,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Ur,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Oo,{})}}])]}});import{$isNodeSelection as rC}from"lexical";import{jsx as tn,jsxs as Tx}from"react/jsx-runtime";import"react";var on=()=>Tx("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[tn("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),tn("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),tn("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ja}from"react/jsx-runtime";import Ka from"bson-objectid";import{$applyNodeReplacement as yx}from"lexical";import*as Xa from"react";import wx from"bson-objectid";function Ao(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new wx.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as Sx}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Ex}from"@lexical/utils";import Wa from"bson-objectid";import{$applyNodeReplacement as Nx}from"lexical";var Jt=class extends Sx{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>Ao(o,Ua),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Wa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ua({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Ex(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 Ua({data:t}){return t?.id||(t.id=new Wa.default().toHexString()),Nx(new Jt({data:t}))}import{jsx as Ga}from"react/jsx-runtime";import{ShimmerEffect as Lx}from"@payloadcms/ui";var Va=()=>Ga("div",{className:"lexical-upload",children:Ga(Lx,{height:"95px",width:"203px"})});var Rx=Xa.lazy(()=>import("./component-BAAVC34S.js").then(t=>({default:t.UploadComponent}))),me=class extends Jt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Ao(o,pe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ka.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=pe({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?Ja(Va,{}):Ja(Rx,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function pe({data:t}){return t?.id||(t.id=new Ka.default().toHexString()),yx(new me({data:t}))}function mt(t){return t instanceof me}import{c as Fx}from"react/compiler-runtime";import{jsx as Px}from"react/jsx-runtime";import{useLexicalComposerContext as Bx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as lc,$insertNodeToNearestRoot as ln,mergeRegister as jx}from"@lexical/utils";import{useBulkUpload as Hx,useEffectEvent as Ux,useModal as Wx}from"@payloadcms/ui";import sn from"bson-objectid";import{$createRangeSelection as Gx,$getPreviousSelection as ec,$getSelection as tc,$isParagraphNode as an,$isRangeSelection as oc,$setSelection as Vx,COMMAND_PRIORITY_EDITOR as Jx,COMMAND_PRIORITY_LOW as rc,createCommand as Kx,DROP_COMMAND as Xx,getDOMSelectionFromTarget as zx,isHTMLElement as nc,PASTE_COMMAND as Zx}from"lexical";import{useEffect as Yx}from"react";import{c as za}from"react/compiler-runtime";import{jsx as rn}from"react/jsx-runtime";import{useLexicalComposerContext as Za}from"@lexical/react/LexicalComposerContext.js";import{toast as Ix}from"@payloadcms/ui";import{$getNodeByKey as vx,COMMAND_PRIORITY_EDITOR as Ya}from"lexical";import{useEffect as qa,useState as Mx}from"react";var Dx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=vx(o);n&&n.replace(pe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(nn,{fields:null,relationTo:e,value:r})},$x=t=>{let e=za(13),{enabledCollectionSlugs:o}=t,[r]=Za(),[n,l]=Mx(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}=jt(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Ze,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Ya),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),qa(u,a);let m;e[6]!==i||e[7]!==r||e[8]!==n?(m=f=>{let{collectionSlug:g,doc:k}=f;i(),Dx({editor:r,relationTo:g,replaceNodeKey:n,value:k.id})},e[6]=i,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,h;return e[10]!==d||e[11]!==p?(h=rn(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},Ox=()=>{let t=za(3),[e]=Za(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ze,Ax,Ya),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),qa(o,r),null},Qa=({enabledCollectionSlugs:t})=>t?.length?rn($x,{enabledCollectionSlugs:t}):rn(Ox,{});function Ax(){return Ix.error("No upload collections enabled"),!0}function qx(t){let e=t.target;return!!(nc(e)&&!e.closest("code, span.editor-image")&&nc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Qx(t){let e,o=zx(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 nn=Kx("INSERT_UPLOAD_COMMAND"),ic=t=>{let e=Fx(21),{clientProps:o}=t,[r]=Bx(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=To(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=Hx(),{isModalOpen:h,openModal:f}=Wx(),g;e[3]!==d||e[4]!==r||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=C=>{let{files:x}=C;if(x?.length!==0&&(u(b=>[...b??[],...x.map(eC)]),!h(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{r.update(tC)}),m(b=>{let _=new Map(b.map(oC));r.update(()=>{for(let D of lc()){let v=D.node;if(mt(v)){let L=v.getData();if(L?.pending){let S=_.get(L.pending?.formID);S&&v.replace(pe({data:{id:new sn.default().toHexString(),fields:{},relationTo:S.collectionSlug,value:S.doc.id}}))}}}})}),f(d)}},e[3]=d,e[4]=r,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 k=Ux(g),E;e[14]!==r||e[15]!==k?(E=()=>{if(!r.hasNodes([me]))throw new Error("UploadPlugin: UploadNode not registered on editor");return jx(r.registerNodeTransform(me,C=>{let x=C.getData();if(!x?.pending)return;(async function(){let D=null,v=x?.pending?.src,L=x?.pending?.formID;if(v?.startsWith("data:")){let S=v.match(/data:(image\/[a-zA-Z]+);base64,/),w=S?S[1]:"image/png",N=v.replace(/^data:image\/[a-zA-Z]+;base64,/,""),I=atob(N),$=new Array(I.length);for(let F=0;F<I.length;F++)$[F]=I.charCodeAt(F);let R=new Uint8Array($);D={alt:void 0,file:new File([R],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:L}}else if(v?.startsWith("http")||v?.startsWith("https")){let w=await(await fetch(v)).blob(),N=v.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];D={alt:void 0,file:new File([w],N,{type:w.type}),formID:L}}D&&k({files:[D]})})()}),r.registerCommand(nn,C=>(r.update(()=>{let x=tc()||ec();if(oc(x)){let b=pe({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:_}=x,D=_.getNode();ln(b),an(D)&&!D.__first&&D.remove()}}),!0),Jx),r.registerCommand(Zx,C=>{if(!(C instanceof ClipboardEvent))return!1;let x=C.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(_=>{b.push({alt:"",file:_,formID:new sn.default().toHexString()})}),b.length?(r.update(()=>{let _=tc()||ec();if(oc(_))for(let D of b){let v=pe({data:{pending:{formID:D.formID,src:URL.createObjectURL(D.file)}}}),{focus:L}=_,S=L.getNode();ln(v),an(S)&&!S.__first&&S.remove()}}),k({files:b}),!0):!1},rc),r.registerCommand(Xx,C=>{if(!(C instanceof DragEvent))return!1;let x=C.dataTransfer;if(!x?.types?.length)return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(_=>{b.push({alt:"",file:_,formID:new sn.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),r.update(()=>{if(qx(C)){let _=Qx(C),D=Gx();_!=null&&D.applyDOMRange(_),Vx(D);for(let v of b){let L=pe({data:{pending:{formID:v.formID,src:URL.createObjectURL(v.file)}}}),{focus:S}=D,w=S.getNode();ln(L),an(w)&&!w.__first&&w.remove()}}}),k({files:b}),!0):!1},rc))},e[14]=r,e[15]=k,e[16]=E):E=e[16];let y;e[17]!==r?(y=[r],e[17]=r,e[18]=y):y=e[18],Yx(E,y);let T;return e[19]!==i?(T=Px(Qa,{enabledCollectionSlugs:i}),e[19]=i,e[20]=T):T=e[20],T};function eC(t){return{file:t.file,formID:t.formID}}function tC(){for(let t of lc()){let e=t.node;mt(e)&&e.getData()?.pending&&e.remove()}}function oC(t){return[t.formID,t]}var nC=M({nodes:[me],plugins:[{Component:ic,position:"normal"}],slashMenu:{groups:[z([{Icon:on,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ze,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:on,isActive:({selection:t})=>{if(!rC(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return mt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ze,{replace:!1})}}])]}});import{c as iC}from"react/compiler-runtime";import{jsx as Fo}from"react/jsx-runtime";import{createElement as sC}from"react";import{ShimmerEffect as aC,useConfig as cC}from"@payloadcms/ui";import{lazy as uC,Suspense as dC,useEffect as mC,useState as pC}from"react";var sc={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",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 cn={namespace:"lexical",theme:sc};function ac({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,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:r,resolvedFeatures:i,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as lC}from"payload/shared";var cc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?lC(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function un(t,e,o,r){return{admin:o,features:cc(t),lexical:e,resolvedFeatureMap:t,view:r}}var fC=uC(()=>import("./Field-J6MIUIWP.js").then(t=>({default:t.RichText}))),hC=t=>Fo(Go,{inheritable:!0,views:t.views,children:Fo(gC,{...t})}),gC=t=>{let e=iC(23),{admin:o,clientFeatures:r,featureClientImportMap:n,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]!==n?(m=n===void 0?{}:n,e[2]=n,e[3]=m):m=e[3];let p=m,h=i===void 0?cn:i,{currentView:f}=Vo(),g=c?.[f]?.admin??a,k=c?.[f]?.lexical,E;e[4]!==h||e[5]!==k?(E=typeof k=="function"?k(h):k??h,e[4]=h,e[5]=k,e[6]=E):E=e[6];let y=E,{config:T}=cC(),[C,x]=pC(null),b,_;e[7]!==r||e[8]!==T||e[9]!==f||e[10]!==g||e[11]!==y||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==C||e[16]!==d||e[17]!==c?(b=()=>{if(C&&C.view===f)return;let v=c?.[f],L=v?.filterFeatures?v.filterFeatures(r):r,S=[];for(let N of Object.values(L))N.clientFeatureProvider&&S.push(N.clientFeatureProvider(N.clientFeatureProps));let w=ac({config:T,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:S,lexical:y}});x(un(w,y,g,f))},_=[g,r,T,p,l,s,C,y,d,f,c],e[7]=r,e[8]=T,e[9]=f,e[10]=g,e[11]=y,e[12]=p,e[13]=l,e[14]=s,e[15]=C,e[16]=d,e[17]=c,e[18]=b,e[19]=_):(b=e[18],_=e[19]),mC(b,_);let D;return e[20]!==C||e[21]!==t?(D=Fo(dC,{fallback:Fo(aC,{height:"35vh"}),children:C&&sC(fC,{...t,editorConfig:C,key:C.view})}),e[20]=C,e[21]=t,e[22]=D):D=e[22],D};function xC(t){return t instanceof HTMLElement}function CC(...t){return t.filter(Boolean).join(" ")}var Po=new WeakMap;function uc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Bo(t,e){let o=Po.get(t);if(o===void 0){let r=new Set,n=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 c of r)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Po.set(t,o)}return o.listeners.add(e),()=>{bC(t,e)}}function bC(t,e){let o=Po.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Po.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function kC(t,e){return Bo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function _C(t,e){return Bo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function TC(t,e){return Bo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function wC(t,e){return Bo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as SC}from"react/compiler-runtime";import{jsx as EC}from"react/jsx-runtime";import"react";var NC=()=>{let t=SC(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?EC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as LC}from"react/compiler-runtime";import{jsx as yC}from"react/jsx-runtime";import"react";var RC=()=>{let t=LC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?yC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as IC}from"react/compiler-runtime";import{jsx as vC}from"react/jsx-runtime";import"react";var MC=()=>{let t=IC(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?vC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as DC}from"react/compiler-runtime";import{jsx as $C}from"react/jsx-runtime";import"react";var OC=t=>{let e=DC(3),{children:o}=t,{InlineBlockContainer:r}=xe(),n;return e[0]!==r||e[1]!==o?(n=r?$C(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as AC}from"react/jsx-runtime";import"react";var FC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=le();return r?AC(r,{...o,children:e}):null};import{c as PC}from"react/compiler-runtime";import{jsx as BC}from"react/jsx-runtime";import"react";var jC=()=>{let t=PC(2),{EditButton:e}=le(),o;return t[0]!==e?(o=e?BC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as HC}from"react/compiler-runtime";import{jsx as UC}from"react/jsx-runtime";import"react";var WC=()=>{let t=HC(2),{RemoveButton:e}=le(),o;return t[0]!==e?(o=e?UC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as GC}from"qs-esm";var VC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=GC({depth:e??0,draft:o??!1,locale:r,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 dc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
58
+ `,Ts="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ws="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",_0=new RegExp("^[^"+ws+"]*["+Ts+"]"),T0=new RegExp("^[^"+Ts+"]*["+ws+"]"),w0={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},S0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},E0={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},N0={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},L0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},y0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Ss={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ue("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ue("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ue("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ue("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ue("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ue("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ue("sup",{children:e})),e}};import{jsx as Ft}from"react/jsx-runtime";var Es={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=e.fields?.alt||o?.alt||"",n=o.url;if(!o.mimeType.startsWith("image"))return Ft("a",{href:n,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Ft("img",{alt:r,height:o.height,src:n,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(Ft("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(Ft("img",{alt:r,height:o?.height,src:n,width:o?.width},"image")),Ft("picture",{children:l})}};var st={...bs,...Ss,...fs,...us,..._s,...ms,...ps,...Cs,...gs({}),...Es,...ks};import{jsx as ko,Fragment as R0}from"react/jsx-runtime";import bo from"react";function Ns(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!o}function I0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let r=typeof t.html=="function"?t.html(o):t.html;return ko("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function Ls(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,r={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return bo.createElement(t.Block,r)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},r=typeof t.html=="function"?t.html(o):t.html;return ko("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function v0(t){let e={};for(let[o,r]of Object.entries(t)){if(!r||typeof r!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Ls(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Ls(i))}continue}let n=r;(n.Component||n.html)&&(e[o]=I0(n))}return e}function ys({converters:t,data:e,disableIndent:o,disableTextAlign:r,nodeMap:n}){if(Ns(e)){let l=n?v0(n):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Rs({converters:s,disableIndent:o,disableTextAlign:r,nodes:e.root.children,parent:e.root})}return ko(R0,{})}function Rs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.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=>Rs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:n}}),parent:n}):c:u=ko("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`),bo.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return bo.cloneElement(u,{key:d,style:m})}return bo.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function Ir({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:st}):i=e:i=st;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ys({converters:i,data:o,disableIndent:n,disableTextAlign:l,nodeMap:s});return r?Is(M0,{children:d}):Is("div",{className:t??"payload-richtext",children:d})}function Ms(){let t=$0(7),[e]=D0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=O0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),A0(l,s);let i;return t[5]!==r?(i=vs("div",{className:"debug-jsx-converter",children:vs(Ir,{converters:st,data:r})}),t[5]=r,t[6]=i):i=t[6],i}var F0=M({plugins:[{Component:Ms,position:"bottom"}]});var j={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},P0={text:{"text-red":{css:{color:`light-dark(${j.red[600]}, ${j.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${j.orange[600]}, ${j.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${j.yellow[700]}, ${j.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${j.green[700]}, ${j.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${j.blue[600]}, ${j.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${j.purple[600]}, ${j.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${j.pink[600]}, ${j.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${j.red[400]}, ${j.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${j.orange[400]}, ${j.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${j.yellow[300]}, ${j.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${j.green[400]}, ${j.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${j.blue[400]}, ${j.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${j.purple[400]}, ${j.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${j.pink[400]}, ${j.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as y1}from"lexical";import{jsx as Pt,jsxs as B0}from"react/jsx-runtime";import"react";var vr=()=>B0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pt("g",{clipPath:"url(#clip0_4397_10817)",children:Pt("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),Pt("defs",{children:Pt("clipPath",{id:"clip0_4397_10817",children:Pt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as W0}from"react/jsx-runtime";import{$applyNodeReplacement as V0}from"lexical";import*as Ds from"react";import{DecoratorBlockNode as j0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as H0}from"@lexical/utils";import{$applyNodeReplacement as U0}from"lexical";function G0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:$s({relationTo:o,value:e})}:null}var Bt=class extends j0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:G0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=$s(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return H0(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 $s(t){return U0(new Bt({data:t}))}var z0=Ds.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function K0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ge({relationTo:o,value:e})}:null}var we=class extends Bt{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:K0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Ge(o);return r.setFormat(e.format),r}decorate(e,o){return W0(z0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge(t){return V0(new we({data:t}))}function Mr(t){return t instanceof we}import{c as g1}from"react/compiler-runtime";import{jsx as x1}from"react/jsx-runtime";import{useLexicalComposerContext as C1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as b1}from"@lexical/utils";import{$getPreviousSelection as k1,$getSelection as _1,$isParagraphNode as T1,$isRangeSelection as w1,COMMAND_PRIORITY_EDITOR as S1,createCommand as E1}from"lexical";import{useEffect as N1}from"react";import{c as Fs}from"react/compiler-runtime";import{jsx as $r}from"react/jsx-runtime";import{useLexicalComposerContext as Ps}from"@lexical/react/LexicalComposerContext.js";import{toast as l1}from"@payloadcms/ui";import{$getNodeByKey as i1,COMMAND_PRIORITY_EDITOR as Bs}from"lexical";import{useEffect as js,useState as s1}from"react";import{c as J0}from"react/compiler-runtime";import{jsx as X0}from"react/jsx-runtime";import{useLexicalComposerContext as Z0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Y0,useModal as q0}from"@payloadcms/ui";import{$getNodeByKey as As,$getPreviousSelection as Q0,$getRoot as e1,$getSelection as t1,$isRangeSelection as o1,$setSelection as r1}from"lexical";import{useEffect as n1,useState as Os}from"react";var jt=t=>{let e=J0(23),[o]=Z0(),[r,n]=Os(null),[l,s]=Os(!1),[i,d,c]=Y0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=q0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let v=t1()??Q0();n(v)},e[0]=f):f=e[0];let g=f,T;e[1]!==o||e[2]!==r?(T=()=>{r&&o.update(()=>{if(o1(r)){let{anchor:v,focus:N}=r;As(v.key)&&As(N.key)&&r1(r.clone())}else e1().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=T):T=e[3];let E=T,S;e[4]!==u?(S=()=>{u()},e[4]=u,e[5]=S):S=e[5];let x=S,b,C;e[6]!==a||e[7]!==h||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let v=h[a];v&&!v?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},C=[h,a,E,l],e[6]=a,e[7]=h,e[8]=E,e[9]=l,e[10]=b,e[11]=C):(b=e[10],C=e[11]),n1(b,C);let k;e[12]!==d?(k=v=>X0(d,{...v,onClick:()=>{g()}}),e[12]=d,e[13]=k):k=e[13];let _;e[14]!==p?(_=()=>{g(),p(),s(!0)},e[14]=p,e[15]=_):_=e[15];let $;return e[16]!==i||e[17]!==x||e[18]!==m||e[19]!==a||e[20]!==k||e[21]!==_?($={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:_},e[16]=i,e[17]=x,e[18]=m,e[19]=a,e[20]=k,e[21]=_,e[22]=$):$=e[22],$};var a1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=i1(o);n&&n.replace(Ge({relationTo:e,value:r}))}):t.dispatchCommand(Dr,{relationTo:e,value:r})},c1=t=>{let e=Fs(14),{enabledCollectionSlugs:o}=t,[r]=Ps(),[n,l]=s1(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}=jt(i),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Ke,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),Bs),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),js(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=g=>{let{collectionSlug:T,doc:E}=g;a1({editor:r,relationTo:T,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=$r(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},u1=()=>{let t=Fs(3),[e]=Ps(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,d1,Bs),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),js(o,r),null},Hs=({enabledCollectionSlugs:t})=>t?.length?$r(c1,{enabledCollectionSlugs:t}):$r(u1,{});function d1(){return l1.error("No relationship collections enabled"),!0}import{c as m1}from"react/compiler-runtime";import{useConfig as p1,useEntityVisibility as f1}from"@payloadcms/ui";import"react";var _o=t=>{let e=m1(11),{enabledCollectionSlugs:o}=t,{config:r}=p1(),{collections:n}=r,{visibleEntities:l}=f1(),s,i;if(e[0]!==n||e[1]!==o||e[2]!==l?.collections){let c;e[5]!==o||e[6]!==l?.collections?(c=a=>{let{slug:m}=a;return o.includes(m)&&l?.collections.includes(m)},e[5]=o,e[6]=l?.collections,e[7]=c):c=e[7];let u=n.filter(c);s=u,i=u.map(h1),e[0]=n,e[1]=o,e[2]=l?.collections,e[3]=s,e[4]=i}else s=e[3],i=e[4];let d;return e[8]!==s||e[9]!==i?(d={enabledCollections:s,enabledCollectionSlugs:i},e[8]=s,e[9]=i,e[10]=d):d=e[10],d};function h1(t){return t.slug}var Dr=E1("INSERT_RELATIONSHIP_COMMAND"),Us=t=>{let e=g1(7),{clientProps:o}=t,[r]=C1(),n;e[0]!==o.enabledCollectionSlugs?(n={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=n):n=e[1];let{enabledCollectionSlugs:l}=_o(n),s,i;e[2]!==r?(s=()=>{if(!r.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Dr,L1,S1)},i=[r],e[2]=r,e[3]=s,e[4]=i):(s=e[3],i=e[4]),N1(s,i);let d;return e[5]!==l?(d=x1(Hs,{enabledCollectionSlugs:l}),e[5]=l,e[6]=d):d=e[6],d};function L1(t){let e=_1()||k1();if(w1(e)){let o=Ge(t),{focus:r}=e,n=r.getNode();b1(o),T1(n)&&!n.__first&&n.remove()}return!0}var R1=M({nodes:[we],plugins:[{Component:Us,position:"normal"}],slashMenu:{groups:[X([{Icon:vr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:vr,isActive:({selection:t})=>{if(!y1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Mr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as eh}from"react/compiler-runtime";import{jsx as de,jsxs as th}from"react/jsx-runtime";import{useLexicalComposerContext as oh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ys}from"@lexical/react/useLexicalEditable";import{useScrollInfo as rh,useThrottledEffect as nh,useTranslation as lh}from"@payloadcms/ui";import*as Eo from"react";import{useMemo as Pr}from"react";import{c as I1}from"react/compiler-runtime";import{jsx as v1}from"react/jsx-runtime";import{$addUpdateTag as M1}from"lexical";import"react";var Gs="toolbar-popup__button",Ht=t=>{let e=I1(14),{active:o,children:r,editor:n,enabled:l,item:s}=t,i=o===void 0?!1:o,d=l===void 0?!0:l,c=d?"":"disabled",u=i?"active":"",a=s.key?`${Gs}-${s.key}`:"",m;e[0]!==c||e[1]!==u||e[2]!==a?(m=[Gs,c,u,a].filter(Boolean),e[0]=c,e[1]=u,e[2]=a,e[3]=m):m=e[3];let p=m.join(" "),h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==s?(h=()=>{d&&n.focus(()=>{n.update($1),s.onSelect?.({editor:n,isActive:i})})},e[4]=i,e[5]=n,e[6]=d,e[7]=s,e[8]=h):h=e[8];let f=h,g=D1,T;return e[9]!==r||e[10]!==p||e[11]!==f||e[12]!==s.key?(T=v1("button",{className:p,"data-button-key":s.key,onClick:f,onMouseDown:g,type:"button",children:r}),e[9]=r,e[10]=p,e[11]=f,e[12]=s.key,e[13]=T):T=e[13],T};function $1(){M1("toolbar")}function D1(t){t.preventDefault()}import{c as H1}from"react/compiler-runtime";import{jsx as at}from"react/jsx-runtime";import U1,{useMemo as G1}from"react";import{useTranslation as W1}from"@payloadcms/ui";import{jsx as $e,jsxs as Ws}from"react/jsx-runtime";import{Button as A1}from"@payloadcms/ui";import{$addUpdateTag as O1,isDOMNode as F1}from"lexical";import To,{useCallback as P1,useEffect as wo,useMemo as zs,useRef as Ar,useState as Or}from"react";import{createPortal as B1}from"react-dom";var Vs="toolbar-popup__dropdown-item",Ks=To.createContext(null);function Js({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:s,tooltip:i}){let d=zs(()=>[Vs,r===!1?"disabled":"",t?"active":"",l?.key?`${Vs}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Ar(null),u=To.use(Ks);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return wo(()=>{c?.current!=null&&a(c)},[c,a]),$e(A1,{"aria-label":i,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":s},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{O1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function j1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Or(),[s,i]=Or(),d=P1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?i(p=>{if(p==null)return n[0];let h=n.indexOf(p)-1;return n[h===-1?n.length-1:h]}):m==="ArrowDown"&&i(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=zs(()=>({registerItem:d}),[d]);return wo(()=>{n!=null&&s==null&&i(n[0]),s!=null&&s?.current!=null&&s.current.focus()},[n,s]),$e(Ks,{value:u,children:$e("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Xs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=Ar(null),u=Ar(null),[a,m]=Or(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};wo(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:T,top:E}=f.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;g.style.top=`${E+S+f.offsetHeight+5}px`,g.style.left=`${Math.min(T-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),wo(()=>{let f=u.current;if(f!==null&&a){let g=T=>{let E=T.target;F1(E)&&(d&&c.current&&c.current.contains(E)||f.contains(E)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=B1($e(j1,{dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return Ws(To.Fragment,{children:[Ws("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[l&&$e(l,{}),i&&$e("span",{className:"toolbar-popup__dropdown-label",children:i}),$e("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&$e(To.Fragment,{children:h})]})}var Fr="toolbar-popup__dropdown",V1=t=>{let e=H1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:s}=t,{i18n:i}=W1(),{fieldProps:d}=G(),{featureClientSchemaMap:c,schemaPath:u}=d;if(s.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==s?(m=s?.Component&&at(s.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:s},s.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==i||e[11]!==s||e[12]!==u){let m=s.key,p;s.label&&(m=typeof s.label=="function"?s.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):s.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=at(Js,{active:o,editor:n,enabled:l,Icon:s?.ChildComponent?at(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:at("span",{className:"text",children:p})},s.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=i,e[11]=s,e[12]=u,e[13]=a}else a=e[13];return a},z1=U1.memo(V1),Ut=({anchorElem:t,classNames:e,editor:o,group:r,groupState:n,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=r,u=G1(()=>d?.length?d.map(a=>at(z1,{active:n.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:n.enabledItemKeys.includes(a.key),item:a},a.key)):null,[d,n.activeItemKeys,n.enabledItemKeys,t,o]);return at(Xs,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Fr,`${Fr}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!n.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Fr}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as K1}from"@lexical/utils";import{$getSelection as J1}from"lexical";import{useCallback as X1,useDeferredValue as Z1,useEffect as Y1,useRef as Zs,useState as q1}from"react";function Q1(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let r of t){let n=[];for(let l of r.items)e.set(l.key,{active:!1,enabled:!0}),n.push(l.key);o.set(r.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:n})}return{groupStates:o,itemStates:e}}function So(t,e){let[o,r]=q1(()=>Q1(e)),n=Z1(o),l=G(),s=Zs(l);s.current=l;let i=Zs(e);i.current=e;let d=hn(),c=X1(()=>{t.getEditorState().read(()=>{let u=J1();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=[],T=[],E=[],S=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let b of f.items){let C=b.isActive?(!S||g.length<S)&&b.isActive({editor:t,editorConfigContext:m,selection:u}):!1,k=b.isEnabled?b.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;C&&(g.push(b.key),T.push(b)),k&&E.push(b.key),p.set(b.key,{active:C,enabled:k})}let x=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(f.key,{activeItemKeys:g,activeItems:T,enabledGroup:x,enabledItemKeys:E})}r({groupStates:h,itemStates:p})})},[t]);return Y1(()=>{d(c);let u=()=>{d(c)},a=K1(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),n}function ih({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&de(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?de(Ht,{active:t,editor:o,enabled:r,item:n,children:de(n.ChildComponent,{})},n.key):null}function sh({anchorElem:t,editor:e,editorConfig:o,group:r,index:n,toolbarStates:l}){let{i18n:s}=lh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=G(),c=l.groupStates.get(r.key),u=Pr(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:r.ChildComponent},[r,c?.activeItems]),a=Pr(()=>{if(r.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},[r,c?.activeItems,s,i,d]);return th("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,"data-toolbar-group-key":r.key,children:[r.type==="dropdown"&&r.items.length&&c?de(Ut,{anchorElem:t,editor:e,group:r,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,r.type==="buttons"&&r.items.length?r.items.map(m=>{let p=l.itemStates.get(m.key);return de(ih,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,n<o.features.toolbarFixed?.groups.length-1&&de("div",{className:"divider"})]},r.key)}function ah({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Eo.useRef(null),s=Ys(),{y:i}=rh(),d=So(o,r?.features?.toolbarFixed?.groups),c=Pr(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let a=n.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return nh(()=>{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]),de("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&de(Eo.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,a)=>de(sh,{anchorElem:t,editor:o,editorConfig:r,group:u,index:a,toolbarStates:d},u.key))})})}var qs=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return qs(t.parentEditor)}return!1},Qs=t=>{let e=eh(6),{clientProps:o}=t,[r]=oh(),n=G();if(!Ys())return null;let{editorConfig:s}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=qs(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=de(ah,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var ch=M({plugins:[{Component:Qs,position:"aboveContainer"}]});import{c as uh}from"react/compiler-runtime";import{jsx as Se,jsxs as oa}from"react/jsx-runtime";import{useLexicalComposerContext as dh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as mh}from"@lexical/react/useLexicalEditable";import{mergeRegister as ra}from"@lexical/utils";import{$getSelection as na,$isRangeSelection as ea,$isTextNode as ph,COMMAND_PRIORITY_LOW as fh,getDOMSelection as la,SELECTION_CHANGE_COMMAND as hh}from"lexical";import{useCallback as Lo,useEffect as Gt,useMemo as gh,useRef as ta,useState as xh}from"react";import"react";import{createPortal as Ch}from"react-dom";function Br(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function No(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.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,n.style.opacity="1",i&&r!==0?(h-=m.bottom-r+a.height-3,n.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,n.style.transform=`translate(${f}px, ${h}px)`),g}function bh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&Se(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?Se(Ht,{active:t,editor:o,enabled:r,item:n,children:Se(n.ChildComponent,{})},n.key):null}function kh({anchorElem:t,editor:e,group:o,index:r,toolbarStates:n}){let{editorConfig:l}=G(),s=n.groupStates.get(o.key),i=gh(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return oa("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Se(Ut,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=n.itemStates.get(d.key);return Se(bh,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,r<l.features.toolbarInline?.groups.length-1&&Se("div",{className:"divider"})]},o.key)}function _h({anchorElem:t,editor:e}){let o=ta(null),r=ta(null),{editorConfig:n}=G(),l=So(e,n?.features?.toolbarInline?.groups),s=Lo(()=>{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=Lo(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=Lo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Gt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=Lo(()=>{let u=na(),a=la(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(u!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Br(a,h),g=No({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&No({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Gt(()=>{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]),Gt(()=>(e.getEditorState().read(()=>{c()}),ra(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(hh,()=>(c(),!1),fh))),[e,c]),oa("div",{className:"inline-toolbar-popup",ref:o,children:[Se("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,a)=>Se(kh,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function Th(t,e){let o=uh(12),[r,n]=xh(!1),l=mh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=na(),h=la(t._window),f=t.getRootElement();if(h!==null&&(!ea(p)||f===null||!f.contains(h.anchorNode))){n(!1);return}if(!ea(p))return;if(p.getTextContent()!==""){let T=p.getNodes(),E=!1;for(let S of T)if(ph(S)){n(!0),E=!0;break}E||n(!1)}else n(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){n(!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]),Gt(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>ra(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Gt(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=Ch(Se(_h,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var ia=t=>{let{anchorElem:e}=t,[o]=dh();return Th(o,e)};var wh=M({plugins:[{Component:ia,position:"floatingAnchorElem"}]});import{TableCellNode as gx,TableNode as xx,TableRowNode as Cx}from"@lexical/table";import{jsx as sa}from"react/jsx-runtime";import"react";var jr=()=>sa("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sa("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as Sh,$createTableNode as Eh,$createTableRowNode as Nh,$isTableCellNode as aa,$isTableNode as Hr,$isTableRowNode as Ur,TableCellHeaderStates as yo,TableCellNode as Lh,TableNode as yh,TableRowNode as Rh}from"@lexical/table";import{$isParagraphNode as Ih,$isTextNode as vh}from"lexical";var ua=/^\|(.+)\|\s?$/,Mh=/^(\| ?:?-*:? ?)+\|\s?$/,da=({allTransformers:t})=>({type:"element",dependencies:[yh,Rh,Lh],export:e=>{if(!Hr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Ur(r))continue;let l=!1;for(let s of r.getChildren())aa(s)&&(n.push(Zt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===yo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(s=>"---").join(" | ")} |`)}return o.join(`
59
+ `)},regExp:ua,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(Mh.test(n)){let a=e.getPreviousSibling();if(!a||!Hr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Ur(p))return;p.getChildren().forEach(h=>{aa(h)&&h.setHeaderStyles(yo.ROW,yo.ROW)}),e.remove();return}let l=ca(n,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!Ih(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!vh(a))break;let m=ca(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=Eh();for(let a of s){let m=Nh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ma("",t))}let u=e.getPreviousSibling();Hr(u)&&$h(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function $h(t){let e=t.getFirstChild();return Ur(e)?e.getChildrenSize():0}var ma=(t,e)=>{t=t.replace(/\\n/g,`
60
+ `);let o=Sh(yo.NO_STATUS);return Xt(t,e,o),o},ca=(t,e)=>{let o=t.match(ua);return!o||!o[1]?null:o[1].split("|").map(r=>ma(r,e))};import{c as Fh}from"react/compiler-runtime";import{jsx as P,jsxs as Ee}from"react/jsx-runtime";import{useLexicalComposerContext as xa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ph}from"@lexical/react/useLexicalEditable";import{$computeTableMap as Bh,$deleteTableColumnAtSelection as jh,$deleteTableRowAtSelection as Hh,$getNodeTriplet as Uh,$getTableCellNodeFromLexicalNode as ga,$getTableNodeFromLexicalNodeOrThrow as De,$getTableRowIndexFromTableCellNode as Gh,$insertTableColumnAtSelection as Wh,$insertTableRowAtSelection as Vh,$isTableCellNode as Ca,$isTableSelection as Wt,$mergeCells as zh,$setTableColumnIsHeader as Kh,$setTableRowIsHeader as Jh,$unmergeCell as Xh,getTableElement as Wr,getTableObserverFromTableElement as Vr,TableCellHeaderStates as ct,TableCellNode as Zh}from"@lexical/table";import{mergeRegister as Yh}from"@lexical/utils";import{useScrollInfo as qh}from"@payloadcms/ui";import{$getSelection as Io,$isElementNode as Qh,$isRangeSelection as zr,$isTextNode as eg,$setSelection as tg,COMMAND_PRIORITY_CRITICAL as og,getDOMSelection as rg,isDOMNode as ng,SELECTION_CHANGE_COMMAND as lg}from"lexical";import*as Kr from"react";import{useCallback as ae,useEffect as ut,useRef as Ro,useState as dt}from"react";import{createPortal as ba}from"react-dom";import{jsx as Gr,jsxs as Dh}from"react/jsx-runtime";import"react";var pa=()=>Dh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Gr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Gr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Gr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});import{$computeTableCellRectBoundary as Ah,$computeTableMap as Oh,$getNodeTriplet as fa}from"@lexical/table";function ha({selection:t}){let[e,,o]=fa(t.anchor),[r]=fa(t.focus),[n,l,s]=Oh(o,e,r),{maxColumn:i,maxRow:d,minColumn:c,minRow:u}=Ah(n,l,s);return{columns:i-c+1,rows:d-u+1}}function ig(){let t=Io();if(zr(t)&&!t.isCollapsed()||Wt(t)&&!t.anchor.is(t.focus)||!zr(t)&&!Wt(t))return!1;let[e]=Uh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function sg(t){let e=t.getLastDescendant();eg(e)?e.select():Qh(e)?e.selectEnd():e!==null&&e.selectNext()}function ag({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=xa(),s=Ro(null),[i,d]=dt(n),[c,u]=dt({columns:1,rows:1}),[a,m]=dt(!1),[p,h]=dt(!1),{y:f}=qh();ut(()=>l.registerMutationListener(Zh,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),ut(()=>{l.getEditorState().read(()=>{let w=Io();if(Wt(w)){let y=ha({selection:w});u(y);let I=w.anchor.is(w.focus);m(!I&&(y.columns>1||y.rows>1))}h(ig())})},[l]),ut(()=>{let w=e.current,y=s.current,I=l.getRootElement();if(w!=null&&y!=null&&I!=null){let D=I.getBoundingClientRect(),R=w.getBoundingClientRect();y.style.opacity="1";let A=y.getBoundingClientRect(),H=5,B=R.right+H;if(B+A.width>window.innerWidth||B+A.width>D.right){let F=R.left-A.width-H;B=(F<0?H:F)+window.pageXOffset}y.style.left=`${B+window.pageXOffset}px`;let J=R.top;if(J+A.height>window.innerHeight){let F=R.bottom-A.height;J=F<0?H:F}y.style.top=`${J}px`}},[e,s,l,f]),ut(()=>{function w(y){s.current!=null&&e.current!=null&&ng(y.target)&&!s.current.contains(y.target)&&!e.current.contains(y.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let g=ae(()=>{l.update(()=>{if(i.isAttached()){let w=De(i),y=Wr(w,l.getElementByKey(w.getKey()));if(y===null)throw new Error("Expected to find tableElement in DOM");let I=Vr(y);I!==null&&I.$clearHighlight(),w.markDirty(),d(i.getLatest())}tg(null)})},[l,i]),T=()=>{l.update(()=>{let w=Io();if(!Wt(w))return;let I=w.getNodes().filter(Ca),D=zh(I);D&&(sg(D),o())})},E=()=>{l.update(()=>{Xh()}),g()},S=ae(w=>{l.update(()=>{for(let y=0;y<c.rows;y++)Vh(w);o()})},[l,o,c.rows]),x=ae(w=>{l.update(()=>{for(let y=0;y<c.columns;y++)Wh(w);o()})},[l,o,c.columns]),b=ae(()=>{l.update(()=>{Hh(),o()})},[l,o]),C=ae(()=>{l.update(()=>{De(i).remove(),g(),o()})},[l,i,g,o]),k=ae(()=>{l.update(()=>{jh(),o()})},[l,o]),_=ae(()=>{l.update(()=>{let w=De(i),y=Gh(i),I=!i.hasHeaderState(ct.ROW);Jh(w,y,I),g(),o()})},[l,i,g,o]),$=ae(()=>{l.update(()=>{let w=De(i),[,y]=Bh(w,i,i),I=!i.hasHeaderState(ct.COLUMN);Kh(w,y.startColumn,I),g(),o()})},[l,i,g,o]),v=ae(()=>{l.update(()=>{if(i.isAttached()){let w=De(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),N=ae(()=>{l.update(()=>{if(i.isAttached()){let w=De(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),L=null;return t&&(a?L=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(L=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),ba(Ee("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[L?Ee(Kr.Fragment,{children:[L,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>v(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>N(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>S(!1),type:"button",children:Ee("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>S(!0),type:"button",children:Ee("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:Ee("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:Ee("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>_(),type:"button",children:Ee("span",{className:"text",children:[(i.__headerState&ct.ROW)===ct.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>$(),type:"button",children:Ee("span",{className:"text",children:[(i.__headerState&ct.COLUMN)===ct.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function cg({anchorElem:t,cellMerge:e}){let[o]=xa(),r=Ro(null),n=Ro(null),[l,s]=dt(!1),[i,d]=dt(null),c=ae(()=>{let a=r.current,m=Io(),p=rg(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(),T=null,E=null;if(zr(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let x=ga(m.anchor.getNode());if(x==null||(E=o.getElementByKey(x.getKey()),E==null||!x.isAttached()))return f();let b=De(x),C=Wr(b,o.getElementByKey(b.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Vr(C),d(x)}else if(Wt(m)){let x=ga(m.anchor.getNode());if(!Ca(x))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=De(x),C=Wr(b,o.getElementByKey(b.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Vr(C),E=o.getElementByKey(x.getKey())}else if(!h)return f();if(T===null||E===null)return f();let S=!T||!T.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let x=E.getBoundingClientRect(),b=t.getBoundingClientRect(),C=x.top-b.top,k=x.right-b.left;a.style.transform=`translate(${k}px, ${C}px)`}},[o,t]);ut(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Yh(o.registerUpdateListener(p),o.registerCommand(lg,p,og),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=Ro(i);return ut(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),P("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&Ee(Kr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:P(pa,{})}),l&&P(ag,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var ka=t=>{let e=Fh(3),{anchorElem:o}=t,r=Ph(),n;return e[0]!==o||e[1]!==r?(n=ba(r?P(cg,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as ug}from"react/compiler-runtime";import{jsx as Mo,jsxs as dg}from"react/jsx-runtime";import{useLexicalComposerContext as mg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as pg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as fg,$getTableNodeFromLexicalNodeOrThrow as Jr,$getTableRowIndexFromTableCellNode as hg,$isTableCellNode as _a,$isTableRowNode as gg,getDOMCellFromTarget as xg,getTableElement as Cg,TableNode as Ta}from"@lexical/table";import{calculateZoomLevel as wa,mergeRegister as bg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Xr,isHTMLElement as kg,SKIP_SCROLL_INTO_VIEW_TAG as Sa}from"lexical";import*as Na from"react";import{useCallback as Vt,useEffect as Zr,useRef as vo,useState as mt}from"react";import{createPortal as _g}from"react-dom";var Tg=33,Ea=92;function wg({editor:t}){let e=vo(null),o=vo(null),r=vo(null),[n,l]=mt(!1),s=G(),i=vo(null),[d,c]=mt(null),[u,a]=mt(null),[m,p]=mt(!1),[h,f]=mt(null),g=Vt(()=>{a(null),e.current=null,f(null),i.current=null,r.current=null},[]),T=N=>(N.buttons&1)===1;Zr(()=>{let N=new Set;return bg(t.registerMutationListener(Ta,L=>{for(let[w,y]of L)y==="destroyed"?N.delete(w):N.add(w);l(N.size>0)}),t.registerNodeTransform(Ta,L=>{if(L.getColWidths())return L;let w=L.getColumnCount(),y=Ea;return L.setColWidths(Array(w).fill(y)),L}))},[t]),Zr(()=>{if(!n)return;let N=I=>{let D=I.target;if(kg(D)){if(h){c({x:I.clientX,y:I.clientY});return}if(p(T(I)),!(o.current&&o.current.contains(D))&&e.current!==D){e.current=D;let R=xg(D);R&&u!==R?t.getEditorState().read(()=>{let A=Xr(R.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let H=Jr(A),B=Cg(H,t.getElementByKey(H.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=D,r.current=B.getBoundingClientRect(),a(R)},{editor:t}):R==null&&g()}}},L=I=>{p(!0)},w=I=>{p(!1)},y=t.registerRootListener((I,D)=>{D?.removeEventListener("mousemove",N),D?.removeEventListener("mousedown",L),D?.removeEventListener("mouseup",w),I?.addEventListener("mousemove",N),I?.addEventListener("mousedown",L),I?.addEventListener("mouseup",w)});return()=>{y()}},[u,h,t,n,g]);let E=N=>N==="bottom",S=Vt(N=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Xr(u.elem);if(!_a(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Jr(L),y=hg(L),I=w.getChildren(),R=L.getColSpan()===w.getColumnCount()?y:y+L.getRowSpan()-1;if(R>=I.length||R<0)throw new Error("Expected table cell to be inside of table row.");let A=I[R];if(!gg(A))throw new Error("Expected table row");let H=A.getHeight();if(H===void 0){let J=A.getChildren();H=Math.min(...J.map(F=>x(F,t)??1/0))}let B=Math.max(H+N,Tg);A.setHeight(B)},{tag:Sa})},[u,t]),x=(N,L)=>L.getElementByKey(N.getKey())?.clientHeight,b=(N,L)=>{let w;return L.forEach(y=>{y.forEach((I,D)=>{I.cell===N&&(w=D)})}),w},C=Vt(N=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Xr(u.elem);if(!_a(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Jr(L),[y]=fg(w,null,null),I=b(L,y);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let D=w.getColWidths();if(!D)return;let R=D[I];if(R===void 0)return;let A=[...D],H=Math.max(R+N,Ea);A[I]=H,w.setColWidths(A)},{tag:Sa})},[u,t]),k=Vt(N=>{let L=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:y,y:I}=i.current;if(u===null)return;let D=wa(w.target);if(E(N)){let R=(w.clientY-I)/D;S(R)}else{let R=(w.clientX-y)/D;C(R)}g(),document.removeEventListener("mouseup",L)}};return L},[u,g,C,S]),_=Vt(N=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:L.clientX,y:L.clientY},c(i.current),f(N),document.addEventListener("mouseup",k(N))},[u,k]),[$,v]=mt({bottom:null,left:null,right:null,top:null});return Zr(()=>{if(u){let{height:N,left:L,top:w,width:y}=u.elem.getBoundingClientRect(),I=wa(u.elem),D=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${D}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+w+N-D/2}px`,width:`${y}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${N}px`,left:`${window.scrollX+L+y-D/2}px`,top:`${window.scrollY+w}px`,width:`${D}px`}},A=r.current;h&&d&&A&&(E(h)?(R[h].left=`${window.scrollX+A.left}px`,R[h].top=`${window.scrollY+d.y/I}px`,R[h].height="3px",R[h].width=`${A.width}px`):(R[h].top=`${window.scrollY+A.top}px`,R[h].left=`${window.scrollX+d.x/I}px`,R[h].width="3px",R[h].height=`${A.height}px`),R[h].backgroundColor="#adf"),v(R)}else v({bottom:null,left:null,right:null,top:null})},[u,h,d]),Mo("div",{ref:o,children:u!=null&&!m&&dg(Na.Fragment,{children:[Mo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:$.right||void 0}),Mo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:$.bottom||void 0})]})})}var La=()=>{let t=ug(3),[e]=mg(),o=pg(),r;return t[0]!==e||t[1]!==o?(r=o?_g(Mo(wg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as vg}from"react/compiler-runtime";import{jsx as Yr,jsxs as Mg,Fragment as $g}from"react/jsx-runtime";import{useLexicalComposerContext as Dg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Aa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Ag,$getTableColumnIndexFromTableCellNode as Og,$getTableRowIndexFromTableCellNode as Fg,$insertTableColumnAtSelection as Pg,$insertTableRowAtSelection as Bg,$isTableCellNode as jg,$isTableNode as Ia,getTableElement as Hg,TableNode as Ug}from"@lexical/table";import{$findMatchingParent as Gg,mergeRegister as Wg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as va,isHTMLElement as Vg}from"lexical";import{useEffect as Ma,useMemo as zg,useRef as $a,useState as $o}from"react";import"react";import{createPortal as Kg}from"react-dom";import{c as yg}from"react/compiler-runtime";import{useEffect as Rg,useRef as Ig}from"react";var Sg="Expected a function",Eg=Math.max,Ng=Math.min;function Lg(t,e,o){let r,n,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(Sg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?Eg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(C){let k=r,_=s;return r=s=void 0,l=C,u=t.apply(_,k),u}function h(C){return l=C,a=setTimeout(T,e),i?p(C):u}function f(C){let k=C-n,_=C-l,$=e-k;return d?Ng($,c-_):$}function g(C){let k=C-n,_=C-l;return n===void 0||k>=e||k<0||d&&_>=c}function T(){let C=Date.now();if(g(C))return E(C);a=setTimeout(T,f(C))}function E(C){return a=void 0,m&&r?p(C):(r=s=void 0,u)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function x(){return a===void 0?u:E(Date.now())}function b(){let C=Date.now(),k=g(C);if(r=arguments,s=this,n=C,k){if(a===void 0)return h(n);if(d)return clearTimeout(a),a=setTimeout(T,e),p(n)}return a===void 0&&(a=setTimeout(T,e)),u}return b.cancel=S,b.flush=x,b}var ya=Lg;function Ra(t,e,o){let r=yg(6),n=Ig(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ya(t,e,{maxWait:o}),()=>{n.current?.cancel()}),s=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=s):(l=r[3],s=r[4]),Rg(l,s);let i;return r[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=i):i=r[5],i}var Da=20;function Jg({anchorElem:t}){let[e]=Dg(),o=Aa(),r=G(),[n,l]=$o(!1),[s,i]=$o(!1),[d,c]=$o(!1),[u,a]=$o({}),m=$a(new Set),p=$a(null),h=Ra(T=>{let{isOutside:E,tableDOMNode:S}=Xg(T,r.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!S)return;p.current=S;let x=null,b=null,C=null;if(e.getEditorState().read(()=>{let R=va(S);if(jg(R)){let A=Gg(R,H=>Ia(H));if(!Ia(A))return;if(C=Hg(A,e.getElementByKey(A.getKey())),C){let H=A.getChildrenSize(),B=A.getChildAtIndex(0)?.getChildrenSize(),J=Fg(R),F=Og(R);J===H-1?x=R:F===B-1&&(b=R)}}},{editor:e}),!C)return;let k=C.parentElement;if(!k)return;let{bottom:_,height:$,left:v,right:N,width:L,y:w}=C.getBoundingClientRect(),y=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(y=k.scrollWidth>k.clientWidth);let{left:I,y:D}=t.getBoundingClientRect();x?(i(!1),l(!0),a({height:Da,left:y&&k?k.offsetLeft:v-I,top:_-D+5,width:y&&k?k.offsetWidth:L})):b&&(i(!0),l(!1),a({height:$,left:N-I+5,top:w-D,width:Da}))},50,250),f=zg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Ma(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Ma(()=>Wg(e.registerMutationListener(Ug,T=>{e.getEditorState().read(()=>{let E=!1;for(let[S,x]of T)switch(x){case"created":{m.current.add(S),E=!0;break}case"destroyed":{m.current.delete(S),E=!0;break}default:break}if(E){f.disconnect();for(let S of m.current){let{tableElement:x}=Ag(S);f.observe(x)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=T=>{e.update(()=>{p.current&&(va(p.current)?.selectEnd(),T?(Bg(),l(!1)):(Pg(),i(!1)))})};return o?Mg($g,{children:[n&&Yr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Yr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function Xg(t,e){let o=t.target;if(Vg(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Oa(t){let e=vg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Aa())return null;let l;return e[0]!==r?(l=Kg(Yr(Jg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Zg}from"react/compiler-runtime";import{jsx as qr,jsxs as Yg}from"react/jsx-runtime";import{useLexicalComposerContext as qg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Qg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ex,TableCellNode as tx,TableNode as ox,TableRowNode as rx}from"@lexical/table";import{mergeRegister as nx}from"@lexical/utils";import{formatDrawerSlug as lx,useEditDepth as ix}from"@payloadcms/ui";import{$getSelection as sx,$isRangeSelection as ax,COMMAND_PRIORITY_EDITOR as cx,createCommand as ux}from"lexical";import{createContext as dx,use as mx,useEffect as px,useMemo as fx,useState as hx}from"react";import*as Fa from"react";var Do=ux("OPEN_EMBED_DRAWER_COMMAND"),Pa=dx({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Ba({children:t}){let[e,o]=hx({cellEditorConfig:null,cellEditorPlugins:null});return qr(Pa,{value:fx(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ja=()=>{let t=Zg(16),[e]=qg(),o=mx(Pa),r=ix(),{fieldProps:n,uuid:l}=G(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=lx({slug:i,depth:r}),t[0]=r,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=fe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([ox,rx,tx]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return nx(e.registerCommand(Do,()=>{let f=null;return e.getEditorState().read(()=>{let g=sx();ax(g)&&(f=g)}),f&&u(),!0},cx))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],px(a,m);let p;t[10]!==e?(p=(f,g)=>{!g.columns||!g.rows||e.dispatchCommand(ex,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let h;return t[12]!==c||t[13]!==s||t[14]!==p?(h=Yg(Fa.Fragment,{children:[qr(kt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),qr(Qg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=h):h=t[15],h};var bx=M({markdownTransformers:[da],nodes:[xx,gx,Cx],plugins:[{Component:ja,position:"normal"},{Component:La,position:"normal"},{Component:ka,position:"floatingAnchorElem"},{Component:Oa,position:"floatingAnchorElem"}],providers:[Ba],slashMenu:{groups:[X([{Icon:jr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:jr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]}});import{$isNodeSelection as Jx}from"lexical";import{jsx as Qr,jsxs as kx}from"react/jsx-runtime";import"react";var en=()=>kx("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Qr("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Qr("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Qr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as yx}from"react/compiler-runtime";import{jsx as Rx}from"react/jsx-runtime";import{useLexicalComposerContext as Ix}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ya,$insertNodeToNearestRoot as rn,mergeRegister as vx}from"@lexical/utils";import{useBulkUpload as Mx,useEffectEvent as $x,useModal as Dx}from"@payloadcms/ui";import nn from"bson-objectid";import{$createRangeSelection as Ax,$getPreviousSelection as za,$getSelection as Ka,$isParagraphNode as ln,$isRangeSelection as Ja,$setSelection as Ox,COMMAND_PRIORITY_EDITOR as Fx,COMMAND_PRIORITY_LOW as Xa,createCommand as Px,DROP_COMMAND as Bx,getDOMSelectionFromTarget as jx,isHTMLElement as Za,PASTE_COMMAND as Hx}from"lexical";import{useEffect as Ux}from"react";import{c as Ha}from"react/compiler-runtime";import{jsx as tn}from"react/jsx-runtime";import{useLexicalComposerContext as Ua}from"@lexical/react/LexicalComposerContext.js";import{toast as _x}from"@payloadcms/ui";import{$getNodeByKey as Tx,COMMAND_PRIORITY_EDITOR as Ga}from"lexical";import{useEffect as Wa,useState as wx}from"react";var Sx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Tx(o);n&&n.replace(ve({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(on,{fields:null,relationTo:e,value:r})},Ex=t=>{let e=Ha(13),{enabledCollectionSlugs:o}=t,[r]=Ua(),[n,l]=wx(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}=jt(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Je,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Ga),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Wa(u,a);let m;e[6]!==i||e[7]!==r||e[8]!==n?(m=f=>{let{collectionSlug:g,doc:T}=f;i(),Sx({editor:r,relationTo:g,replaceNodeKey:n,value:T.id})},e[6]=i,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,h;return e[10]!==d||e[11]!==p?(h=tn(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},Nx=()=>{let t=Ha(3),[e]=Ua(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Je,Lx,Ga),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Wa(o,r),null},Va=({enabledCollectionSlugs:t})=>t?.length?tn(Ex,{enabledCollectionSlugs:t}):tn(Nx,{});function Lx(){return _x.error("No upload collections enabled"),!0}function Gx(t){let e=t.target;return!!(Za(e)&&!e.closest("code, span.editor-image")&&Za(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Wx(t){let e,o=jx(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 on=Px("INSERT_UPLOAD_COMMAND"),qa=t=>{let e=yx(20),{clientProps:o}=t,[r]=Ix(),n;e[0]!==o.enabledCollectionSlugs?(n={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=n):n=e[1];let{enabledCollectionSlugs:l}=_o(n),{drawerSlug:s,setCollectionSlug:i,setInitialForms:d,setOnCancel:c,setOnSuccess:u,setSelectableCollections:a}=Mx(),{isModalOpen:m,openModal:p}=Dx(),h;e[2]!==s||e[3]!==r||e[4]!==l||e[5]!==m||e[6]!==p||e[7]!==i||e[8]!==d||e[9]!==c||e[10]!==u||e[11]!==a?(h=S=>{let{files:x}=S;if(x?.length!==0&&(d(b=>[...b??[],...x.map(Vx)]),!m(s))){if(!l.length||!l[0])return;i(l[0]),a(l),c(()=>{r.update(zx)}),u(b=>{let C=new Map(b.map(Kx));r.update(()=>{for(let k of Ya()){let _=k.node;if(Ze(_)){let $=_.getData();if($?.pending){let v=C.get($.pending?.formID);v&&_.replace(ve({data:{id:new nn.default().toHexString(),fields:{},relationTo:v.collectionSlug,value:v.doc.id}}))}}}})}),p(s)}},e[2]=s,e[3]=r,e[4]=l,e[5]=m,e[6]=p,e[7]=i,e[8]=d,e[9]=c,e[10]=u,e[11]=a,e[12]=h):h=e[12];let f=$x(h),g;e[13]!==r||e[14]!==f?(g=()=>{if(!r.hasNodes([Xe]))throw new Error("UploadPlugin: UploadNode not registered on editor");return vx(r.registerNodeTransform(Xe,S=>{let x=S.getData();if(!x?.pending)return;(async function(){let k=null,_=x?.pending?.src,$=x?.pending?.formID;if(_?.startsWith("data:")){let v=_.match(/data:(image\/[a-zA-Z]+);base64,/),N=v?v[1]:"image/png",L=_.replace(/^data:image\/[a-zA-Z]+;base64,/,""),w=atob(L),y=new Array(w.length);for(let R=0;R<w.length;R++)y[R]=w.charCodeAt(R);let I=new Uint8Array(y);k={alt:void 0,file:new File([I],"pasted-image."+N?.split("/",2)[1],{type:N}),formID:$}}else if(_?.startsWith("http")||_?.startsWith("https")){let N=await(await fetch(_)).blob(),L=_.split("/").pop()||"pasted-image"+N.type.split("/",2)[1];k={alt:void 0,file:new File([N],L,{type:N.type}),formID:$}}k&&f({files:[k]})})()}),r.registerCommand(on,S=>(r.update(()=>{let x=Ka()||za();if(Ja(x)){let b=ve({data:{id:S.id,fields:S.fields,relationTo:S.relationTo,value:S.value}}),{focus:C}=x,k=C.getNode();rn(b),ln(k)&&!k.__first&&k.remove()}}),!0),Fx),r.registerCommand(Hx,S=>{if(!(S instanceof ClipboardEvent))return!1;let x=S.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(C=>{b.push({alt:"",file:C,formID:new nn.default().toHexString()})}),b.length?(r.update(()=>{let C=Ka()||za();if(Ja(C))for(let k of b){let _=ve({data:{pending:{formID:k.formID,src:URL.createObjectURL(k.file)}}}),{focus:$}=C,v=$.getNode();rn(_),ln(v)&&!v.__first&&v.remove()}}),f({files:b}),!0):!1},Xa),r.registerCommand(Bx,S=>{if(!(S instanceof DragEvent))return!1;let x=S.dataTransfer;if(!x?.types?.length)return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(C=>{b.push({alt:"",file:C,formID:new nn.default().toHexString()})}),b.length?(S.preventDefault(),S.stopPropagation(),r.update(()=>{if(Gx(S)){let C=Wx(S),k=Ax();C!=null&&k.applyDOMRange(C),Ox(k);for(let _ of b){let $=ve({data:{pending:{formID:_.formID,src:URL.createObjectURL(_.file)}}}),{focus:v}=k,N=v.getNode();rn($),ln(N)&&!N.__first&&N.remove()}}}),f({files:b}),!0):!1},Xa))},e[13]=r,e[14]=f,e[15]=g):g=e[15];let T;e[16]!==r?(T=[r],e[16]=r,e[17]=T):T=e[17],Ux(g,T);let E;return e[18]!==l?(E=Rx(Va,{enabledCollectionSlugs:l}),e[18]=l,e[19]=E):E=e[19],E};function Vx(t){return{file:t.file,formID:t.formID}}function zx(){for(let t of Ya()){let e=t.node;Ze(e)&&e.getData()?.pending&&e.remove()}}function Kx(t){return[t.formID,t]}var Xx=M({nodes:[Xe],plugins:[{Component:qa,position:"normal"}],slashMenu:{groups:[X([{Icon:en,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:en,isActive:({selection:t})=>{if(!Jx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ze(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]}});import{c as Yx}from"react/compiler-runtime";import{jsx as Ao}from"react/jsx-runtime";import{createElement as qx}from"react";import{ShimmerEffect as Qx,useConfig as eC}from"@payloadcms/ui";import{lazy as tC,Suspense as oC,useEffect as rC,useState as nC}from"react";var Qa={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",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 sn={namespace:"lexical",theme:Qa};function ec({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,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:r,resolvedFeatures:i,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as Zx}from"payload/shared";var tc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Zx(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function an(t,e,o,r){return{admin:o,features:tc(t),lexical:e,resolvedFeatureMap:t,view:r}}var lC=tC(()=>import("./Field-YZR46UCY.js").then(t=>({default:t.RichText}))),iC=t=>Ao(Uo,{inheritable:!0,views:t.views,children:Ao(sC,{...t})}),sC=t=>{let e=Yx(23),{admin:o,clientFeatures:r,featureClientImportMap:n,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]!==n?(m=n===void 0?{}:n,e[2]=n,e[3]=m):m=e[3];let p=m,h=i===void 0?sn:i,{currentView:f}=Go(),g=c?.[f]?.admin??a,T=c?.[f]?.lexical,E;e[4]!==h||e[5]!==T?(E=typeof T=="function"?T(h):T??h,e[4]=h,e[5]=T,e[6]=E):E=e[6];let S=E,{config:x}=eC(),[b,C]=nC(null),k,_;e[7]!==r||e[8]!==x||e[9]!==f||e[10]!==g||e[11]!==S||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==d||e[17]!==c?(k=()=>{if(b&&b.view===f)return;let v=c?.[f],N=v?.filterFeatures?v.filterFeatures(r):r,L=[];for(let y of Object.values(N))y.clientFeatureProvider&&L.push(y.clientFeatureProvider(y.clientFeatureProps));let w=ec({config:x,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:L,lexical:S}});C(an(w,S,g,f))},_=[g,r,x,p,l,s,b,S,d,f,c],e[7]=r,e[8]=x,e[9]=f,e[10]=g,e[11]=S,e[12]=p,e[13]=l,e[14]=s,e[15]=b,e[16]=d,e[17]=c,e[18]=k,e[19]=_):(k=e[18],_=e[19]),rC(k,_);let $;return e[20]!==b||e[21]!==t?($=Ao(oC,{fallback:Ao(Qx,{height:"35vh"}),children:b&&qx(lC,{...t,editorConfig:b,key:b.view})}),e[20]=b,e[21]=t,e[22]=$):$=e[22],$};function aC(t){return t instanceof HTMLElement}function cC(...t){return t.filter(Boolean).join(" ")}var Oo=new WeakMap;function oc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Fo(t,e){let o=Oo.get(t);if(o===void 0){let r=new Set,n=s=>{o!==void 0&&(o.start=oc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=oc(s);for(let c of r)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Oo.set(t,o)}return o.listeners.add(e),()=>{uC(t,e)}}function uC(t,e){let o=Oo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Oo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function dC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function mC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function pC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function fC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as hC}from"react/compiler-runtime";import{jsx as gC}from"react/jsx-runtime";import"react";var xC=()=>{let t=hC(2),{EditButton:e}=he(),o;return t[0]!==e?(o=e?gC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as CC}from"react/compiler-runtime";import{jsx as bC}from"react/jsx-runtime";import"react";var kC=()=>{let t=CC(2),{RemoveButton:e}=he(),o;return t[0]!==e?(o=e?bC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as _C}from"react/compiler-runtime";import{jsx as TC}from"react/jsx-runtime";import"react";var wC=()=>{let t=_C(2),{Label:e}=he(),o;return t[0]!==e?(o=e?TC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as SC}from"react/compiler-runtime";import{jsx as EC}from"react/jsx-runtime";import"react";var NC=t=>{let e=SC(3),{children:o}=t,{InlineBlockContainer:r}=he(),n;return e[0]!==r||e[1]!==o?(n=r?EC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as LC}from"react/jsx-runtime";import"react";var yC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=le();return r?LC(r,{...o,children:e}):null};import{c as RC}from"react/compiler-runtime";import{jsx as IC}from"react/jsx-runtime";import"react";var vC=()=>{let t=RC(2),{EditButton:e}=le(),o;return t[0]!==e?(o=e?IC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as MC}from"react/compiler-runtime";import{jsx as $C}from"react/jsx-runtime";import"react";var DC=()=>{let t=MC(2),{RemoveButton:e}=le(),o;return t[0]!==e?(o=e?$C(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as AC}from"qs-esm";var OC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=AC({depth:e??0,draft:o??!1,locale:r,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 rc={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 r=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()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as JC}from"react/jsx-runtime";import{CodeField as KC,useFormFields as XC}from"@payloadcms/ui";import{useId as zC,useMemo as ZC}from"react";var jo={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 YC=({autoComplete:t,field:e,forceRender:o,languages:r=jo,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=XC(([k])=>k.language),m=a?.value||a?.initialValue||"typescript",p=zC(),h=r[m],f=ZC(()=>({...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&&JC(KC,{autoComplete:t,field:f,forceRender:o,onMount:(k,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),E.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 T=>{let x=await(await fetch(T.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(x,T.filePath)})))()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},g)};import{jsx as oe,jsxs as bc}from"react/jsx-runtime";import{useLexicalEditable as nb}from"@lexical/react/useLexicalEditable";import{ChevronIcon as lb,Combobox as ib,CopyToClipboard as sb,PopupList as ab,RenderFields as cb,useForm as ub,useFormFields as kc,useTranslation as db}from"@payloadcms/ui";import mb from"react";import{jsx as mc}from"react/jsx-runtime";import"react";var pc=()=>mc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:mc("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as hc}from"react/jsx-runtime";import"react";import{useCollapsible as QC}from"@payloadcms/ui";import{jsx as fc}from"react/jsx-runtime";import"react";var Ho=()=>fc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:fc("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var qC="code-block-collapse-button",gc=()=>{let{toggle:t}=QC();return hc("button",{className:qC,onClick:t,type:"button",children:hc(Ho,{})})};import{jsx as xc,jsxs as eb}from"react/jsx-runtime";import"react";import{useCollapsible as ob,useTranslation as rb}from"@payloadcms/ui";var tb="code-block-floating-collapse-button",Cc=()=>{let{isCollapsed:t,toggle:e}=ob(),{t:o}=rb();return t?eb("button",{className:tb,onClick:e,type:"button",children:[xc("span",{children:o("general:collapse")}),xc(Ho,{})]}):null};var Je="payload-richtext-code-block",pb=t=>{let{languages:e}=t,o=e||jo,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=le(),{setModified:s}=ub(),{t:i}=db(),{codeField:d}=kc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=kc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=nb(),p=mb.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:oe(ab.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:oe("span",{className:`${Je}__language-code`,"data-language":h,children:f})})})),[o,u]);return oe(r,{Actions:bc("div",{className:`${Je}__actions`,children:[oe(ib,{button:bc("div",{className:`${Je}__language-selector-button`,"data-selected-language":c?.value,children:[oe("span",{children:a}),oe(lb,{className:`${Je}__chevron`})]}),buttonType:"custom",className:`${Je}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),oe(sb,{value:d?.value??""}),oe(gc,{}),m&&oe(l,{})]}),className:Je,collapsibleProps:{AfterCollapsible:oe(Cc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:oe("div",{className:`${Je}__pill`,children:oe(pc,{})}),children:oe(cb,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as fb}from"react/compiler-runtime";import{jsx as pt}from"react/jsx-runtime";import{FieldContext as hb,FieldPathContext as _c,ServerFunctionsContext as Tc,ShimmerEffect as gb,useServerFunctions as xb}from"@payloadcms/ui";import Cb,{useEffect as bb,useRef as kb}from"react";var _b=t=>{let e=fb(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:s,setValue:i,value:d}=t,[c,u]=Cb.useState(null),a=xb(),{_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]!==r||e[3]!==l||e[4]!==s?(g=()=>{(async function(){let{Field:D}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:s});u(D)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=s,e[5]=g):g=e[5];let k=g,E=kb(!1),y,T;if(e[6]!==k?(y=()=>{E.current||(E.current=!0,k())},T=[k],e[6]=k,e[7]=y,e[8]=T):(y=e[7],T=e[8]),bb(y,T),!c)return typeof n<"u"?n:pt(gb,{});let C={...a,getFormState:async b=>a.getFormState({...b,collectionSlug:p==="collection"?h:void 0,globalSlug:p==="global"?h:void 0})};if(typeof d>"u"&&!i)return pt(Tc,{value:{...C},children:pt(_c,{value:f,children:c},f)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:f,setValue:i??Tb,showError:!1,value:d};return pt(Tc,{value:{...C},children:pt(_c,{value:f,children:pt(hb,{value:x,children:c})},f)})};function Tb(){}function wc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}var wb=wc;export{It as $createAutoLinkNode,Be as $createBlockNode,et as $createHorizontalRuleNode,Ct as $createInlineBlockNode,_e as $createLinkNode,Ve as $createRelationshipNode,pe as $createUploadNode,we as $isAutoLinkNode,Pe as $isBlockNode,Rt as $isHorizontalRuleNode,bt as $isInlineBlockNode,K as $isLinkNode,$r as $isRelationshipNode,mt as $isUploadNode,Vc as AlignFeatureClient,Te as AutoLinkNode,FC as BlockCollapsible,jC as BlockEditButton,se as BlockNode,WC as BlockRemoveButton,qc as BlockquoteFeatureClient,ad as BlocksFeatureClient,vd as BoldFeatureClient,ne as CAN_USE_DOM,jf as ChecklistFeatureClient,pb as CodeBlockBlockComponent,YC as CodeComponent,M0 as DETAIL_TYPE_TO_DETAIL,y0 as DOUBLE_LINE_BREAK,V0 as DebugJsxConverterFeatureClient,$0 as ELEMENT_FORMAT_TO_TYPE,D0 as ELEMENT_TYPE_TO_FORMAT,Ic as ENABLE_SLASH_MENU_COMMAND,Nc as EditorConfigProvider,kt as FieldsDrawer,hh as FixedToolbarFeatureClient,Nm as HeadingFeatureClient,Gm as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,qe as INSERT_BLOCK_COMMAND,Qe as INSERT_INLINE_BLOCK_COMMAND,N0 as IS_ALL_FORMATTING,ip as IndentFeatureClient,OC as InlineBlockContainer,NC as InlineBlockEditButton,MC as InlineBlockLabel,xt as InlineBlockNode,RC as InlineBlockRemoveButton,Ad as InlineCodeFeatureClient,Rh as InlineToolbarFeatureClient,jd as ItalicFeatureClient,I0 as LTR_REGEX,c0 as LexicalPluginToLexicalFeatureClient,Ef as LinkFeatureClient,te as LinkNode,L0 as NON_BREAKING_SPACE,A as NodeFormat,Xf as OrderedListFeatureClient,C0 as ParagraphFeatureClient,yc as Point,R0 as RTL_REGEX,vc as Rect,O1 as RelationshipFeatureClient,Ee as RelationshipNode,_b as RenderLexical,hC as RichTextField,Go as RichTextViewProvider,g0 as SlateToLexicalFeatureClient,Vd as StrikethroughFeatureClient,zd as SubscriptFeatureClient,Qd as SuperscriptFeatureClient,O0 as TEXT_MODE_TO_TYPE,v0 as TEXT_TYPE_TO_FORMAT,A0 as TEXT_TYPE_TO_MODE,ue as TOGGLE_LINK_COMMAND,_x as TableFeatureClient,Td as TestRecorderFeatureClient,hm as TextStateFeatureClient,Ht as ToolbarButton,Ut as ToolbarDropdown,Ld as TreeViewFeatureClient,nm as UnderlineFeatureClient,o0 as UnorderedListFeatureClient,nC as UploadFeatureClient,me as UploadNode,wC as addSwipeDownListener,kC as addSwipeLeftListener,_C as addSwipeRightListener,TC as addSwipeUpListener,wb as buildDefaultEditorState,wc as buildEditorState,dc as codeConverterClient,dr as createBlockNode,M as createClientFeature,J0 as defaultColors,cn as defaultEditorLexicalConfig,Hr as getDOMRangeRect,Mc as getEnabledNodes,VC as getRestPopulateFn,tt as getSelectedNode,xC as isHTMLElement,Rc as isPoint,CC as joinClasses,un as sanitizeClientEditorConfig,cc as sanitizeClientFeatures,Lo as setFloatingElemPosition,go as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,pr as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,le as useBlockComponentContext,W as useEditorConfigContext,xe as useInlineBlockComponentContext,Lc as useLexicalDocumentDrawer,ge as useLexicalDrawer,jt as useLexicalListDrawer,Vo as useRichTextView};
65
+ `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as FC}from"react/jsx-runtime";import{CodeField as PC,useFormFields as BC}from"@payloadcms/ui";import{useId as jC,useMemo as HC}from"react";var Po={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 UC=({autoComplete:t,field:e,forceRender:o,languages:r=Po,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=BC(([T])=>T.language),m=a?.value||a?.initialValue||"typescript",p=jC(),h=r[m],f=HC(()=>({...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&&FC(PC,{autoComplete:t,field:f,forceRender:o,onMount:(T,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),E.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 x=>{let C=await(await fetch(x.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(C,x.filePath)})))()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},g)};import{jsx as oe,jsxs as dc}from"react/jsx-runtime";import{useLexicalEditable as XC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as ZC,Combobox as YC,CopyToClipboard as qC,PopupList as QC,RenderFields as e2,useForm as t2,useFormFields as mc,useTranslation as o2}from"@payloadcms/ui";import r2 from"react";import{jsx as nc}from"react/jsx-runtime";import"react";var lc=()=>nc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:nc("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as sc}from"react/jsx-runtime";import"react";import{useCollapsible as WC}from"@payloadcms/ui";import{jsx as ic}from"react/jsx-runtime";import"react";var Bo=()=>ic("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:ic("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var GC="code-block-collapse-button",ac=()=>{let{toggle:t}=WC();return sc("button",{className:GC,onClick:t,type:"button",children:sc(Bo,{})})};import{jsx as cc,jsxs as VC}from"react/jsx-runtime";import"react";import{useCollapsible as KC,useTranslation as JC}from"@payloadcms/ui";var zC="code-block-floating-collapse-button",uc=()=>{let{isCollapsed:t,toggle:e}=KC(),{t:o}=JC();return t?VC("button",{className:zC,onClick:e,type:"button",children:[cc("span",{children:o("general:collapse")}),cc(Bo,{})]}):null};var We="payload-richtext-code-block",n2=t=>{let{languages:e}=t,o=e||Po,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=le(),{setModified:s}=t2(),{t:i}=o2(),{codeField:d}=mc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=mc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=XC(),p=r2.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:oe(QC.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:oe("span",{className:`${We}__language-code`,"data-language":h,children:f})})})),[o,u]);return oe(r,{Actions:dc("div",{className:`${We}__actions`,children:[oe(YC,{button:dc("div",{className:`${We}__language-selector-button`,"data-selected-language":c?.value,children:[oe("span",{children:a}),oe(ZC,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),oe(qC,{value:d?.value??""}),oe(ac,{}),m&&oe(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:oe(uc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:oe("div",{className:`${We}__pill`,children:oe(lc,{})}),children:oe(e2,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as l2}from"react/compiler-runtime";import{jsx as pt}from"react/jsx-runtime";import{FieldContext as i2,FieldPathContext as pc,ServerFunctionsContext as fc,ShimmerEffect as s2,useServerFunctions as a2}from"@payloadcms/ui";import c2,{useEffect as u2,useRef as d2}from"react";var m2=t=>{let e=l2(10),{name:o,field:r,initialValue:n,label:l,Loading:s,path:i,schemaPath:d,setValue:c,value:u}=t,[a,m]=c2.useState(null),p=a2(),{_internal_renderField:h}=p,[f,g]=d.split(".",2),T=o!==void 0?o:r?.name,E=l!==void 0?l:r?.label,S=i??T??"",x;e[0]!==h||e[1]!==E||e[2]!==T||e[3]!==n||e[4]!==i||e[5]!==d?(x=()=>{(async function(){let{Field:w}=await h({name:T,hidden:!1,initialValue:n??void 0,label:typeof E=="function"?void 0:E,path:i,schemaPath:d});m(w)})()},e[0]=h,e[1]=E,e[2]=T,e[3]=n,e[4]=i,e[5]=d,e[6]=x):x=e[6];let b=x,C=d2(!1),k,_;if(e[7]!==b?(k=()=>{C.current||(C.current=!0,b())},_=[b],e[7]=b,e[8]=k,e[9]=_):(k=e[8],_=e[9]),u2(k,_),!a)return typeof s<"u"?s:pt(s2,{});let $={...p,getFormState:async N=>p.getFormState({...N,collectionSlug:f==="collection"?g:void 0,globalSlug:f==="global"?g:void 0})};if(typeof u>"u"&&!c)return pt(fc,{value:{...$},children:pt(pc,{value:S,children:a},S)});let v={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:S,setValue:c??p2,showError:!1,value:u};return pt(fc,{value:{...$},children:pt(pc,{value:S,children:pt(i2,{value:v,children:a})},S)})};function p2(){}function hc({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}var f2=hc;export{It as $createAutoLinkNode,Fe as $createBlockNode,et as $createHorizontalRuleNode,Ct as $createInlineBlockNode,be as $createLinkNode,Ge as $createRelationshipNode,ve as $createUploadNode,_e as $isAutoLinkNode,Oe as $isBlockNode,Rt as $isHorizontalRuleNode,bt as $isInlineBlockNode,K as $isLinkNode,Mr as $isRelationshipNode,Ze as $isUploadNode,Fc as AlignFeatureClient,ke as AutoLinkNode,yC as BlockCollapsible,vC as BlockEditButton,se as BlockNode,DC as BlockRemoveButton,Wc as BlockquoteFeatureClient,ed as BlocksFeatureClient,wd as BoldFeatureClient,ne as CAN_USE_DOM,Mf as ChecklistFeatureClient,n2 as CodeBlockBlockComponent,UC as CodeComponent,S0 as DETAIL_TYPE_TO_DETAIL,k0 as DOUBLE_LINE_BREAK,F0 as DebugJsxConverterFeatureClient,N0 as ELEMENT_FORMAT_TO_TYPE,E0 as ELEMENT_TYPE_TO_FORMAT,Tc as ENABLE_SLASH_MENU_COMMAND,Cc as EditorConfigProvider,kt as FieldsDrawer,ch as FixedToolbarFeatureClient,Cm as HeadingFeatureClient,Om as HorizontalRuleFeatureClient,Ce as HorizontalRuleNode,qe as INSERT_BLOCK_COMMAND,Qe as INSERT_INLINE_BLOCK_COMMAND,C0 as IS_ALL_FORMATTING,qm as IndentFeatureClient,NC as InlineBlockContainer,xC as InlineBlockEditButton,wC as InlineBlockLabel,xt as InlineBlockNode,kC as InlineBlockRemoveButton,yd as InlineCodeFeatureClient,wh as InlineToolbarFeatureClient,Md as ItalicFeatureClient,T0 as LTR_REGEX,t0 as LexicalPluginToLexicalFeatureClient,xf as LinkFeatureClient,te as LinkNode,b0 as NON_BREAKING_SPACE,O as NodeFormat,jf as OrderedListFeatureClient,u0 as ParagraphFeatureClient,kc as Point,_0 as RTL_REGEX,wc as Rect,R1 as RelationshipFeatureClient,we as RelationshipNode,m2 as RenderLexical,iC as RichTextField,Uo as RichTextViewProvider,a0 as SlateToLexicalFeatureClient,Fd as StrikethroughFeatureClient,Hd as SubscriptFeatureClient,Vd as SuperscriptFeatureClient,L0 as TEXT_MODE_TO_TYPE,w0 as TEXT_TYPE_TO_FORMAT,y0 as TEXT_TYPE_TO_MODE,ue as TOGGLE_LINK_COMMAND,bx as TableFeatureClient,fd as TestRecorderFeatureClient,sm as TextStateFeatureClient,Ht as ToolbarButton,Ut as ToolbarDropdown,bd as TreeViewFeatureClient,Zd as UnderlineFeatureClient,Jf as UnorderedListFeatureClient,Xx as UploadFeatureClient,Xe as UploadNode,fC as addSwipeDownListener,dC as addSwipeLeftListener,mC as addSwipeRightListener,pC as addSwipeUpListener,f2 as buildDefaultEditorState,hc as buildEditorState,rc as codeConverterClient,cr as createBlockNode,M as createClientFeature,P0 as defaultColors,sn as defaultEditorLexicalConfig,Br as getDOMRangeRect,Sc as getEnabledNodes,OC as getRestPopulateFn,tt as getSelectedNode,aC as isHTMLElement,_c as isPoint,cC as joinClasses,an as sanitizeClientEditorConfig,tc as sanitizeClientFeatures,No as setFloatingElemPosition,ho as setFloatingElemPositionForLinkEditor,X as slashMenuBasicGroupWithItems,xe as toolbarAddDropdownGroupWithItems,dr as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,le as useBlockComponentContext,G as useEditorConfigContext,he as useInlineBlockComponentContext,bc as useLexicalDocumentDrawer,fe as useLexicalDrawer,jt as useLexicalListDrawer,Go as useRichTextView};
66
66
  //# sourceMappingURL=index.js.map