@payloadcms/richtext-lexical 3.77.0-internal.0b6b4e4 → 3.77.0-internal.16f474b

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 (118) hide show
  1. package/dist/exports/client/Field-HJGV32KA.js +2 -0
  2. package/dist/exports/client/Field-HJGV32KA.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-2S5Q7QYO.js +2 -0
  5. package/dist/exports/client/chunk-2S5Q7QYO.js.map +7 -0
  6. package/dist/exports/client/chunk-EZX4YW7S.js +12 -0
  7. package/dist/exports/client/chunk-EZX4YW7S.js.map +7 -0
  8. package/dist/exports/client/componentInline-NL25DNZ5.js +2 -0
  9. package/dist/exports/client/index.d.ts +0 -1
  10. package/dist/exports/client/index.d.ts.map +1 -1
  11. package/dist/exports/client/index.js +23 -23
  12. package/dist/exports/client/index.js.map +3 -3
  13. package/dist/exports/react/index.d.ts +1 -3
  14. package/dist/exports/react/index.d.ts.map +1 -1
  15. package/dist/exports/react/index.js +0 -1
  16. package/dist/exports/react/index.js.map +1 -1
  17. package/dist/features/blocks/client/component/BlockContent.d.ts +4 -7
  18. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  19. package/dist/features/blocks/client/component/BlockContent.js +8 -9
  20. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  21. package/dist/features/blocks/client/component/index.d.ts +4 -20
  22. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  23. package/dist/features/blocks/client/component/index.js +11 -40
  24. package/dist/features/blocks/client/component/index.js.map +1 -1
  25. package/dist/features/blocks/client/componentInline/index.d.ts +14 -8
  26. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  27. package/dist/features/blocks/client/componentInline/index.js +9 -38
  28. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  29. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -4
  30. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  31. package/dist/features/blocks/client/nodes/BlocksNode.js +1 -3
  32. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  33. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -4
  34. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  35. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +1 -3
  36. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  37. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +20 -6
  38. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  39. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -7
  40. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  41. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +2 -17
  42. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  43. package/dist/features/converters/lexicalToJSX/converter/index.js +4 -124
  44. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  45. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +10 -14
  46. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  47. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  48. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
  49. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  50. package/dist/field/Field.d.ts.map +1 -1
  51. package/dist/field/Field.js +6 -15
  52. package/dist/field/Field.js.map +1 -1
  53. package/dist/field/bundled.css +1 -1
  54. package/dist/field/index.d.ts +0 -1
  55. package/dist/field/index.d.ts.map +1 -1
  56. package/dist/field/index.js +35 -64
  57. package/dist/field/index.js.map +1 -1
  58. package/dist/field/rscEntry.d.ts +1 -1
  59. package/dist/field/rscEntry.d.ts.map +1 -1
  60. package/dist/field/rscEntry.js +0 -12
  61. package/dist/field/rscEntry.js.map +1 -1
  62. package/dist/index.d.ts +1 -1
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +1 -3
  65. package/dist/index.js.map +1 -1
  66. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  67. package/dist/lexical/LexicalEditor.js +1 -2
  68. package/dist/lexical/LexicalEditor.js.map +1 -1
  69. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  70. package/dist/lexical/LexicalProvider.js +3 -12
  71. package/dist/lexical/LexicalProvider.js.map +1 -1
  72. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  73. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  74. package/dist/lexical/config/client/sanitize.js +2 -3
  75. package/dist/lexical/config/client/sanitize.js.map +1 -1
  76. package/dist/lexical/config/types.d.ts +0 -4
  77. package/dist/lexical/config/types.d.ts.map +1 -1
  78. package/dist/lexical/config/types.js.map +1 -1
  79. package/dist/lexical/nodes/index.d.ts +2 -12
  80. package/dist/lexical/nodes/index.d.ts.map +1 -1
  81. package/dist/lexical/nodes/index.js +2 -213
  82. package/dist/lexical/nodes/index.js.map +1 -1
  83. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  84. package/dist/lexical/plugins/SlashMenu/index.js +1 -14
  85. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  86. package/dist/types.d.ts +2 -329
  87. package/dist/types.d.ts.map +1 -1
  88. package/dist/types.js.map +1 -1
  89. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  90. package/dist/utilities/generateImportMap.js +0 -1
  91. package/dist/utilities/generateImportMap.js.map +1 -1
  92. package/dist/validate/hasText.d.ts +1 -6
  93. package/dist/validate/hasText.d.ts.map +1 -1
  94. package/dist/validate/hasText.js +4 -10
  95. package/dist/validate/hasText.js.map +1 -1
  96. package/package.json +7 -12
  97. package/dist/exports/client/Field-4IVB5SEE.js +0 -2
  98. package/dist/exports/client/Field-4IVB5SEE.js.map +0 -7
  99. package/dist/exports/client/chunk-CRVQNLN7.js +0 -2
  100. package/dist/exports/client/chunk-CRVQNLN7.js.map +0 -7
  101. package/dist/exports/client/chunk-UOYS7JHZ.js +0 -12
  102. package/dist/exports/client/chunk-UOYS7JHZ.js.map +0 -7
  103. package/dist/exports/client/componentInline-22F6QL2B.js +0 -2
  104. package/dist/exports/client/internal-client.d.ts +0 -3
  105. package/dist/exports/client/internal-client.d.ts.map +0 -1
  106. package/dist/field/RichTextViewProvider.d.ts +0 -85
  107. package/dist/field/RichTextViewProvider.d.ts.map +0 -1
  108. package/dist/field/RichTextViewProvider.js +0 -91
  109. package/dist/field/RichTextViewProvider.js.map +0 -1
  110. package/dist/field/ViewSelector.d.ts +0 -4
  111. package/dist/field/ViewSelector.d.ts.map +0 -1
  112. package/dist/field/ViewSelector.js +0 -89
  113. package/dist/field/ViewSelector.js.map +0 -1
  114. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +0 -2
  115. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +0 -1
  116. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +0 -48
  117. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +0 -1
  118. /package/dist/exports/client/{componentInline-22F6QL2B.js.map → componentInline-NL25DNZ5.js.map} +0 -0
@@ -1,26 +1,26 @@
1
- "use client";import{a as Ce,c as pt,d as ft,e as ht}from"./chunk-CRVQNLN7.js";import{a as Je}from"./chunk-DBWINSQN.js";import{a as gt,b as Ke}from"./chunk-QJ5EETIB.js";import{a as xe}from"./chunk-INBEEENE.js";import{a as wc}from"./chunk-F26IQ5RE.js";import{b as zt,c as Zt,d as ie,e as Yt,f as Wo,g as Go,h as Ec,i as Sc,k as Nc,m as Lc,p as yc}from"./chunk-UOYS7JHZ.js";import{a as Tc,b as U}from"./chunk-BZZVLW4U.js";function z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Dc}from"react/compiler-runtime";import{useLexicalComposerContext as $c}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as be}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Ac}from"@lexical/utils";import{$getSelection as Oc,$isElementNode as me,$isNodeSelection as Fc,$isRangeSelection as xt,COMMAND_PRIORITY_LOW as Pc,FORMAT_ELEMENT_COMMAND as Ct}from"lexical";import{useEffect as Bc}from"react";import{jsx as Vo,jsxs as Rc}from"react/jsx-runtime";import"react";var dn=()=>Rc("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:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Jo,jsxs as Ic}from"react/jsx-runtime";import"react";var mn=()=>Ic("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:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ko,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:[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 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Xo,jsxs as Mc}from"react/jsx-runtime";import"react";var pn=()=>Mc("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:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var D=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 fn=t=>({type:"dropdown",ChildComponent:qt,items:t,key:"align",order:30});var Ie=t=>me(t)?t.getFormatType():t.__format,hn=[fn([{ChildComponent:qt,isActive:({selection:t})=>{if(!xt(t))return!1;for(let e of t.getNodes()){if((me(e)||be(e))&&Ie(e)==="left")continue;let o=e.getParent();if(!((me(o)||be(o))&&Ie(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ct,"left")},order:1},{ChildComponent:dn,isActive:({selection:t})=>{if(!xt(t))return!1;for(let e of t.getNodes()){if((me(e)||be(e))&&Ie(e)==="center")continue;let o=e.getParent();if(!((me(o)||be(o))&&Ie(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ct,"center")},order:2},{ChildComponent:pn,isActive:({selection:t})=>{if(!xt(t))return!1;for(let e of t.getNodes()){if((me(e)||be(e))&&Ie(e)==="right")continue;let o=e.getParent();if(!((me(o)||be(o))&&Ie(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ct,"right")},order:3},{ChildComponent:mn,isActive:({selection:t})=>{if(!xt(t))return!1;for(let e of t.getNodes()){if((me(e)||be(e))&&Ie(e)==="justify")continue;let o=e.getParent();if(!((me(o)||be(o))&&Ie(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ct,"justify")},order:4}])],jc=()=>{let t=Dc(3),[e]=$c(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ct,Wc,Pc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Bc(o,r),null},Hc=D({plugins:[{Component:jc,position:"normal"}],toolbarFixed:{groups:hn},toolbarInline:{groups:hn}});function Uc(t){return(me(t)||be(t))&&!t.isInline()}function Wc(t){let e=Oc();if(!xt(e)&&!Fc(e))return!1;let o=e.getNodes();for(let r of o){let n=Ac(r,Uc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as Tn,$isQuoteNode as kn,QuoteNode as Jc}from"@lexical/rich-text";import{$setBlocksType as wn}from"@lexical/selection";import{$getSelection as En,$isRangeSelection as Kc}from"lexical";import{jsx as gn}from"react/jsx-runtime";import"react";var zo=()=>gn("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:gn("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 xn}from"react/jsx-runtime";import"react";var bt=()=>xn("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:xn("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 te=t=>({type:"dropdown",ChildComponent:bt,items:t,key:"text",order:25});import{$createQuoteNode as Gc,$isQuoteNode as Cn,QuoteNode as Vc}from"@lexical/rich-text";var bn={type:"element",dependencies:[Vc],export:(t,e)=>{if(!Cn(t))return null;let o=e(t).split(`
1
+ "use client";import{a as xe,c as ft,d as ht,e as gt}from"./chunk-2S5Q7QYO.js";import{a as ze}from"./chunk-DBWINSQN.js";import{a as xt,b as Xe}from"./chunk-QJ5EETIB.js";import{a as ge}from"./chunk-INBEEENE.js";import{a as Cc}from"./chunk-F26IQ5RE.js";import{b as Kt,c as Jt,d as ne,e as zt,f as bc,g as kc,i as _c,k as Tc,l as wc}from"./chunk-EZX4YW7S.js";import{a as xc,b as U}from"./chunk-BZZVLW4U.js";function z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as yc}from"react/compiler-runtime";import{useLexicalComposerContext as Rc}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as Ce}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Ic}from"@lexical/utils";import{$getSelection as vc,$isElementNode as ce,$isNodeSelection as Mc,$isRangeSelection as Ct,COMMAND_PRIORITY_LOW as Dc,FORMAT_ELEMENT_COMMAND as bt}from"lexical";import{useEffect as $c}from"react";import{jsx as Po,jsxs as Ec}from"react/jsx-runtime";import"react";var ln=()=>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:[Po("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Po("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Po("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bo,jsxs as Sc}from"react/jsx-runtime";import"react";var sn=()=>Sc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as jo,jsxs as Nc}from"react/jsx-runtime";import"react";var Xt=()=>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:[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:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ho,jsxs as Lc}from"react/jsx-runtime";import"react";var an=()=>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:[Ho("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ho("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ho("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var D=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 cn=t=>({type:"dropdown",ChildComponent:Xt,items:t,key:"align",order:30});var ve=t=>ce(t)?t.getFormatType():t.__format,un=[cn([{ChildComponent:Xt,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&ve(e)==="left")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&ve(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(bt,"left")},order:1},{ChildComponent:ln,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&ve(e)==="center")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&ve(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(bt,"center")},order:2},{ChildComponent:an,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&ve(e)==="right")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&ve(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(bt,"right")},order:3},{ChildComponent:sn,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&ve(e)==="justify")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&ve(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(bt,"justify")},order:4}])],Ac=()=>{let t=yc(3),[e]=Rc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(bt,Pc,Dc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),$c(o,r),null},Oc=D({plugins:[{Component:Ac,position:"normal"}],toolbarFixed:{groups:un},toolbarInline:{groups:un}});function Fc(t){return(ce(t)||Ce(t))&&!t.isInline()}function Pc(t){let e=vc();if(!Ct(e)&&!Mc(e))return!1;let o=e.getNodes();for(let r of o){let n=Ic(r,Fc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as xn,$isQuoteNode as hn,QuoteNode as Hc}from"@lexical/rich-text";import{$setBlocksType as Cn}from"@lexical/selection";import{$getSelection as bn,$isRangeSelection as Uc}from"lexical";import{jsx as dn}from"react/jsx-runtime";import"react";var Uo=()=>dn("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:dn("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 mn}from"react/jsx-runtime";import"react";var kt=()=>mn("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:mn("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:kt,items:t,key:"text",order:25});import{$createQuoteNode as Bc,$isQuoteNode as pn,QuoteNode as jc}from"@lexical/rich-text";var fn={type:"element",dependencies:[jc],export:(t,e)=>{if(!pn(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(Cn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Gc();n.append(...e),t.replace(n),n.select(0,0)}};var _n=[te([{ChildComponent:zo,isActive:({selection:t})=>{if(!Kc(t))return!1;for(let e of t.getNodes())if(!kn(e)&&!kn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=En();wn(e,()=>Tn())})},order:20}])],Xc=D({markdownTransformers:[bn],nodes:[Jc],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=En();wn(e,()=>Tn())})}}])]},toolbarFixed:{groups:_n},toolbarInline:{groups:_n}});import{getTranslation as ao}from"@payloadcms/translations";import{jsx as Zo,jsxs as zc}from"react/jsx-runtime";import"react";var Qt=()=>zc("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("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Zo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Zo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Sn}from"react/jsx-runtime";import"react";var eo=()=>Sn("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:Sn("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 to(t,e){return t?()=>Zc("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Qt}import{$parseSerializedNode as On}from"lexical";import{JSOX as Yo}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=Yc(t,n);e[o]=s.value,n=s.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Yc(t,e){let o=t[e];return o==='"'?Nn(t,e):o==="'"?Nn(t,e,!0):o==="{"?Qc(t,e):o==="["?qc(t,e):tu(t,e)}function qc(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:Yo.parse(`[${r}]`)}}function Nn(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 Qc(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:eu(r)}}function eu(t){return t[0]!=="{"?Yo.parse(t):Yo.parse(t.replace(/(\w+):/g,'"$1":'))}function tu(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function kt({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${ou(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,Ln)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,Ln)}}`));return e.join(" ")}function ou(t){return t.replace(/"/g,"&quot;")}function Ln(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,T=r;e:for(let[L,_]of d.entries()){let b=l?_.trim():_,x=0;if(l)for(let k=0;k<_.length&&_[k]===" ";k++)x++;let C=0;for(L===0&&(C=(n.index??0)+n[0].length-x);C<b.length;){let k=b[C],v=b[C+1];if(c){if(k==="`"&&h++,h%2===0)if(k==="<"&&v==="/"){if(u--,u<0){i[i.length-1]===`
4
- `&&(i=i.slice(0,-1)),T=L;for(let I=C;I<b.length;I++)if(b[I]===">"){g=I+1;break}break e}}else if(k==="/"&&v===">"){if(u--,u<0){i[i.length-1]===`
5
- `&&(i=i.slice(0,-1)),T=L,g=C+2;break e}}else k==="<"&&v!=="/"&&u++;i+=k}else{if(k==="{"&&!m?a++:k==="}"&&!m?a--:(k==='"'||k==="'")&&!m?m=k:k===m&&(m=null),k==="/"&&v===">"&&a===0&&!m){p=!0,T=L,g=C+2;break e}else if(k===">"&&a===0&&!m){c=!0,C++;continue}s+=k}C++}if(c?i?.length>0&&L>0&&(i+=`
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(pn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Bc();n.append(...e),t.replace(n),n.select(0,0)}};var gn=[ee([{ChildComponent:Uo,isActive:({selection:t})=>{if(!Uc(t))return!1;for(let e of t.getNodes())if(!hn(e)&&!hn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=bn();Cn(e,()=>xn())})},order:20}])],Wc=D({markdownTransformers:[fn],nodes:[Hc],slashMenu:{groups:[z([{Icon:Uo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=bn();Cn(e,()=>xn())})}}])]},toolbarFixed:{groups:gn},toolbarInline:{groups:gn}});import{getTranslation as lo}from"@payloadcms/translations";import{jsx as Wo,jsxs as Gc}from"react/jsx-runtime";import"react";var Zt=()=>Gc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as kn}from"react/jsx-runtime";import"react";var Yt=()=>kn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:kn("path",{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 Vc}from"react/jsx-runtime";import"react";function qt(t,e){return t?()=>Vc("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Zt}import{$parseSerializedNode as vn}from"lexical";import{JSOX as Go}from"jsox";function Qt({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==='"'?_n(t,e):o==="'"?_n(t,e,!0):o==="{"?zc(t,e):o==="["?Jc(t,e):Zc(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:Go.parse(`[${r}]`)}}function _n(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 zc(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:Xc(r)}}function Xc(t){return t[0]!=="{"?Go.parse(t):Go.parse(t.replace(/(\w+):/g,'"$1":'))}function Zc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function _t({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${Yc(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,Tn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,Tn)}}`));return e.join(" ")}function Yc(t){return t.replace(/"/g,"&quot;")}function Tn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function eo({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),x=0,T=r;e:for(let[S,_]of d.entries()){let b=l?_.trim():_,g=0;if(l)for(let k=0;k<_.length&&_[k]===" ";k++)g++;let C=0;for(S===0&&(C=(n.index??0)+n[0].length-g);C<b.length;){let k=b[C],y=b[C+1];if(c){if(k==="`"&&h++,h%2===0)if(k==="<"&&y==="/"){if(u--,u<0){i[i.length-1]===`
4
+ `&&(i=i.slice(0,-1)),T=S;for(let I=C;I<b.length;I++)if(b[I]===">"){x=I+1;break}break e}}else if(k==="/"&&y===">"){if(u--,u<0){i[i.length-1]===`
5
+ `&&(i=i.slice(0,-1)),T=S,x=C+2;break e}}else k==="<"&&y!=="/"&&u++;i+=k}else{if(k==="{"&&!m?a++:k==="}"&&!m?a--:(k==='"'||k==="'")&&!m?m=k:k===m&&(m=null),k==="/"&&y===">"&&a===0&&!m){p=!0,T=S,x=C+2;break e}else if(k===">"&&a===0&&!m){c=!0,C++;continue}s+=k}C++}if(c?i?.length>0&&S>0&&(i+=`
6
6
  `):s+=`
7
- `,o&&u<0){let k=b.match(o);if(k?.index!==void 0){T=L,g=k.index+k[0].length-1;break}}if(L===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
7
+ `,o&&u<0){let k=b.match(o);if(k?.index!==void 0){T=S,x=k.index+k[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[T].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:r+T,endlineLastCharIndex:g,propsString:s}}import{jsx as Au}from"react/jsx-runtime";import Ou from"bson-objectid";import{$applyNodeReplacement as Fu}from"lexical";import"react";import{DecoratorBlockNode as ru}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as nu}from"@lexical/utils";import lu from"bson-objectid";import{$applyNodeReplacement as iu}from"lexical";var _t=class extends ru{__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=su(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return nu(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 su(t){return iu(new _t({fields:{...t,id:t?.id||new lu.default().toHexString()}}))}import{jsx as G,jsxs as Tt,Fragment as vn}from"react/jsx-runtime";import{useLexicalComposerContext as hu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as gu}from"@lexical/react/useLexicalEditable";import{getTranslation as xu}from"@payloadcms/translations";import{Button as Mn,Collapsible as Cu,Drawer as bu,EditDepthProvider as ku,ErrorPill as _u,Form as Tu,formatDrawerSlug as wu,FormSubmit as Eu,Pill as Su,RenderFields as Nu,SectionTitle as Lu,useConfig as yu,useDocumentForm as Ru,useDocumentInfo as Dn,useEditDepth as Iu,useFormSubmitted as vu,useServerFunctions as Mu,useTranslation as Du}from"@payloadcms/ui";import{abortAndIgnore as qo}from"@payloadcms/ui/shared";import{$getNodeByKey as lo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as io,reduceFieldsToValues as $n}from"payload/shared";import wt,{useCallback as Qo,useEffect as er,useMemo as Et,useRef as tr}from"react";import{v4 as $u}from"uuid";import{c as au}from"react/compiler-runtime";import{jsx as no,jsxs as cu}from"react/jsx-runtime";import{useLexicalEditable as uu}from"@lexical/react/useLexicalEditable";import{RenderFields as du,useFormSubmitted as mu}from"@payloadcms/ui";import pu,{createContext as fu}from"react";var yn=fu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),se=()=>pu.use(yn),Rn=t=>{let e=au(4),{Collapsible:o,CustomBlock:r,CustomLabel:n,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=mu()&&i>0,a=uu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,...T}=f;return no(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?cu(yn,{value:h,children:[r,no(s,{})]}):no(p,{children:no(du,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function In({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var An=t=>{let{cacheBuster:e,className:o,CustomBlock:r,CustomLabel:n,formData:l,nodeKey:s}=t,i=vu(),{id:d,collectionSlug:c,globalSlug:u}=Dn(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=U(),{fields:g}=Ru(),T=tr(new AbortController),w=Iu(),[L,_]=wt.useState(0),{config:b}=yu(),x=wu({slug:`lexical-blocks-create-${f}-${l.id}`,depth:w}),{toggleDrawer:C}=xe(x),{getDocPreferences:k,setDocFieldPreferences:v}=Dn(),[I]=hu(),y=gu(),S=l.blockType,{getFormState:E}=Mu(),R=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}.fields`,[N,M]=wt.useState(()=>{let H=p?.[l.id]?.formState;if(!H)return!1;let ee=Object.fromEntries(Object.entries(H).map(([W,V])=>[W,W in l?{...V,initialValue:l[W],value:l[W]}:V]));return ee.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},ee}),$=tr(!1),A=tr(e);er(()=>{$.current?(A.current!==e&&M(!1),A.current=e):$.current=!0},[e]);let[F,P]=wt.useState(()=>n?G(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:se}):N?._components?.customComponents?.BlockLabel??void 0),[J,X]=wt.useState(()=>r?G(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:se}):N?._components?.customComponents?.Block??void 0);er(()=>{let H=new AbortController;return l&&!N&&(async()=>{let{state:W}=await E({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:io(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!y,renderAllFields:!0,schemaPath:R,signal:H.signal});if(W){W.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let V=$n(io(W,{excludeFiles:!0}),!0);I.update(()=>{let q=lo(s);if(q&&$e(q)){let le=V;le.blockType=S,q.setFields(le,!0)}}),M(W),n||P(W._components?.customComponents?.BlockLabel??void 0),r||X(W._components?.customComponents?.Block??void 0)}})(),()=>{qo(H)}},[E,R,y,d,n,r,l,I,s,N,c,u,k,g,S]);let[Ge,Gt]=wt.useState(p?.[l.id]?.collapsed??!1),ut=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}`,Q=a.blocks?.[ut]?.[0],Y=Q.blockReferences?typeof Q?.blockReferences?.[0]=="string"?b.blocksMap[Q?.blockReferences?.[0]]:Q?.blockReferences?.[0]:Q?.blocks?.[0],{i18n:dt,t:ne}=Du(),mt=Qo(async({formState:H,submit:ee})=>{qo(T.current);let W=new AbortController;T.current=W;let{state:V}=await E({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:io(g,{excludeFiles:!0}),formState:H,globalSlug:u,initialBlockFormState:H,operation:"update",readOnly:!y,renderAllFields:!!ee,schemaPath:R,signal:W.signal});if(!V)return H;H.blockName&&(V.blockName=H.blockName);let q=$n(In({fields:io(V,{excludeFiles:!0})}),!0);if(setTimeout(()=>{I.update(()=>{let le=lo(s);if(le&&$e(le)){let Ve=q;Ve.blockType=S,le.setFields(Ve,!0)}})},0),ee){P(V._components?.customComponents?.BlockLabel??void 0),X(V._components?.customComponents?.Block??void 0);let le=0;for(let Ve of Object.values(V))Ve?.valid===!1&&le++;_(le)}return V},[E,d,c,k,u,R,S,g,y,I,s]);er(()=>()=>{qo(T.current)},[]);let Vt=Qo(()=>{I.update(()=>{lo(s)?.remove()})},[I,s]),Re=Y?.labels?.singular?xu(Y.labels.singular,dt):Y?.slug,Jt=Qo(H=>{k().then(ee=>{let V=ee?.fields?.[m.name]?.collapsed,q=V&&V?.length?V:[];H?q.includes(l.id)||q.push(l.id):q.includes(l.id)&&q.splice(q.indexOf(l.id),1),v(m.name,{collapsed:q,hello:"hi"})})},[k,m.name,v,l.id]),Kt=Et(()=>()=>G(Mn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!y,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),C(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"small",tooltip:ne("lexical:blocks:inlineBlocks:edit",{label:Re})}),[o,y,ne,Re,C]),Xt=Et(()=>()=>G(Mn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!y,icon:"x",onClick:H=>{H.preventDefault(),Vt()},round:!0,tooltip:"Remove Block"}),[o,y,Vt]),Ho=Et(()=>({Actions:H,children:ee,className:W,collapsibleProps:V,disableBlockName:q,editButton:le,errorCount:Ve,fieldHasErrors:Uo,Label:an,Pill:cn,removeButton:_c})=>G("div",{className:`${o}__container ${o}-${S}`,children:G(Cu,{className:[`${o}__row`,Uo?`${o}__row--has-errors`:`${o}__row--no-errors`,W].filter(Boolean).join(" "),collapsibleStyle:Uo?"error":"default",header:Tt("div",{className:`${o}__block-header`,children:[typeof an<"u"?an:typeof F<"u"?F:Tt("div",{className:`${o}__block-label`,children:[typeof cn<"u"?cn:G(Su,{className:`${o}__block-pill ${o}__block-pill-${S}`,pillStyle:"white",size:"small",children:Re??S}),!q&&!Y?.admin?.disableBlockName&&G(Lu,{path:"blockName",readOnly:!y}),Uo&&G(_u,{count:Ve??0,i18n:dt,withMessage:!0})]}),G("div",{className:`${o}__block-actions`,children:typeof H<"u"?H:Tt(vn,{children:[J&&le!==!1||!J&&le?G(Kt,{}):null,_c!==!1&&y?G(Xt,{}):null]})})]}),isCollapsed:Ge,onToggle:un=>{Jt(un),Gt(un)},...V||{},children:ee},0)}),[J,F,Kt,Xt,Re,o,Y?.admin?.disableBlockName,S,dt,Ge,Jt,y]),ln=l?.id,sn=Et(()=>()=>G(ku,{children:G(bu,{className:"",slug:x,title:ne(`lexical:blocks:inlineBlocks:${ln?"edit":"create"}`,{label:Re??ne("lexical:blocks:inlineBlocks:label")}),children:N?Tt(vn,{children:[G(Nu,{fields:Y?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:R,permissions:!0,readOnly:!y}),G(Eu,{programmaticSubmit:!0,children:ne("fields:saveChanges")})]}):null})}),[N,x,ln,Re,ne,y,Y?.fields,R]),kc=Et(()=>N?G(Tu,{beforeSubmit:[async({formState:H})=>await mt({formState:H,submit:!0})],el:"div",fields:Y?.fields??[],initialState:N,onChange:[mt],onSubmit:(H,ee)=>{ee.blockType=S,I.update(()=>{let W=lo(s);W&&$e(W)&&W.setFields(ee,!0)}),C()},submitted:i,uuid:$u(),children:G(Rn,{baseClass:o,BlockDrawer:sn,Collapsible:Ho,CustomBlock:J,CustomLabel:F,EditButton:Kt,errorCount:L,formSchema:Y?.fields??[],initialState:N,nodeKey:s,RemoveButton:Xt})}):null,[Ho,sn,J,F,S,Xt,Kt,o,I,L,C,Y?.fields,N,s,mt,i]);return Y?kc:G(Ho,{disableBlockName:!0,fieldHasErrors:!0,children:Tt("div",{className:`${o}-not-found`,children:["Error: Block '",S,"' not found in the config but exists in the lexical data"]})})};var ae=class extends _t{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=Ae(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,r,n]){return Au(An,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:r,CustomLabel:n,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ae(t){return Fu(new ae({fields:{...t,id:t?.id||new Ou.default().toHexString()}}))}function $e(t){return t instanceof ae}import{createHeadlessEditor as Pu}from"@lexical/headless";function or(t,e){return({editorState:r})=>{let n=Pu({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 Bu}from"@lexical/headless";function so(t,e){return({markdown:r})=>{let n=Bu({nodes:t});return n.update(()=>{zt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function ju(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Pn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Fn(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Fn(r,!0);n&&(o=o.concat(n))}return o};function Fn(t,e){if(!t.jsx)return null;let o=ju(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[pt],export:s=>{if(!ht(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?" "+kt({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+kt({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=ft({blockType:t.slug,...a});s.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[ae],export:s=>{if(!$e(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(`
10
+ . Start match: `+JSON.stringify(n))}return{afterEndLine:d[T].trim().slice(x),beforeStartLine:f,content:i,endLineIndex:r+T,endlineLastCharIndex:x,propsString:s}}import{jsx as Iu}from"react/jsx-runtime";import vu from"bson-objectid";import{$applyNodeReplacement as Mu}from"lexical";import"react";import{DecoratorBlockNode as qc}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Qc}from"@lexical/utils";import eu from"bson-objectid";import{$applyNodeReplacement as tu}from"lexical";var Tt=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=ou(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Qc(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 ou(t){return tu(new Tt({fields:{...t,id:t?.id||new eu.default().toHexString()}}))}import{jsx as K,jsxs as wt,Fragment as Nn}from"react/jsx-runtime";import{useLexicalComposerContext as uu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as du}from"@lexical/react/useLexicalEditable";import{getTranslation as mu}from"@payloadcms/translations";import{Button as Ln,Collapsible as pu,Drawer as fu,EditDepthProvider as hu,ErrorPill as gu,Form as xu,formatDrawerSlug as Cu,FormSubmit as bu,Pill as ku,RenderFields as _u,SectionTitle as Tu,useConfig as wu,useDocumentForm as Eu,useDocumentInfo as yn,useEditDepth as Su,useFormSubmitted as Nu,useServerFunctions as Lu,useTranslation as yu}from"@payloadcms/ui";import{abortAndIgnore as Vo}from"@payloadcms/ui/shared";import{$getNodeByKey as oo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as ro,reduceFieldsToValues as Rn}from"payload/shared";import Et,{useCallback as Ko,useEffect as Jo,useMemo as St,useRef as zo}from"react";import{v4 as Ru}from"uuid";import{c as ru}from"react/compiler-runtime";import{jsx as to,jsxs as nu}from"react/jsx-runtime";import{useLexicalEditable as lu}from"@lexical/react/useLexicalEditable";import{RenderFields as iu,useFormSubmitted as su}from"@payloadcms/ui";import au,{createContext as cu}from"react";var wn=cu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,CustomBlock:null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),be=()=>au.use(wn),En=t=>{let e=ru(4),{Collapsible:o,...r}=t,{BlockDrawer:n,CustomBlock:l,errorCount:s,formSchema:i}=r,c=su()&&s>0,u=lu(),a;e[0]!==o||e[1]!==s||e[2]!==c?(a=p=>{let{children:h,...f}=p;return to(o,{errorCount:s,fieldHasErrors:c,...f,children:h})},e[0]=o,e[1]=s,e[2]=c,e[3]=a):a=e[3];let m=a;return l?nu(wn,{value:{...r,BlockCollapsible:m},children:[l,to(n,{})]}):to(m,{children:to(iu,{fields:i,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!u})})};function Sn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var In=t=>{let{cacheBuster:e,className:o,formData:r,nodeKey:n}=t,l=Nu(),{id:s,collectionSlug:i,globalSlug:d}=yn(),{fieldProps:{featureClientSchemaMap:c,field:u,initialLexicalFormState:a,schemaPath:m},uuid:p}=U(),{fields:h}=Eu(),f=zo(new AbortController),x=Su(),[T,E]=Et.useState(0),{config:S}=wu(),_=Cu({slug:`lexical-blocks-create-${p}-${r.id}`,depth:x}),{toggleDrawer:b}=ge(_),{getDocPreferences:g,setDocFieldPreferences:C}=yn(),[k]=uu(),y=du(),I=r.blockType,{getFormState:v}=Lu(),N=`${m}.lexical_internal_feature.blocks.lexical_blocks.${I}.fields`,[w,R]=Et.useState(()=>{let H=a?.[r.id]?.formState;if(!H)return!1;let Q=Object.fromEntries(Object.entries(H).map(([G,V])=>[G,G in r?{...V,initialValue:r[G],value:r[G]}:V]));return Q.blockName={initialValue:r.blockName,passesCondition:!0,valid:!0,value:r.blockName},Q}),L=zo(!1),M=zo(e);Jo(()=>{L.current?(M.current!==e&&R(!1),M.current=e):L.current=!0},[e]);let[$,A]=Et.useState(w?._components?.customComponents?.BlockLabel??void 0),[F,P]=Et.useState(w?._components?.customComponents?.Block??void 0);Jo(()=>{let H=new AbortController;return r&&!w&&(async()=>{let{state:G}=await v({id:s,collectionSlug:i,data:r,docPermissions:{fields:!0},docPreferences:await g(),documentFormState:ro(h,{excludeFiles:!0}),globalSlug:d,initialBlockData:r,operation:"update",readOnly:!y,renderAllFields:!0,schemaPath:N,signal:H.signal});if(G){G.blockName={initialValue:r.blockName,passesCondition:!0,valid:!0,value:r.blockName};let V=Rn(ro(G,{excludeFiles:!0}),!0);k.update(()=>{let q=oo(n);if(q&&Ae(q)){let re=V;re.blockType=I,q.setFields(re,!0)}}),R(G),A(G._components?.customComponents?.BlockLabel??void 0),P(G._components?.customComponents?.Block??void 0)}})(),()=>{Vo(H)}},[v,N,y,s,r,k,n,w,i,d,g,h,I]);let[Z,Y]=Et.useState(a?.[r.id]?.collapsed??!1),mt=`${m}.lexical_internal_feature.blocks.lexical_blocks.${I}`,fe=c.blocks?.[mt]?.[0],W=fe.blockReferences?typeof fe?.blockReferences?.[0]=="string"?S.blocksMap[fe?.blockReferences?.[0]]:fe?.blockReferences?.[0]:fe?.blocks?.[0],{i18n:le,t:he}=yu(),pt=Ko(async({formState:H,submit:Q})=>{Vo(f.current);let G=new AbortController;f.current=G;let{state:V}=await v({id:s,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await g(),documentFormState:ro(h,{excludeFiles:!0}),formState:H,globalSlug:d,initialBlockFormState:H,operation:"update",readOnly:!y,renderAllFields:!!Q,schemaPath:N,signal:G.signal});if(!V)return H;H.blockName&&(V.blockName=H.blockName);let q=Rn(Sn({fields:ro(V,{excludeFiles:!0})}),!0);if(setTimeout(()=>{k.update(()=>{let re=oo(n);if(re&&Ae(re)){let Je=q;Je.blockType=I,re.setFields(Je,!0)}})},0),Q){A(V._components?.customComponents?.BlockLabel??void 0),P(V._components?.customComponents?.Block??void 0);let re=0;for(let Je of Object.values(V))Je?.valid===!1&&re++;E(re)}return V},[v,s,i,g,d,N,I,h,y,k,n]);Jo(()=>()=>{Vo(f.current)},[]);let Re=Ko(()=>{k.update(()=>{oo(n)?.remove()})},[k,n]),Ie=W?.labels?.singular?mu(W.labels.singular,le):W?.slug,Vt=Ko(H=>{g().then(Q=>{let V=Q?.fields?.[u.name]?.collapsed,q=V&&V?.length?V:[];H?q.includes(r.id)||q.push(r.id):q.includes(r.id)&&q.splice(q.indexOf(r.id),1),C(u.name,{collapsed:q,hello:"hi"})})},[g,u.name,C,r.id]),Ve=St(()=>()=>K(Ln,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!y,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),b(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"small",tooltip:he("lexical:blocks:inlineBlocks:edit",{label:Ie})}),[o,y,he,Ie,b]),Ke=St(()=>()=>K(Ln,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!y,icon:"x",onClick:H=>{H.preventDefault(),Re()},round:!0,tooltip:"Remove Block"}),[o,y,Re]),Oo=St(()=>({Actions:H,children:Q,className:G,collapsibleProps:V,disableBlockName:q,editButton:re,errorCount:Je,fieldHasErrors:Fo,Label:on,Pill:rn,removeButton:gc})=>K("div",{className:`${o}__container ${o}-${I}`,children:K(pu,{className:[`${o}__row`,Fo?`${o}__row--has-errors`:`${o}__row--no-errors`,G].filter(Boolean).join(" "),collapsibleStyle:Fo?"error":"default",header:wt("div",{className:`${o}__block-header`,children:[typeof on<"u"?on:typeof $<"u"?$:wt("div",{className:`${o}__block-label`,children:[typeof rn<"u"?rn:K(ku,{className:`${o}__block-pill ${o}__block-pill-${I}`,pillStyle:"white",size:"small",children:Ie??I}),!q&&!W?.admin?.disableBlockName&&K(Tu,{path:"blockName",readOnly:!y}),Fo&&K(gu,{count:Je??0,i18n:le,withMessage:!0})]}),K("div",{className:`${o}__block-actions`,children:typeof H<"u"?H:wt(Nn,{children:[F&&re!==!1||!F&&re?K(Ve,{}):null,gc!==!1&&y?K(Ke,{}):null]})})]}),isCollapsed:Z,onToggle:nn=>{Vt(nn),Y(nn)},...V||{},children:Q},0)}),[F,$,Ve,Ke,Ie,o,W?.admin?.disableBlockName,I,le,Z,Vt,y]),en=r?.id,tn=St(()=>()=>K(hu,{children:K(fu,{className:"",slug:_,title:he(`lexical:blocks:inlineBlocks:${en?"edit":"create"}`,{label:Ie??he("lexical:blocks:inlineBlocks:label")}),children:w?wt(Nn,{children:[K(_u,{fields:W?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:!0,readOnly:!y}),K(bu,{programmaticSubmit:!0,children:he("fields:saveChanges")})]}):null})}),[w,_,en,Ie,he,y,W?.fields,N]),hc=St(()=>w?K(xu,{beforeSubmit:[async({formState:H})=>await pt({formState:H,submit:!0})],el:"div",fields:W?.fields??[],initialState:w,onChange:[pt],onSubmit:(H,Q)=>{Q.blockType=I,k.update(()=>{let G=oo(n);G&&Ae(G)&&G.setFields(Q,!0)}),b()},submitted:l,uuid:Ru(),children:K(En,{baseClass:o,BlockDrawer:tn,Collapsible:Oo,CustomBlock:F,EditButton:Ve,errorCount:T,formSchema:W?.fields??[],initialState:w,nodeKey:n,RemoveButton:Ke})}):null,[Oo,tn,F,I,Ke,Ve,o,k,T,b,W?.fields,w,n,pt,l]);return W?hc:K(Oo,{disableBlockName:!0,fieldHasErrors:!0,children:wt("div",{className:`${o}-not-found`,children:["Error: Block '",I,"' not found in the config but exists in the lexical data"]})})};var ie=class extends Tt{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=Oe(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Iu(In,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Oe(t){return Mu(new ie({fields:{...t,id:t?.id||new vu.default().toHexString()}}))}function Ae(t){return t instanceof ie}import{createHeadlessEditor as Du}from"@lexical/headless";function Xo(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=Jt(e)}),l}}import{createHeadlessEditor as $u}from"@lexical/headless";function no(t,e){return({markdown:r})=>{let n=$u({nodes:t});return n.update(()=>{Kt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Au(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Dn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Mn(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Mn(r,!0);n&&(o=o.concat(n))}return o};function Mn(t,e){if(!t.jsx)return null;let o=Au(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[ft],export:s=>{if(!gt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Xo(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?" "+_t({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+_t({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=eo({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}=eo({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=no(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?Qt({propsString:c}):{}});if(a===!1)return;let m=ht({blockType:t.slug,...a});s.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[ie],export:s=>{if(!Ae(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Xo(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
- `;return`<${i.blockType}${u?" "+kt({props:a}):""}>
15
- ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+kt({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}=ro({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),w="";if(t?.jsx?.doNotTrimChildren)w=f.endsWith(`
14
+ `;return`<${i.blockType}${u?" "+_t({props:a}):""}>
15
+ ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+_t({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:x,propsString:T}=eo({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
- `),C=0;for(let k of x){if(C++,k.startsWith(" "))w+=k.slice(2);else if(k==="")w+=k;else{w=f.endsWith(`
19
- `)?f.slice(0,-1):f;break}w+=C===x.length?"":`
20
- `}}else w=(f.startsWith(" ")?f.slice(2):f)+`
21
- `;if(!t?.jsx?.import)return[!1,d];let L=so(n,l),_=t.jsx.import({children:w,closeMatch:null,htmlToLexical:null,markdownToLexical:L,openMatch:c,props:T?oo({propsString:T}):{}});if(_===!1)return[!1,d];let b=Ae({blockType:t.slug,..._});if(b){let x=null,C=null;if(h?.length){x=L({markdown:h})?.root?.children??[];let k=x?.[0];k&&i.append(On(k))}if(i.append(b),p?.length){C=L({markdown:p})?.root?.children;let k=i.getChildren()[i.getChildren().length-1],v=On(C[0])?.getChildren();if(v?.length)for(let I of v)k.append(I)}}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(`
17
+ `)){let g=f.split(`
18
+ `),C=0;for(let k of g){if(C++,k.startsWith(" "))E+=k.slice(2);else if(k==="")E+=k;else{E=f.endsWith(`
19
+ `)?f.slice(0,-1):f;break}E+=C===g.length?"":`
20
+ `}}else E=(f.startsWith(" ")?f.slice(2):f)+`
21
+ `;if(!t?.jsx?.import)return[!1,d];let S=no(n,l),_=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:S,openMatch:c,props:T?Qt({propsString:T}):{}});if(_===!1)return[!1,d];let b=Oe({blockType:t.slug,..._});if(b){let g=null,C=null;if(h?.length){g=S({markdown:h})?.root?.children??[];let k=g?.[0];k&&i.append(vn(k))}if(i.append(b),p?.length){C=S({markdown:p})?.root?.children;let k=i.getChildren()[i.getChildren().length-1],y=vn(C[0])?.getChildren();if(y?.length)for(let I of y)k.append(I)}}return[!0,x]},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 x="";if(i)for(let T of i)x+=T.getTextContent();u=[x]}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=Ae({blockType:t.slug,...h});f&&s.append(f);return}return!1}})),r)}import{createCommand as Bn}from"lexical";var Xe=Bn("INSERT_BLOCK_COMMAND"),ze=Bn("INSERT_INLINE_BLOCK_COMMAND");import{c as Hu}from"react/compiler-runtime";import{useLexicalComposerContext as Uu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Wu,$wrapNodeInElement as Gu,mergeRegister as Vu}from"@lexical/utils";import{formatDrawerSlug as Ju,useEditDepth as Ku}from"@payloadcms/ui";import{$createParagraphNode as Xu,$getNodeByKey as zu,$getPreviousSelection as Zu,$getSelection as Yu,$insertNodes as qu,$isParagraphNode as Qu,$isRangeSelection as ed,$isRootOrShadowRoot as td,COMMAND_PRIORITY_EDITOR as jn}from"lexical";import{useEffect as od,useState as rd}from"react";var Hn=()=>{let t=Hu(12),[e]=Uu(),[o,r]=rd(null),{setCreatedInlineBlock:n,uuid:l}=U(),s=Ku(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=Ju({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=xe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([ae]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Vu(e.registerCommand(Xe,p=>(e.update(()=>{let h=Yu()||Zu();if(ed(h)){let f=Ae(p),{focus:g}=h,T=g.getNode();Wu(f),Qu(T)&&!T.__first&&T.remove()}}),!0),jn),e.registerCommand(ze,p=>{if(o){let f=zu(o);return!f||!ht(f)?!1:(f.setFields(p),r(null),!0)}let h=ft(p);return n?.(h),qu([h]),td(h.getParentOrThrow())&&Gu(h,Xu).selectEnd(),!0},jn))},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],od(a,m),null};var nd=D(({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:Pn({blocks:c,inlineBlocks:u}),nodes:[ae,pt],plugins:[{Component:Hn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:to(a.imageURL,a.imageAltText),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(Xe,{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(ze,{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.imageURL,a.imageAltText),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(Xe,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:eo,items:u.map((a,m)=>({ChildComponent:a.imageURL?to(a.imageURL,a.imageAltText):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(ze,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as sd}from"react/compiler-runtime";import{jsx as Fe,jsxs as ir}from"react/jsx-runtime";import{useLexicalComposerContext as ad}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as cd,$createTextNode as ud,$getRoot as dd,getDOMSelection as rr}from"lexical";import*as Jn from"react";import{useCallback as Oe,useEffect as nr,useLayoutEffect as Wn,useRef as lr,useState as co}from"react";var ld=ie&&"documentMode"in document?document.documentMode:null,Un=ie&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),n6=ie&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),l6=ie&&"InputEvent"in window&&!ld?"getTargetRanges"in new window.InputEvent("input"):!1,i6=ie&&/Version\/[\d.].*Safari/.test(navigator.userAgent),s6=ie&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,a6=ie&&/Android/.test(navigator.userAgent),c6=ie&&/Win/.test(navigator.platform),id=ie&&/^(?=.*Chrome).*/i.test(navigator.userAgent),u6=ie&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!id;var md=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)},pd=(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)},fd=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=no(n,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?Qt({propsString:m}):{}});if(h===!1)return!1;let f=Oe({blockType:t.slug,...h});f&&s.append(f);return}return!1}})),r)}import{createCommand as $n}from"lexical";var Ze=$n("INSERT_BLOCK_COMMAND"),Ye=$n("INSERT_INLINE_BLOCK_COMMAND");import{c as Ou}from"react/compiler-runtime";import{useLexicalComposerContext as Fu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Pu,$wrapNodeInElement as Bu,mergeRegister as ju}from"@lexical/utils";import{formatDrawerSlug as Hu,useEditDepth as Uu}from"@payloadcms/ui";import{$createParagraphNode as Wu,$getNodeByKey as Gu,$getPreviousSelection as Vu,$getSelection as Ku,$insertNodes as Ju,$isParagraphNode as zu,$isRangeSelection as Xu,$isRootOrShadowRoot as Zu,COMMAND_PRIORITY_EDITOR as An}from"lexical";import{useEffect as Yu,useState as qu}from"react";var On=()=>{let t=Ou(12),[e]=Fu(),[o,r]=qu(null),{setCreatedInlineBlock:n,uuid:l}=U(),s=Uu(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=Hu({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([ie]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return ju(e.registerCommand(Ze,p=>(e.update(()=>{let h=Ku()||Vu();if(Xu(h)){let f=Oe(p),{focus:x}=h,T=x.getNode();Pu(f),zu(T)&&!T.__first&&T.remove()}}),!0),An),e.registerCommand(Ye,p=>{if(o){let f=Gu(o);return!f||!gt(f)?!1:(f.setFields(p),r(null),!0)}let h=ht(p);return n?.(h),Ju([h]),Zu(h.getParentOrThrow())&&Bu(h,Wu).selectEnd(),!0},An))},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],Yu(a,m),null};var Qu=D(({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:Dn({blocks:c,inlineBlocks:u}),nodes:[ie,ft],plugins:[{Component:On,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:qt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?lo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ze,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:Yt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?lo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ye,{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:Zt,items:c.map((a,m)=>({ChildComponent:qt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?lo(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ze,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:Yt,items:u.map((a,m)=>({ChildComponent:a.imageURL?qt(a.imageURL,a.imageAltText):Yt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?lo(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ye,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as od}from"react/compiler-runtime";import{jsx as Pe,jsxs as Qo}from"react/jsx-runtime";import{useLexicalComposerContext as rd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as nd,$createTextNode as ld,$getRoot as id,getDOMSelection as Zo}from"lexical";import*as Hn from"react";import{useCallback as Fe,useEffect as Yo,useLayoutEffect as Pn,useRef as qo,useState as io}from"react";var ed=ne&&"documentMode"in document?document.documentMode:null,Fn=ne&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),X5=ne&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Z5=ne&&"InputEvent"in window&&!ed?"getTargetRanges"in new window.InputEvent("input"):!1,Y5=ne&&/Version\/[\d.].*Safari/.test(navigator.userAgent),q5=ne&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Q5=ne&&/Android/.test(navigator.userAgent),e6=ne&&/Win/.test(navigator.platform),td=ne&&/^(?=.*Chrome).*/i.test(navigator.userAgent),t6=ne&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!td;var sd=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)},ad=(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);
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?" "+kt({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 hd(t){return t.key.toLowerCase()==="a"&&(Un?t.metaKey:t.ctrlKey)}function gd(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 Gn(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 Vn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function xd(t){let[e,o]=co([]),[r,n]=co(!1),[,l]=co(""),[s,i]=co(""),d=lr(null),c=lr(!1),u=lr(null),a=Oe(()=>t,[t]),m=Oe(()=>{let _=t.getRootElement(),b=rr(t._window);return _==null||b==null||b.anchorNode==null||b.focusNode==null||!_.contains(b.anchorNode)||!_.contains(b.focusNode)?null:`
33
+ );`}};function ud(t){return t.key.toLowerCase()==="a"&&(Fn?t.metaKey:t.ctrlKey)}function dd(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 Bn(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 jn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function md(t){let[e,o]=io([]),[r,n]=io(!1),[,l]=io(""),[s,i]=io(""),d=qo(null),c=qo(!1),u=qo(null),a=Fe(()=>t,[t]),m=Fe(()=>{let _=t.getRootElement(),b=Zo(t._window);return _==null||b==null||b.anchorNode==null||b.focusNode==null||!_.contains(b.anchorNode)||!_.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(fd).join(`
50
+ ${e.map(cd).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=Oe((_,b)=>{o(x=>{let C=e.length-1,k=e[C];if(k&&k.name===_){if(_==="type")return[...e.slice(0,C),{...k,value:k.value+b}];if(k.value===b)return[...e.slice(0,C),{...k,count:k.count+1}]}return[...x,{name:_,count:1,value:b}]})},[e,o]);Wn(()=>{let _=x=>{if(!r)return;let C=x.key;hd(x)?p("selectAll",""):Vn.has(C)?p("press",x.key):[...C].length>1?p("keydown",x.key):p("type",x.key)},b=x=>{if(!r)return;let C=x.key;!Vn.has(C)&&[...C].length>1&&p("keyup",x.key)};return t.registerRootListener((x,C)=>{C!==null&&(C.removeEventListener("keydown",_),C.removeEventListener("keyup",b)),x!==null&&(x.addEventListener("keydown",_),x.addEventListener("keyup",b))})},[t,r,p]),Wn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),nr(()=>{if(e){let _=m();_!==null&&i(_),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),nr(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:x,editorState:C})=>{if(!r)return;let k=C._selection,v=d.current,I=c.current;if(v!==k){if(x.size===0&&b.size===0&&!I){let S=rr(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}d.current=k}c.current=!1;let y=m();y!==null&&i(y)}),[t,m,r,p]),nr(()=>r?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,r]);let h=Oe(_=>{r||(_.update(()=>{let b=dd();b.clear();let x=ud();b.append(cd().append(x)),x.select()}),o([])),n(b=>!b)},[r]),f=Oe(()=>{if(!r)return;let _=rr(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:b,anchorOffset:x,focusNode:C,focusOffset:k}=gd(_),v=a().getRootElement(),I;b!==null&&(I=Gn(b,v));let y;C!==null&&(y=Gn(C,v)),p("snapshot",{anchorNode:b,anchorOffset:x,anchorPath:I,focusNode:C,focusOffset:k,focusPath:y})},[p,r,a]),g=Oe(()=>{md(m())},[m]),T=Oe(()=>{pd("test.js",m())},[m]);return[Fe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{h(a()),_.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:[Fe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{f(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{g(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{T(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Fe("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var Kn=()=>{let t=sd(3),[e]=ad(),[o,r]=xd(e),n;return t[0]!==o||t[1]!==r?(n=ir(Jn.Fragment,{children:[Fe("p",{children:"HI"}),o,r,Fe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Cd=D({plugins:[{Component:Kn,position:"bottom"}]});import{c as bd}from"react/compiler-runtime";import{jsx as kd}from"react/jsx-runtime";import{useLexicalComposerContext as _d}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Td}from"@lexical/react/LexicalTreeView.js";import"react";var Xn=()=>{let t=bd(2),[e]=_d(),o;return t[0]!==e?(o=kd(Td,{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 wd=D({plugins:[{Component:Xn,position:"bottom"}]});import{$isTableSelection as Ed}from"@lexical/table";import{$isRangeSelection as Sd,FORMAT_TEXT_COMMAND as Nd}from"lexical";import{jsx as zn}from"react/jsx-runtime";import"react";var Zn=()=>zn("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:zn("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 Yn={type:"text-format",format:["bold","italic"],tag:"***"},qn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Qn={type:"text-format",format:["bold"],tag:"**"},el={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var tl=[Z([{ChildComponent:Zn,isActive:({selection:t})=>Sd(t)||Ed(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Nd,"bold")},order:1}])],Ld=D(({featureProviderMap:t})=>{let e=[Qn,el];return t.get("italic")&&e.push(qn,Yn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:tl},toolbarInline:{groups:tl}}});import{$isTableSelection as Rd}from"@lexical/table";import{$isRangeSelection as Id,FORMAT_TEXT_COMMAND as vd}from"lexical";import{jsx as ol,jsxs as yd}from"react/jsx-runtime";import"react";var rl=()=>yd("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:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),ol("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var nl={type:"text-format",format:["code"],tag:"`"};var ll=[Z([{ChildComponent:rl,isActive:({selection:t})=>Id(t)||Rd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(vd,"code")},order:7}])],Md=D({enableFormats:["code"],markdownTransformers:[nl],toolbarFixed:{groups:ll},toolbarInline:{groups:ll}});import{$isTableSelection as Dd}from"@lexical/table";import{$isRangeSelection as $d,FORMAT_TEXT_COMMAND as Ad}from"lexical";import{jsx as il}from"react/jsx-runtime";import"react";var sl=()=>il("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:il("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 al={type:"text-format",format:["italic"],tag:"*"},cl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var ul=[Z([{ChildComponent:sl,isActive:({selection:t})=>$d(t)||Dd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Ad,"italic")},order:2}])],Od=D({enableFormats:["italic"],markdownTransformers:[al,cl],toolbarFixed:{groups:ul},toolbarInline:{groups:ul}});import{$isTableSelection as Pd}from"@lexical/table";import{$isRangeSelection as Bd,FORMAT_TEXT_COMMAND as jd}from"lexical";import{jsx as dl,jsxs as Fd}from"react/jsx-runtime";import"react";var ml=()=>Fd("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:"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"}),dl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var pl={type:"text-format",format:["strikethrough"],tag:"~~"};var fl=[Z([{ChildComponent:ml,isActive:({selection:t})=>Bd(t)||Pd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(jd,"strikethrough")},order:4}])],Hd=D({enableFormats:["strikethrough"],markdownTransformers:[pl],toolbarFixed:{groups:fl},toolbarInline:{groups:fl}});import{$isTableSelection as Ud}from"@lexical/table";import{$isRangeSelection as Wd,FORMAT_TEXT_COMMAND as Gd}from"lexical";import{jsx as hl}from"react/jsx-runtime";import"react";var gl=()=>hl("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:hl("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 xl=[Z([{ChildComponent:gl,isActive:({selection:t})=>Wd(t)||Ud(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Gd,"subscript")},order:5}])],Vd=D({enableFormats:["subscript"],toolbarFixed:{groups:xl},toolbarInline:{groups:xl}});import{$isTableSelection as Jd}from"@lexical/table";import{$isRangeSelection as Kd,FORMAT_TEXT_COMMAND as Xd}from"lexical";import{jsx as Cl}from"react/jsx-runtime";import"react";var bl=()=>Cl("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:"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 kl=[Z([{ChildComponent:bl,isActive:({selection:t})=>Kd(t)||Jd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Xd,"superscript")},order:6}])],zd=D({enableFormats:["superscript"],toolbarFixed:{groups:kl},toolbarInline:{groups:kl}});import{$isTableSelection as Yd}from"@lexical/table";import{$isRangeSelection as qd,FORMAT_TEXT_COMMAND as Qd}from"lexical";import{jsx as _l,jsxs as Zd}from"react/jsx-runtime";import"react";var Tl=()=>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:[_l("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"}),_l("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var wl=[Z([{ChildComponent:Tl,isActive:({selection:t})=>qd(t)||Yd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Qd,"underline")},order:3}])],em=D({enableFormats:["underline"],toolbarFixed:{groups:wl},toolbarInline:{groups:wl}});import{jsx as ar}from"react/jsx-runtime";import{jsx as tm}from"react/jsx-runtime";function om(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])=>[om(o),r])):{};return tm("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as rm}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as nm}from"@lexical/selection";import{$getNodeByKey as lm,$getState as im,$setState as sm,createState as am,TextNode as cm}from"lexical";import{useEffect as um}from"react";function El(t){let e=new Map;for(let o in t){let r=t[o],n=am(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(()=>{nm(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);sm(n,l.stateConfig,r)})})}function Sl({stateMap:t}){let[e]=rm();return um(()=>e.registerMutationListener(cm,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=lm(r),s=e.getElementByKey(r);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=im(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 Nl=(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(uo,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{sr(d,e,n,s)}})}}return[{type:"dropdown",ChildComponent:()=>ar(uo,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>ar(uo,{}),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}]},dm=D(({props:t})=>{let e=El(t.state);return{plugins:[{Component:()=>Sl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Nl(t,e)},toolbarInline:{groups:Nl(t,e)}}});import{c as hm}from"react/compiler-runtime";import{useLexicalComposerContext as gm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as xm,$isHeadingNode as jl,HeadingNode as Wl}from"@lexical/rich-text";import{$setBlocksType as Cm}from"@lexical/selection";import{$getSelection as bm,$isRangeSelection as km}from"lexical";import{useEffect as _m}from"react";import{jsx as Ll}from"react/jsx-runtime";import"react";var yl=()=>Ll("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:Ll("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 Rl}from"react/jsx-runtime";import"react";var Il=()=>Rl("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:Rl("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 vl}from"react/jsx-runtime";import"react";var Ml=()=>vl("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:vl("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 Dl}from"react/jsx-runtime";import"react";var $l=()=>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:"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 Al}from"react/jsx-runtime";import"react";var Ol=()=>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:"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 Fl}from"react/jsx-runtime";import"react";var Pl=()=>Fl("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:Fl("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 mm,$isHeadingNode as pm,HeadingNode as fm}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 Bl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[fm],export:(n,l)=>{if(!pm(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 mm(l)})}};var Hl=t=>{let e=bm();Cm(e,()=>xm(t))},Ul={h1:yl,h2:Il,h3:Ml,h4:$l,h5:Ol,h6:Pl},Tm=D(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((r,n)=>({ChildComponent:Ul[r],isActive:({selection:l})=>{if(!km(l))return!1;for(let s of l.getNodes()){if(jl(s)&&s.getTag()===r)continue;let i=s.getParent();if(!(jl(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(()=>{Hl(r)})},order:n+2})))];return{markdownTransformers:[Bl(e)],nodes:[Wl],plugins:[{Component:wm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:Ul[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(()=>{Hl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),wm=t=>{let e=hm(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]=gm(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(Wl,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]),_m(c,u),null};import{$isNodeSelection as Bm}from"lexical";import{jsx as Gl}from"react/jsx-runtime";import"react";var ur=()=>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("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Vl,jsxs as Em}from"react/jsx-runtime";import"react";var Jl=()=>Em("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Vl("path",{d:"M5 10h10",stroke:"currentColor"}),Vl("path",{d:"M10 15V5",stroke:"currentColor"})]});var ke=t=>({type:"dropdown",ChildComponent:Jl,items:t,key:"add",order:10});import{addClassNamesToElement as Sm}from"@lexical/utils";import{$applyNodeReplacement as Nm,createCommand as Lm,DecoratorNode as ym}from"lexical";var Nt=Lm("INSERT_HORIZONTAL_RULE_COMMAND"),St=class extends ym{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Rm,priority:0})}}static importJSON(e){return Kl()}createDOM(e){let o=document.createElement("hr");return Sm(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
- `}isInline(){return!1}updateDOM(){return!1}};function Rm(){return{node:Kl()}}function Kl(){return Nm(new St)}import{$applyNodeReplacement as Im}from"lexical";import"react";var _e=class extends St{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Ze()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Ze(){return Im(new _e)}function Lt(t){return t instanceof _e}var Xl={type:"element",dependencies:[_e],export:(t,e)=>Lt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ze();e&&t.replace(e)}};import{c as vm}from"react/compiler-runtime";import{useLexicalComposerContext as Mm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Dm}from"@lexical/utils";import{$getSelection as $m,$isRangeSelection as Am,COMMAND_PRIORITY_EDITOR as Om}from"lexical";import{useEffect as Fm}from"react";var zl=()=>{let t=vm(3),[e]=Mm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Nt,Pm,Om),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Fm(o,r),null};function Pm(t){let e=$m();if(!Am(e))return!1;if(e.focus.getNode()!==null){let r=Ze();Dm(r)}return!0}var jm=D({markdownTransformers:[Xl],nodes:[_e],plugins:[{Component:zl,position:"normal"}],slashMenu:{groups:[z([{Icon:ur,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Nt,void 0)}}])]},toolbarFixed:{groups:[ke([{ChildComponent:ur,isActive:({selection:t})=>{if(!Bm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Lt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Nt,void 0)}}])]}});import{$findMatchingParent as li}from"@lexical/utils";import{$isElementNode as Qm,INDENT_CONTENT_COMMAND as ep,OUTDENT_CONTENT_COMMAND as tp}from"lexical";import{jsx as mo,jsxs as Hm}from"react/jsx-runtime";import"react";var Zl=()=>Hm("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 Um}from"react/jsx-runtime";import"react";var Yl=()=>Um("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 Wm}from"react/jsx-runtime";import{useLexicalComposerContext as Gm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Vm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Jm,mergeRegister as ql}from"@lexical/utils";import{$getSelection as Km,$isElementNode as oi,$isRangeSelection as Xm,COMMAND_PRIORITY_LOW as Ql,INDENT_CONTENT_COMMAND as ei,KEY_TAB_COMMAND as zm,OUTDENT_CONTENT_COMMAND as Zm,TabNode as Ym}from"lexical";import{useEffect as ti}from"react";var ri=({clientProps:t})=>{let[e]=Gm(),{disabledNodes:o,disableTabNode:r}=t;return ti(()=>{if(!(!e||!o?.length))return ql(e.registerCommand(ei,()=>qm(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Ql),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[s]of n){let i=l._nodeMap.get(s);oi(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),ti(()=>{if(!(!e||!r))return ql(e.registerCommand(zm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Zm:ei,void 0)),Ql),e.registerNodeTransform(Ym,n=>{n.remove()}))},[e,r]),Wm(Vm,{})};function qm(t){let e=Km();if(!Xm(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=Jm(l,c=>oi(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 ni=t=>({type:"buttons",items:t,key:"indent",order:35});var ii=({disabledNodes:t})=>[ni([{ChildComponent:Zl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>si(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!li(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tp,void 0)},order:1},{ChildComponent:Yl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>si(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!li(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ep,void 0)},order:2}])],op=D(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ri,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:ii({disabledNodes:e})},toolbarInline:{groups:ii({disabledNodes:e})}}}),si=t=>Qm(t)&&t.canIndent();import{$findMatchingParent as xf}from"@lexical/utils";import{$getSelection as br,$isRangeSelection as Bi}from"lexical";import{jsx as ai}from"react/jsx-runtime";import"react";var ci=()=>ai("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:ai("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 ui}from"@lexical/selection";function Ye(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?ui(o)?r:n:ui(e)?r:n}var dr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as pp}from"lexical";import{addClassNamesToElement as rp,isHTMLAnchorElement as np}from"@lexical/utils";import fr from"bson-objectid";import{$applyNodeReplacement as lp,$createTextNode as di,$getSelection as ip,$isElementNode as mi,$isRangeSelection as pr,createCommand as sp,ElementNode as ap}from"lexical";var cp=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends ap{__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:up,priority:1})}}static importJSON(e){let o=Te({}).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 fr.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=mr(o.rel,"add","noopener")),rp(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(!pr(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(mi(r)){let n=Te({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!cp.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,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=mr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=mr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function up(t){let e=null;if(np(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new fr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Te({id:t,fields:e}){return lp(new oe({id:t??new fr.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var pe=sp("TOGGLE_LINK_COMMAND");function hr(t){let e=ip();if(!pr(e)&&(t===null||!t.selectedNodes?.length))return;let o=pr(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:dp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(di(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||mi(l)&&!l.isInline())){if(K(s)){n=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(di(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(r)||(r=s,n=Te({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 dp(t){return mp(t,e=>K(e))}function mp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function mr(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 pi={type:"text-match",dependencies:[oe],export:(t,e)=>{if(!K(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=pp(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as fp,$isElementNode as hp}from"lexical";var we=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=yt({}).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=yt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function yt({fields:t}){return fp(new we({id:"",fields:t}))}function Ee(t){return t instanceof we}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 fi,$getSelection as bp,$isElementNode as gi,$isLineBreakNode as xi,$isNodeSelection as kp,$isRangeSelection as _p,$isTextNode as Rt,TextNode as Tp}from"lexical";import{useEffect as wp}from"react";function hi(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 Ci(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Ep=/[.,;\s]/;function ho(t){return t!==void 0&&Ep.test(t)}function bi(t){return ho(t[t.length-1])}function xr(t){return ho(t[0])}function Sp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function ki(t){let e=t.getPreviousSibling();return gi(e)&&(e=e.getLastDescendant()),e===null||xi(e)||Rt(e)&&bi(e.getTextContent())}function _i(t){let e=t.getNextSibling();return gi(e)&&(e=e.getFirstDescendant()),e===null||xi(e)||Rt(e)&&xr(e.getTextContent())}function Np(t,e,o,r){return(t>0?ho(o[t-1]):ki(r[0]))?e<o.length?ho(o[e]):_i(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=yt({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=fi(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(Rt):void 0,p=fi(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=Ci(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 gr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!Rt(c)||!c.isSimpleText()){fo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Ci(l,e);if(s===null||s.text!==l){fo(t),o(null,t.getFields()?.url??null);return}if(!ki(t)||!_i(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 Ip(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(Ee(r)){let s=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!xr(l)||Sp(l,s))&&(r.append(t),gr(r,e,o),o(null,r.getFields()?.url??null))}Ee(n)&&!bi(l)&&(fo(n),gr(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 vp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&Rt(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([we]))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(Ee(d))gr(d,e,s);else if(!K(d)){if(i.isSimpleText()&&(xr(i.getTextContent())||!Ee(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 Dp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,$p=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ap=[hi(Dp,t=>t.startsWith("http")?t:`https://${t}`),hi($p,t=>`mailto:${t}`)],Ti=()=>{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 wi=()=>Op(Fp,{});import{jsx as rf}from"react/jsx-runtime";import"react";import{createPortal as nf}from"react-dom";import{jsx as Se,jsxs as It,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 Ei,mergeRegister as Si}from"@lexical/utils";import{getTranslation as Cr}from"@payloadcms/translations";import{CloseMenuIcon as Up,EditIcon as Wp,ExternalLinkIcon as Ni,formatDrawerSlug as Gp,useConfig as Vp,useEditDepth as Jp,useLocale as Kp,useTranslation as Xp}from"@payloadcms/ui";import{requests as zp}from"@payloadcms/ui/shared";import{$getSelection as Li,$isLineBreakNode as Zp,$isRangeSelection as yi,COMMAND_PRIORITY_HIGH as Yp,COMMAND_PRIORITY_LOW as Ri,getDOMSelection as qp,KEY_ESCAPE_COMMAND as Qp,SELECTION_CHANGE_COMMAND as ef}from"lexical";import{formatAdminURL as tf}from"payload/shared";import Ii,{useCallback as vi,useEffect as Co,useLayoutEffect as of,useRef as Mi,useState as Pe}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,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 xo=Pp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Di(t){t.preventDefault()}function $i({anchorElem:t}){let[e]=jp(),[o,r]=Pe(),n=Mi(null),l=Mi(null),[s,i]=Pe(null),[d,c]=Pe(null),{fieldProps:{schemaPath:u},uuid:a}=U(),m=Hp(),{config:p,getEntityConfig:h}=Vp(),{i18n:f,t:g}=Xp(),[T,w]=Pe(),L=Jp(),[_,b]=Pe(!1),[x,C]=Pe([]),k=Kp(),[v,I]=Pe(!1),y=Gp({slug:"lexical-rich-text-link-"+a,depth:L}),{toggleDrawer:S}=xe(y),E=vi(()=>{b(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),I(!1),i(null),c(null),C([]),w(void 0)},[b,i,c,C]),R=vi(()=>{let N=Li(),M;if(!yi(N)||!N){E();return}let $=Ye(N);M=e.getElementByKey($.getKey())?.getBoundingClientRect();let A=Ei($,K),F=N.getNodes().filter(de=>!Zp(de)).find(de=>{let Q=Ei(de,K);return A&&!A.is(Q)||Q&&!Q.is(A)});if(A==null||F){E();return}r(A);let P=A.getFields(),J={...P,id:A.getID(),text:A.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 de=P?.doc?.relationTo?h({collectionSlug:P?.doc?.relationTo}):void 0;if(!de)c(P?.label?String(P?.label):null),i(P?.url?String(P?.url):null);else{let Q=typeof P.doc?.value=="object"?P.doc.value.id:P.doc?.value,Y=P.doc?.relationTo;if(!Q||!Y)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let dt=g("fields:linkedTo",{label:`${Cr(de.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(dt),zp.get(tf({apiRoute:p.routes.api,path:`/${Y}/${Q}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:k?.code}}).then(async ne=>{if(!ne.ok)throw new Error(`HTTP error! Status: ${ne.status}`);let mt=await ne.json(),Vt=de?.admin?.useAsTitle||"id",Re=mt[Vt],Jt=g("fields:linkedTo",{label:`${Cr(de.labels.singular,f)} - ${Re}`}).replace(/<[^>]*>?/g,"");c(Jt)}).catch(()=>{let ne=g("fields:linkedTo",{label:`${Cr(de.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${Q}`}).replace(/<[^>]*>?/g,"");c(ne)})}}w(J),b(!0),C(N?N?.getNodes():[]),Ee(A)?I(!0):I(!1);let X=n.current,Ge=qp(e._window),{activeElement:Gt}=document;if(X===null)return;let ut=e.getRootElement();return Ge!==null&&ut!==null&&ut.contains(Ge.anchorNode)?(M||(M=Ge.getRangeAt(0).getBoundingClientRect()),M!=null&&(M.y+=40,l.current=M)):(Gt==null||Gt.className!=="link-input")&&(ut!==null&&go(null,X,t),i(null),c(null)),!0},[e,E,p.routes.admin,p.routes.api,p.serverURL,h,g,f,k?.code,t]);return Co(()=>Si(e.registerCommand(xo,N=>(e.dispatchCommand(pe,N),R(),S(),!0),Ri)),[e,R,S,y]),Co(()=>{let N=t.parentElement,M=()=>{e.getEditorState().read(()=>{R()})};return window.addEventListener("resize",M),N?.addEventListener("scroll",M),()=>{window.removeEventListener("resize",M),N?.removeEventListener("scroll",M)}},[t.parentElement,e,R]),Co(()=>Si(e.registerUpdateListener(({editorState:N})=>{N.read(()=>{R()})}),e.registerCommand(ef,()=>(R(),!0),Ri),e.registerCommand(Qp,()=>_?(E(),!0):!1,Yp)),[e,R,_,E]),Co(()=>{e.getEditorState().read(()=>{R()})},[e,R]),of(()=>{!_||!n.current||!t||!l.current||go(l.current,n.current,t)},[s,d,_,t,o]),It(Ii.Fragment,{children:[Se("div",{className:"link-editor",ref:n,children:It("div",{className:"link-input",children:[s&&s.length>0?It("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Se(Ni,{}):null,d!=null&&d.length>0?d:s]}):d!=null&&d.length>0?It(Bp,{children:[o?.__fields.newTab?Se(Ni,{}):null,Se("span",{className:"link-input__label-pure",children:d})]}):null,m&&It(Ii.Fragment,{children:[Se("button",{"aria-label":"Edit link",className:"link-edit",onClick:N=>{N.preventDefault(),S()},onMouseDown:Di,tabIndex:0,type:"button",children:Se(Wp,{})}),!v&&Se("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(pe,null)},onMouseDown:Di,tabIndex:0,type:"button",children:Se(Up,{})})]})]})}),Se(gt,{className:"lexical-link-edit-drawer",data:T,drawerSlug:y,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(N,M)=>{let $=M,A={...$};delete A.text,e.update(()=>{let F=Li(),P=null;if(yi(F)?P=Ye(F).getParent():x.length&&(P=x[0]?.getParent()??null),P&&Ee(P)){let J=Te({fields:A});P.replace(J,!0)}}),e.dispatchCommand(pe,{fields:A,selectedNodes:x,text:$.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Ai=t=>{let{anchorElem:e=document.body}=t;return nf(rf($i,{anchorElem:e}),e)};import{c as af}from"react/compiler-runtime";import{useLexicalComposerContext as cf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as uf}from"@lexical/utils";import{$getSelection as df,$isElementNode as mf,$isRangeSelection as pf,COMMAND_PRIORITY_LOW as Fi,PASTE_COMMAND as ff}from"lexical";import{useEffect as hf}from"react";var lf=/^(?:[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+)?$/,sf=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Oi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||lf.test(t)||sf.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}var Pi=t=>{let e=af(5),{clientProps:o}=t,[r]=cf(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return uf(r.registerCommand(pe,s=>s===null?(hr(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),hr(s),!0),Fi),r.registerCommand(ff,s=>{let i=df();if(!pf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!Oi(d))return!1;if(!i.getNodes().some(gf)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(pe,{fields:c,text:null}),s.preventDefault(),!0}return!1},Fi))},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]),hf(n,l),null};function gf(t){return mf(t)}var ji=[dr([{ChildComponent:ci,isActive:({selection:t})=>{if(Bi(t)){let e=Ye(t);return xf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(Bi(t)&&br()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(pe,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=br()?.getTextContent(),r=br()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(xo,{fields:n,selectedNodes:r,text:o})}},order:1}])],Cf=D(({props:t})=>({markdownTransformers:[pi],nodes:[oe,t?.disableAutoLinks===!0?null:we].filter(Boolean),plugins:[{Component:Pi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Ti,position:"normal"},{Component:wi,position:"normal"},{Component:Ai,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ji},toolbarInline:{groups:ji}}));import{$isListNode as Tr,INSERT_CHECK_LIST_COMMAND as Ji,ListItemNode as If,ListNode as vf}from"@lexical/list";import{$isRangeSelection as Mf}from"lexical";import{jsx as Hi,jsxs as bf}from"react/jsx-runtime";import"react";var kr=()=>bf("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:[Hi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Hi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as kf}from"react/jsx-runtime";import{ListPlugin as _f}from"@lexical/react/LexicalListPlugin.js";import"react";var qe=()=>kf(_f,{});function bo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function Qe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Sf,ListItemNode as Nf,ListNode as Lf}from"@lexical/list";import{$createListItemNode as Tf,$createListNode as wf,$isListItemNode as Ef,$isListNode as _r}from"@lexical/list";var Ui=4,et=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),s=Tf(t==="check"?r[3]==="x":void 0);if(_r(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(_r(n)&&n.getListType()===t)n.append(s),e.remove();else{let d=wf(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/Ui);i&&s.setIndent(i)},Be=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let s of n)if(Ef(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(_r(u)){r.push(Be(u,e,o+1));continue}}let i=" ".repeat(o*Ui),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 Wi={type:"element",dependencies:[Lf,Nf],export:(t,e)=>Sf(t)?Be(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:et("check")};import{jsx as yf}from"react/jsx-runtime";import{CheckListPlugin as Rf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Gi=()=>yf(Rf,{});var Vi=[te([{ChildComponent:kr,isActive:({selection:t})=>{if(!Mf(t))return!1;for(let e of t.getNodes()){if(Tr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Tr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Tr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ji,void 0)},order:12}])],Df=D(({featureProviderMap:t})=>{let e=[{Component:Gi,position:"normal"}],o=bo("checklist",t);return o&&e.push({Component:qe,position:"normal"}),{markdownTransformers:[Wi],nodes:o?[vf,If]:[],plugins:e,slashMenu:{groups:[Qe([{Icon:kr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(Ji,void 0)}}])]},toolbarFixed:{groups:Vi},toolbarInline:{groups:Vi}}});import{$isListNode as Er,INSERT_ORDERED_LIST_COMMAND as zi,ListItemNode as Pf,ListNode as Bf}from"@lexical/list";import{$isRangeSelection as jf}from"lexical";import{jsx as vt,jsxs as $f}from"react/jsx-runtime";import"react";var wr=()=>$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:[vt("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"}),vt("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"}),vt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Af,ListItemNode as Of,ListNode as Ff}from"@lexical/list";var Ki={type:"element",dependencies:[Ff,Of],export:(t,e)=>Af(t)?Be(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:et("number")};var Xi=[te([{ChildComponent:wr,isActive:({selection:t})=>{if(!jf(t))return!1;for(let e of t.getNodes()){if(Er(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Er(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Er(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(zi,void 0)},order:10}])],Hf=D(({featureProviderMap:t})=>{let e=bo("ordered",t);return{markdownTransformers:[Ki],nodes:e?[Bf,Pf]:[],plugins:e?[{Component:qe,position:"normal"}]:[],slashMenu:{groups:[Qe([{Icon:wr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(zi,void 0)}}])]},toolbarFixed:{groups:Xi},toolbarInline:{groups:Xi}}});import{$isListNode as Nr,INSERT_UNORDERED_LIST_COMMAND as qi,ListItemNode as Jf,ListNode as Kf}from"@lexical/list";import{$isRangeSelection as Xf}from"lexical";import{jsx as tt,jsxs as Uf}from"react/jsx-runtime";import"react";var Sr=()=>Uf("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:[tt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),tt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),tt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),tt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),tt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),tt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Wf,ListItemNode as Gf,ListNode as Vf}from"@lexical/list";var Zi={type:"element",dependencies:[Vf,Gf],export:(t,e)=>Wf(t)?Be(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:et("bullet")};var Yi=[te([{ChildComponent:Sr,isActive:({selection:t})=>{if(!Xf(t))return!1;for(let e of t.getNodes()){if(Nr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Nr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Nr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(qi,void 0)},order:11}])],zf=D({markdownTransformers:[Zi],nodes:[Kf,Jf],plugins:[{Component:qe,position:"normal"}],slashMenu:{groups:[Qe([{Icon:Sr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(qi,void 0)}}])]},toolbarFixed:{groups:Yi},toolbarInline:{groups:Yi}});import{jsx as Zf}from"react/jsx-runtime";import{addClassNamesToElement as Yf}from"@lexical/utils";import{$applyNodeReplacement as qf,DecoratorNode as Qf}from"lexical";import*as Qi from"react";var e0=Qi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Mt=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 t0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Yf(o,"unknownConverted"),o}decorate(){return Zf(e0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function t0({data:t}){return qf(new Mt({data:t}))}var o0=D(()=>({nodes:[Mt]}));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 es from"react";var s0=es.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Dt=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 Dt({data:t}))}var c0=D(()=>({nodes:[Dt]}));import{$setBlocksType as rs}from"@lexical/selection";import{$createParagraphNode as ns,$getSelection as ls,$isParagraphNode as ts,$isRangeSelection as u0}from"lexical";var os=[te([{ChildComponent:bt,isActive:({selection:t})=>{if(!u0(t))return!1;for(let e of t.getNodes())if(!ts(e)&&!ts(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ls();rs(e,()=>ns())})},order:1}])],d0=D({slashMenu:{groups:[z([{Icon:bt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ls();rs(e,()=>ns())})}}])]},toolbarFixed:{groups:os},toolbarInline:{groups:os}});import{c as $0}from"react/compiler-runtime";import{jsx as Ss}from"react/jsx-runtime";import{useLexicalComposerContext as A0}from"@lexical/react/LexicalComposerContext";import{useEffect as O0,useState as F0}from"react";import{jsx as Es,Fragment as D0}from"react/jsx-runtime";import"react";import{jsx as m0}from"react/jsx-runtime";var is={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return m0("blockquote",{children:o})}};import{jsx as p0}from"react/jsx-runtime";var ss={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return p0(r,{children:o})}};import{jsx as f0}from"react/jsx-runtime";var as={horizontalrule:f0("hr",{})};import{jsx as h0}from"react/jsx-runtime";var cs={linebreak:h0("br",{})};import{jsx as us}from"react/jsx-runtime";var ds=({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 us("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="#")),us("a",{href:s,rel:n,target:l,children:r})}});import{jsx as ot,jsxs as g0,Fragment as x0}from"react/jsx-runtime";import{v4 as C0}from"uuid";var ms={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return ot(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=C0();return ot("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:g0(x0,{children:[ot("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),ot("label",{htmlFor:l,children:n}),ot("br",{})]})})}else return ot("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as Lr}from"react/jsx-runtime";var ps={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Lr("p",{children:o}):Lr("p",{children:Lr("br",{})})}};var fs={tab:" "};import{jsx as $t}from"react/jsx-runtime";var hs={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return $t("div",{className:"lexical-table-container",children:$t("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:$t("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 $t(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 $t("tr",{className:"lexical-table-row",children:o})}};import{jsx as je}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},b0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,k0="\xA0",_0=`
54
+ `},[t,e]),p=Fe((_,b)=>{o(g=>{let C=e.length-1,k=e[C];if(k&&k.name===_){if(_==="type")return[...e.slice(0,C),{...k,value:k.value+b}];if(k.value===b)return[...e.slice(0,C),{...k,count:k.count+1}]}return[...g,{name:_,count:1,value:b}]})},[e,o]);Pn(()=>{let _=g=>{if(!r)return;let C=g.key;ud(g)?p("selectAll",""):jn.has(C)?p("press",g.key):[...C].length>1?p("keydown",g.key):p("type",g.key)},b=g=>{if(!r)return;let C=g.key;!jn.has(C)&&[...C].length>1&&p("keyup",g.key)};return t.registerRootListener((g,C)=>{C!==null&&(C.removeEventListener("keydown",_),C.removeEventListener("keyup",b)),g!==null&&(g.addEventListener("keydown",_),g.addEventListener("keyup",b))})},[t,r,p]),Pn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),Yo(()=>{if(e){let _=m();_!==null&&i(_),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),Yo(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:g,editorState:C})=>{if(!r)return;let k=C._selection,y=d.current,I=c.current;if(y!==k){if(g.size===0&&b.size===0&&!I){let N=Zo(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}d.current=k}c.current=!1;let v=m();v!==null&&i(v)}),[t,m,r,p]),Yo(()=>r?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,r]);let h=Fe(_=>{r||(_.update(()=>{let b=id();b.clear();let g=ld();b.append(nd().append(g)),g.select()}),o([])),n(b=>!b)},[r]),f=Fe(()=>{if(!r)return;let _=Zo(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:b,anchorOffset:g,focusNode:C,focusOffset:k}=dd(_),y=a().getRootElement(),I;b!==null&&(I=Bn(b,y));let v;C!==null&&(v=Bn(C,y)),p("snapshot",{anchorNode:b,anchorOffset:g,anchorPath:I,focusNode:C,focusOffset:k,focusPath:v})},[p,r,a]),x=Fe(()=>{sd(m())},[m]),T=Fe(()=>{ad("test.js",m())},[m]);return[Pe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{h(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Qo("div",{className:"test-recorder-output",children:[Qo("div",{className:"test-recorder-toolbar",children:[Pe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{f(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Pe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{x(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Pe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{T(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Pe("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var Un=()=>{let t=od(3),[e]=rd(),[o,r]=md(e),n;return t[0]!==o||t[1]!==r?(n=Qo(Hn.Fragment,{children:[Pe("p",{children:"HI"}),o,r,Pe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var pd=D({plugins:[{Component:Un,position:"bottom"}]});import{c as fd}from"react/compiler-runtime";import{jsx as hd}from"react/jsx-runtime";import{useLexicalComposerContext as gd}from"@lexical/react/LexicalComposerContext.js";import{TreeView as xd}from"@lexical/react/LexicalTreeView.js";import"react";var Wn=()=>{let t=fd(2),[e]=gd(),o;return t[0]!==e?(o=hd(xd,{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 Cd=D({plugins:[{Component:Wn,position:"bottom"}]});import{$isTableSelection as bd}from"@lexical/table";import{$isRangeSelection as kd,FORMAT_TEXT_COMMAND as _d}from"lexical";import{jsx as Gn}from"react/jsx-runtime";import"react";var Vn=()=>Gn("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:Gn("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 X=t=>({type:"buttons",items:t,key:"format",order:40});var Kn={type:"text-format",format:["bold","italic"],tag:"***"},Jn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},zn={type:"text-format",format:["bold"],tag:"**"},Xn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Zn=[X([{ChildComponent:Vn,isActive:({selection:t})=>kd(t)||bd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(_d,"bold")},order:1}])],Td=D(({featureProviderMap:t})=>{let e=[zn,Xn];return t.get("italic")&&e.push(Jn,Kn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Zn},toolbarInline:{groups:Zn}}});import{$isTableSelection as Ed}from"@lexical/table";import{$isRangeSelection as Sd,FORMAT_TEXT_COMMAND as Nd}from"lexical";import{jsx as Yn,jsxs as wd}from"react/jsx-runtime";import"react";var qn=()=>wd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Yn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Yn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Qn={type:"text-format",format:["code"],tag:"`"};var el=[X([{ChildComponent:qn,isActive:({selection:t})=>Sd(t)||Ed(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Nd,"code")},order:7}])],Ld=D({enableFormats:["code"],markdownTransformers:[Qn],toolbarFixed:{groups:el},toolbarInline:{groups:el}});import{$isTableSelection as yd}from"@lexical/table";import{$isRangeSelection as Rd,FORMAT_TEXT_COMMAND as Id}from"lexical";import{jsx as tl}from"react/jsx-runtime";import"react";var ol=()=>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:"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 rl={type:"text-format",format:["italic"],tag:"*"},nl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var ll=[X([{ChildComponent:ol,isActive:({selection:t})=>Rd(t)||yd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Id,"italic")},order:2}])],vd=D({enableFormats:["italic"],markdownTransformers:[rl,nl],toolbarFixed:{groups:ll},toolbarInline:{groups:ll}});import{$isTableSelection as Dd}from"@lexical/table";import{$isRangeSelection as $d,FORMAT_TEXT_COMMAND as Ad}from"lexical";import{jsx as il,jsxs as Md}from"react/jsx-runtime";import"react";var sl=()=>Md("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:[il("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"}),il("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var al={type:"text-format",format:["strikethrough"],tag:"~~"};var cl=[X([{ChildComponent:sl,isActive:({selection:t})=>$d(t)||Dd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Ad,"strikethrough")},order:4}])],Od=D({enableFormats:["strikethrough"],markdownTransformers:[al],toolbarFixed:{groups:cl},toolbarInline:{groups:cl}});import{$isTableSelection as Fd}from"@lexical/table";import{$isRangeSelection as Pd,FORMAT_TEXT_COMMAND as Bd}from"lexical";import{jsx as ul}from"react/jsx-runtime";import"react";var dl=()=>ul("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:ul("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 ml=[X([{ChildComponent:dl,isActive:({selection:t})=>Pd(t)||Fd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Bd,"subscript")},order:5}])],jd=D({enableFormats:["subscript"],toolbarFixed:{groups:ml},toolbarInline:{groups:ml}});import{$isTableSelection as Hd}from"@lexical/table";import{$isRangeSelection as Ud,FORMAT_TEXT_COMMAND as Wd}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:"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 hl=[X([{ChildComponent:fl,isActive:({selection:t})=>Ud(t)||Hd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Wd,"superscript")},order:6}])],Gd=D({enableFormats:["superscript"],toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{$isTableSelection as Kd}from"@lexical/table";import{$isRangeSelection as Jd,FORMAT_TEXT_COMMAND as zd}from"lexical";import{jsx as gl,jsxs as Vd}from"react/jsx-runtime";import"react";var xl=()=>Vd("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:"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"}),gl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Cl=[X([{ChildComponent:xl,isActive:({selection:t})=>Jd(t)||Kd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(zd,"underline")},order:3}])],Xd=D({enableFormats:["underline"],toolbarFixed:{groups:Cl},toolbarInline:{groups:Cl}});import{jsx as tr}from"react/jsx-runtime";import{jsx as Zd}from"react/jsx-runtime";function Yd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var so=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Yd(o),r])):{};return Zd("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 Qd}from"@lexical/selection";import{$getNodeByKey as em,$getState as tm,$setState as om,createState as rm,TextNode as nm}from"lexical";import{useEffect as lm}from"react";function bl(t){let e=new Map;for(let o in t){let r=t[o],n=rm(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function er(t,e,o,r){t.update(()=>{Qd(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);om(n,l.stateConfig,r)})})}function kl({stateMap:t}){let[e]=qd();return lm(()=>e.registerMutationListener(nm,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=em(r),s=e.getElementByKey(r);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=tm(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 _l=(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:()=>tr(so,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{er(d,e,n,s)}})}}return[{type:"dropdown",ChildComponent:()=>tr(so,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>tr(so,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)er(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},im=D(({props:t})=>{let e=bl(t.state);return{plugins:[{Component:()=>kl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:_l(t,e)},toolbarInline:{groups:_l(t,e)}}});import{c as um}from"react/compiler-runtime";import{useLexicalComposerContext as dm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as mm,$isHeadingNode as Al,HeadingNode as Pl}from"@lexical/rich-text";import{$setBlocksType as pm}from"@lexical/selection";import{$getSelection as fm,$isRangeSelection as hm}from"lexical";import{useEffect as gm}from"react";import{jsx as Tl}from"react/jsx-runtime";import"react";var wl=()=>Tl("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:Tl("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 El}from"react/jsx-runtime";import"react";var Sl=()=>El("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:El("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 Nl}from"react/jsx-runtime";import"react";var Ll=()=>Nl("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:Nl("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 yl}from"react/jsx-runtime";import"react";var Rl=()=>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("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 Il}from"react/jsx-runtime";import"react";var vl=()=>Il("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:Il("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 Ml}from"react/jsx-runtime";import"react";var Dl=()=>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:"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 sm,$isHeadingNode as am,HeadingNode as cm}from"@lexical/rich-text";var or=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var $l=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(!am(n))return null;let s=Number(n.getTag().slice(1));return"#".repeat(s)+" "+l(n)},regExp:r,replace:or(n=>{let l="h"+n[1]?.length;return sm(l)})}};var Ol=t=>{let e=fm();pm(e,()=>mm(t))},Fl={h1:wl,h2:Sl,h3:Ll,h4:Rl,h5:vl,h6:Dl},xm=D(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((r,n)=>({ChildComponent:Fl[r],isActive:({selection:l})=>{if(!hm(l))return!1;for(let s of l.getNodes()){if(Al(s)&&s.getTag()===r)continue;let i=s.getParent();if(!(Al(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(()=>{Ol(r)})},order:n+2})))];return{markdownTransformers:[$l(e)],nodes:[Pl],plugins:[{Component:Cm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:Fl[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(()=>{Ol(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),Cm=t=>{let e=um(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]=dm(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(Pl,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]),gm(c,u),null};import{$isNodeSelection as $m}from"lexical";import{jsx as Bl}from"react/jsx-runtime";import"react";var rr=()=>Bl("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:Bl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as jl,jsxs as bm}from"react/jsx-runtime";import"react";var Hl=()=>bm("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[jl("path",{d:"M5 10h10",stroke:"currentColor"}),jl("path",{d:"M10 15V5",stroke:"currentColor"})]});var ke=t=>({type:"dropdown",ChildComponent:Hl,items:t,key:"add",order:10});import{addClassNamesToElement as km}from"@lexical/utils";import{$applyNodeReplacement as _m,createCommand as Tm,DecoratorNode as wm}from"lexical";var Lt=Tm("INSERT_HORIZONTAL_RULE_COMMAND"),Nt=class extends wm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Em,priority:0})}}static importJSON(e){return Ul()}createDOM(e){let o=document.createElement("hr");return km(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function Em(){return{node:Ul()}}function Ul(){return _m(new Nt)}import{$applyNodeReplacement as Sm}from"lexical";import"react";var _e=class extends Nt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return qe()}decorate(){return null}exportJSON(){return super.exportJSON()}};function qe(){return Sm(new _e)}function yt(t){return t instanceof _e}var Wl={type:"element",dependencies:[_e],export:(t,e)=>yt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=qe();e&&t.replace(e)}};import{c as Nm}from"react/compiler-runtime";import{useLexicalComposerContext as Lm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ym}from"@lexical/utils";import{$getSelection as Rm,$isRangeSelection as Im,COMMAND_PRIORITY_EDITOR as vm}from"lexical";import{useEffect as Mm}from"react";var Gl=()=>{let t=Nm(3),[e]=Lm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Lt,Dm,vm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Mm(o,r),null};function Dm(t){let e=Rm();if(!Im(e))return!1;if(e.focus.getNode()!==null){let r=qe();ym(r)}return!0}var Am=D({markdownTransformers:[Wl],nodes:[_e],plugins:[{Component:Gl,position:"normal"}],slashMenu:{groups:[z([{Icon:rr,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,void 0)}}])]},toolbarFixed:{groups:[ke([{ChildComponent:rr,isActive:({selection:t})=>{if(!$m(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return yt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,void 0)}}])]}});import{$findMatchingParent as ei}from"@lexical/utils";import{$isElementNode as zm,INDENT_CONTENT_COMMAND as Xm,OUTDENT_CONTENT_COMMAND as Zm}from"lexical";import{jsx as ao,jsxs as Om}from"react/jsx-runtime";import"react";var Vl=()=>Om("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ao("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as co,jsxs as Fm}from"react/jsx-runtime";import"react";var Kl=()=>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:[co("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Pm}from"react/jsx-runtime";import{useLexicalComposerContext as Bm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as jm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Hm,mergeRegister as Jl}from"@lexical/utils";import{$getSelection as Um,$isElementNode as Yl,$isRangeSelection as Wm,COMMAND_PRIORITY_LOW as zl,INDENT_CONTENT_COMMAND as Xl,KEY_TAB_COMMAND as Gm,OUTDENT_CONTENT_COMMAND as Vm,TabNode as Km}from"lexical";import{useEffect as Zl}from"react";var ql=({clientProps:t})=>{let[e]=Bm(),{disabledNodes:o,disableTabNode:r}=t;return Zl(()=>{if(!(!e||!o?.length))return Jl(e.registerCommand(Xl,()=>Jm(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),zl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[s]of n){let i=l._nodeMap.get(s);Yl(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),Zl(()=>{if(!(!e||!r))return Jl(e.registerCommand(Gm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Vm:Xl,void 0)),zl),e.registerNodeTransform(Km,n=>{n.remove()}))},[e,r]),Pm(jm,{})};function Jm(t){let e=Um();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=Hm(l,c=>Yl(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 Ql=t=>({type:"buttons",items:t,key:"indent",order:35});var ti=({disabledNodes:t})=>[Ql([{ChildComponent:Vl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>oi(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ei(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Zm,void 0)},order:1},{ChildComponent:Kl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>oi(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ei(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Xm,void 0)},order:2}])],Ym=D(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ql,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:ti({disabledNodes:e})},toolbarInline:{groups:ti({disabledNodes:e})}}}),oi=t=>zm(t)&&t.canIndent();import{$findMatchingParent as mf}from"@lexical/utils";import{$getSelection as mr,$isRangeSelection as $i}from"lexical";import{jsx as ri}from"react/jsx-runtime";import"react";var ni=()=>ri("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:ri("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 li}from"@lexical/selection";function Qe(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?li(o)?r:n:li(e)?r:n}var nr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as ap}from"lexical";import{addClassNamesToElement as qm,isHTMLAnchorElement as Qm}from"@lexical/utils";import sr from"bson-objectid";import{$applyNodeReplacement as ep,$createTextNode as ii,$getSelection as tp,$isElementNode as si,$isRangeSelection as ir,createCommand as op,ElementNode as rp}from"lexical";var np=new Set(["http:","https:","mailto:","sms:","tel:"]),te=class extends rp{__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:lp,priority:1})}}static importJSON(e){let o=Te({}).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 sr.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=lr(o.rel,"add","noopener")),qm(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(!ir(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(si(r)){let n=Te({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!np.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=lr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=lr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function lp(t){let e=null;if(Qm(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new sr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Te({id:t,fields:e}){return ep(new te({id:t??new sr.default().toHexString(),fields:e}))}function J(t){return t instanceof te}var ue=op("TOGGLE_LINK_COMMAND");function ar(t){let e=tp();if(!ir(e)&&(t===null||!t.selectedNodes?.length))return;let o=ir(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();J(s)&&(s.getChildren().forEach(d=>{s.insertBefore(d)}),s.remove())});return}if(o?.length===1){let l=o[0],s=J(l)?l:ip(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(ii(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||si(l)&&!l.isInline())){if(J(s)){n=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(ii(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(r)||(r=s,n=Te({fields:t.fields}),J(s)?l.getPreviousSibling()===null?s.insertBefore(n):s.insertAfter(n):l.insertBefore(n)),J(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 ip(t){return sp(t,e=>J(e))}function sp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function lr(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 ai={type:"text-match",dependencies:[te],export:(t,e)=>{if(!J(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=ap(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as cp,$isElementNode as up}from"lexical";var we=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=Rt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(up(r)){let n=Rt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Rt({fields:t}){return cp(new we({id:"",fields:t}))}function Ee(t){return t instanceof we}import{c as dp}from"react/compiler-runtime";import{useLexicalComposerContext as mp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as pp}from"@lexical/utils";import{$createTextNode as ci,$getSelection as fp,$isElementNode as di,$isLineBreakNode as mi,$isNodeSelection as hp,$isRangeSelection as gp,$isTextNode as It,TextNode as xp}from"lexical";import{useEffect as Cp}from"react";function ui(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 pi(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var bp=/[.,;\s]/;function mo(t){return t!==void 0&&bp.test(t)}function fi(t){return mo(t[t.length-1])}function ur(t){return mo(t[0])}function kp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function hi(t){let e=t.getPreviousSibling();return di(e)&&(e=e.getLastDescendant()),e===null||mi(e)||It(e)&&fi(e.getTextContent())}function gi(t){let e=t.getNextSibling();return di(e)&&(e=e.getFirstDescendant()),e===null||mi(e)||It(e)&&ur(e.getTextContent())}function _p(t,e,o,r){return(t>0?mo(o[t-1]):hi(r[0]))?e<o.length?mo(o[e]):gi(r[r.length-1]):!1}function Tp(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 wp(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Rt({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=ci(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[x,T]=a.splitText(o-h);x&&c.push(x),u=T}i+=p}),d){let a=fp(),m=a?a.getNodes().find(It):void 0,p=ci(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(gp(a)?p.select(a.anchor.offset,a.focus.offset):hp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function Ep(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,s,i=0;for(;(s=pi(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]=Tp(r,i+d,i+u),f=i+d-m,x=i+u-m,T=wp(p,f,x,s);r=T?[T,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function cr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!It(c)||!c.isSimpleText()){uo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=pi(l,e);if(s===null||s.text!==l){uo(t),o(null,t.getFields()?.url??null);return}if(!hi(t)||!gi(t)){uo(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 Sp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(Ee(r)){let s=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!ur(l)||kp(l,s))&&(r.append(t),cr(r,e,o),o(null,r.getFields()?.url??null))}Ee(n)&&!fi(l)&&(uo(n),cr(n,e,o),o(null,n.getFields()?.url??null))}function uo(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 Np(t){let e=[t],o=t.getNextSibling();for(;o!==null&&It(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Lp(t,e,o){let r=dp(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([we]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return pp(t.registerNodeTransform(xp,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(Ee(d))cr(d,e,s);else if(!J(d)){if(i.isSimpleText()&&(ur(i.getTextContent())||!Ee(c))){let u=Np(i);Ep(u,e,s)}Sp(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]),Cp(n,l)}var yp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Rp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ip=[ui(yp,t=>t.startsWith("http")?t:`https://${t}`),ui(Rp,t=>`mailto:${t}`)],xi=()=>{let[t]=mp();return Lp(t,Ip),null};import{jsx as vp}from"react/jsx-runtime";import{ClickableLinkPlugin as Mp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ci=()=>vp(Mp,{});import{jsx as qp}from"react/jsx-runtime";import"react";import{createPortal as Qp}from"react-dom";import{jsx as Se,jsxs as vt,Fragment as $p}from"react/jsx-runtime";import{useLexicalComposerContext as Ap}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Op}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as bi,mergeRegister as ki}from"@lexical/utils";import{getTranslation as dr}from"@payloadcms/translations";import{CloseMenuIcon as Fp,EditIcon as Pp,ExternalLinkIcon as _i,formatDrawerSlug as Bp,useConfig as jp,useEditDepth as Hp,useLocale as Up,useTranslation as Wp}from"@payloadcms/ui";import{requests as Gp}from"@payloadcms/ui/shared";import{$getSelection as Ti,$isLineBreakNode as Vp,$isRangeSelection as wi,COMMAND_PRIORITY_HIGH as Kp,COMMAND_PRIORITY_LOW as Ei,getDOMSelection as Jp,KEY_ESCAPE_COMMAND as zp,SELECTION_CHANGE_COMMAND as Xp}from"lexical";import{formatAdminURL as Zp}from"payload/shared";import Si,{useCallback as Ni,useEffect as ho,useLayoutEffect as Yp,useRef as Li,useState as Be}from"react";function po(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 Dp}from"lexical";var fo=Dp("TOGGLE_LINK_WITH_MODAL_COMMAND");function yi(t){t.preventDefault()}function Ri({anchorElem:t}){let[e]=Ap(),[o,r]=Be(),n=Li(null),l=Li(null),[s,i]=Be(null),[d,c]=Be(null),{fieldProps:{schemaPath:u},uuid:a}=U(),m=Op(),{config:p,getEntityConfig:h}=jp(),{i18n:f,t:x}=Wp(),[T,E]=Be(),S=Hp(),[_,b]=Be(!1),[g,C]=Be([]),k=Up(),[y,I]=Be(!1),v=Bp({slug:"lexical-rich-text-link-"+a,depth:S}),{toggleDrawer:N}=ge(v),w=Ni(()=>{b(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),I(!1),i(null),c(null),C([]),E(void 0)},[b,i,c,C]),R=Ni(()=>{let L=Ti(),M;if(!wi(L)||!L){w();return}let $=Qe(L);M=e.getElementByKey($.getKey())?.getBoundingClientRect();let A=bi($,J),F=L.getNodes().filter(W=>!Vp(W)).find(W=>{let le=bi(W,J);return A&&!A.is(le)||le&&!le.is(A)});if(A==null||F){w();return}r(A);let P=A.getFields(),Z={...P,id:A.getID(),text:A.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 W=P?.doc?.relationTo?h({collectionSlug:P?.doc?.relationTo}):void 0;if(!W)c(P?.label?String(P?.label):null),i(P?.url?String(P?.url):null);else{let le=typeof P.doc?.value=="object"?P.doc.value.id:P.doc?.value,he=P.doc?.relationTo;if(!le||!he)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let pt=x("fields:linkedTo",{label:`${dr(W.labels.singular,f)} - ${x("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(pt),Gp.get(Zp({apiRoute:p.routes.api,path:`/${he}/${le}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:k?.code}}).then(async Re=>{if(!Re.ok)throw new Error(`HTTP error! Status: ${Re.status}`);let Ie=await Re.json(),Vt=W?.admin?.useAsTitle||"id",Ve=Ie[Vt],Ke=x("fields:linkedTo",{label:`${dr(W.labels.singular,f)} - ${Ve}`}).replace(/<[^>]*>?/g,"");c(Ke)}).catch(()=>{let Re=x("fields:linkedTo",{label:`${dr(W.labels.singular,f)} - ${x("general:untitled",f)} - ID: ${le}`}).replace(/<[^>]*>?/g,"");c(Re)})}}E(Z),b(!0),C(L?L?.getNodes():[]),Ee(A)?I(!0):I(!1);let Y=n.current,mt=Jp(e._window),{activeElement:Ao}=document;if(Y===null)return;let fe=e.getRootElement();return mt!==null&&fe!==null&&fe.contains(mt.anchorNode)?(M||(M=mt.getRangeAt(0).getBoundingClientRect()),M!=null&&(M.y+=40,l.current=M)):(Ao==null||Ao.className!=="link-input")&&(fe!==null&&po(null,Y,t),i(null),c(null)),!0},[e,w,p.routes.admin,p.routes.api,p.serverURL,h,x,f,k?.code,t]);return ho(()=>ki(e.registerCommand(fo,L=>(e.dispatchCommand(ue,L),R(),N(),!0),Ei)),[e,R,N,v]),ho(()=>{let L=t.parentElement,M=()=>{e.getEditorState().read(()=>{R()})};return window.addEventListener("resize",M),L?.addEventListener("scroll",M),()=>{window.removeEventListener("resize",M),L?.removeEventListener("scroll",M)}},[t.parentElement,e,R]),ho(()=>ki(e.registerUpdateListener(({editorState:L})=>{L.read(()=>{R()})}),e.registerCommand(Xp,()=>(R(),!0),Ei),e.registerCommand(zp,()=>_?(w(),!0):!1,Kp)),[e,R,_,w]),ho(()=>{e.getEditorState().read(()=>{R()})},[e,R]),Yp(()=>{!_||!n.current||!t||!l.current||po(l.current,n.current,t)},[s,d,_,t,o]),vt(Si.Fragment,{children:[Se("div",{className:"link-editor",ref:n,children:vt("div",{className:"link-input",children:[s&&s.length>0?vt("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?vt($p,{children:[o?.__fields.newTab?Se(_i,{}):null,Se("span",{className:"link-input__label-pure",children:d})]}):null,m&&vt(Si.Fragment,{children:[Se("button",{"aria-label":"Edit link",className:"link-edit",onClick:L=>{L.preventDefault(),N()},onMouseDown:yi,tabIndex:0,type:"button",children:Se(Pp,{})}),!y&&Se("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ue,null)},onMouseDown:yi,tabIndex:0,type:"button",children:Se(Fp,{})})]})]})}),Se(xt,{className:"lexical-link-edit-drawer",data:T,drawerSlug:v,drawerTitle:x("fields:editLink"),featureKey:"link",handleDrawerSubmit:(L,M)=>{let $=M,A={...$};delete A.text,e.update(()=>{let F=Ti(),P=null;if(wi(F)?P=Qe(F).getParent():g.length&&(P=g[0]?.getParent()??null),P&&Ee(P)){let Z=Te({fields:A});P.replace(Z,!0)}}),e.dispatchCommand(ue,{fields:A,selectedNodes:g,text:$.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Ii=t=>{let{anchorElem:e=document.body}=t;return Qp(qp(Ri,{anchorElem:e}),e)};import{c as of}from"react/compiler-runtime";import{useLexicalComposerContext as rf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as nf}from"@lexical/utils";import{$getSelection as lf,$isElementNode as sf,$isRangeSelection as af,COMMAND_PRIORITY_LOW as Mi,PASTE_COMMAND as cf}from"lexical";import{useEffect as uf}from"react";var ef=/^(?:[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+)?$/,tf=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function vi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||ef.test(t)||tf.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}var Di=t=>{let e=of(5),{clientProps:o}=t,[r]=rf(),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 nf(r.registerCommand(ue,s=>s===null?(ar(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),ar(s),!0),Mi),r.registerCommand(cf,s=>{let i=lf();if(!af(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!vi(d))return!1;if(!i.getNodes().some(df)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ue,{fields:c,text:null}),s.preventDefault(),!0}return!1},Mi))},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]),uf(n,l),null};function df(t){return sf(t)}var Ai=[nr([{ChildComponent:ni,isActive:({selection:t})=>{if($i(t)){let e=Qe(t);return mf(e,J)!=null}return!1},isEnabled:({selection:t})=>!!($i(t)&&mr()?.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=mr()?.getTextContent(),r=mr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(fo,{fields:n,selectedNodes:r,text:o})}},order:1}])],pf=D(({props:t})=>({markdownTransformers:[ai],nodes:[te,t?.disableAutoLinks===!0?null:we].filter(Boolean),plugins:[{Component:Di,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:xi,position:"normal"},{Component:Ci,position:"normal"},{Component:Ii,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ai},toolbarInline:{groups:Ai}}));import{$isListNode as hr,INSERT_CHECK_LIST_COMMAND as Hi,ListItemNode as Sf,ListNode as Nf}from"@lexical/list";import{$isRangeSelection as Lf}from"lexical";import{jsx as Oi,jsxs as ff}from"react/jsx-runtime";import"react";var pr=()=>ff("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Oi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Oi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as hf}from"react/jsx-runtime";import{ListPlugin as gf}from"@lexical/react/LexicalListPlugin.js";import"react";var et=()=>hf(gf,{});function go(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function tt(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as kf,ListItemNode as _f,ListNode as Tf}from"@lexical/list";import{$createListItemNode as xf,$createListNode as Cf,$isListItemNode as bf,$isListNode as fr}from"@lexical/list";var Fi=4,ot=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),s=xf(t==="check"?r[3]==="x":void 0);if(fr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(fr(n)&&n.getListType()===t)n.append(s),e.remove();else{let d=Cf(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/Fi);i&&s.setIndent(i)},je=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let s of n)if(bf(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(fr(u)){r.push(je(u,e,o+1));continue}}let i=" ".repeat(o*Fi),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 Pi={type:"element",dependencies:[Tf,_f],export:(t,e)=>kf(t)?je(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:ot("check")};import{jsx as wf}from"react/jsx-runtime";import{CheckListPlugin as Ef}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Bi=()=>wf(Ef,{});var ji=[ee([{ChildComponent:pr,isActive:({selection:t})=>{if(!Lf(t))return!1;for(let e of t.getNodes()){if(hr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(hr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(hr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Hi,void 0)},order:12}])],yf=D(({featureProviderMap:t})=>{let e=[{Component:Bi,position:"normal"}],o=go("checklist",t);return o&&e.push({Component:et,position:"normal"}),{markdownTransformers:[Pi],nodes:o?[Nf,Sf]:[],plugins:e,slashMenu:{groups:[tt([{Icon:pr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(Hi,void 0)}}])]},toolbarFixed:{groups:ji},toolbarInline:{groups:ji}}});import{$isListNode as xr,INSERT_ORDERED_LIST_COMMAND as Gi,ListItemNode as Df,ListNode as $f}from"@lexical/list";import{$isRangeSelection as Af}from"lexical";import{jsx as Mt,jsxs as Rf}from"react/jsx-runtime";import"react";var gr=()=>Rf("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:[Mt("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"}),Mt("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"}),Mt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as If,ListItemNode as vf,ListNode as Mf}from"@lexical/list";var Ui={type:"element",dependencies:[Mf,vf],export:(t,e)=>If(t)?je(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:ot("number")};var Wi=[ee([{ChildComponent:gr,isActive:({selection:t})=>{if(!Af(t))return!1;for(let e of t.getNodes()){if(xr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(xr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(xr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)},order:10}])],Of=D(({featureProviderMap:t})=>{let e=go("ordered",t);return{markdownTransformers:[Ui],nodes:e?[$f,Df]:[],plugins:e?[{Component:et,position:"normal"}]:[],slashMenu:{groups:[tt([{Icon:gr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Gi,void 0)}}])]},toolbarFixed:{groups:Wi},toolbarInline:{groups:Wi}}});import{$isListNode as br,INSERT_UNORDERED_LIST_COMMAND as Ji,ListItemNode as Hf,ListNode as Uf}from"@lexical/list";import{$isRangeSelection as Wf}from"lexical";import{jsx as rt,jsxs as Ff}from"react/jsx-runtime";import"react";var Cr=()=>Ff("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:[rt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),rt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),rt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),rt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),rt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),rt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Pf,ListItemNode as Bf,ListNode as jf}from"@lexical/list";var Vi={type:"element",dependencies:[jf,Bf],export:(t,e)=>Pf(t)?je(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:ot("bullet")};var Ki=[ee([{ChildComponent:Cr,isActive:({selection:t})=>{if(!Wf(t))return!1;for(let e of t.getNodes()){if(br(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(br(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(br(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ji,void 0)},order:11}])],Gf=D({markdownTransformers:[Vi],nodes:[Uf,Hf],plugins:[{Component:et,position:"normal"}],slashMenu:{groups:[tt([{Icon:Cr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ji,void 0)}}])]},toolbarFixed:{groups:Ki},toolbarInline:{groups:Ki}});import{jsx as Vf}from"react/jsx-runtime";import{addClassNamesToElement as Kf}from"@lexical/utils";import{$applyNodeReplacement as Jf,DecoratorNode as zf}from"lexical";import*as zi from"react";var Xf=zi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Dt=class extends zf{__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 Zf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Kf(o,"unknownConverted"),o}decorate(){return Vf(Xf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Zf({data:t}){return Jf(new Dt({data:t}))}var Yf=D(()=>({nodes:[Dt]}));import{jsx as qf}from"react/jsx-runtime";import{addClassNamesToElement as Qf}from"@lexical/utils";import{$applyNodeReplacement as e0,DecoratorNode as t0}from"lexical";import*as Xi from"react";var o0=Xi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),$t=class extends t0{__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 r0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Qf(o,"unknownConverted"),o}decorate(){return qf(o0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function r0({data:t}){return e0(new $t({data:t}))}var n0=D(()=>({nodes:[$t]}));import{$setBlocksType as qi}from"@lexical/selection";import{$createParagraphNode as Qi,$getSelection as es,$isParagraphNode as Zi,$isRangeSelection as l0}from"lexical";var Yi=[ee([{ChildComponent:kt,isActive:({selection:t})=>{if(!l0(t))return!1;for(let e of t.getNodes())if(!Zi(e)&&!Zi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=es();qi(e,()=>Qi())})},order:1}])],i0=D({slashMenu:{groups:[z([{Icon:kt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=es();qi(e,()=>Qi())})}}])]},toolbarFixed:{groups:Yi},toolbarInline:{groups:Yi}});import{c as L0}from"react/compiler-runtime";import{jsx as ks}from"react/jsx-runtime";import{useLexicalComposerContext as y0}from"@lexical/react/LexicalComposerContext";import{useEffect as R0,useState as I0}from"react";import{jsx as bs,Fragment as N0}from"react/jsx-runtime";import"react";import{jsx as s0}from"react/jsx-runtime";var ts={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return s0("blockquote",{children:o})}};import{jsx as a0}from"react/jsx-runtime";var os={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return a0(r,{children:o})}};import{jsx as c0}from"react/jsx-runtime";var rs={horizontalrule:c0("hr",{})};import{jsx as u0}from"react/jsx-runtime";var ns={linebreak:u0("br",{})};import{jsx as ls}from"react/jsx-runtime";var is=({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 ls("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="#")),ls("a",{href:s,rel:n,target:l,children:r})}});import{jsx as nt,jsxs as d0,Fragment as m0}from"react/jsx-runtime";import{v4 as p0}from"uuid";var ss={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return nt(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=p0();return nt("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:d0(m0,{children:[nt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),nt("label",{htmlFor:l,children:n}),nt("br",{})]})})}else return nt("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as kr}from"react/jsx-runtime";var as={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?kr("p",{children:o}):kr("p",{children:kr("br",{})})}};var cs={tab:" "};import{jsx as At}from"react/jsx-runtime";var us={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 He}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},f0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,h0="\xA0",g0=`
57
57
 
58
- `,gs="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",xs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",T0=new RegExp("^[^"+xs+"]*["+gs+"]"),w0=new RegExp("^[^"+gs+"]*["+xs+"]"),E0={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},S0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},N0={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},L0={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},y0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},R0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Cs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=je("strong",{children:e})),t.format&O.IS_ITALIC&&(e=je("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=je("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=je("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=je("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=je("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=je("sup",{children:e})),e}};import{jsx as At}from"react/jsx-runtime";var bs={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 At("a",{href:n,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return At("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(At("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(At("img",{alt:r,height:o?.height,src:n,width:o?.width},"image")),At("picture",{children:l})}};var rt={...ps,...Cs,...cs,...is,...hs,...ss,...as,...ms,...ds({}),...bs,...fs};import{jsx as _o,Fragment as I0}from"react/jsx-runtime";import ko from"react";function ks(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 v0(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 _s(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,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 M0(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]=_s(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]=_s(i))}continue}let n=r;(n.Component||n.html)&&(e[o]=v0(n))}return e}function Ts({converters:t,data:e,disableIndent:o,disableTextAlign:r,nodeMap:n}){if(ks(e)){let l=n?{...t,...M0(n)}:t;return ws({converters:l,disableIndent:o,disableTextAlign:r,nodes:e.root.children,parent:e.root})}return _o(I0,{})}function ws({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=>ws({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 yr({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:rt}):i=e:i=rt;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Ts({converters:i,data:o,disableIndent:n,disableTextAlign:l,nodeMap:s});return r?Es(D0,{children:d}):Es("div",{className:t??"payload-richtext",children:d})}function Ns(){let t=$0(7),[e]=A0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=F0(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]),O0(l,s);let i;return t[5]!==r?(i=Ss("div",{className:"debug-jsx-converter",children:Ss(yr,{converters:rt,data:r})}),t[5]=r,t[6]=i):i=t[6],i}var P0=D({plugins:[{Component:Ns,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)"}},B0={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 L1}from"lexical";import{jsx as Ot,jsxs as j0}from"react/jsx-runtime";import"react";var Rr=()=>j0("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:[Ot("g",{clipPath:"url(#clip0_4397_10817)",children:Ot("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"})}),Ot("defs",{children:Ot("clipPath",{id:"clip0_4397_10817",children:Ot("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as V0}from"react/jsx-runtime";import{$applyNodeReplacement as J0}from"lexical";import*as ys from"react";import{DecoratorBlockNode as H0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as U0}from"@lexical/utils";import{$applyNodeReplacement as W0}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:Ls({relationTo:o,value:e})}:null}var Ft=class extends H0{__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=Ls(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return U0(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 Ls(t){return W0(new Ft({data:t}))}var K0=ys.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function X0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:He({relationTo:o,value:e})}:null}var Ne=class extends Ft{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:X0,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=He(o);return r.setFormat(e.format),r}decorate(e,o){return V0(K0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function He(t){return J0(new Ne({data:t}))}function Ir(t){return t instanceof Ne}import{c as h1}from"react/compiler-runtime";import{jsx as g1}from"react/jsx-runtime";import{useLexicalComposerContext as x1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as C1}from"@lexical/utils";import{$getPreviousSelection as b1,$getSelection as k1,$isParagraphNode as _1,$isRangeSelection as T1,COMMAND_PRIORITY_EDITOR as w1,createCommand as E1}from"lexical";import{useEffect as S1}from"react";import{c as vs}from"react/compiler-runtime";import{jsx as vr}from"react/jsx-runtime";import{useLexicalComposerContext as Ms}from"@lexical/react/LexicalComposerContext.js";import{toast as i1}from"@payloadcms/ui";import{$getNodeByKey as s1,COMMAND_PRIORITY_EDITOR as Ds}from"lexical";import{useEffect as $s,useState as a1}from"react";import{c as z0}from"react/compiler-runtime";import{jsx as Z0}from"react/jsx-runtime";import{useLexicalComposerContext as Y0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as q0,useModal as Q0}from"@payloadcms/ui";import{$getNodeByKey as Rs,$getPreviousSelection as e1,$getRoot as t1,$getSelection as o1,$isRangeSelection as r1,$setSelection as n1}from"lexical";import{useEffect as l1,useState as Is}from"react";var Pt=t=>{let e=z0(23),[o]=Y0(),[r,n]=Is(null),[l,s]=Is(!1),[i,d,c]=q0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=Q0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let I=o1()??e1();n(I)},e[0]=f):f=e[0];let g=f,T;e[1]!==o||e[2]!==r?(T=()=>{r&&o.update(()=>{if(r1(r)){let{anchor:I,focus:y}=r;Rs(I.key)&&Rs(y.key)&&n1(r.clone())}else t1().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=T):T=e[3];let w=T,L;e[4]!==u?(L=()=>{u()},e[4]=u,e[5]=L):L=e[5];let _=L,b,x;e[6]!==a||e[7]!==h||e[8]!==w||e[9]!==l?(b=()=>{if(!l)return;let I=h[a];I&&!I?.isOpen&&(s(!1),setTimeout(()=>{w()},1))},x=[h,a,w,l],e[6]=a,e[7]=h,e[8]=w,e[9]=l,e[10]=b,e[11]=x):(b=e[10],x=e[11]),l1(b,x);let C;e[12]!==d?(C=I=>Z0(d,{...I,onClick:()=>{g()}}),e[12]=d,e[13]=C):C=e[13];let k;e[14]!==p?(k=()=>{g(),p(),s(!0)},e[14]=p,e[15]=k):k=e[15];let v;return e[16]!==i||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==C||e[21]!==k?(v={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:C,openListDrawer:k},e[16]=i,e[17]=_,e[18]=m,e[19]=a,e[20]=C,e[21]=k,e[22]=v):v=e[22],v};var c1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=s1(o);n&&n.replace(He({relationTo:e,value:r}))}):t.dispatchCommand(Mr,{relationTo:e,value:r})},u1=t=>{let e=vs(14),{enabledCollectionSlugs:o}=t,[r]=Ms(),[n,l]=a1(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}=Pt(i),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Je,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),Ds),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),$s(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=g=>{let{collectionSlug:T,doc:w}=g;c1({editor:r,relationTo:T,replaceNodeKey:n,value:w.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=vr(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},d1=()=>{let t=vs(3),[e]=Ms(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Je,m1,Ds),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),$s(o,r),null},As=({enabledCollectionSlugs:t})=>t?.length?vr(u1,{enabledCollectionSlugs:t}):vr(d1,{});function m1(){return i1.error("No relationship collections enabled"),!0}import{useConfig as p1,useEntityVisibility as f1}from"@payloadcms/ui";import*as Os from"react";var To=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=p1(),{visibleEntities:l}=f1();return Os.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 Mr=E1("INSERT_RELATIONSHIP_COMMAND"),Fs=t=>{let e=h1(8),{clientProps:o}=t,[r]=x1(),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([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Mr,N1,w1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),S1(d,c);let u;return e[6]!==i?(u=g1(As,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function N1(t){let e=k1()||b1();if(T1(e)){let o=He(t),{focus:r}=e,n=r.getNode();C1(o),_1(n)&&!n.__first&&n.remove()}return!0}var y1=D({nodes:[Ne],plugins:[{Component:Fs,position:"normal"}],slashMenu:{groups:[z([{Icon:Rr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Rr,isActive:({selection:t})=>{if(!L1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ir(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]}});import{c as Js}from"react/compiler-runtime";import{jsx as ce,jsxs as th}from"react/jsx-runtime";import{useLexicalComposerContext as oh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ks}from"@lexical/react/useLexicalEditable";import{useScrollInfo as rh,useThrottledEffect as nh,useTranslation as lh}from"@payloadcms/ui";import*as Le from"react";import{useMemo as ih}from"react";import{c as R1}from"react/compiler-runtime";import{jsx as I1}from"react/jsx-runtime";import{mergeRegister as v1}from"@lexical/utils";import{$addUpdateTag as M1,$getSelection as D1}from"lexical";import{useDeferredValue as $1,useEffect as A1,useState as O1}from"react";var Ps="toolbar-popup__button",Bt=t=>{let e=R1(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[s,i]=O1(l),d=$1(s),c=U(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Ps}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Ps,u,a,m].filter(Boolean),e[1]=u,e[2]=a,e[3]=m,e[4]=p):p=e[4];let h=p.join(" "),f;e[5]!==r||e[6]!==c||e[7]!==n?(f=()=>{r.getEditorState().read(()=>{let k=D1();if(!k)return;let v=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:k}):!1,I=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:k}):!0;i(y=>y.active===v&&y.enabled===I?y:{active:v,enabled:I})})},e[5]=r,e[6]=c,e[7]=n,e[8]=f):f=e[8];let g=f,T=Yt(),w,L;e[9]!==r||e[10]!==T||e[11]!==g?(w=()=>{T(g);let k=()=>T(g),v=v1(r.registerUpdateListener(k));return document.addEventListener("mouseup",k),()=>{v(),document.removeEventListener("mouseup",k)}},L=[r,T,g],e[9]=r,e[10]=T,e[11]=g,e[12]=w,e[13]=L):(w=e[12],L=e[13]),A1(w,L);let _;e[14]!==s||e[15]!==r||e[16]!==n?(_=()=>{s.enabled&&r.focus(()=>{r.update(F1),n.onSelect?.({editor:r,isActive:s.active})})},e[14]=s,e[15]=r,e[16]=n,e[17]=_):_=e[17];let b=_,x=P1,C;return e[18]!==o||e[19]!==h||e[20]!==b||e[21]!==n.key?(C=I1("button",{className:h,"data-button-key":n.key,onClick:b,onMouseDown:x,type:"button",children:o}),e[18]=o,e[19]=h,e[20]=b,e[21]=n.key,e[22]=C):C=e[22],C};function F1(){M1("toolbar")}function P1(t){t.preventDefault()}import{c as V1}from"react/compiler-runtime";import{jsx as nt}from"react/jsx-runtime";import Vs,{useCallback as J1,useDeferredValue as K1,useEffect as X1,useMemo as z1}from"react";import{mergeRegister as Z1}from"@lexical/utils";import{useTranslation as Y1}from"@payloadcms/ui";import{$getSelection as q1}from"lexical";import{jsx as ve,jsxs as Bs}from"react/jsx-runtime";import{Button as B1}from"@payloadcms/ui";import{$addUpdateTag as j1,isDOMNode as H1}from"lexical";import wo,{useCallback as U1,useEffect as Eo,useMemo as Hs,useRef as Dr,useState as $r}from"react";import{createPortal as W1}from"react-dom";var js="toolbar-popup__dropdown-item",Us=wo.createContext(null);function Ws({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:s,tooltip:i}){let d=Hs(()=>[js,r===!1?"disabled":"",t?"active":"",l?.key?`${js}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Dr(null),u=wo.use(Us);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return Eo(()=>{c?.current!=null&&a(c)},[c,a]),ve(B1,{"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(()=>{j1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function G1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=$r(),[s,i]=$r(),d=U1(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=Hs(()=>({registerItem:d}),[d]);return Eo(()=>{n!=null&&s==null&&i(n[0]),s!=null&&s?.current!=null&&s.current.focus()},[n,s]),ve(Us,{value:u,children:ve("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Gs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=Dr(null),u=Dr(null),[a,m]=$r(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};Eo(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:T,top:w}=f.getBoundingClientRect(),L=window.scrollY||document.documentElement.scrollTop;g.style.top=`${w+L+f.offsetHeight+5}px`,g.style.left=`${Math.min(T-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),Eo(()=>{let f=u.current;if(f!==null&&a){let g=T=>{let w=T.target;H1(w)&&(d&&c.current&&c.current.contains(w)||f.contains(w)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=W1(ve(G1,{dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return Bs(wo.Fragment,{children:[Bs("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&&ve(l,{}),i&&ve("span",{className:"toolbar-popup__dropdown-label",children:i}),ve("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&ve(wo.Fragment,{children:h})]})}var Ar="toolbar-popup__dropdown",Q1=t=>{let e=V1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:s}=t,{i18n:i}=Y1(),{fieldProps:d}=U(),{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&&nt(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=nt(Ws,{active:o,editor:n,enabled:l,Icon:s?.ChildComponent?nt(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:nt("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},eh=Vs.memo(Q1),Ue=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:s,maxActiveItems:i,onActiveChange:d})=>{let[c,u]=Vs.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=K1(c),m=U(),{items:p,key:h}=r,f=Yt(),g=J1(()=>{o.getEditorState().read(()=>{let w=q1();if(!w)return;let L=[],_=[],b=[];for(let x of p)x.isActive&&(!i||L.length<i)&&x.isActive({editor:o,editorConfigContext:m,selection:w})&&(L.push(x.key),_.push(x)),x.isEnabled?x.isEnabled({editor:o,editorConfigContext:m,selection:w})&&b.push(x.key):b.push(x.key);u({activeItemKeys:L,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:w}):!0,enabledItemKeys:b}),d&&d({activeItems:_})})},[o,m,r,p,i,d]);X1(()=>(f(g),Z1(o.registerUpdateListener(async()=>{await f(g)}))),[o,f,g]);let T=z1(()=>p?.length?p.map(w=>nt(eh,{active:a.activeItemKeys.includes(w.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(w.key),item:w},w.key)):null,[p,a,t,o]);return nt(Gs,{buttonAriaLabel:`${h} dropdown`,buttonClassName:[Ar,`${Ar}-${h}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:h,Icon:n,itemsContainerClassNames:[`${Ar}-items`,...l||[]],label:s,children:T},h)};function sh({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ce(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ce(Bt,{editor:e,item:o,children:ce(o.ChildComponent,{})},o.key):null}function ah(t){let e=Js(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:s}=t,{i18n:i}=lh(),{fieldProps:d}=U(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Le.useState(void 0),[p,h]=Le.useState(void 0),f;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(f=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?h(()=>l.ChildComponent):h(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=f):f=e[3];let g;e[4]!==l?(g=[l],e[4]=l,e[5]=g):g=e[5],Le.useEffect(f,g);let T;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==i||e[11]!==u?(T=b=>{let{activeItems:x}=b;if(!x.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(h(()=>l.ChildComponent),m(void 0)):(h(void 0),m(void 0));return}let C=x[0],k=C.key;C.label&&(k=typeof C.label=="function"?C.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):C.label),k.length>25&&(k=k.substring(0,25)+"..."),x.length===1?(m(k),h(()=>C.ChildComponent)):(m(i.t("lexical:general:toolbarItemsActive",{count:x.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?h(()=>l.ChildComponent):h(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=i,e[11]=u,e[12]=T):T=e[12];let w=T,L=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==s||e[20]!==w||e[21]!==L?(_=th("div",{className:L,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?ce(Ue,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:w}):ce(Ue,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:w}):null,l.type==="buttons"&&l.items.length?l.items.map(b=>ce(sh,{anchorElem:o,editor:r,item:b},b.key)):null,s<n.features.toolbarFixed?.groups.length-1&&ce("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=s,e[20]=w,e[21]=L,e[22]=_):_=e[22],_}function ch({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Le.useRef(null),s=Ks(),{y:i}=rh(),d=ih(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return nh(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,i]),ce("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&ce(Le.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>ce(ah,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Xs=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Xs(t.parentEditor)}return!1},zs=t=>{let e=Js(6),{clientProps:o}=t,[r]=oh(),n=U();if(!Ks())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.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=Xs(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=ce(ch,{anchorElem:document.body,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,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 uh=D({plugins:[{Component:zs,position:"aboveContainer"}]});import{c as qs}from"react/compiler-runtime";import{jsx as fe,jsxs as Qs}from"react/jsx-runtime";import{useLexicalComposerContext as dh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as mh}from"@lexical/react/useLexicalEditable";import{mergeRegister as ea}from"@lexical/utils";import{$getSelection as ta,$isRangeSelection as Zs,$isTextNode as ph,COMMAND_PRIORITY_LOW as fh,getDOMSelection as oa,SELECTION_CHANGE_COMMAND as hh}from"lexical";import{useCallback as No,useEffect as jt,useRef as Ys,useState as gh}from"react";import*as Lo from"react";import{createPortal as xh}from"react-dom";function Or(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 So(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 Ch({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&fe(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?fe(Bt,{editor:e,item:o,children:fe(o.ChildComponent,{})},o.key):null}function bh(t){let e=qs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:s}=U(),[i,d]=Lo.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],Lo.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=f=>{let{activeItems:g}=f;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let T=g[0];d(()=>T?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,h;return e[10]!==i||e[11]!==o||e[12]!==r||e[13]!==s.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(h=Qs("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?i?fe(Ue,{anchorElem:o,editor:r,group:n,Icon:i,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):fe(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(f=>fe(Ch,{anchorElem:o,editor:r,item:f},f.key)):null,l<s.features.toolbarInline?.groups.length-1&&fe("div",{className:"divider"})]},n.key),e[10]=i,e[11]=o,e[12]=r,e[13]=s.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=h):h=e[18],h}function kh({anchorElem:t,editor:e}){let o=Ys(null),r=Ys(null),{editorConfig:n}=U(),l=No(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),s=No(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,h=document.elementFromPoint(m,p);o.current.contains(h)||l()}}},[l]),i=No(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);jt(()=>(document.addEventListener("mousemove",s),document.addEventListener("mouseup",i),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",i)}),[o,s,i]);let d=No(()=>{let c=ta(),u=oa(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let h=Or(u,p),f=So({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:h});r.current&&So({anchorElem:o.current,anchorFlippedOffset:f,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:h,verticalGap:8})}else l()},[e,l,t]);return jt(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),jt(()=>(e.getEditorState().read(()=>{d()}),ea(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(hh,()=>(d(),!1),fh))),[e,d]),Qs("div",{className:"inline-toolbar-popup",ref:o,children:[fe("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>fe(bh,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function _h(t,e){let o=qs(12),[r,n]=gh(!1),l=mh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=ta(),h=oa(t._window),f=t.getRootElement();if(h!==null&&(!Zs(p)||f===null||!f.contains(h.anchorNode))){n(!1);return}if(!Zs(p))return;if(p.getTextContent()!==""){let T=p.getNodes(),w=!1;for(let L of T)if(ph(L)){n(!0),w=!0;break}w||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]),jt(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>ea(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]),jt(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=xh(fe(kh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var ra=t=>{let{anchorElem:e}=t,[o]=dh();return _h(o,e)};var Th=D({plugins:[{Component:ra,position:"floatingAnchorElem"}]});import{TableCellNode as dx,TableNode as mx,TableRowNode as px}from"@lexical/table";import{jsx as na}from"react/jsx-runtime";import"react";var Fr=()=>na("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:na("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 wh,$createTableNode as Eh,$createTableRowNode as Sh,$isTableCellNode as la,$isTableNode as Pr,$isTableRowNode as Br,TableCellHeaderStates as yo,TableCellNode as Nh,TableNode as Lh,TableRowNode as yh}from"@lexical/table";import{$isParagraphNode as Rh,$isTextNode as Ih}from"lexical";var sa=/^\|(.+)\|\s?$/,vh=/^(\| ?:?-*:? ?)+\|\s?$/,aa=({allTransformers:t})=>({type:"element",dependencies:[Lh,yh,Nh],export:e=>{if(!Pr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Br(r))continue;let l=!1;for(let s of r.getChildren())la(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:sa,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(vh.test(n)){let a=e.getPreviousSibling();if(!a||!Pr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Br(p))return;p.getChildren().forEach(h=>{la(h)&&h.setHeaderStyles(yo.ROW,yo.ROW)}),e.remove();return}let l=ia(n,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!Rh(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!Ih(a))break;let m=ia(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=Sh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ca("",t))}let u=e.getPreviousSibling();Pr(u)&&Mh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function Mh(t){let e=t.getFirstChild();return Br(e)?e.getChildrenSize():0}var ca=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=wh(yo.NO_STATUS);return zt(t,e,o),o},ia=(t,e)=>{let o=t.match(sa);return!o||!o[1]?null:o[1].split("|").map(r=>ca(r,e))};import{c as $h}from"react/compiler-runtime";import{jsx as B,jsxs as ye}from"react/jsx-runtime";import{useLexicalComposerContext as fa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ah}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as da,$deleteTableColumnAtSelection as Oh,$deleteTableRowAtSelection as Fh,$getNodeTriplet as Ph,$getTableCellNodeFromLexicalNode as ma,$getTableColumnIndexFromTableCellNode as Bh,$getTableNodeFromLexicalNodeOrThrow as De,$getTableRowIndexFromTableCellNode as jh,$insertTableColumnAtSelection as Hh,$insertTableRowAtSelection as Uh,$isTableCellNode as ha,$isTableSelection as Ht,$mergeCells as Wh,$unmergeCell as Gh,getTableElement as Hr,getTableObserverFromTableElement as Ur,TableCellHeaderStates as Me,TableCellNode as Vh}from"@lexical/table";import{mergeRegister as Jh}from"@lexical/utils";import{useScrollInfo as Kh}from"@payloadcms/ui";import{$getSelection as Io,$isElementNode as Xh,$isRangeSelection as Wr,$isTextNode as zh,$setSelection as Zh,COMMAND_PRIORITY_CRITICAL as Yh,getDOMSelection as qh,isDOMNode as Qh,SELECTION_CHANGE_COMMAND as eg}from"lexical";import*as Gr from"react";import{useCallback as ue,useEffect as lt,useRef as Ro,useState as it}from"react";import{createPortal as ga}from"react-dom";import{jsx as jr,jsxs as Dh}from"react/jsx-runtime";import"react";var ua=()=>Dh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[jr("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"}),jr("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"}),jr("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 pa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function tg(){let t=Io();if(Wr(t)&&!t.isCollapsed()||Ht(t)&&!t.anchor.is(t.focus)||!Wr(t)&&!Ht(t))return!1;let[e]=Ph(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function og(t){let e=t.getLastDescendant();zh(e)?e.select():Xh(e)?e.selectEnd():e!==null&&e.selectNext()}function rg({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=fa(),s=Ro(null),[i,d]=it(n),[c,u]=it({columns:1,rows:1}),[a,m]=it(!1),[p,h]=it(!1),{y:f}=Kh();lt(()=>l.registerMutationListener(Vh,E=>{E.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),lt(()=>{l.getEditorState().read(()=>{let E=Io();if(Ht(E)){let R=pa(E);u(pa(E)),m(R.columns>1||R.rows>1)}h(tg())})},[l]),lt(()=>{let E=e.current,R=s.current,N=l.getRootElement();if(E!=null&&R!=null&&N!=null){let M=N.getBoundingClientRect(),$=E.getBoundingClientRect();R.style.opacity="1";let A=R.getBoundingClientRect(),F=5,P=$.right+F;if(P+A.width>window.innerWidth||P+A.width>M.right){let X=$.left-A.width-F;P=(X<0?F:X)+window.pageXOffset}R.style.left=`${P+window.pageXOffset}px`;let J=$.top;if(J+A.height>window.innerHeight){let X=$.bottom-A.height;J=X<0?F:X}R.style.top=`${J}px`}},[e,s,l,f]),lt(()=>{function E(R){s.current!=null&&e.current!=null&&Qh(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&r(!1)}return window.addEventListener("click",E),()=>window.removeEventListener("click",E)},[r,e]);let g=ue(()=>{l.update(()=>{if(i.isAttached()){let E=De(i),R=Hr(E,l.getElementByKey(E.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let N=Ur(R);N!==null&&N.$clearHighlight(),E.markDirty(),d(i.getLatest())}Zh(null)})},[l,i]),T=()=>{l.update(()=>{let E=Io();if(!Ht(E))return;let N=E.getNodes().filter(ha),M=Wh(N);M&&(og(M),o())})},w=()=>{l.update(()=>{Gh()})},L=ue(E=>{l.update(()=>{for(let R=0;R<c.rows;R++)Uh(E);o()})},[l,o,c.rows]),_=ue(E=>{l.update(()=>{for(let R=0;R<c.columns;R++)Hh(E);o()})},[l,o,c.columns]),b=ue(()=>{l.update(()=>{Fh(),o()})},[l,o]),x=ue(()=>{l.update(()=>{De(i).remove(),g(),o()})},[l,i,g,o]),C=ue(()=>{l.update(()=>{Oh(),o()})},[l,o]),k=ue(()=>{l.update(()=>{let E=De(i),R=jh(i),[N]=da(E,null,null),M=new Set,$=i.getHeaderStyles()^Me.ROW;if(N[R])for(let A=0;A<N[R].length;A++){let F=N[R][A];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles($,Me.ROW)))}g(),o()})},[l,i,g,o]),v=ue(()=>{l.update(()=>{let E=De(i),R=Bh(i),[N]=da(E,null,null),M=new Set,$=i.getHeaderStyles()^Me.COLUMN;if(N)for(let A=0;A<N.length;A++){let F=N?.[A]?.[R];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles($,Me.COLUMN)))}g(),o()})},[l,i,g,o]),I=ue(()=>{l.update(()=>{if(i.isAttached()){let E=De(i);E&&E.setRowStriping(!E.getRowStriping())}g(),o()})},[l,i,g,o]),y=ue(()=>{l.update(()=>{if(i.isAttached()){let E=De(i);E&&E.setFrozenColumns(E.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:()=>T(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):p&&(S=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>w(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),ga(ye("div",{className:"table-action-menu-dropdown",onClick:E=>{E.stopPropagation()},ref:s,children:[S?ye(Gr.Fragment,{children:[S,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>y(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>L(!1),type:"button",children:ye("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:()=>L(!0),type:"button",children:ye("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:()=>_(!1),type:"button",children:ye("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:()=>_(!0),type:"button",children:ye("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:()=>C(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>k(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&Me.ROW)===Me.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>v(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&Me.COLUMN)===Me.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function ng({anchorElem:t,cellMerge:e}){let[o]=fa(),r=Ro(null),n=Ro(null),[l,s]=it(!1),[i,d]=it(null),c=ue(()=>{let a=r.current,m=Io(),p=qh(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,w=null;if(Wr(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let _=ma(m.anchor.getNode());if(_==null||(w=o.getElementByKey(_.getKey()),w==null||!_.isAttached()))return f();let b=De(_),x=Hr(b,o.getElementByKey(b.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Ur(x),d(_)}else if(Ht(m)){let _=ma(m.anchor.getNode());if(!ha(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=De(_),x=Hr(b,o.getElementByKey(b.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Ur(x),w=o.getElementByKey(_.getKey())}else if(!h)return f();if(T===null||w===null)return f();let L=!T||!T.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",L),a.classList.toggle("table-cell-action-button-container--inactive",!L),L){let _=w.getBoundingClientRect(),b=t.getBoundingClientRect(),x=_.top-b.top,C=_.right-b.left;a.style.transform=`translate(${C}px, ${x}px)`}},[o,t]);lt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Jh(o.registerUpdateListener(p),o.registerCommand(eg,p,Yh),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=Ro(i);return lt(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),B("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&ye(Gr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:B(ua,{})}),l&&B(rg,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var xa=t=>{let e=$h(3),{anchorElem:o}=t,r=Ah(),n;return e[0]!==o||e[1]!==r?(n=ga(r?B(ng,{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 lg}from"react/compiler-runtime";import{jsx as Mo,jsxs as ig}from"react/jsx-runtime";import{useLexicalComposerContext as sg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ag}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as cg,$getTableNodeFromLexicalNodeOrThrow as Vr,$getTableRowIndexFromTableCellNode as ug,$isTableCellNode as Ca,$isTableRowNode as dg,getDOMCellFromTarget as mg,getTableElement as pg,TableNode as ba}from"@lexical/table";import{calculateZoomLevel as ka,mergeRegister as fg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Jr,isHTMLElement as hg,SKIP_SCROLL_INTO_VIEW_TAG as _a}from"lexical";import*as wa from"react";import{useCallback as Ut,useEffect as Kr,useRef as vo,useState as st}from"react";import{createPortal as gg}from"react-dom";var xg=33,Ta=92;function Cg({editor:t}){let e=vo(null),o=vo(null),r=vo(null),[n,l]=st(!1),s=U(),i=vo(null),[d,c]=st(null),[u,a]=st(null),[m,p]=st(!1),[h,f]=st(null),g=Ut(()=>{a(null),e.current=null,f(null),i.current=null,r.current=null},[]),T=y=>(y.buttons&1)===1;Kr(()=>{let y=new Set;return fg(t.registerMutationListener(ba,S=>{for(let[E,R]of S)R==="destroyed"?y.delete(E):y.add(E);l(y.size>0)}),t.registerNodeTransform(ba,S=>{if(S.getColWidths())return S;let E=S.getColumnCount(),R=Ta;return S.setColWidths(Array(E).fill(R)),S}))},[t]),Kr(()=>{if(!n)return;let y=N=>{let M=N.target;if(hg(M)){if(h){c({x:N.clientX,y:N.clientY});return}if(p(T(N)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let $=mg(M);$&&u!==$?t.getEditorState().read(()=>{let A=Jr($.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let F=Vr(A),P=pg(F,t.getElementByKey(F.getKey()));if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=M,r.current=P.getBoundingClientRect(),a($)},{editor:t}):$==null&&g()}}},S=N=>{p(!0)},E=N=>{p(!1)},R=t.registerRootListener((N,M)=>{M?.removeEventListener("mousemove",y),M?.removeEventListener("mousedown",S),M?.removeEventListener("mouseup",E),N?.addEventListener("mousemove",y),N?.addEventListener("mousedown",S),N?.addEventListener("mouseup",E)});return()=>{R()}},[u,h,t,n,g]);let w=y=>y==="bottom",L=Ut(y=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Jr(u.elem);if(!Ca(S))throw new Error("TableCellResizer: Table cell node not found.");let E=Vr(S),R=ug(S),N=E.getChildren(),$=S.getColSpan()===E.getColumnCount()?R:R+S.getRowSpan()-1;if($>=N.length||$<0)throw new Error("Expected table cell to be inside of table row.");let A=N[$];if(!dg(A))throw new Error("Expected table row");let F=A.getHeight();if(F===void 0){let J=A.getChildren();F=Math.min(...J.map(X=>_(X,t)??1/0))}let P=Math.max(F+y,xg);A.setHeight(P)},{tag:_a})},[u,t]),_=(y,S)=>S.getElementByKey(y.getKey())?.clientHeight,b=(y,S)=>{let E;return S.forEach(R=>{R.forEach((N,M)=>{N.cell===y&&(E=M)})}),E},x=Ut(y=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Jr(u.elem);if(!Ca(S))throw new Error("TableCellResizer: Table cell node not found.");let E=Vr(S),[R]=cg(E,null,null),N=b(S,R);if(N===void 0)throw new Error("TableCellResizer: Table column not found.");let M=E.getColWidths();if(!M)return;let $=M[N];if($===void 0)return;let A=[...M],F=Math.max($+y,Ta);A[N]=F,E.setColWidths(A)},{tag:_a})},[u,t]),C=Ut(y=>{let S=E=>{if(E.preventDefault(),E.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:N}=i.current;if(u===null)return;let M=ka(E.target);if(w(y)){let $=(E.clientY-N)/M;L($)}else{let $=(E.clientX-R)/M;x($)}g(),document.removeEventListener("mouseup",S)}};return S},[u,g,x,L]),k=Ut(y=>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(y),document.addEventListener("mouseup",C(y))},[u,C]),[v,I]=st({bottom:null,left:null,right:null,top:null});return Kr(()=>{if(u){let{height:y,left:S,top:E,width:R}=u.elem.getBoundingClientRect(),N=ka(u.elem),M=10,$={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${M}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+E+y-M/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${y}px`,left:`${window.scrollX+S+R-M/2}px`,top:`${window.scrollY+E}px`,width:`${M}px`}},A=r.current;h&&d&&A&&(w(h)?($[h].left=`${window.scrollX+A.left}px`,$[h].top=`${window.scrollY+d.y/N}px`,$[h].height="3px",$[h].width=`${A.width}px`):($[h].top=`${window.scrollY+A.top}px`,$[h].left=`${window.scrollX+d.x/N}px`,$[h].width="3px",$[h].height=`${A.height}px`),$[h].backgroundColor="#adf"),I($)}else I({bottom:null,left:null,right:null,top:null})},[u,h,d]),Mo("div",{ref:o,children:u!=null&&!m&&ig(wa.Fragment,{children:[Mo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("right"),style:v.right||void 0}),Mo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("bottom"),style:v.bottom||void 0})]})})}var Ea=()=>{let t=lg(3),[e]=sg(),o=ag(),r;return t[0]!==e||t[1]!==o?(r=o?gg(Mo(Cg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Ng}from"react/compiler-runtime";import{jsx as Xr,jsxs as Lg,Fragment as yg}from"react/jsx-runtime";import{useLexicalComposerContext as Rg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ma}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Ig,$getTableColumnIndexFromTableCellNode as vg,$getTableRowIndexFromTableCellNode as Mg,$insertTableColumnAtSelection as Dg,$insertTableRowAtSelection as $g,$isTableCellNode as Ag,$isTableNode as La,getTableElement as Og,TableNode as Fg}from"@lexical/table";import{$findMatchingParent as Pg,mergeRegister as Bg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ya,isHTMLElement as jg}from"lexical";import{useEffect as Ra,useMemo as Hg,useRef as Ia,useState as Do}from"react";import"react";import{createPortal as Ug}from"react-dom";import{c as wg}from"react/compiler-runtime";import{useEffect as Eg,useRef as Sg}from"react";var bg="Expected a function",kg=Math.max,_g=Math.min;function Tg(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(bg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?kg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(x){let C=r,k=s;return r=s=void 0,l=x,u=t.apply(k,C),u}function h(x){return l=x,a=setTimeout(T,e),i?p(x):u}function f(x){let C=x-n,k=x-l,v=e-C;return d?_g(v,c-k):v}function g(x){let C=x-n,k=x-l;return n===void 0||C>=e||C<0||d&&k>=c}function T(){let x=Date.now();if(g(x))return w(x);a=setTimeout(T,f(x))}function w(x){return a=void 0,m&&r?p(x):(r=s=void 0,u)}function L(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function _(){return a===void 0?u:w(Date.now())}function b(){let x=Date.now(),C=g(x);if(r=arguments,s=this,n=x,C){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=L,b.flush=_,b}var Sa=Tg;function Na(t,e,o){let r=wg(6),n=Sg(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Sa(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]),Eg(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 va=20;function Wg({anchorElem:t}){let[e]=Rg(),o=Ma(),r=U(),[n,l]=Do(!1),[s,i]=Do(!1),[d,c]=Do(!1),[u,a]=Do({}),m=Ia(new Set),p=Ia(null),h=Na(T=>{let{isOutside:w,tableDOMNode:L}=Gg(T,r.editorConfig?.lexical);if(w){l(!1),i(!1);return}if(!L)return;p.current=L;let _=null,b=null,x=null;if(e.getEditorState().read(()=>{let $=ya(L);if(Ag($)){let A=Pg($,F=>La(F));if(!La(A))return;if(x=Og(A,e.getElementByKey(A.getKey())),x){let F=A.getChildrenSize(),P=A.getChildAtIndex(0)?.getChildrenSize(),J=Mg($),X=vg($);J===F-1?_=$:X===P-1&&(b=$)}}},{editor:e}),!x)return;let C=x.parentElement;if(!C)return;let{bottom:k,height:v,left:I,right:y,width:S,y:E}=x.getBoundingClientRect(),R=!1;C&&C.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(R=C.scrollWidth>C.clientWidth);let{left:N,y:M}=t.getBoundingClientRect();_?(i(!1),l(!0),a({height:va,left:R&&C?C.offsetLeft:I-N,top:k-M+5,width:R&&C?C.offsetWidth:S})):b&&(i(!0),l(!1),a({height:v,left:y-N+5,top:E-M,width:va}))},50,250),f=Hg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Ra(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Ra(()=>Bg(e.registerMutationListener(Fg,T=>{e.getEditorState().read(()=>{let w=!1;for(let[L,_]of T)switch(_){case"created":{m.current.add(L),w=!0;break}case"destroyed":{m.current.delete(L),w=!0;break}default:break}if(w){f.disconnect();for(let L of m.current){let{tableElement:_}=Ig(L);f.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=T=>{e.update(()=>{p.current&&(ya(p.current)?.selectEnd(),T?($g(),l(!1)):(Dg(),i(!1)))})};return o?Lg(yg,{children:[n&&Xr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Xr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function Gg(t,e){let o=t.target;if(jg(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 Da(t){let e=Ng(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Ma())return null;let l;return e[0]!==r?(l=Ug(Xr(Wg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Vg}from"react/compiler-runtime";import{jsx as zr,jsxs as Jg}from"react/jsx-runtime";import{useLexicalComposerContext as Kg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Xg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as zg,TableCellNode as Zg,TableNode as Yg,TableRowNode as qg}from"@lexical/table";import{mergeRegister as Qg}from"@lexical/utils";import{formatDrawerSlug as ex,useEditDepth as tx}from"@payloadcms/ui";import{$getSelection as ox,$isRangeSelection as rx,COMMAND_PRIORITY_EDITOR as nx,createCommand as lx}from"lexical";import{createContext as ix,use as sx,useEffect as ax,useMemo as cx,useState as ux}from"react";import*as $a from"react";var $o=lx("OPEN_EMBED_DRAWER_COMMAND"),Aa=ix({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Oa({children:t}){let[e,o]=ux({cellEditorConfig:null,cellEditorPlugins:null});return zr(Aa,{value:cx(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Fa=()=>{let t=Vg(16),[e]=Kg(),o=sx(Aa),r=tx(),{fieldProps:n,uuid:l}=U(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=ex({slug:i,depth:r}),t[0]=r,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=xe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([Yg,qg,Zg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Qg(e.registerCommand($o,()=>{let f=null;return e.getEditorState().read(()=>{let g=ox();rx(g)&&(f=g)}),f&&u(),!0},nx))},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],ax(a,m);let p;t[10]!==e?(p=(f,g)=>{!g.columns||!g.rows||e.dispatchCommand(zg,{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=Jg($a.Fragment,{children:[zr(gt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),zr(Xg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=h):h=t[15],h};var fx=D({markdownTransformers:[aa],nodes:[mx,dx,px],plugins:[{Component:Fa,position:"normal"},{Component:Ea,position:"normal"},{Component:xa,position:"floatingAnchorElem"},{Component:Da,position:"floatingAnchorElem"}],providers:[Oa],slashMenu:{groups:[z([{Icon:Fr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand($o,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Fr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand($o,{})}}])]}});import{$isNodeSelection as Zx}from"lexical";import{jsx as Zr,jsxs as hx}from"react/jsx-runtime";import"react";var Yr=()=>hx("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:[Zr("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"}),Zr("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"}),Zr("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 Ua}from"react/jsx-runtime";import Wa from"bson-objectid";import{$applyNodeReplacement as _x}from"lexical";import*as Ga from"react";import gx 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 gx.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as xx}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Cx}from"@lexical/utils";import Ba from"bson-objectid";import{$applyNodeReplacement as bx}from"lexical";var Wt=class extends xx{__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,Pa),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ba.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Pa({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Cx(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 Pa({data:t}){return t?.id||(t.id=new Ba.default().toHexString()),bx(new Wt({data:t}))}import{jsx as ja}from"react/jsx-runtime";import{ShimmerEffect as kx}from"@payloadcms/ui";var Ha=()=>ja("div",{className:"lexical-upload",children:ja(kx,{height:"95px",width:"203px"})});var Tx=Ga.lazy(()=>import("./component-XIHC3W6W.js").then(t=>({default:t.UploadComponent}))),he=class extends Wt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Ao(o,ge),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=ge({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?Ua(Ha,{}):Ua(Tx,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function ge({data:t}){return t?.id||(t.id=new Wa.default().toHexString()),_x(new he({data:t}))}function at(t){return t instanceof he}import{c as Ix}from"react/compiler-runtime";import{jsx as vx}from"react/jsx-runtime";import{useLexicalComposerContext as Mx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as tc,$insertNodeToNearestRoot as en,mergeRegister as Dx}from"@lexical/utils";import{useBulkUpload as $x,useEffectEvent as Ax,useModal as Ox}from"@payloadcms/ui";import tn from"bson-objectid";import{$createRangeSelection as Fx,$getPreviousSelection as Za,$getSelection as Ya,$isParagraphNode as on,$isRangeSelection as qa,$setSelection as Px,COMMAND_PRIORITY_EDITOR as Bx,COMMAND_PRIORITY_LOW as Qa,createCommand as jx,DROP_COMMAND as Hx,getDOMSelectionFromTarget as Ux,isHTMLElement as ec,PASTE_COMMAND as Wx}from"lexical";import{useEffect as Gx}from"react";import{c as Va}from"react/compiler-runtime";import{jsx as qr}from"react/jsx-runtime";import{useLexicalComposerContext as Ja}from"@lexical/react/LexicalComposerContext.js";import{toast as wx}from"@payloadcms/ui";import{$getNodeByKey as Ex,COMMAND_PRIORITY_EDITOR as Ka}from"lexical";import{useEffect as Xa,useState as Sx}from"react";var Nx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Ex(o);n&&n.replace(ge({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Qr,{fields:null,relationTo:e,value:r})},Lx=t=>{let e=Va(13),{enabledCollectionSlugs:o}=t,[r]=Ja(),[n,l]=Sx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=Pt(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Ke,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Ka),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Xa(u,a);let m;e[6]!==i||e[7]!==r||e[8]!==n?(m=f=>{let{collectionSlug:g,doc:T}=f;i(),Nx({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=qr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},yx=()=>{let t=Va(3),[e]=Ja(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,Rx,Ka),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Xa(o,r),null},za=({enabledCollectionSlugs:t})=>t?.length?qr(Lx,{enabledCollectionSlugs:t}):qr(yx,{});function Rx(){return wx.error("No upload collections enabled"),!0}function Vx(t){let e=t.target;return!!(ec(e)&&!e.closest("code, span.editor-image")&&ec(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Jx(t){let e,o=Ux(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 Qr=jx("INSERT_UPLOAD_COMMAND"),oc=t=>{let e=Ix(21),{clientProps:o}=t,[r]=Mx(),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}=$x(),{isModalOpen:h,openModal:f}=Ox(),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=b=>{let{files:x}=b;if(x?.length!==0&&(u(C=>[...C??[],...x.map(Kx)]),!h(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{r.update(Xx)}),m(C=>{let k=new Map(C.map(zx));r.update(()=>{for(let v of tc()){let I=v.node;if(at(I)){let y=I.getData();if(y?.pending){let S=k.get(y.pending?.formID);S&&I.replace(ge({data:{id:new tn.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 T=Ax(g),w;e[14]!==r||e[15]!==T?(w=()=>{if(!r.hasNodes([he]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Dx(r.registerNodeTransform(he,b=>{let x=b.getData();if(!x?.pending)return;(async function(){let v=null,I=x?.pending?.src,y=x?.pending?.formID;if(I?.startsWith("data:")){let S=I.match(/data:(image\/[a-zA-Z]+);base64,/),E=S?S[1]:"image/png",R=I.replace(/^data:image\/[a-zA-Z]+;base64,/,""),N=atob(R),M=new Array(N.length);for(let F=0;F<N.length;F++)M[F]=N.charCodeAt(F);let $=new Uint8Array(M);v={alt:void 0,file:new File([$],"pasted-image."+E?.split("/",2)[1],{type:E}),formID:y}}else if(I?.startsWith("http")||I?.startsWith("https")){let E=await(await fetch(I)).blob(),R=I.split("/").pop()||"pasted-image"+E.type.split("/",2)[1];v={alt:void 0,file:new File([E],R,{type:E.type}),formID:y}}v&&T({files:[v]})})()}),r.registerCommand(Qr,b=>(r.update(()=>{let x=Ya()||Za();if(qa(x)){let C=ge({data:{id:b.id,fields:b.fields,relationTo:b.relationTo,value:b.value}}),{focus:k}=x,v=k.getNode();en(C),on(v)&&!v.__first&&v.remove()}}),!0),Bx),r.registerCommand(Wx,b=>{if(!(b instanceof ClipboardEvent))return!1;let x=b.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let C=[];return x?.files?.length&&Array.from(x.files).forEach(k=>{C.push({alt:"",file:k,formID:new tn.default().toHexString()})}),C.length?(r.update(()=>{let k=Ya()||Za();if(qa(k))for(let v of C){let I=ge({data:{pending:{formID:v.formID,src:URL.createObjectURL(v.file)}}}),{focus:y}=k,S=y.getNode();en(I),on(S)&&!S.__first&&S.remove()}}),T({files:C}),!0):!1},Qa),r.registerCommand(Hx,b=>{if(!(b instanceof DragEvent))return!1;let x=b.dataTransfer;if(!x?.types?.length)return!1;let C=[];return x?.files?.length&&Array.from(x.files).forEach(k=>{C.push({alt:"",file:k,formID:new tn.default().toHexString()})}),C.length?(b.preventDefault(),b.stopPropagation(),r.update(()=>{if(Vx(b)){let k=Jx(b),v=Fx();k!=null&&v.applyDOMRange(k),Px(v);for(let I of C){let y=ge({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:S}=v,E=S.getNode();en(y),on(E)&&!E.__first&&E.remove()}}}),T({files:C}),!0):!1},Qa))},e[14]=r,e[15]=T,e[16]=w):w=e[16];let L;e[17]!==r?(L=[r],e[17]=r,e[18]=L):L=e[18],Gx(w,L);let _;return e[19]!==i?(_=vx(za,{enabledCollectionSlugs:i}),e[19]=i,e[20]=_):_=e[20],_};function Kx(t){return{file:t.file,formID:t.formID}}function Xx(){for(let t of tc()){let e=t.node;at(e)&&e.getData()?.pending&&e.remove()}}function zx(t){return[t.formID,t]}var Yx=D({nodes:[he],plugins:[{Component:oc,position:"normal"}],slashMenu:{groups:[z([{Icon:Yr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Yr,isActive:({selection:t})=>{if(!Zx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return at(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as Qx}from"react/compiler-runtime";import{jsx as Oo}from"react/jsx-runtime";import{createElement as eC}from"react";import{ShimmerEffect as tC,useConfig as oC}from"@payloadcms/ui";import{lazy as rC,Suspense as nC,useEffect as lC,useState as iC}from"react";var rc={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 rn={namespace:"lexical",theme:rc};function nc({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 qx}from"payload/shared";var lc=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?qx(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 nn(t,e,o,r){return{admin:o,features:lc(t),lexical:e,resolvedFeatureMap:t,view:r}}var sC=rC(()=>import("./Field-4IVB5SEE.js").then(t=>({default:t.RichText}))),aC=t=>Oo(Wo,{inheritable:!0,views:t.views,children:Oo(cC,{...t})}),cC=t=>{let e=Qx(22),{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?rn:i,{currentView:f}=Go(),g=c?.[f]?.admin??a,T=c?.[f]?.lexical,w;e[4]!==h||e[5]!==T?(w=typeof T=="function"?T(h):T??h,e[4]=h,e[5]=T,e[6]=w):w=e[6];let L=w,{config:_}=oC(),[b,x]=iC(null),C,k;e[7]!==r||e[8]!==_||e[9]!==f||e[10]!==g||e[11]!==L||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==d?(C=()=>{if(b&&b.view===f)return;let I=[];for(let S of Object.values(r))S.clientFeatureProvider&&I.push(S.clientFeatureProvider(S.clientFeatureProps));let y=nc({config:_,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:I,lexical:L}});x(nn(y,L,g,f))},k=[g,r,_,p,l,s,b,L,d,f],e[7]=r,e[8]=_,e[9]=f,e[10]=g,e[11]=L,e[12]=p,e[13]=l,e[14]=s,e[15]=b,e[16]=d,e[17]=C,e[18]=k):(C=e[17],k=e[18]),lC(C,k);let v;return e[19]!==b||e[20]!==t?(v=Oo(nC,{fallback:Oo(tC,{height:"35vh"}),children:b&&eC(sC,{...t,editorConfig:b,key:b.view})}),e[19]=b,e[20]=t,e[21]=v):v=e[21],v};function uC(t){return t instanceof HTMLElement}function dC(...t){return t.filter(Boolean).join(" ")}var Fo=new WeakMap;function ic(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Po(t,e){let o=Fo.get(t);if(o===void 0){let r=new Set,n=s=>{o!==void 0&&(o.start=ic(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=ic(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},Fo.set(t,o)}return o.listeners.add(e),()=>{mC(t,e)}}function mC(t,e){let o=Fo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Fo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function pC(t,e){return Po(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function fC(t,e){return Po(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function hC(t,e){return Po(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function gC(t,e){return Po(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as xC}from"react/compiler-runtime";import{jsx as CC}from"react/jsx-runtime";import"react";var bC=()=>{let t=xC(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?CC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as kC}from"react/compiler-runtime";import{jsx as _C}from"react/jsx-runtime";import"react";var TC=()=>{let t=kC(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?_C(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as wC}from"react/compiler-runtime";import{jsx as EC}from"react/jsx-runtime";import"react";var SC=()=>{let t=wC(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?EC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as NC}from"react/compiler-runtime";import{jsx as LC}from"react/jsx-runtime";import"react";var yC=t=>{let e=NC(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?LC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as RC}from"react/jsx-runtime";import"react";var IC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=se();return r?RC(r,{...o,children:e}):null};import{c as vC}from"react/compiler-runtime";import{jsx as MC}from"react/jsx-runtime";import"react";var DC=()=>{let t=vC(2),{EditButton:e}=se(),o;return t[0]!==e?(o=e?MC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as $C}from"react/compiler-runtime";import{jsx as AC}from"react/jsx-runtime";import"react";var OC=()=>{let t=$C(2),{RemoveButton:e}=se(),o;return t[0]!==e?(o=e?AC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as FC}from"qs-esm";var PC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=FC({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 sc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
58
+ `,ds="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ms="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",x0=new RegExp("^[^"+ms+"]*["+ds+"]"),C0=new RegExp("^[^"+ds+"]*["+ms+"]"),b0={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},k0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},_0={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},T0={[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"},w0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},E0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var ps={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=He("strong",{children:e})),t.format&O.IS_ITALIC&&(e=He("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=He("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=He("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=He("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=He("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=He("sup",{children:e})),e}};import{jsx as Ot}from"react/jsx-runtime";var fs={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 Ot("a",{href:n,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Ot("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(Ot("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(Ot("img",{alt:r,height:o?.height,src:n,width:o?.width},"image")),Ot("picture",{children:l})}};var lt={...as,...ps,...ns,...ts,...us,...os,...rs,...ss,...is({}),...fs,...cs};import{jsx as gs,Fragment as S0}from"react/jsx-runtime";import _r from"react";function hs(t){let e=!!t?.root?.children?.length,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!(!e||o)}function xs({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return hs(e)?Cs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):gs(S0,{})}function Cs({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=>Cs({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=gs("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`),_r.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return _r.cloneElement(u,{key:d,style:m})}return _r.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}var Tr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let s={};e?typeof e=="function"?s=e({defaultConverters:lt}):s=e:s=lt;let i=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&xs({converters:s,data:o,disableIndent:n,disableTextAlign:l});return r?bs(N0,{children:i}):bs("div",{className:t??"payload-richtext",children:i})};function _s(){let t=L0(7),[e]=y0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=I0(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]),R0(l,s);let i;return t[5]!==r?(i=ks("div",{className:"debug-jsx-converter",children:ks(Tr,{converters:lt,data:r})}),t[5]=r,t[6]=i):i=t[6],i}var v0=D({plugins:[{Component:_s,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)"}},M0={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 k1}from"lexical";import{jsx as Ft,jsxs as D0}from"react/jsx-runtime";import"react";var wr=()=>D0("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:[Ft("g",{clipPath:"url(#clip0_4397_10817)",children:Ft("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"})}),Ft("defs",{children:Ft("clipPath",{id:"clip0_4397_10817",children:Ft("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as P0}from"react/jsx-runtime";import{$applyNodeReplacement as B0}from"lexical";import*as ws from"react";import{DecoratorBlockNode as $0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as A0}from"@lexical/utils";import{$applyNodeReplacement as O0}from"lexical";function F0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ts({relationTo:o,value:e})}:null}var Pt=class extends $0{__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:F0,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=Ts(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return A0(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 Ts(t){return O0(new Pt({data:t}))}var j0=ws.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function H0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ue({relationTo:o,value:e})}:null}var Ne=class extends Pt{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:H0,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=Ue(o);return r.setFormat(e.format),r}decorate(e,o){return P0(j0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ue(t){return B0(new Ne({data:t}))}function Er(t){return t instanceof Ne}import{c as a1}from"react/compiler-runtime";import{jsx as c1}from"react/jsx-runtime";import{useLexicalComposerContext as u1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as d1}from"@lexical/utils";import{$getPreviousSelection as m1,$getSelection as p1,$isParagraphNode as f1,$isRangeSelection as h1,COMMAND_PRIORITY_EDITOR as g1,createCommand as x1}from"lexical";import{useEffect as C1}from"react";import{c as Ns}from"react/compiler-runtime";import{jsx as Sr}from"react/jsx-runtime";import{useLexicalComposerContext as Ls}from"@lexical/react/LexicalComposerContext.js";import{toast as Q0}from"@payloadcms/ui";import{$getNodeByKey as e1,COMMAND_PRIORITY_EDITOR as ys}from"lexical";import{useEffect as Rs,useState as t1}from"react";import{c as U0}from"react/compiler-runtime";import{jsx as W0}from"react/jsx-runtime";import{useLexicalComposerContext as G0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as V0,useModal as K0}from"@payloadcms/ui";import{$getNodeByKey as Es,$getPreviousSelection as J0,$getRoot as z0,$getSelection as X0,$isRangeSelection as Z0,$setSelection as Y0}from"lexical";import{useEffect as q0,useState as Ss}from"react";var Bt=t=>{let e=U0(23),[o]=G0(),[r,n]=Ss(null),[l,s]=Ss(!1),[i,d,c]=V0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=K0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let I=X0()??J0();n(I)},e[0]=f):f=e[0];let x=f,T;e[1]!==o||e[2]!==r?(T=()=>{r&&o.update(()=>{if(Z0(r)){let{anchor:I,focus:v}=r;Es(I.key)&&Es(v.key)&&Y0(r.clone())}else z0().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 _=S,b,g;e[6]!==a||e[7]!==h||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let I=h[a];I&&!I?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},g=[h,a,E,l],e[6]=a,e[7]=h,e[8]=E,e[9]=l,e[10]=b,e[11]=g):(b=e[10],g=e[11]),q0(b,g);let C;e[12]!==d?(C=I=>W0(d,{...I,onClick:()=>{x()}}),e[12]=d,e[13]=C):C=e[13];let k;e[14]!==p?(k=()=>{x(),p(),s(!0)},e[14]=p,e[15]=k):k=e[15];let y;return e[16]!==i||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==C||e[21]!==k?(y={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:C,openListDrawer:k},e[16]=i,e[17]=_,e[18]=m,e[19]=a,e[20]=C,e[21]=k,e[22]=y):y=e[22],y};var o1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=e1(o);n&&n.replace(Ue({relationTo:e,value:r}))}):t.dispatchCommand(Nr,{relationTo:e,value:r})},r1=t=>{let e=Ns(14),{enabledCollectionSlugs:o}=t,[r]=Ls(),[n,l]=t1(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}=Bt(i),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(ze,x=>(l(x?.replace?x?.replace.nodeKey:null),u(),!0),ys),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Rs(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=x=>{let{collectionSlug:T,doc:E}=x;o1({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=Sr(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},n1=()=>{let t=Ns(3),[e]=Ls(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ze,l1,ys),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Rs(o,r),null},Is=({enabledCollectionSlugs:t})=>t?.length?Sr(r1,{enabledCollectionSlugs:t}):Sr(n1,{});function l1(){return Q0.error("No relationship collections enabled"),!0}import{useConfig as i1,useEntityVisibility as s1}from"@payloadcms/ui";import*as vs from"react";var xo=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=i1(),{visibleEntities:l}=s1();return vs.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 Nr=x1("INSERT_RELATIONSHIP_COMMAND"),Ms=t=>{let e=a1(8),{clientProps:o}=t,[r]=u1(),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}=xo(s),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Nr,b1,g1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),C1(d,c);let u;return e[6]!==i?(u=c1(Is,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function b1(t){let e=p1()||m1();if(h1(e)){let o=Ue(t),{focus:r}=e,n=r.getNode();d1(o),f1(n)&&!n.__first&&n.remove()}return!0}var _1=D({nodes:[Ne],plugins:[{Component:Ms,position:"normal"}],slashMenu:{groups:[z([{Icon:wr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:wr,isActive:({selection:t})=>{if(!k1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Er(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]}});import{c as Hs}from"react/compiler-runtime";import{jsx as se,jsxs as z1}from"react/jsx-runtime";import{useLexicalComposerContext as X1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Us}from"@lexical/react/useLexicalEditable";import{useScrollInfo as Z1,useThrottledEffect as Y1,useTranslation as q1}from"@payloadcms/ui";import*as Le from"react";import{useMemo as Q1}from"react";import{c as T1}from"react/compiler-runtime";import{jsx as w1}from"react/jsx-runtime";import{mergeRegister as E1}from"@lexical/utils";import{$addUpdateTag as S1,$getSelection as N1}from"lexical";import{useDeferredValue as L1,useEffect as y1,useState as R1}from"react";var Ds="toolbar-popup__button",jt=t=>{let e=T1(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[s,i]=R1(l),d=L1(s),c=U(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Ds}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Ds,u,a,m].filter(Boolean),e[1]=u,e[2]=a,e[3]=m,e[4]=p):p=e[4];let h=p.join(" "),f;e[5]!==r||e[6]!==c||e[7]!==n?(f=()=>{r.getEditorState().read(()=>{let k=N1();if(!k)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:k}):!1,I=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:k}):!0;i(v=>v.active===y&&v.enabled===I?v:{active:y,enabled:I})})},e[5]=r,e[6]=c,e[7]=n,e[8]=f):f=e[8];let x=f,T=zt(),E,S;e[9]!==r||e[10]!==T||e[11]!==x?(E=()=>{T(x);let k=()=>T(x),y=E1(r.registerUpdateListener(k));return document.addEventListener("mouseup",k),()=>{y(),document.removeEventListener("mouseup",k)}},S=[r,T,x],e[9]=r,e[10]=T,e[11]=x,e[12]=E,e[13]=S):(E=e[12],S=e[13]),y1(E,S);let _;e[14]!==s||e[15]!==r||e[16]!==n?(_=()=>{s.enabled&&r.focus(()=>{r.update(I1),n.onSelect?.({editor:r,isActive:s.active})})},e[14]=s,e[15]=r,e[16]=n,e[17]=_):_=e[17];let b=_,g=v1,C;return e[18]!==o||e[19]!==h||e[20]!==b||e[21]!==n.key?(C=w1("button",{className:h,"data-button-key":n.key,onClick:b,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=h,e[20]=b,e[21]=n.key,e[22]=C):C=e[22],C};function I1(){S1("toolbar")}function v1(t){t.preventDefault()}import{c as P1}from"react/compiler-runtime";import{jsx as it}from"react/jsx-runtime";import js,{useCallback as B1,useDeferredValue as j1,useEffect as H1,useMemo as U1}from"react";import{mergeRegister as W1}from"@lexical/utils";import{useTranslation as G1}from"@payloadcms/ui";import{$getSelection as V1}from"lexical";import{jsx as Me,jsxs as $s}from"react/jsx-runtime";import{Button as M1}from"@payloadcms/ui";import{$addUpdateTag as D1,isDOMNode as $1}from"lexical";import Co,{useCallback as A1,useEffect as bo,useMemo as Os,useRef as Lr,useState as yr}from"react";import{createPortal as O1}from"react-dom";var As="toolbar-popup__dropdown-item",Fs=Co.createContext(null);function Ps({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:s,tooltip:i}){let d=Os(()=>[As,r===!1?"disabled":"",t?"active":"",l?.key?`${As}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Lr(null),u=Co.use(Fs);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return bo(()=>{c?.current!=null&&a(c)},[c,a]),Me(M1,{"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(()=>{D1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function F1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=yr(),[s,i]=yr(),d=A1(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=Os(()=>({registerItem:d}),[d]);return bo(()=>{n!=null&&s==null&&i(n[0]),s!=null&&s?.current!=null&&s.current.focus()},[n,s]),Me(Fs,{value:u,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Bs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=Lr(null),u=Lr(null),[a,m]=yr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};bo(()=>{let f=u.current,x=c.current;if(a&&f!==null&&x!==null){let{left:T,top:E}=f.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;x.style.top=`${E+S+f.offsetHeight+5}px`,x.style.left=`${Math.min(T-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),bo(()=>{let f=u.current;if(f!==null&&a){let x=T=>{let E=T.target;$1(E)&&(d&&c.current&&c.current.contains(E)||f.contains(E)||m(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,u,a,d]);let h=O1(Me(F1,{dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return $s(Co.Fragment,{children:[$s("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&&Me(l,{}),i&&Me("span",{className:"toolbar-popup__dropdown-label",children:i}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Me(Co.Fragment,{children:h})]})}var Rr="toolbar-popup__dropdown",K1=t=>{let e=P1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:s}=t,{i18n:i}=G1(),{fieldProps:d}=U(),{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&&it(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=it(Ps,{active:o,editor:n,enabled:l,Icon:s?.ChildComponent?it(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:it("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},J1=js.memo(K1),We=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:s,maxActiveItems:i,onActiveChange:d})=>{let[c,u]=js.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=j1(c),m=U(),{items:p,key:h}=r,f=zt(),x=B1(()=>{o.getEditorState().read(()=>{let E=V1();if(!E)return;let S=[],_=[],b=[];for(let g of p)g.isActive&&(!i||S.length<i)&&g.isActive({editor:o,editorConfigContext:m,selection:E})&&(S.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:E})&&b.push(g.key):b.push(g.key);u({activeItemKeys:S,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:E}):!0,enabledItemKeys:b}),d&&d({activeItems:_})})},[o,m,r,p,i,d]);H1(()=>(f(x),W1(o.registerUpdateListener(async()=>{await f(x)}))),[o,f,x]);let T=U1(()=>p?.length?p.map(E=>it(J1,{active:a.activeItemKeys.includes(E.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(E.key),item:E},E.key)):null,[p,a,t,o]);return it(Bs,{buttonAriaLabel:`${h} dropdown`,buttonClassName:[Rr,`${Rr}-${h}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:h,Icon:n,itemsContainerClassNames:[`${Rr}-items`,...l||[]],label:s,children:T},h)};function eh({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(jt,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function th(t){let e=Hs(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:s}=t,{i18n:i}=q1(),{fieldProps:d}=U(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Le.useState(void 0),[p,h]=Le.useState(void 0),f;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(f=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?h(()=>l.ChildComponent):h(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=f):f=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Le.useEffect(f,x);let T;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==i||e[11]!==u?(T=b=>{let{activeItems:g}=b;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(h(()=>l.ChildComponent),m(void 0)):(h(void 0),m(void 0));return}let C=g[0],k=C.key;C.label&&(k=typeof C.label=="function"?C.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):C.label),k.length>25&&(k=k.substring(0,25)+"..."),g.length===1?(m(k),h(()=>C.ChildComponent)):(m(i.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?h(()=>l.ChildComponent):h(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=i,e[11]=u,e[12]=T):T=e[12];let E=T,S=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==s||e[20]!==E||e[21]!==S?(_=z1("div",{className:S,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?se(We,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):se(We,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):null,l.type==="buttons"&&l.items.length?l.items.map(b=>se(eh,{anchorElem:o,editor:r,item:b},b.key)):null,s<n.features.toolbarFixed?.groups.length-1&&se("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=s,e[20]=E,e[21]=S,e[22]=_):_=e[22],_}function oh({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Le.useRef(null),s=Us(),{y:i}=Z1(),d=Q1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Y1(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,i]),se("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&se(Le.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>se(th,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Ws=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Ws(t.parentEditor)}return!1},Gs=t=>{let e=Hs(6),{clientProps:o}=t,[r]=X1(),n=U();if(!Us())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.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=Ws(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=se(oh,{anchorElem:document.body,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,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 rh=D({plugins:[{Component:Gs,position:"aboveContainer"}]});import{c as Js}from"react/compiler-runtime";import{jsx as de,jsxs as zs}from"react/jsx-runtime";import{useLexicalComposerContext as nh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as lh}from"@lexical/react/useLexicalEditable";import{mergeRegister as Xs}from"@lexical/utils";import{$getSelection as Zs,$isRangeSelection as Vs,$isTextNode as ih,COMMAND_PRIORITY_LOW as sh,getDOMSelection as Ys,SELECTION_CHANGE_COMMAND as ah}from"lexical";import{useCallback as _o,useEffect as Ht,useRef as Ks,useState as ch}from"react";import*as To from"react";import{createPortal as uh}from"react-dom";function Ir(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 ko(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 x=0;return!e&&h<p.top&&!i&&(x=a.height+d.height+c*2,h+=x),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)`),x}function dh({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&de(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?de(jt,{editor:e,item:o,children:de(o.ChildComponent,{})},o.key):null}function mh(t){let e=Js(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:s}=U(),[i,d]=To.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],To.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=f=>{let{activeItems:x}=f;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let T=x[0];d(()=>T?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,h;return e[10]!==i||e[11]!==o||e[12]!==r||e[13]!==s.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(h=zs("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?i?de(We,{anchorElem:o,editor:r,group:n,Icon:i,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):de(We,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(f=>de(dh,{anchorElem:o,editor:r,item:f},f.key)):null,l<s.features.toolbarInline?.groups.length-1&&de("div",{className:"divider"})]},n.key),e[10]=i,e[11]=o,e[12]=r,e[13]=s.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=h):h=e[18],h}function ph({anchorElem:t,editor:e}){let o=Ks(null),r=Ks(null),{editorConfig:n}=U(),l=_o(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),s=_o(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,h=document.elementFromPoint(m,p);o.current.contains(h)||l()}}},[l]),i=_o(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ht(()=>(document.addEventListener("mousemove",s),document.addEventListener("mouseup",i),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",i)}),[o,s,i]);let d=_o(()=>{let c=Zs(),u=Ys(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let h=Ir(u,p),f=ko({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:h});r.current&&ko({anchorElem:o.current,anchorFlippedOffset:f,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:h,verticalGap:8})}else l()},[e,l,t]);return Ht(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),Ht(()=>(e.getEditorState().read(()=>{d()}),Xs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(ah,()=>(d(),!1),sh))),[e,d]),zs("div",{className:"inline-toolbar-popup",ref:o,children:[de("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>de(mh,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function fh(t,e){let o=Js(12),[r,n]=ch(!1),l=lh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Zs(),h=Ys(t._window),f=t.getRootElement();if(h!==null&&(!Vs(p)||f===null||!f.contains(h.anchorNode))){n(!1);return}if(!Vs(p))return;if(p.getTextContent()!==""){let T=p.getNodes(),E=!1;for(let S of T)if(ih(S)){n(!0),E=!0;break}E||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){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]),Ht(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>Xs(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]),Ht(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=uh(de(ph,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var qs=t=>{let{anchorElem:e}=t,[o]=nh();return fh(o,e)};var hh=D({plugins:[{Component:qs,position:"floatingAnchorElem"}]});import{TableCellNode as nx,TableNode as lx,TableRowNode as ix}from"@lexical/table";import{jsx as Qs}from"react/jsx-runtime";import"react";var vr=()=>Qs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qs("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 gh,$createTableNode as xh,$createTableRowNode as Ch,$isTableCellNode as ea,$isTableNode as Mr,$isTableRowNode as Dr,TableCellHeaderStates as wo,TableCellNode as bh,TableNode as kh,TableRowNode as _h}from"@lexical/table";import{$isParagraphNode as Th,$isTextNode as wh}from"lexical";var oa=/^\|(.+)\|\s?$/,Eh=/^(\| ?:?-*:? ?)+\|\s?$/,ra=({allTransformers:t})=>({type:"element",dependencies:[kh,_h,bh],export:e=>{if(!Mr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Dr(r))continue;let l=!1;for(let s of r.getChildren())ea(s)&&(n.push(Jt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===wo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(s=>"---").join(" | ")} |`)}return o.join(`
59
+ `)},regExp:oa,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(Eh.test(n)){let a=e.getPreviousSibling();if(!a||!Mr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Dr(p))return;p.getChildren().forEach(h=>{ea(h)&&h.setHeaderStyles(wo.ROW,wo.ROW)}),e.remove();return}let l=ta(n,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!Th(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!wh(a))break;let m=ta(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=xh();for(let a of s){let m=Ch();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:na("",t))}let u=e.getPreviousSibling();Mr(u)&&Sh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function Sh(t){let e=t.getFirstChild();return Dr(e)?e.getChildrenSize():0}var na=(t,e)=>{t=t.replace(/\\n/g,`
60
+ `);let o=gh(wo.NO_STATUS);return Kt(t,e,o),o},ta=(t,e)=>{let o=t.match(oa);return!o||!o[1]?null:o[1].split("|").map(r=>na(r,e))};import{c as Lh}from"react/compiler-runtime";import{jsx as B,jsxs as ye}from"react/jsx-runtime";import{useLexicalComposerContext as ca}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as yh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ia,$deleteTableColumnAtSelection as Rh,$deleteTableRowAtSelection as Ih,$getNodeTriplet as vh,$getTableCellNodeFromLexicalNode as sa,$getTableColumnIndexFromTableCellNode as Mh,$getTableNodeFromLexicalNodeOrThrow as $e,$getTableRowIndexFromTableCellNode as Dh,$insertTableColumnAtSelection as $h,$insertTableRowAtSelection as Ah,$isTableCellNode as ua,$isTableSelection as Ut,$mergeCells as Oh,$unmergeCell as Fh,getTableElement as Ar,getTableObserverFromTableElement as Or,TableCellHeaderStates as De,TableCellNode as Ph}from"@lexical/table";import{mergeRegister as Bh}from"@lexical/utils";import{useScrollInfo as jh}from"@payloadcms/ui";import{$getSelection as So,$isElementNode as Hh,$isRangeSelection as Fr,$isTextNode as Uh,$setSelection as Wh,COMMAND_PRIORITY_CRITICAL as Gh,getDOMSelection as Vh,isDOMNode as Kh,SELECTION_CHANGE_COMMAND as Jh}from"lexical";import*as Pr from"react";import{useCallback as ae,useEffect as st,useRef as Eo,useState as at}from"react";import{createPortal as da}from"react-dom";import{jsx as $r,jsxs as Nh}from"react/jsx-runtime";import"react";var la=()=>Nh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[$r("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"}),$r("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"}),$r("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 aa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function zh(){let t=So();if(Fr(t)&&!t.isCollapsed()||Ut(t)&&!t.anchor.is(t.focus)||!Fr(t)&&!Ut(t))return!1;let[e]=vh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Xh(t){let e=t.getLastDescendant();Uh(e)?e.select():Hh(e)?e.selectEnd():e!==null&&e.selectNext()}function Zh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=ca(),s=Eo(null),[i,d]=at(n),[c,u]=at({columns:1,rows:1}),[a,m]=at(!1),[p,h]=at(!1),{y:f}=jh();st(()=>l.registerMutationListener(Ph,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),st(()=>{l.getEditorState().read(()=>{let w=So();if(Ut(w)){let R=aa(w);u(aa(w)),m(R.columns>1||R.rows>1)}h(zh())})},[l]),st(()=>{let w=e.current,R=s.current,L=l.getRootElement();if(w!=null&&R!=null&&L!=null){let M=L.getBoundingClientRect(),$=w.getBoundingClientRect();R.style.opacity="1";let A=R.getBoundingClientRect(),F=5,P=$.right+F;if(P+A.width>window.innerWidth||P+A.width>M.right){let Y=$.left-A.width-F;P=(Y<0?F:Y)+window.pageXOffset}R.style.left=`${P+window.pageXOffset}px`;let Z=$.top;if(Z+A.height>window.innerHeight){let Y=$.bottom-A.height;Z=Y<0?F:Y}R.style.top=`${Z}px`}},[e,s,l,f]),st(()=>{function w(R){s.current!=null&&e.current!=null&&Kh(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let x=ae(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i),R=Ar(w,l.getElementByKey(w.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let L=Or(R);L!==null&&L.$clearHighlight(),w.markDirty(),d(i.getLatest())}Wh(null)})},[l,i]),T=()=>{l.update(()=>{let w=So();if(!Ut(w))return;let L=w.getNodes().filter(ua),M=Oh(L);M&&(Xh(M),o())})},E=()=>{l.update(()=>{Fh()})},S=ae(w=>{l.update(()=>{for(let R=0;R<c.rows;R++)Ah(w);o()})},[l,o,c.rows]),_=ae(w=>{l.update(()=>{for(let R=0;R<c.columns;R++)$h(w);o()})},[l,o,c.columns]),b=ae(()=>{l.update(()=>{Ih(),o()})},[l,o]),g=ae(()=>{l.update(()=>{$e(i).remove(),x(),o()})},[l,i,x,o]),C=ae(()=>{l.update(()=>{Rh(),o()})},[l,o]),k=ae(()=>{l.update(()=>{let w=$e(i),R=Dh(i),[L]=ia(w,null,null),M=new Set,$=i.getHeaderStyles()^De.ROW;if(L[R])for(let A=0;A<L[R].length;A++){let F=L[R][A];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles($,De.ROW)))}x(),o()})},[l,i,x,o]),y=ae(()=>{l.update(()=>{let w=$e(i),R=Mh(i),[L]=ia(w,null,null),M=new Set,$=i.getHeaderStyles()^De.COLUMN;if(L)for(let A=0;A<L.length;A++){let F=L?.[A]?.[R];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles($,De.COLUMN)))}x(),o()})},[l,i,x,o]),I=ae(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i);w&&w.setRowStriping(!w.getRowStriping())}x(),o()})},[l,i,x,o]),v=ae(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}x(),o()})},[l,i,x,o]),N=null;return t&&(a?N=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):p&&(N=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),da(ye("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[N?ye(Pr.Fragment,{children:[N,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>S(!1),type:"button",children:ye("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:()=>S(!0),type:"button",children:ye("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:()=>_(!1),type:"button",children:ye("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:()=>_(!0),type:"button",children:ye("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:()=>C(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>k(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Yh({anchorElem:t,cellMerge:e}){let[o]=ca(),r=Eo(null),n=Eo(null),[l,s]=at(!1),[i,d]=at(null),c=ae(()=>{let a=r.current,m=So(),p=Vh(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 x=o.getRootElement(),T=null,E=null;if(Fr(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=sa(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return f();let b=$e(_),g=Ar(b,o.getElementByKey(b.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Or(g),d(_)}else if(Ut(m)){let _=sa(m.anchor.getNode());if(!ua(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=$e(_),g=Ar(b,o.getElementByKey(b.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Or(g),E=o.getElementByKey(_.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 _=E.getBoundingClientRect(),b=t.getBoundingClientRect(),g=_.top-b.top,C=_.right-b.left;a.style.transform=`translate(${C}px, ${g}px)`}},[o,t]);st(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Bh(o.registerUpdateListener(p),o.registerCommand(Jh,p,Gh),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=Eo(i);return st(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),B("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&ye(Pr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:B(la,{})}),l&&B(Zh,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var ma=t=>{let e=Lh(3),{anchorElem:o}=t,r=yh(),n;return e[0]!==o||e[1]!==r?(n=da(r?B(Yh,{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 qh}from"react/compiler-runtime";import{jsx as Lo,jsxs as Qh}from"react/jsx-runtime";import{useLexicalComposerContext as eg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as tg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as og,$getTableNodeFromLexicalNodeOrThrow as Br,$getTableRowIndexFromTableCellNode as rg,$isTableCellNode as pa,$isTableRowNode as ng,getDOMCellFromTarget as lg,getTableElement as ig,TableNode as fa}from"@lexical/table";import{calculateZoomLevel as ha,mergeRegister as sg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as jr,isHTMLElement as ag,SKIP_SCROLL_INTO_VIEW_TAG as ga}from"lexical";import*as Ca from"react";import{useCallback as Wt,useEffect as Hr,useRef as No,useState as ct}from"react";import{createPortal as cg}from"react-dom";var ug=33,xa=92;function dg({editor:t}){let e=No(null),o=No(null),r=No(null),[n,l]=ct(!1),s=U(),i=No(null),[d,c]=ct(null),[u,a]=ct(null),[m,p]=ct(!1),[h,f]=ct(null),x=Wt(()=>{a(null),e.current=null,f(null),i.current=null,r.current=null},[]),T=v=>(v.buttons&1)===1;Hr(()=>{let v=new Set;return sg(t.registerMutationListener(fa,N=>{for(let[w,R]of N)R==="destroyed"?v.delete(w):v.add(w);l(v.size>0)}),t.registerNodeTransform(fa,N=>{if(N.getColWidths())return N;let w=N.getColumnCount(),R=xa;return N.setColWidths(Array(w).fill(R)),N}))},[t]),Hr(()=>{if(!n)return;let v=L=>{let M=L.target;if(ag(M)){if(h){c({x:L.clientX,y:L.clientY});return}if(p(T(L)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let $=lg(M);$&&u!==$?t.getEditorState().read(()=>{let A=jr($.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let F=Br(A),P=ig(F,t.getElementByKey(F.getKey()));if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=M,r.current=P.getBoundingClientRect(),a($)},{editor:t}):$==null&&x()}}},N=L=>{p(!0)},w=L=>{p(!1)},R=t.registerRootListener((L,M)=>{M?.removeEventListener("mousemove",v),M?.removeEventListener("mousedown",N),M?.removeEventListener("mouseup",w),L?.addEventListener("mousemove",v),L?.addEventListener("mousedown",N),L?.addEventListener("mouseup",w)});return()=>{R()}},[u,h,t,n,x]);let E=v=>v==="bottom",S=Wt(v=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=jr(u.elem);if(!pa(N))throw new Error("TableCellResizer: Table cell node not found.");let w=Br(N),R=rg(N),L=w.getChildren(),$=N.getColSpan()===w.getColumnCount()?R:R+N.getRowSpan()-1;if($>=L.length||$<0)throw new Error("Expected table cell to be inside of table row.");let A=L[$];if(!ng(A))throw new Error("Expected table row");let F=A.getHeight();if(F===void 0){let Z=A.getChildren();F=Math.min(...Z.map(Y=>_(Y,t)??1/0))}let P=Math.max(F+v,ug);A.setHeight(P)},{tag:ga})},[u,t]),_=(v,N)=>N.getElementByKey(v.getKey())?.clientHeight,b=(v,N)=>{let w;return N.forEach(R=>{R.forEach((L,M)=>{L.cell===v&&(w=M)})}),w},g=Wt(v=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=jr(u.elem);if(!pa(N))throw new Error("TableCellResizer: Table cell node not found.");let w=Br(N),[R]=og(w,null,null),L=b(N,R);if(L===void 0)throw new Error("TableCellResizer: Table column not found.");let M=w.getColWidths();if(!M)return;let $=M[L];if($===void 0)return;let A=[...M],F=Math.max($+v,xa);A[L]=F,w.setColWidths(A)},{tag:ga})},[u,t]),C=Wt(v=>{let N=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:L}=i.current;if(u===null)return;let M=ha(w.target);if(E(v)){let $=(w.clientY-L)/M;S($)}else{let $=(w.clientX-R)/M;g($)}x(),document.removeEventListener("mouseup",N)}};return N},[u,x,g,S]),k=Wt(v=>N=>{if(N.preventDefault(),N.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:N.clientX,y:N.clientY},c(i.current),f(v),document.addEventListener("mouseup",C(v))},[u,C]),[y,I]=ct({bottom:null,left:null,right:null,top:null});return Hr(()=>{if(u){let{height:v,left:N,top:w,width:R}=u.elem.getBoundingClientRect(),L=ha(u.elem),M=10,$={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${M}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+w+v-M/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+N+R-M/2}px`,top:`${window.scrollY+w}px`,width:`${M}px`}},A=r.current;h&&d&&A&&(E(h)?($[h].left=`${window.scrollX+A.left}px`,$[h].top=`${window.scrollY+d.y/L}px`,$[h].height="3px",$[h].width=`${A.width}px`):($[h].top=`${window.scrollY+A.top}px`,$[h].left=`${window.scrollX+d.x/L}px`,$[h].width="3px",$[h].height=`${A.height}px`),$[h].backgroundColor="#adf"),I($)}else I({bottom:null,left:null,right:null,top:null})},[u,h,d]),Lo("div",{ref:o,children:u!=null&&!m&&Qh(Ca.Fragment,{children:[Lo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("right"),style:y.right||void 0}),Lo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("bottom"),style:y.bottom||void 0})]})})}var ba=()=>{let t=qh(3),[e]=eg(),o=tg(),r;return t[0]!==e||t[1]!==o?(r=o?cg(Lo(dg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as bg}from"react/compiler-runtime";import{jsx as Ur,jsxs as kg,Fragment as _g}from"react/jsx-runtime";import{useLexicalComposerContext as Tg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as La}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as wg,$getTableColumnIndexFromTableCellNode as Eg,$getTableRowIndexFromTableCellNode as Sg,$insertTableColumnAtSelection as Ng,$insertTableRowAtSelection as Lg,$isTableCellNode as yg,$isTableNode as Ta,getTableElement as Rg,TableNode as Ig}from"@lexical/table";import{$findMatchingParent as vg,mergeRegister as Mg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as wa,isHTMLElement as Dg}from"lexical";import{useEffect as Ea,useMemo as $g,useRef as Sa,useState as yo}from"react";import"react";import{createPortal as Ag}from"react-dom";import{c as gg}from"react/compiler-runtime";import{useEffect as xg,useRef as Cg}from"react";var mg="Expected a function",pg=Math.max,fg=Math.min;function hg(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(mg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?pg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let C=r,k=s;return r=s=void 0,l=g,u=t.apply(k,C),u}function h(g){return l=g,a=setTimeout(T,e),i?p(g):u}function f(g){let C=g-n,k=g-l,y=e-C;return d?fg(y,c-k):y}function x(g){let C=g-n,k=g-l;return n===void 0||C>=e||C<0||d&&k>=c}function T(){let g=Date.now();if(x(g))return E(g);a=setTimeout(T,f(g))}function E(g){return a=void 0,m&&r?p(g):(r=s=void 0,u)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function _(){return a===void 0?u:E(Date.now())}function b(){let g=Date.now(),C=x(g);if(r=arguments,s=this,n=g,C){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=_,b}var ka=hg;function _a(t,e,o){let r=gg(6),n=Cg(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ka(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]),xg(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 Na=20;function Og({anchorElem:t}){let[e]=Tg(),o=La(),r=U(),[n,l]=yo(!1),[s,i]=yo(!1),[d,c]=yo(!1),[u,a]=yo({}),m=Sa(new Set),p=Sa(null),h=_a(T=>{let{isOutside:E,tableDOMNode:S}=Fg(T,r.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!S)return;p.current=S;let _=null,b=null,g=null;if(e.getEditorState().read(()=>{let $=wa(S);if(yg($)){let A=vg($,F=>Ta(F));if(!Ta(A))return;if(g=Rg(A,e.getElementByKey(A.getKey())),g){let F=A.getChildrenSize(),P=A.getChildAtIndex(0)?.getChildrenSize(),Z=Sg($),Y=Eg($);Z===F-1?_=$:Y===P-1&&(b=$)}}},{editor:e}),!g)return;let C=g.parentElement;if(!C)return;let{bottom:k,height:y,left:I,right:v,width:N,y:w}=g.getBoundingClientRect(),R=!1;C&&C.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(R=C.scrollWidth>C.clientWidth);let{left:L,y:M}=t.getBoundingClientRect();_?(i(!1),l(!0),a({height:Na,left:R&&C?C.offsetLeft:I-L,top:k-M+5,width:R&&C?C.offsetWidth:N})):b&&(i(!0),l(!1),a({height:y,left:v-L+5,top:w-M,width:Na}))},50,250),f=$g(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Ea(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Ea(()=>Mg(e.registerMutationListener(Ig,T=>{e.getEditorState().read(()=>{let E=!1;for(let[S,_]of T)switch(_){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:_}=wg(S);f.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let x=T=>{e.update(()=>{p.current&&(wa(p.current)?.selectEnd(),T?(Lg(),l(!1)):(Ng(),i(!1)))})};return o?kg(_g,{children:[n&&Ur("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),s&&Ur("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function Fg(t,e){let o=t.target;if(Dg(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 ya(t){let e=bg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!La())return null;let l;return e[0]!==r?(l=Ag(Ur(Og,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Pg}from"react/compiler-runtime";import{jsx as Wr,jsxs as Bg}from"react/jsx-runtime";import{useLexicalComposerContext as jg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Hg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Ug,TableCellNode as Wg,TableNode as Gg,TableRowNode as Vg}from"@lexical/table";import{mergeRegister as Kg}from"@lexical/utils";import{formatDrawerSlug as Jg,useEditDepth as zg}from"@payloadcms/ui";import{$getSelection as Xg,$isRangeSelection as Zg,COMMAND_PRIORITY_EDITOR as Yg,createCommand as qg}from"lexical";import{createContext as Qg,use as ex,useEffect as tx,useMemo as ox,useState as rx}from"react";import*as Ra from"react";var Ro=qg("OPEN_EMBED_DRAWER_COMMAND"),Ia=Qg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function va({children:t}){let[e,o]=rx({cellEditorConfig:null,cellEditorPlugins:null});return Wr(Ia,{value:ox(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ma=()=>{let t=Pg(16),[e]=jg(),o=ex(Ia),r=zg(),{fieldProps:n,uuid:l}=U(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=Jg({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([Gg,Vg,Wg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Kg(e.registerCommand(Ro,()=>{let f=null;return e.getEditorState().read(()=>{let x=Xg();Zg(x)&&(f=x)}),f&&u(),!0},Yg))},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],tx(a,m);let p;t[10]!==e?(p=(f,x)=>{!x.columns||!x.rows||e.dispatchCommand(Ug,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=p):p=t[11];let h;return t[12]!==c||t[13]!==s||t[14]!==p?(h=Bg(Ra.Fragment,{children:[Wr(xt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),Wr(Hg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=h):h=t[15],h};var sx=D({markdownTransformers:[ra],nodes:[lx,nx,ix],plugins:[{Component:Ma,position:"normal"},{Component:ba,position:"normal"},{Component:ma,position:"floatingAnchorElem"},{Component:ya,position:"floatingAnchorElem"}],providers:[va],slashMenu:{groups:[z([{Icon:vr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Ro,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:vr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Ro,{})}}])]}});import{$isNodeSelection as Wx}from"lexical";import{jsx as Gr,jsxs as ax}from"react/jsx-runtime";import"react";var Vr=()=>ax("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:[Gr("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"}),Gr("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"}),Gr("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 Fa}from"react/jsx-runtime";import Pa from"bson-objectid";import{$applyNodeReplacement as fx}from"lexical";import*as Ba from"react";import cx from"bson-objectid";function Io(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 cx.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as ux}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as dx}from"@lexical/utils";import $a from"bson-objectid";import{$applyNodeReplacement as mx}from"lexical";var Gt=class extends ux{__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=>Io(o,Da),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new $a.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Da({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return dx(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 Da({data:t}){return t?.id||(t.id=new $a.default().toHexString()),mx(new Gt({data:t}))}import{jsx as Aa}from"react/jsx-runtime";import{ShimmerEffect as px}from"@payloadcms/ui";var Oa=()=>Aa("div",{className:"lexical-upload",children:Aa(px,{height:"95px",width:"203px"})});var hx=Ba.lazy(()=>import("./component-XIHC3W6W.js").then(t=>({default:t.UploadComponent}))),me=class extends Gt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Io(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 Pa.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?Fa(Oa,{}):Fa(hx,{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 Pa.default().toHexString()),fx(new me({data:t}))}function ut(t){return t instanceof me}import{c as wx}from"react/compiler-runtime";import{jsx as Ex}from"react/jsx-runtime";import{useLexicalComposerContext as Sx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Za,$insertNodeToNearestRoot as zr,mergeRegister as Nx}from"@lexical/utils";import{useBulkUpload as Lx,useEffectEvent as yx,useModal as Rx}from"@payloadcms/ui";import Xr from"bson-objectid";import{$createRangeSelection as Ix,$getPreviousSelection as Va,$getSelection as Ka,$isParagraphNode as Zr,$isRangeSelection as Ja,$setSelection as vx,COMMAND_PRIORITY_EDITOR as Mx,COMMAND_PRIORITY_LOW as za,createCommand as Dx,DROP_COMMAND as $x,getDOMSelectionFromTarget as Ax,isHTMLElement as Xa,PASTE_COMMAND as Ox}from"lexical";import{useEffect as Fx}from"react";import{c as ja}from"react/compiler-runtime";import{jsx as Kr}from"react/jsx-runtime";import{useLexicalComposerContext as Ha}from"@lexical/react/LexicalComposerContext.js";import{toast as gx}from"@payloadcms/ui";import{$getNodeByKey as xx,COMMAND_PRIORITY_EDITOR as Ua}from"lexical";import{useEffect as Wa,useState as Cx}from"react";var bx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=xx(o);n&&n.replace(pe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Jr,{fields:null,relationTo:e,value:r})},kx=t=>{let e=ja(13),{enabledCollectionSlugs:o}=t,[r]=Ha(),[n,l]=Cx(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}=Bt(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Xe,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Ua),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:x,doc:T}=f;i(),bx({editor:r,relationTo:x,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=Kr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},_x=()=>{let t=ja(3),[e]=Ha(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Xe,Tx,Ua),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Wa(o,r),null},Ga=({enabledCollectionSlugs:t})=>t?.length?Kr(kx,{enabledCollectionSlugs:t}):Kr(_x,{});function Tx(){return gx.error("No upload collections enabled"),!0}function Px(t){let e=t.target;return!!(Xa(e)&&!e.closest("code, span.editor-image")&&Xa(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Bx(t){let e,o=Ax(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 Jr=Dx("INSERT_UPLOAD_COMMAND"),Ya=t=>{let e=wx(21),{clientProps:o}=t,[r]=Sx(),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}=xo(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=Lx(),{isModalOpen:h,openModal:f}=Rx(),x;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?(x=b=>{let{files:g}=b;if(g?.length!==0&&(u(C=>[...C??[],...g.map(jx)]),!h(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{r.update(Hx)}),m(C=>{let k=new Map(C.map(Ux));r.update(()=>{for(let y of Za()){let I=y.node;if(ut(I)){let v=I.getData();if(v?.pending){let N=k.get(v.pending?.formID);N&&I.replace(pe({data:{id:new Xr.default().toHexString(),fields:{},relationTo:N.collectionSlug,value:N.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]=x):x=e[13];let T=yx(x),E;e[14]!==r||e[15]!==T?(E=()=>{if(!r.hasNodes([me]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Nx(r.registerNodeTransform(me,b=>{let g=b.getData();if(!g?.pending)return;(async function(){let y=null,I=g?.pending?.src,v=g?.pending?.formID;if(I?.startsWith("data:")){let N=I.match(/data:(image\/[a-zA-Z]+);base64,/),w=N?N[1]:"image/png",R=I.replace(/^data:image\/[a-zA-Z]+;base64,/,""),L=atob(R),M=new Array(L.length);for(let F=0;F<L.length;F++)M[F]=L.charCodeAt(F);let $=new Uint8Array(M);y={alt:void 0,file:new File([$],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:v}}else if(I?.startsWith("http")||I?.startsWith("https")){let w=await(await fetch(I)).blob(),R=I.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];y={alt:void 0,file:new File([w],R,{type:w.type}),formID:v}}y&&T({files:[y]})})()}),r.registerCommand(Jr,b=>(r.update(()=>{let g=Ka()||Va();if(Ja(g)){let C=pe({data:{id:b.id,fields:b.fields,relationTo:b.relationTo,value:b.value}}),{focus:k}=g,y=k.getNode();zr(C),Zr(y)&&!y.__first&&y.remove()}}),!0),Mx),r.registerCommand(Ox,b=>{if(!(b instanceof ClipboardEvent))return!1;let g=b.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{C.push({alt:"",file:k,formID:new Xr.default().toHexString()})}),C.length?(r.update(()=>{let k=Ka()||Va();if(Ja(k))for(let y of C){let I=pe({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:v}=k,N=v.getNode();zr(I),Zr(N)&&!N.__first&&N.remove()}}),T({files:C}),!0):!1},za),r.registerCommand($x,b=>{if(!(b instanceof DragEvent))return!1;let g=b.dataTransfer;if(!g?.types?.length)return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{C.push({alt:"",file:k,formID:new Xr.default().toHexString()})}),C.length?(b.preventDefault(),b.stopPropagation(),r.update(()=>{if(Px(b)){let k=Bx(b),y=Ix();k!=null&&y.applyDOMRange(k),vx(y);for(let I of C){let v=pe({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:N}=y,w=N.getNode();zr(v),Zr(w)&&!w.__first&&w.remove()}}}),T({files:C}),!0):!1},za))},e[14]=r,e[15]=T,e[16]=E):E=e[16];let S;e[17]!==r?(S=[r],e[17]=r,e[18]=S):S=e[18],Fx(E,S);let _;return e[19]!==i?(_=Ex(Ga,{enabledCollectionSlugs:i}),e[19]=i,e[20]=_):_=e[20],_};function jx(t){return{file:t.file,formID:t.formID}}function Hx(){for(let t of Za()){let e=t.node;ut(e)&&e.getData()?.pending&&e.remove()}}function Ux(t){return[t.formID,t]}var Gx=D({nodes:[me],plugins:[{Component:Ya,position:"normal"}],slashMenu:{groups:[z([{Icon:Vr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Vr,isActive:({selection:t})=>{if(!Wx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ut(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]}});import{c as Kx}from"react/compiler-runtime";import{jsx as Qr}from"react/jsx-runtime";import{ShimmerEffect as Jx,useConfig as zx}from"@payloadcms/ui";import{lazy as Xx,Suspense as Zx,useEffect as Yx,useState as qx}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 Yr={namespace:"lexical",theme:qa};function Qa({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 Vx}from"payload/shared";var ec=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?Vx(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 qr(t,e,o){return{admin:o,features:ec(t),lexical:e,resolvedFeatureMap:t}}var Qx=Xx(()=>import("./Field-HJGV32KA.js").then(t=>({default:t.RichText}))),eC=t=>{let e=Kx(18),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let u=c,a;e[2]!==n?(a=n===void 0?{}:n,e[2]=n,e[3]=a):a=e[3];let m=a,p=i===void 0?Yr:i,{config:h}=zx(),[f,x]=qx(null),T,E;e[4]!==u||e[5]!==r||e[6]!==h||e[7]!==m||e[8]!==l||e[9]!==s||e[10]!==f||e[11]!==p||e[12]!==d?(T=()=>{if(f)return;let _=[];for(let g of Object.values(r))g.clientFeatureProvider&&_.push(g.clientFeatureProvider(g.clientFeatureProps));let b=Qa({config:h,featureClientImportMap:m,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:_,lexical:p}});x(qr(b,p,u))},E=[u,r,h,m,l,s,f,p,d],e[4]=u,e[5]=r,e[6]=h,e[7]=m,e[8]=l,e[9]=s,e[10]=f,e[11]=p,e[12]=d,e[13]=T,e[14]=E):(T=e[13],E=e[14]),Yx(T,E);let S;return e[15]!==f||e[16]!==t?(S=Qr(Zx,{fallback:Qr(Jx,{height:"35vh"}),children:f&&Qr(Qx,{...t,editorConfig:f})}),e[15]=f,e[16]=t,e[17]=S):S=e[17],S};function tC(t){return t instanceof HTMLElement}function oC(...t){return t.filter(Boolean).join(" ")}var vo=new WeakMap;function tc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mo(t,e){let o=vo.get(t);if(o===void 0){let r=new Set,n=s=>{o!==void 0&&(o.start=tc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=tc(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},vo.set(t,o)}return o.listeners.add(e),()=>{rC(t,e)}}function rC(t,e){let o=vo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(vo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function nC(t,e){return Mo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function lC(t,e){return Mo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function iC(t,e){return Mo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function sC(t,e){return Mo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as aC}from"react/compiler-runtime";import{jsx as cC}from"react/jsx-runtime";import"react";var uC=()=>{let t=aC(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?cC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as dC}from"react/compiler-runtime";import{jsx as mC}from"react/jsx-runtime";import"react";var pC=()=>{let t=dC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?mC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as fC}from"react/compiler-runtime";import{jsx as hC}from"react/jsx-runtime";import"react";var gC=()=>{let t=fC(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?hC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as xC}from"react/compiler-runtime";import{jsx as CC}from"react/jsx-runtime";import"react";var bC=t=>{let e=xC(3),{children:o}=t,{InlineBlockContainer:r}=xe(),n;return e[0]!==r||e[1]!==o?(n=r?CC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as kC}from"react/jsx-runtime";import"react";var _C=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=be();return r?kC(r,{...o,children:e}):null};import{c as TC}from"react/compiler-runtime";import{jsx as wC}from"react/jsx-runtime";import"react";var EC=()=>{let t=TC(2),{EditButton:e}=be(),o;return t[0]!==e?(o=e?wC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as SC}from"react/compiler-runtime";import{jsx as NC}from"react/jsx-runtime";import"react";var LC=()=>{let t=SC(2),{RemoveButton:e}=be(),o;return t[0]!==e?(o=e?NC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as yC}from"qs-esm";var RC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=yC({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 oc={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 BC}from"react/jsx-runtime";import{CodeField as jC,useFormFields as HC}from"@payloadcms/ui";import{useId as UC,useMemo as WC}from"react";var Bo={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 GC=({autoComplete:t,field:e,forceRender:o,languages:r=Bo,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=HC(([T])=>T.language),m=a?.value||a?.initialValue||"typescript",p=UC(),h=r[m],f=WC(()=>({...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&&BC(jC,{autoComplete:t,field:f,forceRender:o,onMount:(T,w)=>{w.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),w.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),w.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:w.languages.typescript.JsxEmit.React,moduleResolution:w.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:w.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),w.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 _=>{let x=await(await fetch(_.url)).text();w.languages.typescript.typescriptDefaults.addExtraLib(x,_.filePath)})))()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},g)};import{jsx as re,jsxs as hc}from"react/jsx-runtime";import{useLexicalEditable as YC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as qC,Combobox as QC,CopyToClipboard as e2,PopupList as t2,RenderFields as o2,useForm as r2,useFormFields as gc,useTranslation as n2}from"@payloadcms/ui";import l2 from"react";import{jsx as ac}from"react/jsx-runtime";import"react";var cc=()=>ac("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:ac("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 dc}from"react/jsx-runtime";import"react";import{useCollapsible as JC}from"@payloadcms/ui";import{jsx as uc}from"react/jsx-runtime";import"react";var jo=()=>uc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:uc("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 VC="code-block-collapse-button",mc=()=>{let{toggle:t}=JC();return dc("button",{className:VC,onClick:t,type:"button",children:dc(jo,{})})};import{jsx as pc,jsxs as KC}from"react/jsx-runtime";import"react";import{useCollapsible as zC,useTranslation as ZC}from"@payloadcms/ui";var XC="code-block-floating-collapse-button",fc=()=>{let{isCollapsed:t,toggle:e}=zC(),{t:o}=ZC();return t?KC("button",{className:XC,onClick:e,type:"button",children:[pc("span",{children:o("general:collapse")}),pc(jo,{})]}):null};var We="payload-richtext-code-block",i2=t=>{let{languages:e}=t,o=e||Bo,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=se(),{setModified:s}=r2(),{t:i}=n2(),{codeField:d}=gc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=gc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=YC(),p=l2.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:re(t2.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:re("span",{className:`${We}__language-code`,"data-language":h,children:f})})})),[o,u]);return re(r,{Actions:hc("div",{className:`${We}__actions`,children:[re(QC,{button:hc("div",{className:`${We}__language-selector-button`,"data-selected-language":c?.value,children:[re("span",{children:a}),re(qC,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(e2,{value:d?.value??""}),re(mc,{}),m&&re(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:re(fc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${We}__pill`,children:re(cc,{})}),children:re(o2,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as s2}from"react/compiler-runtime";import{jsx as ct}from"react/jsx-runtime";import{FieldContext as a2,FieldPathContext as xc,ServerFunctionsContext as Cc,ShimmerEffect as c2,useServerFunctions as u2}from"@payloadcms/ui";import d2,{useEffect as m2,useRef as p2}from"react";var f2=t=>{let e=s2(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:s,setValue:i,value:d}=t,[c,u]=d2.useState(null),a=u2(),{_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:v}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:s});u(v)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=s,e[5]=g):g=e[5];let T=g,w=p2(!1),L,_;if(e[6]!==T?(L=()=>{w.current||(w.current=!0,T())},_=[T],e[6]=T,e[7]=L,e[8]=_):(L=e[7],_=e[8]),m2(L,_),!c)return typeof n<"u"?n:ct(c2,{});let b={...a,getFormState:async C=>a.getFormState({...C,collectionSlug:p==="collection"?h:void 0,globalSlug:p==="global"?h:void 0})};if(typeof d>"u"&&!i)return ct(Cc,{value:{...b},children:ct(xc,{value:f,children:c},f)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:f,setValue:i??h2,showError:!1,value:d};return ct(Cc,{value:{...b},children:ct(xc,{value:f,children:ct(a2,{value:x,children:c})},f)})};function h2(){}function bc({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 g2=bc;export{yt as $createAutoLinkNode,Ae as $createBlockNode,Ze as $createHorizontalRuleNode,ft as $createInlineBlockNode,Te as $createLinkNode,He as $createRelationshipNode,ge as $createUploadNode,Ee as $isAutoLinkNode,$e as $isBlockNode,Lt as $isHorizontalRuleNode,ht as $isInlineBlockNode,K as $isLinkNode,Ir as $isRelationshipNode,at as $isUploadNode,Hc as AlignFeatureClient,we as AutoLinkNode,IC as BlockCollapsible,DC as BlockEditButton,ae as BlockNode,OC as BlockRemoveButton,Xc as BlockquoteFeatureClient,nd as BlocksFeatureClient,Ld as BoldFeatureClient,ie as CAN_USE_DOM,Df as ChecklistFeatureClient,i2 as CodeBlockBlockComponent,GC as CodeComponent,S0 as DETAIL_TYPE_TO_DETAIL,_0 as DOUBLE_LINE_BREAK,P0 as DebugJsxConverterFeatureClient,L0 as ELEMENT_FORMAT_TO_TYPE,N0 as ELEMENT_TYPE_TO_FORMAT,Nc as ENABLE_SLASH_MENU_COMMAND,Tc as EditorConfigProvider,gt as FieldsDrawer,uh as FixedToolbarFeatureClient,Tm as HeadingFeatureClient,jm as HorizontalRuleFeatureClient,_e as HorizontalRuleNode,Xe as INSERT_BLOCK_COMMAND,ze as INSERT_INLINE_BLOCK_COMMAND,b0 as IS_ALL_FORMATTING,op as IndentFeatureClient,yC as InlineBlockContainer,bC as InlineBlockEditButton,SC as InlineBlockLabel,pt as InlineBlockNode,TC as InlineBlockRemoveButton,Md as InlineCodeFeatureClient,Th as InlineToolbarFeatureClient,Od as ItalicFeatureClient,w0 as LTR_REGEX,o0 as LexicalPluginToLexicalFeatureClient,Cf as LinkFeatureClient,oe as LinkNode,k0 as NON_BREAKING_SPACE,O as NodeFormat,Hf as OrderedListFeatureClient,d0 as ParagraphFeatureClient,Ec as Point,T0 as RTL_REGEX,Lc as Rect,y1 as RelationshipFeatureClient,Ne as RelationshipNode,f2 as RenderLexical,aC as RichTextField,Wo as RichTextViewProvider,c0 as SlateToLexicalFeatureClient,Hd as StrikethroughFeatureClient,Vd as SubscriptFeatureClient,zd as SuperscriptFeatureClient,y0 as TEXT_MODE_TO_TYPE,E0 as TEXT_TYPE_TO_FORMAT,R0 as TEXT_TYPE_TO_MODE,pe as TOGGLE_LINK_COMMAND,fx as TableFeatureClient,Cd as TestRecorderFeatureClient,dm as TextStateFeatureClient,Bt as ToolbarButton,Ue as ToolbarDropdown,wd as TreeViewFeatureClient,em as UnderlineFeatureClient,zf as UnorderedListFeatureClient,Yx as UploadFeatureClient,he as UploadNode,gC as addSwipeDownListener,pC as addSwipeLeftListener,fC as addSwipeRightListener,hC as addSwipeUpListener,g2 as buildDefaultEditorState,bc as buildEditorState,sc as codeConverterClient,cr as createBlockNode,D as createClientFeature,B0 as defaultColors,rn as defaultEditorLexicalConfig,Or as getDOMRangeRect,yc as getEnabledNodes,PC as getRestPopulateFn,Ye as getSelectedNode,uC as isHTMLElement,Sc as isPoint,dC as joinClasses,nn as sanitizeClientEditorConfig,lc as sanitizeClientFeatures,So as setFloatingElemPosition,go as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,dr as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,se as useBlockComponentContext,U as useEditorConfigContext,Ce as useInlineBlockComponentContext,wc as useLexicalDocumentDrawer,xe as useLexicalDrawer,Pt as useLexicalListDrawer,Go as useRichTextView};
65
+ `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as IC}from"react/jsx-runtime";import{CodeField as vC,useFormFields as MC}from"@payloadcms/ui";import{useId as DC,useMemo as $C}from"react";var Do={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 AC=({autoComplete:t,field:e,forceRender:o,languages:r=Do,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=MC(([T])=>T.language),m=a?.value||a?.initialValue||"typescript",p=DC(),h=r[m],f=$C(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),x=`${e.name}-${m}-${h}`;return f&&IC(vC,{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 _=>{let g=await(await fetch(_.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(g,_.filePath)})))()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},x)};import{jsx as oe,jsxs as uc}from"react/jsx-runtime";import{useLexicalEditable as UC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as WC,Combobox as GC,CopyToClipboard as VC,PopupList as KC,RenderFields as JC,useForm as zC,useFormFields as dc,useTranslation as XC}from"@payloadcms/ui";import ZC from"react";import{jsx as rc}from"react/jsx-runtime";import"react";var nc=()=>rc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:rc("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 ic}from"react/jsx-runtime";import"react";import{useCollapsible as FC}from"@payloadcms/ui";import{jsx as lc}from"react/jsx-runtime";import"react";var $o=()=>lc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:lc("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 OC="code-block-collapse-button",sc=()=>{let{toggle:t}=FC();return ic("button",{className:OC,onClick:t,type:"button",children:ic($o,{})})};import{jsx as ac,jsxs as PC}from"react/jsx-runtime";import"react";import{useCollapsible as jC,useTranslation as HC}from"@payloadcms/ui";var BC="code-block-floating-collapse-button",cc=()=>{let{isCollapsed:t,toggle:e}=jC(),{t:o}=HC();return t?PC("button",{className:BC,onClick:e,type:"button",children:[ac("span",{children:o("general:collapse")}),ac($o,{})]}):null};var Ge="payload-richtext-code-block",YC=t=>{let{languages:e}=t,o=e||Do,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=be(),{setModified:s}=zC(),{t:i}=XC(),{codeField:d}=dc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=dc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:x=>{f({type:"UPDATE",path:"language",value:x}),s(!0)}})),a=o[c?.value],m=UC(),p=ZC.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:oe(KC.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:oe("span",{className:`${Ge}__language-code`,"data-language":h,children:f})})})),[o,u]);return oe(r,{Actions:uc("div",{className:`${Ge}__actions`,children:[oe(GC,{button:uc("div",{className:`${Ge}__language-selector-button`,"data-selected-language":c?.value,children:[oe("span",{children:a}),oe(WC,{className:`${Ge}__chevron`})]}),buttonType:"custom",className:`${Ge}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),oe(VC,{value:d?.value??""}),oe(sc,{}),m&&oe(l,{})]}),className:Ge,collapsibleProps:{AfterCollapsible:oe(cc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:oe("div",{className:`${Ge}__pill`,children:oe(nc,{})}),children:oe(JC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as qC}from"react/compiler-runtime";import{jsx as dt}from"react/jsx-runtime";import{FieldContext as QC,FieldPathContext as mc,ServerFunctionsContext as pc,ShimmerEffect as e2,useServerFunctions as t2}from"@payloadcms/ui";import o2,{useEffect as r2,useRef as n2}from"react";var l2=t=>{let e=qC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:s,setValue:i,value:d}=t,[c,u]=o2.useState(null),a=t2(),{_internal_renderField:m}=a,[p,h]=s.split(".",2),f=l??(o&&"name"in o?o?.name:"")??"",x;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==s?(x=()=>{(async function(){let{Field:y}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:s});u(y)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=s,e[5]=x):x=e[5];let T=x,E=n2(!1),S,_;if(e[6]!==T?(S=()=>{E.current||(E.current=!0,T())},_=[T],e[6]=T,e[7]=S,e[8]=_):(S=e[7],_=e[8]),r2(S,_),!c)return typeof n<"u"?n:dt(e2,{});let b={...a,getFormState:async C=>a.getFormState({...C,collectionSlug:p==="collection"?h:void 0,globalSlug:p==="global"?h:void 0})};if(typeof d>"u"&&!i)return dt(pc,{value:{...b},children:dt(mc,{value:f,children:c},f)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:f,setValue:i??i2,showError:!1,value:d};return dt(pc,{value:{...b},children:dt(mc,{value:f,children:dt(QC,{value:g,children:c})},f)})};function i2(){}function fc({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 s2=fc;export{Rt as $createAutoLinkNode,Oe as $createBlockNode,qe as $createHorizontalRuleNode,ht as $createInlineBlockNode,Te as $createLinkNode,Ue as $createRelationshipNode,pe as $createUploadNode,Ee as $isAutoLinkNode,Ae as $isBlockNode,yt as $isHorizontalRuleNode,gt as $isInlineBlockNode,J as $isLinkNode,Er as $isRelationshipNode,ut as $isUploadNode,Oc as AlignFeatureClient,we as AutoLinkNode,_C as BlockCollapsible,EC as BlockEditButton,ie as BlockNode,LC as BlockRemoveButton,Wc as BlockquoteFeatureClient,Qu as BlocksFeatureClient,Td as BoldFeatureClient,ne as CAN_USE_DOM,yf as ChecklistFeatureClient,YC as CodeBlockBlockComponent,AC as CodeComponent,k0 as DETAIL_TYPE_TO_DETAIL,g0 as DOUBLE_LINE_BREAK,v0 as DebugJsxConverterFeatureClient,T0 as ELEMENT_FORMAT_TO_TYPE,_0 as ELEMENT_TYPE_TO_FORMAT,_c as ENABLE_SLASH_MENU_COMMAND,xc as EditorConfigProvider,xt as FieldsDrawer,rh as FixedToolbarFeatureClient,xm as HeadingFeatureClient,Am as HorizontalRuleFeatureClient,_e as HorizontalRuleNode,Ze as INSERT_BLOCK_COMMAND,Ye as INSERT_INLINE_BLOCK_COMMAND,f0 as IS_ALL_FORMATTING,Ym as IndentFeatureClient,bC as InlineBlockContainer,uC as InlineBlockEditButton,gC as InlineBlockLabel,ft as InlineBlockNode,pC as InlineBlockRemoveButton,Ld as InlineCodeFeatureClient,hh as InlineToolbarFeatureClient,vd as ItalicFeatureClient,C0 as LTR_REGEX,Yf as LexicalPluginToLexicalFeatureClient,pf as LinkFeatureClient,te as LinkNode,h0 as NON_BREAKING_SPACE,O as NodeFormat,Of as OrderedListFeatureClient,i0 as ParagraphFeatureClient,bc as Point,x0 as RTL_REGEX,Tc as Rect,_1 as RelationshipFeatureClient,Ne as RelationshipNode,l2 as RenderLexical,eC as RichTextField,n0 as SlateToLexicalFeatureClient,Od as StrikethroughFeatureClient,jd as SubscriptFeatureClient,Gd as SuperscriptFeatureClient,w0 as TEXT_MODE_TO_TYPE,b0 as TEXT_TYPE_TO_FORMAT,E0 as TEXT_TYPE_TO_MODE,ue as TOGGLE_LINK_COMMAND,sx as TableFeatureClient,pd as TestRecorderFeatureClient,im as TextStateFeatureClient,jt as ToolbarButton,We as ToolbarDropdown,Cd as TreeViewFeatureClient,Xd as UnderlineFeatureClient,Gf as UnorderedListFeatureClient,Gx as UploadFeatureClient,me as UploadNode,sC as addSwipeDownListener,nC as addSwipeLeftListener,lC as addSwipeRightListener,iC as addSwipeUpListener,s2 as buildDefaultEditorState,fc as buildEditorState,oc as codeConverterClient,or as createBlockNode,D as createClientFeature,M0 as defaultColors,Yr as defaultEditorLexicalConfig,Ir as getDOMRangeRect,wc as getEnabledNodes,RC as getRestPopulateFn,Qe as getSelectedNode,tC as isHTMLElement,kc as isPoint,oC as joinClasses,qr as sanitizeClientEditorConfig,ec as sanitizeClientFeatures,ko as setFloatingElemPosition,po as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,nr as toolbarFeatureButtonsGroupWithItems,X as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,be as useBlockComponentContext,U as useEditorConfigContext,xe as useInlineBlockComponentContext,Cc as useLexicalDocumentDrawer,ge as useLexicalDrawer,Bt as useLexicalListDrawer};
66
66
  //# sourceMappingURL=index.js.map