@payloadcms/richtext-lexical 3.17.1 → 3.18.0-canary.030d28e

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 (116) hide show
  1. package/dist/dependencyChecker.spec.js +17 -0
  2. package/dist/dependencyChecker.spec.js.map +1 -0
  3. package/dist/exports/client/{RelationshipComponent-AAFBGDZ5.js → RelationshipComponent-SOY5AKWW.js} +2 -2
  4. package/dist/exports/client/chunk-DIR6RNSY.js +2 -0
  5. package/dist/exports/client/chunk-DIR6RNSY.js.map +7 -0
  6. package/dist/exports/client/{chunk-CGFQWJ56.js → chunk-JNGXYK2K.js} +2 -2
  7. package/dist/exports/client/chunk-JNGXYK2K.js.map +7 -0
  8. package/dist/exports/client/{chunk-XXNV22UZ.js → chunk-RIV4NGKY.js} +2 -2
  9. package/dist/exports/client/{chunk-XXNV22UZ.js.map → chunk-RIV4NGKY.js.map} +2 -2
  10. package/dist/exports/client/{chunk-AXXPUMFU.js → chunk-RJTGMBHA.js} +2 -2
  11. package/dist/exports/client/chunk-RJTGMBHA.js.map +7 -0
  12. package/dist/exports/client/{component-SX36AJXS.js → component-FU65NQBY.js} +2 -2
  13. package/dist/exports/client/{component-NUQPQ2MC.js → component-VZEKUT7Y.js} +2 -2
  14. package/dist/exports/client/componentInline-MX6DTKSG.js +2 -0
  15. package/dist/exports/client/index.js +8 -8
  16. package/dist/exports/client/index.js.map +3 -3
  17. package/dist/exports/react/components/RichText/converter/converters/link.js +1 -1
  18. package/dist/exports/react/components/RichText/converter/converters/link.js.map +1 -1
  19. package/dist/exports/react/components/RichText/converter/converters/tab.d.ts +4 -0
  20. package/dist/exports/react/components/RichText/converter/converters/tab.d.ts.map +1 -0
  21. package/dist/exports/react/components/RichText/converter/converters/tab.js +9 -0
  22. package/dist/exports/react/components/RichText/converter/converters/tab.js.map +1 -0
  23. package/dist/exports/react/components/RichText/converter/defaultConverters.d.ts.map +1 -1
  24. package/dist/exports/react/components/RichText/converter/defaultConverters.js +3 -1
  25. package/dist/exports/react/components/RichText/converter/defaultConverters.js.map +1 -1
  26. package/dist/exports/react/components/RichText/converter/index.d.ts.map +1 -1
  27. package/dist/exports/react/components/RichText/converter/index.js +2 -1
  28. package/dist/exports/react/components/RichText/converter/index.js.map +1 -1
  29. package/dist/exports/react/index.d.ts +1 -0
  30. package/dist/exports/react/index.d.ts.map +1 -1
  31. package/dist/exports/react/index.js +1 -0
  32. package/dist/exports/react/index.js.map +1 -1
  33. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  34. package/dist/features/blocks/client/component/index.js +1 -2
  35. package/dist/features/blocks/client/component/index.js.map +1 -1
  36. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  37. package/dist/features/blocks/client/componentInline/index.js +3 -5
  38. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  39. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  40. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  41. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  42. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  43. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  44. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  45. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  46. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  47. package/dist/features/converters/html/converter/converters/linebreak.d.ts +2 -2
  48. package/dist/features/converters/html/converter/converters/linebreak.d.ts.map +1 -1
  49. package/dist/features/converters/html/converter/converters/linebreak.js.map +1 -1
  50. package/dist/features/converters/html/converter/converters/paragraph.d.ts +1 -1
  51. package/dist/features/converters/html/converter/converters/paragraph.d.ts.map +1 -1
  52. package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
  53. package/dist/features/converters/html/converter/converters/tab.d.ts +4 -0
  54. package/dist/features/converters/html/converter/converters/tab.d.ts.map +1 -0
  55. package/dist/features/converters/html/converter/converters/tab.js +9 -0
  56. package/dist/features/converters/html/converter/converters/tab.js.map +1 -0
  57. package/dist/features/converters/html/converter/converters/text.d.ts +1 -1
  58. package/dist/features/converters/html/converter/converters/text.d.ts.map +1 -1
  59. package/dist/features/converters/html/converter/converters/text.js.map +1 -1
  60. package/dist/features/converters/html/converter/defaultConverters.d.ts.map +1 -1
  61. package/dist/features/converters/html/converter/defaultConverters.js +2 -1
  62. package/dist/features/converters/html/converter/defaultConverters.js.map +1 -1
  63. package/dist/features/converters/html/converter/index.d.ts.map +1 -1
  64. package/dist/features/converters/html/converter/index.js +2 -1
  65. package/dist/features/converters/html/converter/index.js.map +1 -1
  66. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  67. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  68. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  69. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  70. package/dist/features/link/client/plugins/autoLink/index.js +1 -1
  71. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  72. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  73. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  74. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  75. package/dist/features/link/nodes/LinkNode.js +8 -4
  76. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  77. package/dist/features/link/nodes/types.d.ts +2 -2
  78. package/dist/features/link/nodes/types.d.ts.map +1 -1
  79. package/dist/features/link/nodes/types.js.map +1 -1
  80. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  81. package/dist/features/link/server/baseFields.js +7 -1
  82. package/dist/features/link/server/baseFields.js.map +1 -1
  83. package/dist/features/link/server/index.js +1 -1
  84. package/dist/features/link/server/index.js.map +1 -1
  85. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  86. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  87. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  88. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  89. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  90. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  91. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  92. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  93. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  94. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  95. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  96. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  97. package/dist/field/rscEntry.d.ts.map +1 -1
  98. package/dist/field/rscEntry.js +3 -0
  99. package/dist/field/rscEntry.js.map +1 -1
  100. package/dist/index.d.ts +2 -0
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +3 -1
  103. package/dist/index.js.map +1 -1
  104. package/dist/nodeTypes.d.ts +5 -1
  105. package/dist/nodeTypes.d.ts.map +1 -1
  106. package/dist/nodeTypes.js.map +1 -1
  107. package/package.json +6 -6
  108. package/dist/exports/client/chunk-AXXPUMFU.js.map +0 -7
  109. package/dist/exports/client/chunk-CGFQWJ56.js.map +0 -7
  110. package/dist/exports/client/chunk-XI5JV5QT.js +0 -2
  111. package/dist/exports/client/chunk-XI5JV5QT.js.map +0 -7
  112. package/dist/exports/client/componentInline-KDFOWBR5.js +0 -2
  113. /package/dist/exports/client/{RelationshipComponent-AAFBGDZ5.js.map → RelationshipComponent-SOY5AKWW.js.map} +0 -0
  114. /package/dist/exports/client/{component-SX36AJXS.js.map → component-FU65NQBY.js.map} +0 -0
  115. /package/dist/exports/client/{component-NUQPQ2MC.js.map → component-VZEKUT7Y.js.map} +0 -0
  116. /package/dist/exports/client/{componentInline-KDFOWBR5.js.map → componentInline-MX6DTKSG.js.map} +0 -0
@@ -1,6 +1,6 @@
1
- "use client";import{a as ce,c as io,d as lo,e as so}from"./chunk-XI5JV5QT.js";import{a as We,b as _t,c as Tt,d as wt}from"./chunk-AXXPUMFU.js";import{a as Ke,b as ze,c as Ze,d as ao}from"./chunk-CGFQWJ56.js";import{a as Ve,b as Et,c as Ae,d as Ye,e as Xe,f as co}from"./chunk-XXNV22UZ.js";import{a as ae}from"./chunk-INBEEENE.js";import{a as hs}from"./chunk-F26IQ5RE.js";import{a as fs,b as br,d as _r,e as Tr,f as gs,g as Cs,h as xs,j as bs,l as _s,m as Ts}from"./chunk-7XFF5VOE.js";import{a as ps,b as B}from"./chunk-3LGFOM34.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as _e,$isRangeSelection as Nt,FORMAT_ELEMENT_COMMAND as Lt}from"lexical";import{jsx as uo,jsxs as ws}from"react/jsx-runtime";import"react";var wr=()=>ws("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[uo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as mo,jsxs as Es}from"react/jsx-runtime";import"react";var Er=()=>Es("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 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as po,jsxs as ks}from"react/jsx-runtime";import"react";var kt=()=>ks("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:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as fo,jsxs as Ns}from"react/jsx-runtime";import"react";var kr=()=>Ns("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:[fo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),fo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),fo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var v=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({featureClientSchemaMap:n,featureProviderMap:i,field:l,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d})=>{let c=t({featureClientSchemaMap:n,featureProviderMap:i,field:l,props:o,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d});return c.sanitizedClientFeatureProps===null&&(c.sanitizedClientFeatureProps=o),c};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Nr=t=>({type:"dropdown",ChildComponent:kt,items:t,key:"align",order:30});var Lr=[Nr([{ChildComponent:kt,isActive:({selection:t})=>{if(!Nt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,"left")},order:1},{ChildComponent:wr,isActive:({selection:t})=>{if(!Nt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,"center")},order:2},{ChildComponent:kr,isActive:({selection:t})=>{if(!Nt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,"right")},order:3},{ChildComponent:Er,isActive:({selection:t})=>{if(!Nt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,"justify")},order:4}])],Ls=v({toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{$createQuoteNode as Dr,$isQuoteNode as vr,QuoteNode as ys}from"@lexical/rich-text";import{$setBlocksType as Ar}from"@lexical/selection";import{$getSelection as Fr,$isRangeSelection as vs}from"lexical";import{jsx as Ir}from"react/jsx-runtime";import"react";var ho=()=>Ir("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:Ir("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 Rr}from"react/jsx-runtime";import"react";var Je=()=>Rr("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:Rr("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 J=t=>({type:"dropdown",ChildComponent:Je,items:t,key:"text",order:25});import{$createQuoteNode as Is,$isQuoteNode as Sr,QuoteNode as Rs}from"@lexical/rich-text";import{$createLineBreakNode as Ss}from"lexical";var yr={type:"element",dependencies:[Rs],export:(t,e)=>{if(!Sr(t))return null;let o=e(t).split(`
1
+ "use client";import{a as ce,c as io,d as lo,e as so}from"./chunk-DIR6RNSY.js";import{a as We,b as _t,c as Tt,d as wt}from"./chunk-RJTGMBHA.js";import{a as Ke,b as ze,c as Ze,d as ao}from"./chunk-JNGXYK2K.js";import{a as Ve,b as Et,c as Ae,d as Ye,e as Xe,f as co}from"./chunk-RIV4NGKY.js";import{a as ae}from"./chunk-INBEEENE.js";import{a as fs}from"./chunk-F26IQ5RE.js";import{a as ps,b as br,d as _r,e as Tr,f as hs,g as gs,h as Cs,j as xs,l as bs,m as _s}from"./chunk-7XFF5VOE.js";import{a as ms,b as B}from"./chunk-3LGFOM34.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as _e,$isRangeSelection as Nt,FORMAT_ELEMENT_COMMAND as Lt}from"lexical";import{jsx as uo,jsxs as Ts}from"react/jsx-runtime";import"react";var wr=()=>Ts("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[uo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as mo,jsxs as ws}from"react/jsx-runtime";import"react";var Er=()=>ws("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 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as po,jsxs as Es}from"react/jsx-runtime";import"react";var kt=()=>Es("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:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as fo,jsxs as ks}from"react/jsx-runtime";import"react";var kr=()=>ks("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:[fo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),fo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),fo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var v=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({featureClientSchemaMap:n,featureProviderMap:i,field:l,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d})=>{let c=t({featureClientSchemaMap:n,featureProviderMap:i,field:l,props:o,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:d});return c.sanitizedClientFeatureProps===null&&(c.sanitizedClientFeatureProps=o),c};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Nr=t=>({type:"dropdown",ChildComponent:kt,items:t,key:"align",order:30});var Lr=[Nr([{ChildComponent:kt,isActive:({selection:t})=>{if(!Nt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,"left")},order:1},{ChildComponent:wr,isActive:({selection:t})=>{if(!Nt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,"center")},order:2},{ChildComponent:kr,isActive:({selection:t})=>{if(!Nt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,"right")},order:3},{ChildComponent:Er,isActive:({selection:t})=>{if(!Nt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Lt,"justify")},order:4}])],Ns=v({toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{$createQuoteNode as Dr,$isQuoteNode as vr,QuoteNode as Ss}from"@lexical/rich-text";import{$setBlocksType as Ar}from"@lexical/selection";import{$getSelection as Fr,$isRangeSelection as ys}from"lexical";import{jsx as Ir}from"react/jsx-runtime";import"react";var ho=()=>Ir("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:Ir("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 Rr}from"react/jsx-runtime";import"react";var Je=()=>Rr("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:Rr("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 J=t=>({type:"dropdown",ChildComponent:Je,items:t,key:"text",order:25});import{$createQuoteNode as Ls,$isQuoteNode as Sr,QuoteNode as Is}from"@lexical/rich-text";import{$createLineBreakNode as Rs}from"lexical";var yr={type:"element",dependencies:[Is],export:(t,e)=>{if(!Sr(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 i=t.getPreviousSibling();if(Sr(i)){i.splice(i.getChildrenSize(),0,[Ss(),...e]),i.select(0,0),t.remove();return}}let n=Is();n.append(...e),t.replace(n),n.select(0,0)}};var Mr=[J([{ChildComponent:ho,isActive:({selection:t})=>{if(!vs(t))return!1;for(let e of t.getNodes())if(!vr(e)&&!vr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Fr();Ar(e,()=>Dr())})},order:20}])],Ms=v({markdownTransformers:[yr],nodes:[ys],slashMenu:{groups:[Z([{Icon:ho,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Fr();Ar(e,()=>Dr())})}}])]},toolbarFixed:{groups:Mr},toolbarInline:{groups:Mr}});import{getTranslation as Dt}from"@payloadcms/translations";import{jsx as go,jsxs as Ds}from"react/jsx-runtime";import"react";var It=()=>Ds("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:[go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Or}from"react/jsx-runtime";import"react";var Rt=()=>Or("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:Or("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 As}from"react/jsx-runtime";import"react";function St(t,e){return t?()=>As("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):It}import{jsx as ua}from"react/jsx-runtime";import da from"bson-objectid";import"react";import{DecoratorBlockNode as Fs}from"@lexical/react/LexicalDecoratorBlockNode.js";import Os from"bson-objectid";var qe=class extends Fs{__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=$s(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}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 $s(t){return new qe({fields:{...t,id:t?.id||new Os.default().toHexString()}})}import{jsx as K,jsxs as Qe,Fragment as Ws}from"react/jsx-runtime";import{Button as Hr,Collapsible as Vs,Drawer as Ks,EditDepthProvider as zs,ErrorPill as Zs,Form as Ys,formatDrawerSlug as Xs,FormSubmit as Js,Pill as qs,RenderFields as Qs,SectionTitle as ea,useDocumentInfo as jr,useEditDepth as ta,useFormSubmitted as oa,useServerFunctions as ra,useTranslation as na}from"@payloadcms/ui";import{abortAndIgnore as Co}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as ia,reduceFieldsToValues as Gr}from"payload/shared";import et,{useCallback as xo,useEffect as bo,useMemo as tt,useRef as la}from"react";import{useLexicalComposerContext as sa}from"@lexical/react/LexicalComposerContext";import{getTranslation as aa}from"@payloadcms/translations";import{$getNodeByKey as _o}from"lexical";import{v4 as ca}from"uuid";import{c as Ps}from"react/compiler-runtime";import{jsx as yt,jsxs as Bs}from"react/jsx-runtime";import{RenderFields as Hs,useFormSubmitted as js}from"@payloadcms/ui";import Gs,{createContext as Us}from"react";var $r=Us({initialState:!1}),ke=()=>Gs.useContext($r),Pr=t=>{let e=Ps(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:a,nodeKey:d,RemoveButton:c}=t,m=js()&&l>0,p,f;e[0]!==r||e[1]!==l||e[2]!==m?(f=_=>yt(r,{editButton:_.editButton,errorCount:l,fieldHasErrors:m,Label:_.Label,removeButton:_.removeButton,children:_.children}),e[0]=r,e[1]=l,e[2]=m,e[3]=f):f=e[3],p=f;let h=p,x;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==i||e[8]!==c||e[9]!==s||e[10]!==a||e[11]!==d?(x=n?Bs($r.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:a,nodeKey:d,RemoveButton:c},children:[n,yt(o,{})]}):yt(h,{children:yt(Hs,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=i,e[8]=c,e[9]=s,e[10]=a,e[11]=d,e[12]=x):x=e[12],x};function Br({fields:t}){for(let e in t){let o=t[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ee="lexical-block",Ur=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=oa(),{id:i,collectionSlug:l,globalSlug:s}=jr(),{fieldProps:{featureClientSchemaMap:a,field:d,initialLexicalFormState:c,permissions:u,readOnly:m,schemaPath:p},uuid:f}=B(),h=la(new AbortController),x=ta(),[_,y]=et.useState(0),D=Xs({slug:`lexical-blocks-create-${f}-${o.id}`,depth:x}),{toggleDrawer:g}=ae(D),{getDocPreferences:w,setDocFieldPreferences:C}=jr(),[b]=sa(),{getFormState:I}=ra(),N=`${p}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[k,R]=et.useState(c?.[o.id]?.formState?{...c?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1);bo(()=>{R(!1)},[e]);let[T,E]=et.useState(k?._components?.customComponents?.BlockLabel),[S,L]=et.useState(k?._components?.customComponents?.Block);bo(()=>{let G=new AbortController;return o&&!k&&(async()=>{let{state:V}=await I({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await w(),globalSlug:s,operation:"update",renderAllFields:!0,schemaPath:N,signal:G.signal});V&&(V.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName},R(V),E(V._components?.customComponents?.BlockLabel),L(V._components?.customComponents?.Block))})(),()=>{Co(G)}},[I,N,i,o,k,l,s,w]);let[A,M]=et.useState(c?.[o.id]?.collapsed??!1),O=`${p}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,H=a.blocks[O]?.[0]?.blocks?.[0],{i18n:oe,t:W}=na(),j=xo(async({formState:G,submit:re})=>{Co(h.current);let V=new AbortController;h.current=V;let{state:X}=await I({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await w(),formState:G,globalSlug:s,operation:"update",renderAllFields:!!re,schemaPath:N,signal:V.signal});if(!X)return G;X.blockName=G.blockName;let Q=Gr(Br({fields:ia(X)}),!0);if(setTimeout(()=>{b.update(()=>{let se=_o(r);if(se&&vt(se)){let De=Q;De.blockType=o.blockType,se.setFields(De,!0)}})},0),re){E(X._components?.customComponents?.BlockLabel),L(X._components?.customComponents?.Block);let se=0;for(let De of Object.values(X))De?.valid===!1&&se++;y(se)}return X},[I,i,l,w,s,N,o.blockType,b,r]);bo(()=>()=>{Co(h.current)},[]);let Ee=xo(()=>{b.update(()=>{_o(r)?.remove()})},[b,r]),xe=H?.labels?.singular?aa(H.labels.singular,oe):H?.slug,be=xo(G=>{w().then(re=>{let X=re?.fields?.[d.name]?.collapsed,Q=X&&X?.length?X:[];G?Q.includes(o.id)||Q.push(o.id):Q.includes(o.id)&&Q.splice(Q.indexOf(o.id),1),C(d.name,{collapsed:Q,hello:"hi"})})},[w,d.name,C,o.id]),ve=tt(()=>()=>K(Hr,{buttonStyle:"icon-label",className:`${ee}__editButton`,disabled:m,el:"button",icon:"edit",onClick:G=>(G.preventDefault(),G.stopPropagation(),g(),!1),onMouseDown:G=>{G.preventDefault()},round:!0,size:"small",tooltip:W("lexical:blocks:inlineBlocks:edit",{label:xe})}),[xe,m,W,g]),Me=tt(()=>()=>K(Hr,{buttonStyle:"icon-label",className:`${ee}__removeButton`,disabled:d?.admin?.readOnly||!1,icon:"x",onClick:G=>{G.preventDefault(),Ee()},round:!0,tooltip:"Remove Block"}),[d?.admin?.readOnly,Ee]),Ue=tt(()=>({children:G,disableBlockName:re,editButton:V,errorCount:X,fieldHasErrors:Q,Label:se,removeButton:De})=>K("div",{className:ee+" "+ee+"-"+o.blockType,children:K(Vs,{className:[`${ee}__row`,Q?`${ee}__row--has-errors`:`${ee}__row--no-errors`].join(" "),collapsibleStyle:Q?"error":"default",header:Qe("div",{className:`${ee}__block-header`,children:[se??T?se??T:Qe("div",{children:[K(qs,{className:`${ee}__block-pill ${ee}__block-pill-${o?.blockType}`,pillStyle:"white",children:xe??o?.blockType}),!re&&K(ea,{path:"blockName",readOnly:d?.admin?.readOnly||!1}),Q&&K(Zs,{count:X??0,i18n:oe,withMessage:!0})]}),Qe("div",{children:[S&&V!==!1||!S&&V?K(ve,{}):null,De!==!1&&b.isEditable()?K(Me,{}):null]})]}),isCollapsed:A,onToggle:xr=>{be(xr),M(xr)},children:G},0)}),[S,T,ve,Me,xe,b,o.blockType,oe,A,be,d?.admin?.readOnly]),bt=tt(()=>()=>K(zs,{children:K(Ks,{className:"",slug:D,title:W(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:xe??W("lexical:blocks:inlineBlocks:label")}),children:k?Qe(Ws,{children:[K(Qs,{fields:H?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:u,readOnly:!1}),K(Js,{programmaticSubmit:!0,children:W("fields:saveChanges")})]}):null})}),[k,D,xe,W,H?.fields,N,u]),ms=tt(()=>k?K(Ys,{beforeSubmit:[async({formState:G})=>await j({formState:G,submit:!0})],fields:H?.fields,initialState:k,onChange:[j],onSubmit:G=>{let re=Gr(G);re.blockType=o.blockType,b.update(()=>{let V=_o(r);V&&vt(V)&&V.setFields(re,!0)}),g()},submitted:n,uuid:ca(),children:K(Pr,{baseClass:ee,BlockDrawer:bt,Collapsible:Ue,CustomBlock:S,EditButton:ve,errorCount:_,formSchema:H?.fields,initialState:k,nodeKey:r,RemoveButton:Me})}):null,[Ue,bt,S,Me,ve,b,_,g,H?.fields,k,r,j,n]);return H?ms:K(Ue,{disableBlockName:!0,fieldHasErrors:!0,children:Qe("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var ue=class extends qe{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=Mt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return ua(Ur,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Mt(t){return new ue({fields:{...t,id:t?.id||new da.default().toHexString()}})}function vt(t){return t instanceof ue}import{createCommand as Wr}from"lexical";var ot=Wr("INSERT_BLOCK_COMMAND"),rt=Wr("INSERT_INLINE_BLOCK_COMMAND");import{c as ma}from"react/compiler-runtime";import{useLexicalComposerContext as pa}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as fa,$wrapNodeInElement as ha,mergeRegister as ga}from"@lexical/utils";import{formatDrawerSlug as Ca,useEditDepth as xa}from"@payloadcms/ui";import{$createParagraphNode as ba,$getNodeByKey as _a,$getPreviousSelection as Ta,$getSelection as wa,$insertNodes as Ea,$isParagraphNode as Kr,$isRangeSelection as ka,$isRootOrShadowRoot as Na,COMMAND_PRIORITY_EDITOR as Vr}from"lexical";import{useEffect as La,useState as Ia}from"react";var zr=()=>{let t=ma(12),[e]=pa(),[o,r]=Ia(null),{setCreatedInlineBlock:n,uuid:i}=B(),l=xa(),s="lexical-inlineBlocks-create-"+i,a;t[0]!==l||t[1]!==s?(a=Ca({slug:s,depth:l}),t[0]=l,t[1]=s,t[2]=a):a=t[2];let d=a,{toggleDrawer:c}=ae(d,!0),u;t[3]!==e||t[4]!==n||t[5]!==o?(u=()=>{if(!e.hasNodes([ue]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return ga(e.registerCommand(ot,p=>(e.update(()=>{let f=wa()||Ta();if(ka(f)){let h=Mt(p);fa(h);let{focus:x}=f,_=x.getNode();Kr(_)&&_.getTextContentSize()===0&&_.getParentOrThrow().getChildren().filter(Ra).length>1&&_.remove()}}),!0),Vr),e.registerCommand(rt,p=>{if(o){let h=_a(o);return!h||!so(h)?!1:(h.setFields(p),r(null),!0)}let f=lo(p);return n?.(f),Ea([f]),Na(f.getParentOrThrow())&&ha(f,ba).selectEnd(),!0},Vr))},t[3]=e,t[4]=n,t[5]=o,t[6]=u):u=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==c?(m=[e,n,o,c],t[7]=e,t[8]=n,t[9]=o,t[10]=c,t[11]=m):m=t[11],La(u,m),null};function Ra(t){return Kr(t)}var Sa=v(({featureClientSchemaMap:t,props:e,schemaPath:o})=>{let r=`${o}.lexical_internal_feature.blocks.lexical_blocks`,n=`${o}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=t.blocks,l=Object.entries(i).filter(([c])=>c.startsWith(r+".")&&!c.replace(r+".","").includes(".")).map(([c,u])=>u[0]),s=Object.entries(i).filter(([c])=>c.startsWith(n+".")&&!c.replace(n+".","").includes(".")).map(([c,u])=>u[0]),a=l.map(c=>c.blocks[0]),d=s.map(c=>c.blocks[0]);return{nodes:[ue,io],plugins:[{Component:zr,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[a?.length?{items:a.map(c=>({Icon:St(c.imageURL,c.imageAltText),key:"block-"+c.slug,keywords:["block","blocks",c.slug],label:({i18n:u})=>c?.labels?.singular?Dt(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(ot,{blockName:"",blockType:c.slug})}})),key:"blocks",label:({i18n:c})=>c.t("lexical:blocks:label")}:null,d?.length?{items:d.map(c=>({Icon:Rt,key:"inlineBlocks-"+c.slug,keywords:["inlineBlock","inline block",c.slug],label:({i18n:u})=>c?.labels?.singular?Dt(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(rt,{blockName:"",blockType:c.slug})}})),key:"inlineBlocks",label:({i18n:c})=>c.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[a.length?{type:"dropdown",ChildComponent:It,items:a.map((c,u)=>({ChildComponent:St(c.imageURL,c.imageAltText),isActive:void 0,key:"block-"+c.slug,label:({i18n:m})=>c?.labels?.singular?Dt(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ot,{blockName:"",blockType:c.slug})},order:u})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Rt,items:d.map((c,u)=>({ChildComponent:c.imageURL?St(c.imageURL,c.imageAltText):Rt,isActive:void 0,key:"inlineBlock-"+c.slug,label:({i18n:m})=>c?.labels?.singular?Dt(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(rt,{blockName:"",blockType:c.slug})},order:u})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as ya}from"react/compiler-runtime";import{jsx as Le,jsxs as ko}from"react/jsx-runtime";import{useLexicalComposerContext as va}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Ma,$createTextNode as Da,$getRoot as Aa,getDOMSelection as To}from"lexical";import*as Jr from"react";import{useCallback as Ne,useEffect as wo,useLayoutEffect as Zr,useRef as Eo,useState as At}from"react";var Fa=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)},Oa=(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)},$a=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);
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let i=t.getPreviousSibling();if(Sr(i)){i.splice(i.getChildrenSize(),0,[Rs(),...e]),i.select(0,0),t.remove();return}}let n=Ls();n.append(...e),t.replace(n),n.select(0,0)}};var Mr=[J([{ChildComponent:ho,isActive:({selection:t})=>{if(!ys(t))return!1;for(let e of t.getNodes())if(!vr(e)&&!vr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Fr();Ar(e,()=>Dr())})},order:20}])],vs=v({markdownTransformers:[yr],nodes:[Ss],slashMenu:{groups:[Z([{Icon:ho,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Fr();Ar(e,()=>Dr())})}}])]},toolbarFixed:{groups:Mr},toolbarInline:{groups:Mr}});import{getTranslation as Dt}from"@payloadcms/translations";import{jsx as go,jsxs as Ms}from"react/jsx-runtime";import"react";var It=()=>Ms("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:[go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Or}from"react/jsx-runtime";import"react";var Rt=()=>Or("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:Or("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 Ds}from"react/jsx-runtime";import"react";function St(t,e){return t?()=>Ds("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):It}import{jsx as ua}from"react/jsx-runtime";import da from"bson-objectid";import"react";import{DecoratorBlockNode as As}from"@lexical/react/LexicalDecoratorBlockNode.js";import Fs from"bson-objectid";var qe=class extends As{__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=Os(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}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 Os(t){return new qe({fields:{...t,id:t?.id||new Fs.default().toHexString()}})}import{jsx as K,jsxs as Qe,Fragment as Us}from"react/jsx-runtime";import{Button as Hr,Collapsible as Ws,Drawer as Vs,EditDepthProvider as Ks,ErrorPill as zs,Form as Zs,formatDrawerSlug as Ys,FormSubmit as Xs,Pill as Js,RenderFields as qs,SectionTitle as Qs,useDocumentInfo as jr,useEditDepth as ea,useFormSubmitted as ta,useServerFunctions as oa,useTranslation as ra}from"@payloadcms/ui";import{abortAndIgnore as Co}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as na,reduceFieldsToValues as ia}from"payload/shared";import et,{useCallback as xo,useEffect as bo,useMemo as tt,useRef as la}from"react";import{useLexicalComposerContext as sa}from"@lexical/react/LexicalComposerContext";import{getTranslation as aa}from"@payloadcms/translations";import{$getNodeByKey as _o}from"lexical";import{v4 as ca}from"uuid";import{c as $s}from"react/compiler-runtime";import{jsx as yt,jsxs as Ps}from"react/jsx-runtime";import{RenderFields as Bs,useFormSubmitted as Hs}from"@payloadcms/ui";import js,{createContext as Gs}from"react";var $r=Gs({initialState:!1}),ke=()=>js.useContext($r),Pr=t=>{let e=$s(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:a,nodeKey:d,RemoveButton:c}=t,m=Hs()&&l>0,p,f;e[0]!==r||e[1]!==l||e[2]!==m?(f=_=>yt(r,{editButton:_.editButton,errorCount:l,fieldHasErrors:m,Label:_.Label,removeButton:_.removeButton,children:_.children}),e[0]=r,e[1]=l,e[2]=m,e[3]=f):f=e[3],p=f;let h=p,x;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==i||e[8]!==c||e[9]!==s||e[10]!==a||e[11]!==d?(x=n?Ps($r.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:a,nodeKey:d,RemoveButton:c},children:[n,yt(o,{})]}):yt(h,{children:yt(Bs,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=i,e[8]=c,e[9]=s,e[10]=a,e[11]=d,e[12]=x):x=e[12],x};function Br({fields:t}){for(let e in t){let o=t[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ee="lexical-block",Gr=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=ta(),{id:i,collectionSlug:l,globalSlug:s}=jr(),{fieldProps:{featureClientSchemaMap:a,field:d,initialLexicalFormState:c,permissions:u,readOnly:m,schemaPath:p},uuid:f}=B(),h=la(new AbortController),x=ea(),[_,y]=et.useState(0),D=Ys({slug:`lexical-blocks-create-${f}-${o.id}`,depth:x}),{toggleDrawer:g}=ae(D),{getDocPreferences:w,setDocFieldPreferences:C}=jr(),[b]=sa(),{getFormState:I}=oa(),N=`${p}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[k,R]=et.useState(c?.[o.id]?.formState?{...c?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1);bo(()=>{R(!1)},[e]);let[T,E]=et.useState(k?._components?.customComponents?.BlockLabel),[S,L]=et.useState(k?._components?.customComponents?.Block);bo(()=>{let W=new AbortController;return o&&!k&&(async()=>{let{state:V}=await I({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await w(),globalSlug:s,operation:"update",renderAllFields:!0,schemaPath:N,signal:W.signal});V&&(V.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName},R(V),E(V._components?.customComponents?.BlockLabel),L(V._components?.customComponents?.Block))})(),()=>{Co(W)}},[I,N,i,o,k,l,s,w]);let[A,M]=et.useState(c?.[o.id]?.collapsed??!1),O=`${p}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,H=a.blocks[O]?.[0]?.blocks?.[0],{i18n:oe,t:U}=ra(),j=xo(async({formState:W,submit:re})=>{Co(h.current);let V=new AbortController;h.current=V;let{state:X}=await I({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await w(),formState:W,globalSlug:s,operation:"update",renderAllFields:!!re,schemaPath:N,signal:V.signal});if(!X)return W;X.blockName=W.blockName;let Q=ia(Br({fields:na(X)}),!0);if(setTimeout(()=>{b.update(()=>{let se=_o(r);if(se&&vt(se)){let De=Q;De.blockType=o.blockType,se.setFields(De,!0)}})},0),re){E(X._components?.customComponents?.BlockLabel),L(X._components?.customComponents?.Block);let se=0;for(let De of Object.values(X))De?.valid===!1&&se++;y(se)}return X},[I,i,l,w,s,N,o.blockType,b,r]);bo(()=>()=>{Co(h.current)},[]);let Ee=xo(()=>{b.update(()=>{_o(r)?.remove()})},[b,r]),xe=H?.labels?.singular?aa(H.labels.singular,oe):H?.slug,be=xo(W=>{w().then(re=>{let X=re?.fields?.[d.name]?.collapsed,Q=X&&X?.length?X:[];W?Q.includes(o.id)||Q.push(o.id):Q.includes(o.id)&&Q.splice(Q.indexOf(o.id),1),C(d.name,{collapsed:Q,hello:"hi"})})},[w,d.name,C,o.id]),ve=tt(()=>()=>K(Hr,{buttonStyle:"icon-label",className:`${ee}__editButton`,disabled:m,el:"button",icon:"edit",onClick:W=>(W.preventDefault(),W.stopPropagation(),g(),!1),onMouseDown:W=>{W.preventDefault()},round:!0,size:"small",tooltip:U("lexical:blocks:inlineBlocks:edit",{label:xe})}),[xe,m,U,g]),Me=tt(()=>()=>K(Hr,{buttonStyle:"icon-label",className:`${ee}__removeButton`,disabled:d?.admin?.readOnly||!1,icon:"x",onClick:W=>{W.preventDefault(),Ee()},round:!0,tooltip:"Remove Block"}),[d?.admin?.readOnly,Ee]),Ue=tt(()=>({children:W,disableBlockName:re,editButton:V,errorCount:X,fieldHasErrors:Q,Label:se,removeButton:De})=>K("div",{className:ee+" "+ee+"-"+o.blockType,children:K(Ws,{className:[`${ee}__row`,Q?`${ee}__row--has-errors`:`${ee}__row--no-errors`].join(" "),collapsibleStyle:Q?"error":"default",header:Qe("div",{className:`${ee}__block-header`,children:[se??T?se??T:Qe("div",{children:[K(Js,{className:`${ee}__block-pill ${ee}__block-pill-${o?.blockType}`,pillStyle:"white",children:xe??o?.blockType}),!re&&K(Qs,{path:"blockName",readOnly:d?.admin?.readOnly||!1}),Q&&K(zs,{count:X??0,i18n:oe,withMessage:!0})]}),Qe("div",{children:[S&&V!==!1||!S&&V?K(ve,{}):null,De!==!1&&b.isEditable()?K(Me,{}):null]})]}),isCollapsed:A,onToggle:xr=>{be(xr),M(xr)},children:W},0)}),[S,T,ve,Me,xe,b,o.blockType,oe,A,be,d?.admin?.readOnly]),bt=tt(()=>()=>K(Ks,{children:K(Vs,{className:"",slug:D,title:U(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:xe??U("lexical:blocks:inlineBlocks:label")}),children:k?Qe(Us,{children:[K(qs,{fields:H?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:u,readOnly:!1}),K(Xs,{programmaticSubmit:!0,children:U("fields:saveChanges")})]}):null})}),[k,D,xe,U,H?.fields,N,u]),ds=tt(()=>k?K(Zs,{beforeSubmit:[async({formState:W})=>await j({formState:W,submit:!0})],fields:H?.fields,initialState:k,onChange:[j],onSubmit:(W,re)=>{re.blockType=o.blockType,b.update(()=>{let V=_o(r);V&&vt(V)&&V.setFields(re,!0)}),g()},submitted:n,uuid:ca(),children:K(Pr,{baseClass:ee,BlockDrawer:bt,Collapsible:Ue,CustomBlock:S,EditButton:ve,errorCount:_,formSchema:H?.fields,initialState:k,nodeKey:r,RemoveButton:Me})}):null,[Ue,bt,S,Me,ve,b,_,g,H?.fields,k,r,j,n]);return H?ds:K(Ue,{disableBlockName:!0,fieldHasErrors:!0,children:Qe("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var ue=class extends qe{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=Mt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return ua(Gr,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Mt(t){return new ue({fields:{...t,id:t?.id||new da.default().toHexString()}})}function vt(t){return t instanceof ue}import{createCommand as Ur}from"lexical";var ot=Ur("INSERT_BLOCK_COMMAND"),rt=Ur("INSERT_INLINE_BLOCK_COMMAND");import{c as ma}from"react/compiler-runtime";import{useLexicalComposerContext as pa}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as fa,$wrapNodeInElement as ha,mergeRegister as ga}from"@lexical/utils";import{formatDrawerSlug as Ca,useEditDepth as xa}from"@payloadcms/ui";import{$createParagraphNode as ba,$getNodeByKey as _a,$getPreviousSelection as Ta,$getSelection as wa,$insertNodes as Ea,$isParagraphNode as Vr,$isRangeSelection as ka,$isRootOrShadowRoot as Na,COMMAND_PRIORITY_EDITOR as Wr}from"lexical";import{useEffect as La,useState as Ia}from"react";var Kr=()=>{let t=ma(12),[e]=pa(),[o,r]=Ia(null),{setCreatedInlineBlock:n,uuid:i}=B(),l=xa(),s="lexical-inlineBlocks-create-"+i,a;t[0]!==l||t[1]!==s?(a=Ca({slug:s,depth:l}),t[0]=l,t[1]=s,t[2]=a):a=t[2];let d=a,{toggleDrawer:c}=ae(d,!0),u;t[3]!==e||t[4]!==n||t[5]!==o?(u=()=>{if(!e.hasNodes([ue]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return ga(e.registerCommand(ot,p=>(e.update(()=>{let f=wa()||Ta();if(ka(f)){let h=Mt(p);fa(h);let{focus:x}=f,_=x.getNode();Vr(_)&&_.getTextContentSize()===0&&_.getParentOrThrow().getChildren().filter(Ra).length>1&&_.remove()}}),!0),Wr),e.registerCommand(rt,p=>{if(o){let h=_a(o);return!h||!so(h)?!1:(h.setFields(p),r(null),!0)}let f=lo(p);return n?.(f),Ea([f]),Na(f.getParentOrThrow())&&ha(f,ba).selectEnd(),!0},Wr))},t[3]=e,t[4]=n,t[5]=o,t[6]=u):u=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==c?(m=[e,n,o,c],t[7]=e,t[8]=n,t[9]=o,t[10]=c,t[11]=m):m=t[11],La(u,m),null};function Ra(t){return Vr(t)}var Sa=v(({featureClientSchemaMap:t,props:e,schemaPath:o})=>{let r=`${o}.lexical_internal_feature.blocks.lexical_blocks`,n=`${o}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=t.blocks,l=Object.entries(i).filter(([c])=>c.startsWith(r+".")&&!c.replace(r+".","").includes(".")).map(([c,u])=>u[0]),s=Object.entries(i).filter(([c])=>c.startsWith(n+".")&&!c.replace(n+".","").includes(".")).map(([c,u])=>u[0]),a=l.map(c=>c.blocks[0]),d=s.map(c=>c.blocks[0]);return{nodes:[ue,io],plugins:[{Component:Kr,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[a?.length?{items:a.map(c=>({Icon:St(c.imageURL,c.imageAltText),key:"block-"+c.slug,keywords:["block","blocks",c.slug],label:({i18n:u})=>c?.labels?.singular?Dt(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(ot,{blockName:"",blockType:c.slug})}})),key:"blocks",label:({i18n:c})=>c.t("lexical:blocks:label")}:null,d?.length?{items:d.map(c=>({Icon:Rt,key:"inlineBlocks-"+c.slug,keywords:["inlineBlock","inline block",c.slug],label:({i18n:u})=>c?.labels?.singular?Dt(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(rt,{blockName:"",blockType:c.slug})}})),key:"inlineBlocks",label:({i18n:c})=>c.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[a.length?{type:"dropdown",ChildComponent:It,items:a.map((c,u)=>({ChildComponent:St(c.imageURL,c.imageAltText),isActive:void 0,key:"block-"+c.slug,label:({i18n:m})=>c?.labels?.singular?Dt(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ot,{blockName:"",blockType:c.slug})},order:u})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Rt,items:d.map((c,u)=>({ChildComponent:c.imageURL?St(c.imageURL,c.imageAltText):Rt,isActive:void 0,key:"inlineBlock-"+c.slug,label:({i18n:m})=>c?.labels?.singular?Dt(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(rt,{blockName:"",blockType:c.slug})},order:u})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as ya}from"react/compiler-runtime";import{jsx as Le,jsxs as ko}from"react/jsx-runtime";import{useLexicalComposerContext as va}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Ma,$createTextNode as Da,$getRoot as Aa,getDOMSelection as To}from"lexical";import*as Xr from"react";import{useCallback as Ne,useEffect as wo,useLayoutEffect as zr,useRef as Eo,useState as At}from"react";var Fa=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)},Oa=(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)},$a=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);
4
4
  await assertSelection(page, {
5
5
  anchorPath: [${n.anchorPath.toString()}],
6
6
  anchorOffset: ${n.anchorOffset},
@@ -10,7 +10,7 @@
10
10
  `;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(`
11
11
  `);default:return` await repeat(${t.count}, async () => {
12
12
  ${o}
13
- );`}};function Pa(t){return t.key.toLowerCase()==="a"&&(br?t.metaKey:t.ctrlKey)}function Ba(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 Yr(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 Xr=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Ha(t){let[e,o]=At([]),[r,n]=At(!1),[,i]=At(""),[l,s]=At(""),a=Eo(null),d=Eo(!1),c=Eo(null),u=Ne(()=>t,[t]),m=Ne(()=>{let g=t.getRootElement(),w=To(t._window);return g==null||w==null||w.anchorNode==null||w.focusNode==null||!g.contains(w.anchorNode)||!g.contains(w.focusNode)?null:`
13
+ );`}};function Pa(t){return t.key.toLowerCase()==="a"&&(br?t.metaKey:t.ctrlKey)}function Ba(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 Zr(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 Yr=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Ha(t){let[e,o]=At([]),[r,n]=At(!1),[,i]=At(""),[l,s]=At(""),a=Eo(null),d=Eo(!1),c=Eo(null),u=Ne(()=>t,[t]),m=Ne(()=>{let g=t.getRootElement(),w=To(t._window);return g==null||w==null||w.anchorNode==null||w.focusNode==null||!g.contains(w.anchorNode)||!g.contains(w.focusNode)?null:`
14
14
  import {
15
15
  initializeE2E,
16
16
  assertHTMLSnapshot,
@@ -31,10 +31,10 @@ ${e.map($a).join(`
31
31
  `)}
32
32
  });
33
33
  });
34
- `},[t,e]),p=Ne((g,w)=>{o(C=>{let b=e.length-1,I=e[b];if(I&&I.name===g){if(g==="type")return[...e.slice(0,b),{...I,value:I.value+w}];if(I.value===w)return[...e.slice(0,b),{...I,count:I.count+1}]}return[...C,{name:g,count:1,value:w}]})},[e,o]);Zr(()=>{let g=C=>{if(!r)return;let b=C.key;Pa(C)?p("selectAll",""):Xr.has(b)?p("press",C.key):[...b].length>1?p("keydown",C.key):p("type",C.key)},w=C=>{if(!r)return;let b=C.key;!Xr.has(b)&&[...b].length>1&&p("keyup",C.key)};return t.registerRootListener((C,b)=>{b!==null&&(b.removeEventListener("keydown",g),b.removeEventListener("keyup",w)),C!==null&&(C.addEventListener("keydown",g),C.addEventListener("keyup",w))})},[t,r,p]),Zr(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),wo(()=>{if(e){let g=m();g!==null&&s(g),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),wo(()=>t.registerUpdateListener(({dirtyElements:w,dirtyLeaves:C,editorState:b})=>{if(!r)return;let I=b._selection,N=a.current,k=d.current;if(N!==I){if(C.size===0&&w.size===0&&!k){let T=To(t._window);if(T&&(T.anchorNode==null||T.focusNode==null))return}a.current=I}d.current=!1;let R=m();R!==null&&s(R)}),[t,m,r,p]),wo(()=>r?t.registerUpdateListener(()=>{let w=t.getRootElement();w!==null&&i(w?.innerHTML)}):void 0,[t,r]);let f=Ne(g=>{r||(g.update(()=>{let w=Aa();w.clear();let C=Da();w.append(Ma().append(C)),C.select()}),o([])),n(w=>!w)},[r]),h=Ne(()=>{if(!r)return;let g=To(t._window);if(g===null||g.anchorNode==null||g.focusNode==null)return;let{anchorNode:w,anchorOffset:C,focusNode:b,focusOffset:I}=Ba(g),N=u().getRootElement(),k;w!==null&&(k=Yr(w,N));let R;b!==null&&(R=Yr(b,N)),p("snapshot",{anchorNode:w,anchorOffset:C,anchorPath:k,focusNode:b,focusOffset:I,focusPath:R})},[p,r,u]),x=Ne(()=>{Fa(m())},[m]),_=Ne(()=>{Oa("test.js",m())},[m]);return[Le("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:g=>{f(u()),g.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?ko("div",{className:"test-recorder-output",children:[ko("div",{className:"test-recorder-toolbar",children:[Le("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:g=>{h(),g.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Le("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:g=>{x(),g.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Le("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:g=>{_(),g.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Le("pre",{id:"test-recorder",ref:c,children:l})]}):null]}var qr=()=>{let t=ya(3),[e]=va(),[o,r]=Ha(e),n;return t[0]!==o||t[1]!==r?(n=ko(Jr.Fragment,{children:[Le("p",{children:"HI"}),o,r,Le("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var ja=v({plugins:[{Component:qr,position:"bottom"}]});import{c as Ga}from"react/compiler-runtime";import{jsx as Ua}from"react/jsx-runtime";import{useLexicalComposerContext as Wa}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Va}from"@lexical/react/LexicalTreeView.js";import"react";var Qr=()=>{let t=Ga(2),[e]=Wa(),o;return t[0]!==e?(o=Ua(Va,{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 Ka=v({plugins:[{Component:Qr,position:"bottom"}]});import{$isTableSelection as za}from"@lexical/table";import{$isRangeSelection as Za,FORMAT_TEXT_COMMAND as Ya}from"lexical";import{jsx as en}from"react/jsx-runtime";import"react";var tn=()=>en("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:en("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 Y=t=>({type:"buttons",items:t,key:"format",order:40});var on={type:"text-format",format:["bold","italic"],tag:"***"},rn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},nn={type:"text-format",format:["bold"],tag:"**"},ln={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var sn=[Y([{ChildComponent:tn,isActive:({selection:t})=>Za(t)||za(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Ya,"bold")},order:1}])],Xa=v(({featureProviderMap:t})=>{let e=[nn,ln];return t.get("italic")&&e.push(rn,on),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:sn},toolbarInline:{groups:sn}}});import{$isTableSelection as qa}from"@lexical/table";import{$isRangeSelection as Qa,FORMAT_TEXT_COMMAND as ec}from"lexical";import{jsx as an,jsxs as Ja}from"react/jsx-runtime";import"react";var cn=()=>Ja("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:[an("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),an("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var un={type:"text-format",format:["code"],tag:"`"};var dn=[Y([{ChildComponent:cn,isActive:({selection:t})=>Qa(t)||qa(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(ec,"code")},order:7}])],tc=v({enableFormats:["code"],markdownTransformers:[un],toolbarFixed:{groups:dn},toolbarInline:{groups:dn}});import{$isTableSelection as oc}from"@lexical/table";import{$isRangeSelection as rc,FORMAT_TEXT_COMMAND as nc}from"lexical";import{jsx as mn}from"react/jsx-runtime";import"react";var pn=()=>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.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 fn={type:"text-format",format:["italic"],tag:"*"},hn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var gn=[Y([{ChildComponent:pn,isActive:({selection:t})=>rc(t)||oc(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(nc,"italic")},order:2}])],ic=v({enableFormats:["italic"],markdownTransformers:[fn,hn],toolbarFixed:{groups:gn},toolbarInline:{groups:gn}});import{$isTableSelection as sc}from"@lexical/table";import{$isRangeSelection as ac,FORMAT_TEXT_COMMAND as cc}from"lexical";import{jsx as Cn,jsxs as lc}from"react/jsx-runtime";import"react";var xn=()=>lc("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:[Cn("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"}),Cn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var bn={type:"text-format",format:["strikethrough"],tag:"~~"};var _n=[Y([{ChildComponent:xn,isActive:({selection:t})=>ac(t)||sc(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(cc,"strikethrough")},order:4}])],uc=v({enableFormats:["strikethrough"],markdownTransformers:[bn],toolbarFixed:{groups:_n},toolbarInline:{groups:_n}});import{$isTableSelection as dc}from"@lexical/table";import{$isRangeSelection as mc,FORMAT_TEXT_COMMAND as pc}from"lexical";import{jsx as Tn}from"react/jsx-runtime";import"react";var wn=()=>Tn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tn("path",{d:"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 En=[Y([{ChildComponent:wn,isActive:({selection:t})=>mc(t)||dc(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(pc,"subscript")},order:5}])],fc=v({enableFormats:["subscript"],toolbarFixed:{groups:En},toolbarInline:{groups:En}});import{$isTableSelection as hc}from"@lexical/table";import{$isRangeSelection as gc,FORMAT_TEXT_COMMAND as Cc}from"lexical";import{jsx as kn}from"react/jsx-runtime";import"react";var Nn=()=>kn("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:kn("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 Ln=[Y([{ChildComponent:Nn,isActive:({selection:t})=>gc(t)||hc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Cc,"superscript")},order:6}])],xc=v({enableFormats:["superscript"],toolbarFixed:{groups:Ln},toolbarInline:{groups:Ln}});import{$isTableSelection as _c}from"@lexical/table";import{$isRangeSelection as Tc,FORMAT_TEXT_COMMAND as wc}from"lexical";import{jsx as In,jsxs as bc}from"react/jsx-runtime";import"react";var Rn=()=>bc("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:[In("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"}),In("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Sn=[Y([{ChildComponent:Rn,isActive:({selection:t})=>Tc(t)||_c(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(wc,"underline")},order:3}])],Ec=v({enableFormats:["underline"],toolbarFixed:{groups:Sn},toolbarInline:{groups:Sn}});import{$createHeadingNode as Ic,$isHeadingNode as Un,HeadingNode as Rc}from"@lexical/rich-text";import{$setBlocksType as Sc}from"@lexical/selection";import{$getSelection as yc,$isRangeSelection as vc}from"lexical";import{jsx as yn}from"react/jsx-runtime";import"react";var vn=()=>yn("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:"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 Mn}from"react/jsx-runtime";import"react";var Dn=()=>Mn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Mn("path",{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 An}from"react/jsx-runtime";import"react";var Fn=()=>An("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:An("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 On}from"react/jsx-runtime";import"react";var $n=()=>On("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:On("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 Pn}from"react/jsx-runtime";import"react";var Bn=()=>Pn("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:Pn("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 Hn}from"react/jsx-runtime";import"react";var jn=()=>Hn("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:Hn("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 kc,$isHeadingNode as Nc,HeadingNode as Lc}from"@lexical/rich-text";var No=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Gn=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Lc],export:(n,i)=>{if(!Nc(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:No(n=>{let i="h"+n[1].length;return kc(i)})}};var Wn=t=>{let e=yc();Sc(e,()=>Ic(t))},Vn={h1:vn,h2:Dn,h3:Fn,h4:$n,h5:Bn,h6:jn},Mc=v(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[J(e.map((r,n)=>({ChildComponent:Vn[r],isActive:({selection:i})=>{if(!vc(i))return!1;for(let l of i.getNodes()){if(Un(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(Un(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Wn(r)})},order:n+2})))];return{markdownTransformers:[Gn(e)],nodes:[Rc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Vn[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(()=>{Wn(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Gc}from"lexical";import{jsx as Kn}from"react/jsx-runtime";import"react";var Lo=()=>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("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as zn,jsxs as Dc}from"react/jsx-runtime";import"react";var Zn=()=>Dc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[zn("path",{d:"M5 10h10",stroke:"currentColor"}),zn("path",{d:"M10 15V5",stroke:"currentColor"})]});var de=t=>({type:"dropdown",ChildComponent:Zn,items:t,key:"add",order:10});var Yn={type:"element",dependencies:[_t],export:(t,e)=>wt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Tt();e&&t.replace(e)}};import{c as Ac}from"react/compiler-runtime";import{useLexicalComposerContext as Fc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Oc}from"@lexical/utils";import{$getSelection as $c,$isRangeSelection as Pc,COMMAND_PRIORITY_EDITOR as Bc}from"lexical";import{useEffect as Hc}from"react";var Xn=()=>{let t=Ac(3),[e]=Fc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(We,jc,Bc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Hc(o,r),null};function jc(t){let e=$c();if(!Pc(e))return!1;if(e.focus.getNode()!==null){let r=Tt();Oc(r)}return!0}var Uc=v({markdownTransformers:[Yn],nodes:[_t],plugins:[{Component:Xn,position:"normal"}],slashMenu:{groups:[Z([{Icon:Lo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,void 0)}}])]},toolbarFixed:{groups:[de([{ChildComponent:Lo,isActive:({selection:t})=>{if(!Gc(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,void 0)}}])]}});import{TabIndentationPlugin as Kc}from"@lexical/react/LexicalTabIndentationPlugin";import{INDENT_CONTENT_COMMAND as zc,OUTDENT_CONTENT_COMMAND as Zc}from"lexical";import{jsx as Ft,jsxs as Wc}from"react/jsx-runtime";import"react";var Jn=()=>Wc("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("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Ft("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Ft("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ft("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Ot,jsxs as Vc}from"react/jsx-runtime";import"react";var qn=()=>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:[Ot("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var Qn=t=>({type:"buttons",items:t,key:"indent",order:35});var ei=[Qn([{ChildComponent:Jn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Zc,void 0)},order:1},{ChildComponent:qn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(zc,void 0)},order:2}])],Yc=v({plugins:[{Component:Kc,position:"normal"}],toolbarFixed:{groups:ei},toolbarInline:{groups:ei}});import{$findMatchingParent as sd}from"@lexical/utils";import{$getSelection as Fo,$isRangeSelection as vi}from"lexical";import{jsx as ti}from"react/jsx-runtime";import"react";var oi=()=>ti("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:ti("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 ri}from"@lexical/selection";function Fe(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?ri(o)?r:n:ri(e)?r:n}var Io=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as lu}from"lexical";import{addClassNamesToElement as Xc,isHTMLAnchorElement as Jc}from"@lexical/utils";import yo from"bson-objectid";import{$applyNodeReplacement as qc,$createTextNode as ni,$getSelection as Qc,$isElementNode as ii,$isRangeSelection as So,createCommand as eu,ElementNode as tu}from"lexical";var ou=new Set(["http:","https:","mailto:","sms:","tel:"]),q=class t extends tu{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:ru,priority:1})}}static importJSON(e){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 yo.default().toHexString(),e.version=3);let o=me({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),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=Ro(o.rel,"add","noopener")),Xc(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,r){if(!So(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&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(ii(r)){let n=me({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!ou.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,r){let n=this.__fields?.url,i=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=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Ro(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Ro(o.rel,"remove","noopener"))),!1}};function ru(t){let e=null;if(Jc(t)){let o=t.textContent;o!==null&&o!==""&&(e=me({id:new yo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function me({id:t,fields:e}){return qc(new q({id:t??new yo.default().toHexString(),fields:e}))}function z(t){return t instanceof q}var ne=eu("TOGGLE_LINK_COMMAND");function vo(t){let e=Qc();if(!So(e)&&(t===null||!t.selectedNodes?.length))return;let o=So(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(i=>{let l=i.getParent();if(z(l)){let s=l.getChildren();for(let a=0;a<s.length;a+=1)l.insertBefore(s[a]);l.remove()}});return}if(o?.length===1){let i=o[0],l=z(i)?i:nu(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(ni(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||ii(i)&&!i.isInline())){if(z(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(ni(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=me({fields:t.fields}),z(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),z(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)n.append(s[a])}i.remove();return}n!==null&&n.append(i)}})}function nu(t){return iu(t,e=>z(e))}function iu(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Ro(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var li={type:"text-match",dependencies:[q],export:(t,e)=>{if(!z(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=me({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=lu(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as su,$isElementNode as au}from"lexical";var pe=class t extends q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){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);let o=nt({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),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(au(r)){let n=nt({fields:this.__fields});return r.append(n),n}return null}};function nt({fields:t}){return su(new pe({id:"",fields:t}))}function fe(t){return t instanceof pe}import{c as cu}from"react/compiler-runtime";import{useLexicalComposerContext as uu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as du}from"@lexical/utils";import{$createTextNode as si,$getSelection as mu,$isElementNode as ci,$isLineBreakNode as ui,$isNodeSelection as pu,$isRangeSelection as fu,$isTextNode as it,TextNode as hu}from"lexical";import{useEffect as gu}from"react";function ai(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 di(t,e){for(let o=0;o<e.length;o++){let r=e[o](t);if(r!=null)return r}return null}var Cu=/[.,;\s]/;function Pt(t){return Cu.test(t)}function mi(t){return Pt(t[t.length-1])}function Do(t){return Pt(t[0])}function xu(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function pi(t){let e=t.getPreviousSibling();return ci(e)&&(e=e.getLastDescendant()),e===null||ui(e)||it(e)&&mi(e.getTextContent())}function fi(t){let e=t.getNextSibling();return ci(e)&&(e=e.getFirstDescendant()),e===null||ui(e)||it(e)&&Do(e.getTextContent())}function bu(t,e,o,r){return(t>0?Pt(o[t-1]):pi(r[0]))?e<o.length?Pt(o[e]):fi(r[r.length-1]):!1}function _u(t,e,o){let r=[],n=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let d=a[0],u=d.getTextContent().length,m=s;s+u<=e?(r.push(d),l+=u):m>=o?i.push(d):n.push(d),s+=u,a.shift()}return[l,r,n,i]}function Tu(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=nt({fields:n});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=si(r.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let d=[],c;for(let f=1;f<t.length;f++){let h=t[f],_=h.getTextContent().length,y=s,D=s+_;if(y<o)if(D<=o)d.push(h);else{let[g,w]=h.splitText(o-y);d.push(g),c=w}s+=_}let u=mu(),m=u?u.getNodes().find(it):void 0,p=si(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...d),m&&m===a&&(fu(u)?p.select(u.anchor.offset,u.focus.offset):pu(u)&&p.select(0,p.getTextContent().length)),a.replace(i),c}}function wu(t,e,o){let r=[...t],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=di(i,e))!=null&&l!==null;){let a=l.index,d=l.length,c=a+d;if(bu(s+a,s+c,n,r)){let[m,,p,f]=_u(r,s+a,s+c),h=s+a-m,x=s+c-m,_=Tu(p,h,x,l);r=_?[_,...f]:f,o(l.url,null),s=0}else s+=c;i=i.substring(c)}}function Mo(t,e,o){let r=t.getChildren(),n=r.length;for(let a=0;a<n;a++){let d=r[a];if(!it(d)||!d.isSimpleText()){$t(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=di(i,e);if(l===null||l.text!==i){$t(t),o(null,t.getFields()?.url??null);return}if(!pi(t)||!fi(t)){$t(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function Eu(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(fe(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:"):!1;(!Do(i)||xu(i,l))&&(r.append(t),Mo(r,e,o),o(null,r.getFields()?.url??null))}fe(n)&&!mi(i)&&($t(n),Mo(n,e,o),o(null,n.getFields()?.url??null))}function $t(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 ku(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 Nu(t,e,o){let r=cu(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([pe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return du(t.registerNodeTransform(hu,s=>{let a=s.getParentOrThrow(),d=s.getPreviousSibling();if(fe(a))Mo(a,e,l);else if(!z(a)){if(s.isSimpleText()&&(Do(s.getTextContent())||!fe(d))){let c=ku(s);wu(c,e,l)}Eu(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=i):(n=r[3],i=r[4]),gu(n,i)}var Lu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Iu=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ru=[ai(Lu,t=>t.startsWith("http")?t:`https://${t}`),ai(Iu,t=>`mailto:${t}`)],hi=()=>{let[t]=uu();return Nu(t,Ru),null};import{jsx as Su}from"react/jsx-runtime";import{ClickableLinkPlugin as yu}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var gi=()=>Su(yu,{});import{jsx as Zu}from"react/jsx-runtime";import"react";import{createPortal as Yu}from"react-dom";import{jsx as he,jsxs as lt,Fragment as Mu}from"react/jsx-runtime";import{useLexicalComposerContext as Du}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Ci,mergeRegister as xi}from"@lexical/utils";import{getTranslation as Ao}from"@payloadcms/translations";import{CloseMenuIcon as Au,EditIcon as Fu,ExternalLinkIcon as bi,formatDrawerSlug as Ou,useConfig as $u,useEditDepth as Pu,useLocale as Bu,useTranslation as Hu}from"@payloadcms/ui";import{requests as ju}from"@payloadcms/ui/shared";import{$getSelection as _i,$isLineBreakNode as Gu,$isRangeSelection as Ti,COMMAND_PRIORITY_HIGH as Uu,COMMAND_PRIORITY_LOW as wi,getDOMSelection as Wu,KEY_ESCAPE_COMMAND as Vu,SELECTION_CHANGE_COMMAND as Ku}from"lexical";import Ei,{useCallback as ki,useEffect as jt,useRef as zu,useState as Ie}from"react";function Bt(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),d=t.top-r,c=t.left-n;d<a.top&&(d+=l.height+t.height+r*2),c+l.width>a.right&&(c=a.right-l.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as vu}from"lexical";var Ht=vu("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ni(t){t.preventDefault()}function Li({anchorElem:t}){let[e]=Du(),[o,r]=Ie(),n=zu(null),[i,l]=Ie(null),[s,a]=Ie(null),{fieldProps:{schemaPath:d},uuid:c}=B(),{config:u}=$u(),{i18n:m,t:p}=Hu(),[f,h]=Ie(),x=Pu(),[_,y]=Ie(!1),[D,g]=Ie([]),w=Bu(),[C,b]=Ie(!1),I=Ou({slug:"lexical-rich-text-link-"+c,depth:x}),{toggleDrawer:N}=ae(I),k=ki(()=>{y(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),b(!1),l(null),a(null),g([]),h(void 0)},[y,l,a,g]),R=ki(()=>{let T=_i(),E;if(!Ti(T)||!T){k();return}let S=Fe(T);E=e.getElementByKey(S.getKey())?.getBoundingClientRect();let L=Ci(S,z),A=T.getNodes().filter(W=>!Gu(W)).find(W=>{let j=Ci(W,z);return L&&!L.is(j)||j&&!j.is(L)});if(L==null||A){k();return}r(L);let M=L.getFields(),O={...M,id:L.getID(),text:L.getTextContent()};if(M?.linkType==="custom")l(M?.url??null),a(null);else{l(`${u.routes.admin==="/"?"":u.routes.admin}/collections/${M?.doc?.relationTo}/${M?.doc?.value}`);let W=u.collections.find(j=>j.slug===M?.doc?.relationTo);if(!W)a(M?.label?String(M?.label):null),l(M?.url?String(M?.url):null);else{let j=typeof M.doc?.value=="object"?M.doc.value.id:M.doc?.value,Ee=M.doc?.relationTo;if(!j||!Ee)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let xe=p("fields:linkedTo",{label:`${Ao(W.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(xe),ju.get(`${u.serverURL}${u.routes.api}/${Ee}/${j}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:w?.code}}).then(async be=>{if(!be.ok)throw new Error(`HTTP error! Status: ${be.status}`);let ve=await be.json(),Me=W?.admin?.useAsTitle||"id",Ue=ve[Me],bt=p("fields:linkedTo",{label:`${Ao(W.labels.singular,m)} - ${Ue}`}).replace(/<[^>]*>?/g,"");a(bt)}).catch(()=>{let be=p("fields:linkedTo",{label:`${Ao(W.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${j}`}).replace(/<[^>]*>?/g,"");a(be)})}}h(O),y(!0),g(T?T?.getNodes():[]),fe(L)?b(!0):b(!1);let U=n.current,P=Wu(e._window),{activeElement:H}=document;if(U===null)return;let oe=e.getRootElement();return P!==null&&oe!==null&&oe.contains(P.anchorNode)?(E||(E=P.getRangeAt(0).getBoundingClientRect()),E!=null&&(E.y+=40,Bt(E,U,t))):(H==null||H.className!=="link-input")&&(oe!==null&&Bt(null,U,t),l(null),a(null)),!0},[e,k,u.routes.admin,u.routes.api,u.collections,u.serverURL,p,m,w?.code,t]);return jt(()=>xi(e.registerCommand(Ht,T=>(e.dispatchCommand(ne,T),R(),N(),!0),wi)),[e,R,N,I]),jt(()=>{let T=t.parentElement,E=()=>{e.getEditorState().read(()=>{R()})};return window.addEventListener("resize",E),T?.addEventListener("scroll",E),()=>{window.removeEventListener("resize",E),T?.removeEventListener("scroll",E)}},[t.parentElement,e,R]),jt(()=>xi(e.registerUpdateListener(({editorState:T})=>{T.read(()=>{R()})}),e.registerCommand(Ku,()=>(R(),!0),wi),e.registerCommand(Vu,()=>_?(k(),!0):!1,Uu)),[e,R,_,k]),jt(()=>{e.getEditorState().read(()=>{R()})},[e,R]),lt(Ei.Fragment,{children:[he("div",{className:"link-editor",ref:n,children:lt("div",{className:"link-input",children:[i&&i.length>0?lt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?he(bi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?lt(Mu,{children:[o?.__fields.newTab?he(bi,{}):null,he("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&lt(Ei.Fragment,{children:[he("button",{"aria-label":"Edit link",className:"link-edit",onClick:T=>{T.preventDefault(),N()},onMouseDown:Ni,tabIndex:0,type:"button",children:he(Fu,{})}),!C&&he("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ne,null)},onMouseDown:Ni,tabIndex:0,type:"button",children:he(Au,{})})]})]})}),he(Ve,{className:"lexical-link-edit-drawer",data:f,drawerSlug:I,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(T,E)=>{let S=E,L={...S};delete L.text,e.update(()=>{let A=_i(),M=null;if(Ti(A)?M=Fe(A).getParent():D.length&&(M=D[0].getParent()),M&&fe(M)){let O=me({fields:L});M.replace(O,!0)}}),e.dispatchCommand(ne,{fields:L,selectedNodes:D,text:S.text})},schemaPath:d,schemaPathSuffix:"fields"})]})}var Ii=t=>{let{anchorElem:e=document.body}=t;return Yu(Zu(Li,{anchorElem:e}),e)};import{c as qu}from"react/compiler-runtime";import{useLexicalComposerContext as Qu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ed}from"@lexical/utils";import{$getSelection as td,$isElementNode as od,$isRangeSelection as rd,COMMAND_PRIORITY_LOW as Si,PASTE_COMMAND as nd}from"lexical";import{useEffect as id}from"react";var Xu=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Ju=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Ri(t){if(!t)return!1;if(t==="https://"||Xu.test(t)||Ju.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var yi=t=>{let e=qu(5),{clientProps:o}=t,[r]=Qu(),n,i;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return ed(r.registerCommand(ne,l=>l===null?(vo(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),vo(l),!0),Si),r.registerCommand(nd,l=>{let s=td();if(!rd(s)||s.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let a=l.clipboardData.getData("text");if(!Ri(a))return!1;if(!s.getNodes().some(ld)){let d={doc:null,linkType:"custom",newTab:!1,url:a};return r.dispatchCommand(ne,{fields:d,text:null}),l.preventDefault(),!0}return!1},Si))},i=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=i):(n=e[3],i=e[4]),id(n,i),null};function ld(t){return od(t)}var Mi=[Io([{ChildComponent:oi,isActive:({selection:t})=>{if(vi(t)){let e=Fe(t);return sd(e,z)!=null}return!1},isEnabled:({selection:t})=>!!(vi(t)&&Fo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ne,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Fo()?.getTextContent(),r=Fo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,newTab:!1};t.dispatchCommand(Ht,{fields:n,selectedNodes:r,text:o})}},order:1}])],ad=v({markdownTransformers:[li],nodes:[q,pe],plugins:[{Component:yi,position:"normal"},{Component:hi,position:"normal"},{Component:gi,position:"normal"},{Component:Ii,position:"floatingAnchorElem"}],toolbarFixed:{groups:Mi},toolbarInline:{groups:Mi}});import{$isListNode as Po,INSERT_CHECK_LIST_COMMAND as Pi,ListItemNode as _d,ListNode as Td}from"@lexical/list";import{$isRangeSelection as wd}from"lexical";import{jsx as Di,jsxs as cd}from"react/jsx-runtime";import"react";var Oo=()=>cd("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:[Di("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Di("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as ud}from"react/jsx-runtime";import{ListPlugin as dd}from"@lexical/react/LexicalListPlugin.js";import"react";var Oe=()=>ud(dd,{});function $e(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as hd,ListItemNode as gd,ListNode as Cd}from"@lexical/list";import{$createListItemNode as md,$createListNode as pd,$isListItemNode as fd,$isListNode as $o}from"@lexical/list";var Ai=4,Pe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=md(t==="check"?r[3]==="x":void 0);if($o(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if($o(n)&&n.getListType()===t)n.append(l),e.remove();else{let a=pd(t,t==="number"?Number(r[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Ai);s&&l.setIndent(s)},Re=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(fd(l)){if(l.getChildrenSize()===1){let c=l.getFirstChild();if($o(c)){r.push(Re(c,e,o+1));continue}}let s=" ".repeat(o*Ai),a=t.getListType(),d=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+d+e(l)),i++}return r.join(`
35
- `)};var Fi={type:"element",dependencies:[Cd,gd],export:(t,e)=>hd(t)?Re(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Pe("check")};import{jsx as xd}from"react/jsx-runtime";import{CheckListPlugin as bd}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Oi=()=>xd(bd,{});var $i=[J([{ChildComponent:Oo,isActive:({selection:t})=>{if(!wd(t))return!1;for(let e of t.getNodes()){if(Po(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Po(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Po(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Pi,void 0)},order:12}])],Ed=v(({featureProviderMap:t})=>{let e=[{Component:Oi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Oe,position:"normal"}),{markdownTransformers:[Fi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Td,_d],plugins:e,slashMenu:{groups:[$e([{Icon:Oo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Pi,void 0)}}])]},toolbarFixed:{groups:$i},toolbarInline:{groups:$i}}});import{$isListNode as Ho,INSERT_ORDERED_LIST_COMMAND as ji,ListItemNode as Rd,ListNode as Sd}from"@lexical/list";import{$isRangeSelection as yd}from"lexical";import{jsx as st,jsxs as kd}from"react/jsx-runtime";import"react";var Bo=()=>kd("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:[st("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"}),st("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"}),st("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Nd,ListItemNode as Ld,ListNode as Id}from"@lexical/list";var Bi={type:"element",dependencies:[Id,Ld],export:(t,e)=>Nd(t)?Re(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Pe("number")};var Hi=[J([{ChildComponent:Bo,isActive:({selection:t})=>{if(!yd(t))return!1;for(let e of t.getNodes()){if(Ho(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Ho(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Ho(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ji,void 0)},order:10}])],vd=v(({featureProviderMap:t})=>({markdownTransformers:[Bi],nodes:t.has("orderedList")?[]:[Sd,Rd],plugins:t.has("orderedList")?[]:[{Component:Oe,position:"normal"}],slashMenu:{groups:[$e([{Icon:Bo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ji,void 0)}}])]},toolbarFixed:{groups:Hi},toolbarInline:{groups:Hi}}));import{$isListNode as Go,INSERT_UNORDERED_LIST_COMMAND as Wi,ListItemNode as Od,ListNode as $d}from"@lexical/list";import{$isRangeSelection as Pd}from"lexical";import{jsx as Be,jsxs as Md}from"react/jsx-runtime";import"react";var jo=()=>Md("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Be("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Be("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Be("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Be("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Be("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Be("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Dd,ListItemNode as Ad,ListNode as Fd}from"@lexical/list";var Gi={type:"element",dependencies:[Fd,Ad],export:(t,e)=>Dd(t)?Re(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Pe("bullet")};var Ui=[J([{ChildComponent:jo,isActive:({selection:t})=>{if(!Pd(t))return!1;for(let e of t.getNodes()){if(Go(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Go(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Go(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Wi,void 0)},order:11}])],Bd=v({markdownTransformers:[Gi],nodes:[$d,Od],plugins:[{Component:Oe,position:"normal"}],slashMenu:{groups:[$e([{Icon:jo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Wi,void 0)}}])]},toolbarFixed:{groups:Ui},toolbarInline:{groups:Ui}});import{jsx as Hd}from"react/jsx-runtime";import{addClassNamesToElement as jd}from"@lexical/utils";import{DecoratorNode as Gd}from"lexical";import*as Vi from"react";var Ud=Vi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),at=class t extends Gd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Wd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return jd(o,"unknownConverted"),o}decorate(){return Hd(Ud,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Wd({data:t}){return new at({data:t})}var Vd=v(()=>({nodes:[at]}));import{jsx as Kd}from"react/jsx-runtime";import{addClassNamesToElement as zd}from"@lexical/utils";import{DecoratorNode as Zd}from"lexical";import*as Ki from"react";var Yd=Ki.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),ct=class t extends Zd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Xd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return zd(o,"unknownConverted"),o}decorate(){return Kd(Yd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Xd({data:t}){return new ct({data:t})}var Jd=v(()=>({nodes:[ct]}));import{$setBlocksType as Yi}from"@lexical/selection";import{$createParagraphNode as Xi,$getSelection as Ji,$isParagraphNode as zi,$isRangeSelection as qd}from"lexical";var Zi=[J([{ChildComponent:Je,isActive:({selection:t})=>{if(!qd(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=Ji();Yi(e,()=>Xi())})},order:1}])],Qd=v({slashMenu:{groups:[Z([{Icon:Je,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ji();Yi(e,()=>Xi())})}}])]},toolbarFixed:{groups:Zi},toolbarInline:{groups:Zi}});import{$isNodeSelection as Mm}from"lexical";import{jsx as ut,jsxs as em}from"react/jsx-runtime";import"react";var Uo=()=>em("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:[ut("g",{clipPath:"url(#clip0_4397_10817)",children:ut("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"})}),ut("defs",{children:ut("clipPath",{id:"clip0_4397_10817",children:ut("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as xm}from"react/compiler-runtime";import{jsx as bm}from"react/jsx-runtime";import{useLexicalComposerContext as _m}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Tm}from"@lexical/utils";import{useConfig as wm}from"@payloadcms/ui";import{$getPreviousSelection as Em,$getSelection as km,$isParagraphNode as rl,$isRangeSelection as Nm,COMMAND_PRIORITY_EDITOR as Lm,createCommand as Im}from"lexical";import{useEffect as Rm}from"react";import{c as mm}from"react/compiler-runtime";import{jsx as Gt}from"react/jsx-runtime";import{useLexicalComposerContext as pm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as fm,COMMAND_PRIORITY_EDITOR as hm}from"lexical";import{useEffect as gm,useState as el}from"react";import{c as tm}from"react/compiler-runtime";import{jsx as om}from"react/jsx-runtime";import{useLexicalComposerContext as rm}from"@lexical/react/LexicalComposerContext";import{useListDrawer as nm,useModal as im}from"@payloadcms/ui";import{$getNodeByKey as qi,$getPreviousSelection as lm,$getRoot as sm,$getSelection as am,$isRangeSelection as cm,$setSelection as um}from"lexical";import{useEffect as dm,useState as Qi}from"react";var dt=t=>{let e=tm(23),[o]=rm(),[r,n]=Qi(null),[i,l]=Qi(!1),[s,a,d]=nm(t),{closeDrawer:c,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=im(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let k=am()??lm();n(k)},e[0]=h):h=e[0];let x=h,_;e[1]!==o||e[2]!==r?(_=()=>{r&&o.update(()=>{if(cm(r)){let{anchor:k,focus:R}=r;qi(k.key)&&qi(R.key)&&um(r.clone())}else sm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=_):_=e[3];let y=_,D;e[4]!==c?(D=()=>{c()},e[4]=c,e[5]=D):D=e[5];let g=D,w,C;e[6]!==u||e[7]!==f||e[8]!==y||e[9]!==i?(w=()=>{if(!i)return;let k=f[u];k&&!k?.isOpen&&(l(!1),setTimeout(()=>{y()},1))},C=[f,u,y,i],e[6]=u,e[7]=f,e[8]=y,e[9]=i,e[10]=w,e[11]=C):(w=e[10],C=e[11]),dm(w,C);let b;e[12]!==a?(b=k=>om(a,{...k,onClick:()=>{x()}}),e[12]=a,e[13]=b):b=e[13];let I;e[14]!==p?(I=()=>{x(),p(),l(!0)},e[14]=p,e[15]=I):I=e[15];let N;return e[16]!==s||e[17]!==g||e[18]!==m||e[19]!==u||e[20]!==b||e[21]!==I?(N={closeListDrawer:g,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:b,openListDrawer:I},e[16]=s,e[17]=g,e[18]=m,e[19]=u,e[20]=b,e[21]=I,e[22]=N):N=e[22],N};var Cm=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=fm(o);n&&n.replace(Ze({relationTo:e,value:r}))}):t.dispatchCommand(Wo,{relationTo:e,value:r})},tl=t=>{let e=mm(16),{enabledCollectionSlugs:o}=t,[r]=pm(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i]=el(n),[l,s]=el(null),a=o||void 0,d;e[2]!==i||e[3]!==a?(d={collectionSlugs:a,selectedCollection:i},e[2]=i,e[3]=a,e[4]=d):d=e[4];let{closeListDrawer:c,ListDrawer:u,openListDrawer:m}=dt(d),p,f;e[5]!==r||e[6]!==m?(p=()=>r.registerCommand(Ke,y=>(s(y?.replace?y?.replace.nodeKey:null),m(),!0),hm),f=[r,m],e[5]=r,e[6]=m,e[7]=p,e[8]=f):(p=e[7],f=e[8]),gm(p,f);let h;e[9]!==c||e[10]!==r||e[11]!==l?(h=y=>{let{collectionSlug:D,docID:g}=y;Cm({editor:r,relationTo:D,replaceNodeKey:l,value:g}),c()},e[9]=c,e[10]=r,e[11]=l,e[12]=h):h=e[12];let x=h,_;return e[13]!==u||e[14]!==x?(_=Gt(u,{onSelect:x}),e[13]=u,e[14]=x,e[15]=_):_=e[15],_},ol=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Gt(tl,{...t}):Gt(Et,{...t,children:Gt(tl,{...t})});var Wo=Im("INSERT_RELATIONSHIP_COMMAND"),nl=t=>{let e=xm(10),{clientProps:o}=t,[r]=_m(),{config:n}=wm(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o?.disabledCollections||e[1]!==i){let u;e[3]!==o?.disabledCollections?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o?.disabledCollections,e[4]=u):u=e[4],c=i.filter(u).map(Sm),e[0]=o?.disabledCollections,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==r?(s=()=>{if(!r.hasNodes([ze]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Wo,vm,Lm)},a=[r],e[5]=r,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Rm(s,a);let d;return e[8]!==l?(d=bm(ol,{enabledCollectionSlugs:l}),e[8]=l,e[9]=d):d=e[9],d};function Sm(t){let{slug:e}=t;return e}function ym(t){return rl(t)}function vm(t){let e=km()||Em();if(Nm(e)){let o=Ze(t);Tm(o);let{focus:r}=e,n=r.getNode();rl(n)&&n.getTextContentSize()===0&&n.getParentOrThrow().getChildren().filter(ym).length>1&&n.remove()}return!0}var Dm=v({nodes:[ze],plugins:[{Component:nl,position:"normal"}],slashMenu:{groups:[Z([{Icon:Uo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:Uo,isActive:({selection:t})=>{if(!Mm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ao(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as dl}from"react/compiler-runtime";import{jsx as te,jsxs as Jm}from"react/jsx-runtime";import{useLexicalComposerContext as qm}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Qm,useThrottledEffect as ep,useTranslation as tp}from"@payloadcms/ui";import*as ge from"react";import{useMemo as op}from"react";import{c as Am}from"react/compiler-runtime";import{jsx as Fm}from"react/jsx-runtime";import{mergeRegister as Om}from"@lexical/utils";import{$addUpdateTag as $m,$getSelection as Pm}from"lexical";import{useEffect as Ut,useState as Vo}from"react";var Ko="toolbar-popup__button",mt=t=>{let e=Am(34),{children:o,editor:r,item:n}=t,[i,l]=Vo(!0),[s,a]=Vo(!1),[d,c]=Vo(Ko),u=B(),m;e[0]!==s||e[1]!==r||e[2]!==u||e[3]!==i||e[4]!==n?(m=()=>{r.getEditorState().read(()=>{let I=Pm();if(I){if(n.isActive){let N=n.isActive({editor:r,editorConfigContext:u,selection:I});s!==N&&a(N)}if(n.isEnabled){let N=n.isEnabled({editor:r,editorConfigContext:u,selection:I});i!==N&&l(N)}}})},e[0]=s,e[1]=r,e[2]=u,e[3]=i,e[4]=n,e[5]=m):m=e[5];let p=m,f,h;e[6]!==p?(f=()=>{p()},h=[p],e[6]=p,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Ut(f,h);let x,_;e[9]!==p?(x=()=>(document.addEventListener("mouseup",p),()=>{document.removeEventListener("mouseup",p)}),_=[p],e[9]=p,e[10]=x,e[11]=_):(x=e[10],_=e[11]),Ut(x,_);let y,D;e[12]!==r||e[13]!==p?(y=()=>Om(r.registerUpdateListener(()=>{p()})),D=[r,p],e[12]=r,e[13]=p,e[14]=y,e[15]=D):(y=e[14],D=e[15]),Ut(y,D);let g;e[16]!==s||e[17]!==i||e[18]!==n.key?(g=()=>{c([Ko,i===!1?"disabled":"",s?"active":"",n?.key?`${Ko}-`+n.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=n.key,e[19]=g):g=e[19];let w;e[20]!==s||e[21]!==d||e[22]!==i||e[23]!==n.key?(w=[i,s,d,n.key],e[20]=s,e[21]=d,e[22]=i,e[23]=n.key,e[24]=w):w=e[24],Ut(g,w);let C;e[25]!==s||e[26]!==r||e[27]!==i||e[28]!==n?(C=()=>{if(i!==!1)return r.focus(()=>{r.update(Bm),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=i,e[28]=n,e[29]=C):C=e[29];let b;return e[30]!==o||e[31]!==d||e[32]!==C?(b=Fm("button",{className:d,onClick:C,onMouseDown:Hm,type:"button",children:o}),e[30]=o,e[31]=d,e[32]=C,e[33]=b):b=e[33],b};function Bm(){$m("toolbar")}function Hm(t){t.preventDefault()}import{c as ul}from"react/compiler-runtime";import{jsx as He}from"react/jsx-runtime";import Yo,{useEffect as cl}from"react";import{mergeRegister as zm}from"@lexical/utils";import{useTranslation as Zm}from"@payloadcms/ui";import{$getSelection as Ym}from"lexical";import{jsx as Te,jsxs as il}from"react/jsx-runtime";import{Button as jm}from"@payloadcms/ui";import{$addUpdateTag as Gm}from"lexical";import Wt,{useCallback as Um,useEffect as pt,useMemo as Wm,useRef as Zo,useState as Vt}from"react";import{createPortal as Vm}from"react-dom";var zo="toolbar-popup__dropdown-item",ll=Wt.createContext(null);function sl({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,a]=Vt(zo);pt(()=>{a([zo,r===!1?"disabled":"",t?"active":"",i?.key?`${zo}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let d=Zo(null),c=Wt.useContext(ll);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return pt(()=>{d?.current!=null&&u(d)},[d,u]),Te(jm,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Gm("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:l,type:"button",children:e})}function Km({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=Vt(),[l,s]=Vt(),a=Um(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),d=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},c=Wm(()=>({registerItem:a}),[a]);return pt(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),Te(ll.Provider,{value:c,children:Te("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:d,ref:e,children:t})})}function al({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Zo(null),d=Zo(null),[c,u]=Vt(!1),m=()=>{u(!1),d?.current!=null&&d.current.focus()};pt(()=>{let f=d.current,h=a.current;if(c&&f!==null&&h!==null){let{left:x,top:_}=f.getBoundingClientRect(),y=window.scrollY||document.documentElement.scrollTop;h.style.top=`${_+y+f.offsetHeight+5}px`,h.style.left=`${Math.min(x-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,d,c]),pt(()=>{let f=d.current;if(f!==null&&c){let h=x=>{let{target:_}=x;s!=null&&a.current!=null&&a.current.contains(_)||f.contains(_)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,d,c,s]);let p=Vm(Te(Km,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return il(Wt.Fragment,{children:[il("button",{"aria-label":t,className:e+(c?" active":""),disabled:r,onClick:f=>{f.preventDefault(),u(!c)},onMouseDown:f=>{f.preventDefault()},ref:d,type:"button",children:[n&&Te(n,{}),l&&Te("span",{className:"toolbar-popup__dropdown-label",children:l}),Te("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&Te(Wt.Fragment,{children:p})]})}var Xo="toolbar-popup__dropdown",Xm=t=>{let e=ul(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=Zm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a;if(l.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==l?(f=l?.Component&&He(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=o,e[1]=r,e[2]=n,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let u=l.key,m;if(l.label){let f;e[6]!==d||e[7]!==s||e[8]!==l||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):l.label,e[6]=d,e[7]=s,e[8]=l,e[9]=c,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==o||e[12]!==m||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==u?(p=He(sl,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?He(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:He("span",{className:"text",children:m})},l.key),e[11]=o,e[12]=m,e[13]=n,e[14]=i,e[15]=l,e[16]=u,e[17]=p):p=e[17],p},Se=t=>{let e=ul(36),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:d,onActiveChange:c}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=Yo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,x]=Yo.useState(f),[_,y]=Yo.useState(!0),D=B(),{items:g,key:w}=i,C;e[2]!==n||e[3]!==D||e[4]!==i||e[5]!==g||e[6]!==d||e[7]!==c?(C=()=>{n.getEditorState().read(()=>{let P=Ym();if(!P)return;let H=[],oe=[],W=[];for(let j of g)j.isActive&&(!d||H.length<d)&&j.isActive({editor:n,editorConfigContext:D,selection:P})&&(H.push(j.key),oe.push(j)),j.isEnabled?j.isEnabled({editor:n,editorConfigContext:D,selection:P})&&W.push(j.key):W.push(j.key);i.isEnabled&&y(i.isEnabled({editor:n,editorConfigContext:D,selection:P})),p(H),x(W),c&&c({activeItems:oe})})},e[2]=n,e[3]=D,e[4]=i,e[5]=g,e[6]=d,e[7]=c,e[8]=C):C=e[8];let b=C,I,N;e[9]!==b?(I=()=>{b()},N=[b],e[9]=b,e[10]=I,e[11]=N):(I=e[10],N=e[11]),cl(I,N);let k,R;e[12]!==n||e[13]!==b?(k=()=>zm(n.registerUpdateListener(()=>{b()})),R=[n,b],e[12]=n,e[13]=b,e[14]=k,e[15]=R):(k=e[14],R=e[15]),cl(k,R);let T=`${w} dropdown`,E=`${Xo}-${w}`,S;e[16]!==r?(S=r||[],e[16]=r,e[17]=S):S=e[17];let L;e[18]!==S||e[19]!==E?(L=[Xo,E,...S].filter(Boolean),e[18]=S,e[19]=E,e[20]=L):L=e[20];let A=L.join(" "),M=!_,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let U;return e[23]!==l||e[24]!==m||e[25]!==o||e[26]!==n||e[27]!==h||e[28]!==w||e[29]!==g||e[30]!==a||e[31]!==A||e[32]!==M||e[33]!==O||e[34]!==T?(U=He(al,{buttonAriaLabel:T,buttonClassName:A,disabled:M,Icon:l,itemsContainerClassNames:[`${Xo}-items`,...O],label:a,children:g.length?g.map(P=>He(Xm,{active:m.includes(P.key),anchorElem:o,editor:n,enabled:h.includes(P.key),item:P},P.key)):null},w),e[23]=l,e[24]=m,e[25]=o,e[26]=n,e[27]=h,e[28]=w,e[29]=g,e[30]=a,e[31]=A,e[32]=M,e[33]=O,e[34]=T,e[35]=U):U=e[35],U};function rp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&te(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?te(mt,{editor:e,item:o,children:te(o.ChildComponent,{})},o.key):null}function np(t){let e=dl(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=tp(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a,[u,m]=ge.useState(void 0),[p,f]=ge.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let x;e[4]!==i?(x=[i],e[4]=i,e[5]=x):x=e[5],ge.useEffect(h,x);let _;e[6]!==d||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==c?(_=w=>{let{activeItems:C}=w;if(!C.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let b=C[0],I=b.key;b.label&&(I=typeof b.label=="function"?b.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):b.label),I.length>25&&(I=I.substring(0,25)+"..."),C.length===1?(m(I),f(()=>b.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:C.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=d,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=c,e[12]=_):_=e[12];let y=_,D=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,g;return e[13]!==p||e[14]!==o||e[15]!==u||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==y||e[21]!==D?(g=Jm("div",{className:D,children:[i.type==="dropdown"&&i.items.length?p?te(Se,{anchorElem:o,editor:r,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:y}):te(Se,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:y}):null,i.type==="buttons"&&i.items.length?i.items.map(w=>te(rp,{anchorElem:o,editor:r,item:w},w.key)):null,l<n.features.toolbarFixed?.groups.length-1&&te("div",{className:"divider"})]},i.key),e[13]=p,e[14]=o,e[15]=u,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=y,e[21]=D,e[22]=g):g=e[22],g}function ip({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=ge.useRef(null),{y:l}=Qm(),s=op(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let d=n.editorContainerRef.current.previousElementSibling;for(;d;){if(d.classList.contains("fixed-toolbar"))return d;d=d.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return ep(()=>{if(!s)return;let a=i.current;if(!a)return;let d=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(d.bottom<c.top||d.top>c.bottom))a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.classList.remove("fixed-toolbar--overlapping"),a.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),te("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&te(ge.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,d)=>te(np,{anchorElem:t,editor:o,editorConfig:r,group:a,index:d},a.key))})})}var ml=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ml(t.parentEditor)}return!1},pl=t=>{let e=dl(6),{clientProps:o}=t,[r]=qm(),n=B(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,a,d;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==n){d=Symbol.for("react.early_return_sentinel");e:{let c=ml(n);if(o?.disableIfParentHasFixedToolbar&&c){d=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){d=null;break e}a=te(ip,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:c})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,e[3]=n,e[4]=a,e[5]=d}else a=e[4],d=e[5];return d!==Symbol.for("react.early_return_sentinel")?d:a};var lp=v({plugins:[{Component:pl,position:"aboveContainer"}]});import{c as gl}from"react/compiler-runtime";import{jsx as ie,jsxs as Cl}from"react/jsx-runtime";import{useLexicalComposerContext as sp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as xl}from"@lexical/utils";import{$getSelection as bl,$isRangeSelection as fl,$isTextNode as ap,COMMAND_PRIORITY_LOW as cp,getDOMSelection as _l,SELECTION_CHANGE_COMMAND as up}from"lexical";import{useCallback as zt,useEffect as ft,useRef as hl,useState as dp}from"react";import*as Zt from"react";import{createPortal as mp}from"react-dom";function Jo(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 Kt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:d=10}=t,c=o.parentElement;if(a===null||c==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-u.height-d,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let x=0;return!e&&f<p.top&&!s&&(x=u.height+a.height+d*2,f+=x),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function pp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ie(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ie(mt,{editor:e,item:o,children:ie(o.ChildComponent,{})},o.key):null}function fp(t){let e=gl(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=B(),[s,a]=Zt.useState(),d;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(d=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=d):d=e[3];let c;e[4]!==n?(c=[n],e[4]=n,e[5]=c):c=e[5],Zt.useEffect(d,c);let u;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(u=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0);return}let _=x[0];a(()=>_.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=u):u=e[9];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==l.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==i||e[16]!==m||e[17]!==p?(f=Cl("div",{className:p,children:[n.type==="dropdown"&&n.items.length?s?ie(Se,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):ie(Se,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ie(pp,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&ie("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=l.features.toolbarInline?.groups.length,e[14]=n,e[15]=i,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function hp({anchorElem:t,editor:e}){let o=hl(null),r=hl(null),{editorConfig:n}=B(),i=zt(()=>{if(o?.current){let d=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";d||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=zt(d=>{if(o?.current&&(d.buttons===1||d.buttons===3)){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!c||!u){let m=d.clientX,p=d.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=zt(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ft(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=zt(()=>{let d=bl(),c=_l(e._window);if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(d!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Jo(c,p),h=Kt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Kt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ft(()=>{let d=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),d&&d.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),d&&d.removeEventListener("scroll",c)}},[e,a,t]),ft(()=>(e.getEditorState().read(()=>{a()}),xl(e.registerUpdateListener(({editorState:d})=>{d.read(()=>{a()})}),e.registerCommand(up,()=>(a(),!1),cp))),[e,a]),Cl("div",{className:"inline-toolbar-popup",ref:o,children:[ie("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((d,c)=>ie(fp,{anchorElem:t,editor:e,group:d,index:c},d.key))]})}function gp(t,e){let o=gl(12),[r,n]=dp(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=bl(),p=_l(t._window),f=t.getRootElement();if(p!==null&&(!fl(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!fl(m))return;if(m.getTextContent()!==""){let x=m.getNodes(),_=!1;for(let y of x)if(ap(y)){n(!0),_=!0;break}_||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ft(s,a);let d,c;if(o[5]!==t||o[6]!==l?(d=()=>xl(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=d,o[8]=c):(d=o[7],c=o[8]),ft(d,c),!r||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=mp(ie(hp,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var Tl=t=>{let{anchorElem:e}=t,[o]=sp();return gp(o,e)};var Cp=v({plugins:[{Component:Tl,position:"floatingAnchorElem"}]});import{TableCellNode as t1,TableNode as o1,TableRowNode as r1}from"@lexical/table";import{jsx as wl}from"react/jsx-runtime";import"react";var qo=()=>wl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:wl("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 xp,$createTableNode as bp,$createTableRowNode as _p,$isTableCellNode as El,$isTableNode as Qo,$isTableRowNode as er,TableCellHeaderStates as Yt,TableCellNode as Tp,TableNode as wp,TableRowNode as Ep}from"@lexical/table";import{$isParagraphNode as kp,$isTextNode as Np}from"lexical";var Nl=/^\|(.+)\|\s?$/,Lp=/^(\| ?:?-*:? ?)+\|\s?$/,Ll=({allTransformers:t})=>({type:"element",dependencies:[wp,Ep,Tp],export:e=>{if(!Qo(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!er(r))continue;let i=!1;for(let l of r.getChildren())El(l)&&(n.push(Tr(t,l).replace(/\n/g,"\\n")),l.__headerState===Yt.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
36
- `)},regExp:Nl,replace:(e,o,r)=>{if(Lp.test(r[0])){let c=e.getPreviousSibling();if(!c||!Qo(c))return;let u=c.getChildren(),m=u[u.length-1];if(!m||!er(m))return;m.getChildren().forEach(p=>{El(p)&&p.setHeaderStyles(Yt.ROW,Yt.ROW)}),e.remove();return}let n=kl(r[0],t);if(n==null)return;let i=[n],l=e.getPreviousSibling(),s=n.length;for(;l&&!(!kp(l)||l.getChildrenSize()!==1);){let c=l.getFirstChild();if(!Np(c))break;let u=kl(c.getTextContent(),t);if(u==null)break;s=Math.max(s,u.length),i.unshift(u);let m=l.getPreviousSibling();l.remove(),l=m}let a=bp();for(let c of i){let u=_p();a.append(u);for(let m=0;m<s;m++)u.append(m<c.length?c[m]:Il("",t))}let d=e.getPreviousSibling();Qo(d)&&Ip(d)===s?(d.append(...a.getChildren()),e.remove()):e.replace(a),a.selectEnd()}});function Ip(t){let e=t.getFirstChild();return er(e)?e.getChildrenSize():0}var Il=(t,e)=>{t=t.replace(/\\n/g,`
37
- `);let o=xp(Yt.NO_STATUS);return _r(t,e,o),o},kl=(t,e)=>{let o=t.match(Nl);return!o||!o[1]?null:o[1].split("|").map(r=>Il(r,e))};import{c as Sp}from"react/compiler-runtime";import{jsx as $,jsxs as Ce}from"react/jsx-runtime";import{useLexicalComposerContext as Ml}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as yp}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as vp,$deleteTableRow__EXPERIMENTAL as Mp,$getNodeTriplet as Dp,$getTableCellNodeFromLexicalNode as Sl,$getTableColumnIndexFromTableCellNode as Ap,$getTableNodeFromLexicalNodeOrThrow as ye,$getTableRowIndexFromTableCellNode as Fp,$insertTableColumn__EXPERIMENTAL as Op,$insertTableRow__EXPERIMENTAL as $p,$isTableCellNode as ht,$isTableRowNode as yl,$isTableSelection as gt,$unmergeCell as Pp,getTableElement as rr,getTableObserverFromTableElement as nr,TableCellHeaderStates as we,TableCellNode as Bp}from"@lexical/table";import{mergeRegister as Hp}from"@lexical/utils";import{useScrollInfo as jp}from"@payloadcms/ui";import{$createParagraphNode as Gp,$getRoot as Up,$getSelection as Jt,$isElementNode as Wp,$isParagraphNode as Dl,$isRangeSelection as ir,$isTextNode as Vp,COMMAND_PRIORITY_CRITICAL as Kp,getDOMSelection as zp,SELECTION_CHANGE_COMMAND as Zp}from"lexical";import*as lr from"react";import{useCallback as le,useEffect as je,useRef as Xt,useState as Ge}from"react";import{createPortal as Al}from"react-dom";import{jsx as tr,jsxs as Rp}from"react/jsx-runtime";import"react";var Rl=()=>Rp("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[tr("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"}),tr("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"}),tr("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 or(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Yp(){let t=Jt();if(ir(t)&&!t.isCollapsed()||gt(t)&&!t.anchor.is(t.focus)||!ir(t)&&!gt(t))return!1;let[e]=Dp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function vl(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Dl(e)||!e.isEmpty())}function Xp(t){let e=t.getLastDescendant();Vp(e)?e.select():Wp(e)?e.selectEnd():e!==null&&e.selectNext()}function Jp({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Ml(),l=Xt(null),[s,a]=Ge(n),[d,c]=Ge({columns:1,rows:1}),[u,m]=Ge(!1),[p,f]=Ge(!1),{y:h}=jp();je(()=>i.registerMutationListener(Bp,T=>{T.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),je(()=>{i.getEditorState().read(()=>{let T=Jt();if(gt(T)){let E=or(T);c(or(T)),m(E.columns>1||E.rows>1)}f(Yp())})},[i]),je(()=>{let T=e.current,E=l.current,S=i.getRootElement();if(T!=null&&E!=null&&S!=null){let L=S.getBoundingClientRect(),A=T.getBoundingClientRect();E.style.opacity="1";let M=E.getBoundingClientRect(),O=5,U=A.right+O;if(U+M.width>window.innerWidth||U+M.width>L.right){let H=A.left-M.width-O;U=(H<0?O:H)+window.pageXOffset}E.style.left=`${U+window.pageXOffset}px`;let P=A.top;if(P+M.height>window.innerHeight){let H=A.bottom-M.height;P=(H<0?O:H)+window.pageYOffset}E.style.top=`${P}px`}},[e,l,i,h]),je(()=>{function T(E){l.current!=null&&e.current!=null&&!l.current.contains(E.target)&&!e.current.contains(E.target)&&r(!1)}return window.addEventListener("click",T),()=>window.removeEventListener("click",T)},[r,e]);let x=le(()=>{i.update(()=>{if(s.isAttached()){let E=ye(s),S=rr(E,i.getElementByKey(E.getKey()));if(S===null)throw new Error("Expected to find tableElement in DOM");let L=nr(S);L!==null&&L.$clearHighlight(),E.markDirty(),a(s.getLatest())}Up().selectStart()})},[i,s]),_=()=>{i.update(()=>{let T=Jt();if(gt(T)){let{columns:E,rows:S}=or(T),L=T.getNodes(),A=null;for(let M=0;M<L.length;M++){let O=L[M];if(ht(O))if(A===null){O.setColSpan(E).setRowSpan(S),A=O;let U=vl(O),P;U&&Dl(P=O.getFirstChild())&&P.remove()}else ht(A)&&(vl(O)||A.append(...O.getChildren()),O.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(Gp()),Xp(A)),o()}})},y=()=>{i.update(()=>{Pp()})},D=le(T=>{i.update(()=>{$p(T),o()})},[i,o]),g=le(T=>{i.update(()=>{for(let E=0;E<d.columns;E++)Op(T);o()})},[i,o,d.columns]),w=le(()=>{i.update(()=>{Mp(),o()})},[i,o]),C=le(()=>{i.update(()=>{ye(s).remove(),x(),o()})},[i,s,x,o]),b=le(()=>{i.update(()=>{vp(),o()})},[i,o]),I=le(()=>{i.update(()=>{let T=ye(s),E=Fp(s),S=T.getChildren();if(E>=S.length||E<0)throw new Error("Expected table cell to be inside of table row.");let L=S[E];if(!yl(L))throw new Error("Expected table row");let A=s.getHeaderStyles()^we.ROW;L.getChildren().forEach(M=>{if(!ht(M))throw new Error("Expected table cell");M.setHeaderStyles(A,we.ROW)}),x(),o()})},[i,s,x,o]),N=le(()=>{i.update(()=>{let T=ye(s),E=Ap(s),S=T.getChildren(),L=Math.max(...S.map(M=>M.getChildren().length));if(E>=L||E<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^we.COLUMN;for(let M=0;M<S.length;M++){let O=S[M];if(!yl(O))throw new Error("Expected table row");let U=O.getChildren();if(E>=U.length)continue;let P=U[E];if(!ht(P))throw new Error("Expected table cell");P.setHeaderStyles(A,we.COLUMN)}x(),o()})},[i,s,x,o]),k=le(()=>{i.update(()=>{if(s.isAttached()){let T=ye(s);T&&T.setRowStriping(!T.getRowStriping())}x(),o()})},[i,s,x,o]),R=null;return t&&(u?R=$("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:$("span",{className:"text",children:"Merge cells"})}):p&&(R=$("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>y(),type:"button",children:$("span",{className:"text",children:"Unmerge cells"})}))),Al(Ce("div",{className:"table-action-menu-dropdown",onClick:T=>{T.stopPropagation()},ref:l,children:[R?Ce(lr.Fragment,{children:[R,$("hr",{})]}):null,$("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>k(),type:"button",children:$("span",{className:"text",children:"Toggle Row Striping"})}),$("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),$("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),$("hr",{}),$("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>g(!1),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),$("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>g(!0),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),$("hr",{}),$("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>b(),type:"button",children:$("span",{className:"text",children:"Delete column"})}),$("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>w(),type:"button",children:$("span",{className:"text",children:"Delete row"})}),$("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:$("span",{className:"text",children:"Delete table"})}),$("hr",{}),$("button",{className:"item",onClick:()=>I(),type:"button",children:Ce("span",{className:"text",children:[(s.__headerState&we.ROW)===we.ROW?"Remove":"Add"," ","row header"]})}),$("button",{className:"item","data-test-id":"table-column-header",onClick:()=>N(),type:"button",children:Ce("span",{className:"text",children:[(s.__headerState&we.COLUMN)===we.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function qp({anchorElem:t,cellMerge:e}){let[o]=Ml(),r=Xt(null),n=Xt(null),[i,l]=Ge(!1),[s,a]=Ge(null),d=le(()=>{let u=r.current,m=Jt(),p=zp(o._window),f=document.activeElement;function h(){u&&(u.classList.remove("table-cell-action-button-container--active"),u.classList.add("table-cell-action-button-container--inactive")),a(null)}if(m==null||u==null)return h();let x=o.getRootElement(),_=null,y=null;if(ir(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let g=Sl(m.anchor.getNode());if(g==null||(y=o.getElementByKey(g.getKey()),y==null||!g.isAttached()))return h();let w=ye(g),C=rr(w,o.getElementByKey(w.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=nr(C),a(g)}else if(gt(m)){let g=Sl(m.anchor.getNode());if(!ht(g))throw new Error("TableSelection anchorNode must be a TableCellNode");let w=ye(g),C=rr(w,o.getElementByKey(w.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=nr(C),y=o.getElementByKey(g.getKey())}else if(!f)return h();if(_===null||y===null)return h();let D=!_||!_.isSelecting;if(u.classList.toggle("table-cell-action-button-container--active",D),u.classList.toggle("table-cell-action-button-container--inactive",!D),D){let g=y.getBoundingClientRect(),w=t.getBoundingClientRect(),C=g.top-w.top,b=g.right-w.left;u.style.transform=`translate(${b}px, ${C}px)`}},[o,t]);je(()=>{let u,m=()=>{u=void 0,o.getEditorState().read(d)},p=()=>(u===void 0&&(u=setTimeout(m,0)),!1);return Hp(o.registerUpdateListener(p),o.registerCommand(Zp,p,Kp),o.registerRootListener((f,h)=>{h&&h.removeEventListener("mouseup",p),f&&(f.addEventListener("mouseup",p),p())}),()=>clearTimeout(u))});let c=Xt(s);return je(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),$("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Ce(lr.Fragment,{children:[$("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:n,type:"button",children:$(Rl,{})}),i&&$(Jp,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Fl=t=>{let e=Sp(3),{anchorElem:o}=t,r=yp(),n;return e[0]!==o||e[1]!==r?(n=Al(r?$(qp,{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 Qp}from"react/compiler-runtime";import{jsx as Qt,jsxs as ef}from"react/jsx-runtime";import{useLexicalComposerContext as tf}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as of}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as rf,$getTableNodeFromLexicalNodeOrThrow as sr,$getTableRowIndexFromTableCellNode as nf,$isTableCellNode as Ol,$isTableRowNode as lf,getDOMCellFromTarget as sf,getTableElement as af,TableNode as cf}from"@lexical/table";import{calculateZoomLevel as $l}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ar}from"lexical";import*as Bl from"react";import{useCallback as Ct,useEffect as cr,useRef as qt,useState as xt}from"react";import{createPortal as uf}from"react-dom";var df=33,Pl=92;function mf({editor:t}){let e=qt(null),o=qt(null),r=qt(null),n=B(),i=qt(null),[l,s]=xt(null),[a,d]=xt(null),[c,u]=xt(!1),[m,p]=xt(null),f=Ct(()=>{d(null),e.current=null,p(null),i.current=null,r.current=null},[]),h=N=>(N.buttons&1)===1;cr(()=>t.registerNodeTransform(cf,N=>{if(N.getColWidths())return N;let k=N.getColumnCount(),R=Pl;return N.setColWidths(Array(k).fill(R)),N}),[t]),cr(()=>{let N=E=>{let S=E.target;if(m){s({x:E.clientX,y:E.clientY});return}if(u(h(E)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let L=sf(S);L&&a!==L?t.getEditorState().read(()=>{let A=ar(L.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=sr(A),O=af(M,t.getElementByKey(M.getKey()));if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=S,r.current=O.getBoundingClientRect(),d(L)},{editor:t}):L==null&&f()}},k=E=>{u(!0)},R=E=>{u(!1)},T=t.registerRootListener((E,S)=>{S?.removeEventListener("mousemove",N),S?.removeEventListener("mousedown",k),S?.removeEventListener("mouseup",R),E?.addEventListener("mousemove",N),E?.addEventListener("mousedown",k),E?.addEventListener("mouseup",R)});return()=>{T()}},[a,m,t,f]);let x=N=>N==="bottom",_=Ct(N=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let k=ar(a.elem);if(!Ol(k))throw new Error("TableCellResizer: Table cell node not found.");let R=sr(k),T=nf(k)+k.getRowSpan()-1,E=R.getChildren();if(T>=E.length||T<0)throw new Error("Expected table cell to be inside of table row.");let S=E[T];if(!lf(S))throw new Error("Expected table row");let L=S.getHeight();if(L===void 0){let M=S.getChildren();L=Math.min(...M.map(O=>y(O,t)??1/0))}let A=Math.max(L+N,df);S.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),y=(N,k)=>k.getElementByKey(N.getKey())?.clientHeight,D=(N,k)=>{for(let R=0;R<k.length;R++)for(let T=0;T<k[R].length;T++)if(k[R][T].cell===N)return T},g=Ct(N=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let k=ar(a.elem);if(!Ol(k))throw new Error("TableCellResizer: Table cell node not found.");let R=sr(k),[T]=rf(R,null,null),E=D(k,T);if(E===void 0)throw new Error("TableCellResizer: Table column not found.");let S=R.getColWidths();if(!S)return;let L=S[E];if(L===void 0)return;let A=[...S],M=Math.max(L+N,Pl);A[E]=M,R.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),w=Ct(N=>{let k=R=>{if(R.preventDefault(),R.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:T,y:E}=i.current;if(a===null)return;let S=$l(R.target);if(x(N)){let L=(R.clientY-E)/S;_(L)}else{let L=(R.clientX-T)/S;g(L)}f(),document.removeEventListener("mouseup",k)}};return k},[a,f,g,_]),C=Ct(N=>k=>{if(k.preventDefault(),k.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:k.clientX,y:k.clientY},s(i.current),p(N),document.addEventListener("mouseup",w(N))},[a,w]),[b,I]=xt({bottom:null,left:null,right:null,top:null});return cr(()=>{if(a){let{height:N,left:k,top:R,width:T}=a.elem.getBoundingClientRect(),E=$l(a.elem),S=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+k}px`,top:`${window.scrollY+R+N-S/2}px`,width:`${T}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${N}px`,left:`${window.scrollX+k+T-S/2}px`,top:`${window.scrollY+R}px`,width:`${S}px`}},A=r.current;m&&l&&A&&(x(m)?(L[m].left=`${window.scrollX+A.left}px`,L[m].top=`${window.scrollY+l.y/E}px`,L[m].height="3px",L[m].width=`${A.width}px`):(L[m].top=`${window.scrollY+A.top}px`,L[m].left=`${window.scrollX+l.x/E}px`,L[m].width="3px",L[m].height=`${A.height}px`),L[m].backgroundColor="#adf"),I(L)}else I({bottom:null,left:null,right:null,top:null})},[a,m,l]),Qt("div",{ref:o,children:a!=null&&!c&&ef(Bl.Fragment,{children:[Qt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:C("right"),style:b.right||void 0}),Qt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:C("bottom"),style:b.bottom||void 0})]})})}var Hl=()=>{let t=Qp(3),[e]=tf(),o=of(),r,n;return t[0]!==e||t[1]!==o?(n=o?uf(Qt(mf,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as _f}from"react/compiler-runtime";import{jsx as ur,jsxs as Tf,Fragment as wf}from"react/jsx-runtime";import{useLexicalComposerContext as Zl}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as Ef,$getTableColumnIndexFromTableCellNode as kf,$getTableRowIndexFromTableCellNode as Nf,$insertTableColumn__EXPERIMENTAL as Lf,$insertTableRow__EXPERIMENTAL as If,$isTableCellNode as Rf,$isTableNode as Ul,getTableElement as Sf,TableNode as yf}from"@lexical/table";import{$findMatchingParent as vf,mergeRegister as Mf}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Wl}from"lexical";import{useEffect as Vl,useMemo as Df,useRef as Kl,useState as eo}from"react";import"react";import{createPortal as Af}from"react-dom";import{c as Cf}from"react/compiler-runtime";import{useEffect as xf,useRef as bf}from"react";var pf="Expected a function",ff=Math.max,hf=Math.min;function gf(t,e,o){let r,n,i=0,l,s=!1,a=!1,d,c,u,m=!0;if(typeof t!="function")throw new TypeError(pf);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,d=a?ff(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function p(C){let b=r,I=l;return r=l=void 0,i=C,c=t.apply(I,b),c}function f(C){return i=C,u=setTimeout(_,e),s?p(C):c}function h(C){let b=C-n,I=C-i,N=e-b;return a?hf(N,d-I):N}function x(C){let b=C-n,I=C-i;return n===void 0||b>=e||b<0||a&&I>=d}function _(){let C=Date.now();if(x(C))return y(C);u=setTimeout(_,h(C))}function y(C){return u=void 0,m&&r?p(C):(r=l=void 0,c)}function D(){u!==void 0&&clearTimeout(u),i=0,r=n=l=u=void 0}function g(){return u===void 0?c:y(Date.now())}function w(){let C=Date.now(),b=x(C);if(r=arguments,l=this,n=C,b){if(u===void 0)return f(n);if(a)return clearTimeout(u),u=setTimeout(_,e),p(n)}return u===void 0&&(u=setTimeout(_,e)),c}return w.cancel=D,w.flush=g,w}var jl=gf;function Gl(t,e,o){let r=Cf(6),n=bf(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=jl(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=i,r[4]=l):(i=r[3],l=r[4]),xf(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...d)=>{let c=d;n.current&&n.current(...c)},r[5]=s):s=r[5],s}var zl=20;function Ff({anchorElem:t}){let[e]=Zl(),o=B(),[r,n]=eo(!1),[i,l]=eo(!1),[s,a]=eo(!1),[d,c]=eo({}),u=Kl(new Set),m=Kl(null),p=Gl(x=>{let{isOutside:_,tableDOMNode:y}=Of(x,o.editorConfig?.lexical);if(_){n(!1),l(!1);return}if(!y)return;m.current=y;let D=null,g=null,w=null;if(e.getEditorState().read(()=>{let C=Wl(y);if(Rf(C)){let b=vf(C,I=>Ul(I));if(!Ul(b))return;if(w=Sf(b,e.getElementByKey(b.getKey())),w){let I=b.getChildrenSize(),N=b.getChildAtIndex(0)?.getChildrenSize(),k=Nf(C),R=kf(C);k===I-1?D=C:R===N-1&&(g=C)}}},{editor:e}),w){let{bottom:C,height:b,left:I,right:N,width:k,y:R}=w.getBoundingClientRect(),{left:T,y:E}=t.getBoundingClientRect();D?(l(!1),n(!0),c({height:zl,left:I-T,top:C-E+5,width:k})):g&&(l(!0),n(!1),c({height:b,left:N-T+5,top:R-E,width:zl}))}},50,250),f=Df(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);Vl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Vl(()=>Mf(e.registerMutationListener(yf,x=>{e.getEditorState().read(()=>{let _=!1;for(let[y,D]of x)switch(D){case"created":{u.current.add(y),_=!0;break}case"destroyed":{u.current.delete(y),_=!0;break}default:break}if(_){f.disconnect();for(let y of u.current){let{tableElement:D}=Ef(y);f.observe(D)}a(u.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{m.current&&(Wl(m.current)?.selectEnd(),x?(If(),n(!1)):(Lf(),l(!1)))})};return e?.isEditable()?Tf(wf,{children:[r&&ur("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...d},type:"button"}),i&&ur("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...d},type:"button"})]}):null}function Of(t,e){let o=t.target;if(o&&o instanceof HTMLElement){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 Yl(t){let e=_f(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Zl();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=Af(ur(Ff,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as $f}from"react/compiler-runtime";import{jsx as dr,jsxs as Pf}from"react/jsx-runtime";import{useLexicalComposerContext as Bf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Hf}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as jf,TableNode as Gf}from"@lexical/table";import{mergeRegister as Uf}from"@lexical/utils";import{formatDrawerSlug as Wf,useEditDepth as Vf}from"@payloadcms/ui";import{$getSelection as Kf,$isRangeSelection as zf,COMMAND_PRIORITY_EDITOR as Zf,createCommand as Yf}from"lexical";import{createContext as Xf,useContext as Jf,useEffect as qf,useMemo as Qf,useState as e1}from"react";import*as Xl from"react";var to=Yf("OPEN_EMBED_DRAWER_COMMAND"),Jl=Xf({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ql({children:t}){let[e,o]=e1({cellEditorConfig:null,cellEditorPlugins:null});return dr(Jl.Provider,{value:Qf(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ql=()=>{let t=$f(16),[e]=Bf(),o=Jf(Jl),r=Vf(),{fieldProps:n,uuid:i}=B(),{schemaPath:l}=n,s="lexical-table-create-"+i,a;t[0]!==r||t[1]!==s?(a=Wf({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=a):a=t[2];let d=a,{toggleDrawer:c}=ae(d,!0),u;t[3]!==e||t[4]!==c?(u=()=>{if(!e.hasNodes([Gf]))throw new Error("TablePlugin: TableNode is not registered on editor");return Uf(e.registerCommand(to,()=>{let h;return h=null,e.getEditorState().read(()=>{let x=Kf();zf(x)&&(h=x)}),h&&c(),!0},Zf))},t[3]=e,t[4]=c,t[5]=u):u=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],qf(u,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(jf,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==d||t[13]!==l||t[14]!==p?(f=Pf(Xl.Fragment,{children:[dr(Ve,{drawerSlug:d,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),dr(Hf,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=d,t[13]=l,t[14]=p,t[15]=f):f=t[15],f};var n1=v({markdownTransformers:[Ll],nodes:[o1,t1,r1],plugins:[{Component:Ql,position:"normal"},{Component:Hl,position:"normal"},{Component:Fl,position:"floatingAnchorElem"},{Component:Yl,position:"floatingAnchorElem"}],providers:[ql],slashMenu:{groups:[Z([{Icon:qo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(to,{})}}])]},toolbarFixed:{groups:[de([{ChildComponent:qo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(to,{})}}])]}});import{$isNodeSelection as I1}from"lexical";import{jsx as mr,jsxs as i1}from"react/jsx-runtime";import"react";var pr=()=>i1("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:[mr("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"}),mr("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"}),mr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as p1}from"react/compiler-runtime";import{jsx as f1}from"react/jsx-runtime";import{useLexicalComposerContext as h1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as g1,mergeRegister as C1}from"@lexical/utils";import{useConfig as x1}from"@payloadcms/ui";import{$getPreviousSelection as b1,$getSelection as _1,$isParagraphNode as T1,$isRangeSelection as w1,COMMAND_PRIORITY_EDITOR as E1,createCommand as k1}from"lexical";import{useEffect as N1}from"react";import{c as es}from"react/compiler-runtime";import{jsx as fr}from"react/jsx-runtime";import{useLexicalComposerContext as ts}from"@lexical/react/LexicalComposerContext.js";import{toast as l1}from"@payloadcms/ui";import{$getNodeByKey as s1,COMMAND_PRIORITY_EDITOR as os}from"lexical";import{useEffect as rs,useState as a1}from"react";var c1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=s1(o);n&&n.replace(Xe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(hr,{fields:null,relationTo:e,value:r})},u1=t=>{let e=es(13),{enabledCollectionSlugs:o}=t,[r]=ts(),[n,i]=a1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:d}=dt(l),c,u;e[2]!==r||e[3]!==d?(c=()=>r.registerCommand(Ae,h=>(i(h?.replace?h?.replace.nodeKey:null),d(),!0),os),u=[r,d],e[2]=r,e[3]=d,e[4]=c,e[5]=u):(c=e[4],u=e[5]),rs(c,u);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,docID:_}=h;s(),c1({editor:r,relationTo:x,replaceNodeKey:n,value:_})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==a||e[11]!==p?(f=fr(a,{onSelect:p}),e[10]=a,e[11]=p,e[12]=f):f=e[12],f},d1=()=>{let t=es(3),[e]=ts(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ae,m1,os),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),rs(o,r),null},ns=t=>fr(Et,{...t,FallbackComponent:d1,uploads:!0,children:fr(u1,{...t})});function m1(){return l1.error("No upload collections enabled"),!0}var hr=k1("INSERT_UPLOAD_COMMAND"),is=t=>{let e=p1(5),[o]=h1(),{config:r}=x1(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ye]))throw new Error("UploadPlugin: UploadNode not registered on editor");return C1(o.registerCommand(hr,a=>(o.update(()=>{let d=_1()||b1();if(w1(d)){let c=Xe({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});g1(c);let{focus:u}=d,m=u.getNode();T1(m)&&!m.__first&&(m.__prev||m.__next)&&m.remove()}}),!0),E1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),N1(i,l);let s;return e[3]!==n?(s=f1(ns,{enabledCollectionSlugs:n.map(L1)}),e[3]=n,e[4]=s):s=e[4],s};function L1(t){let{slug:e}=t;return e}var R1=v({nodes:[Ye],plugins:[{Component:is,position:"normal"}],slashMenu:{groups:[Z([{Icon:pr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ae,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:pr,isActive:({selection:t})=>{if(!I1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return co(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ae,{replace:!1})}}])]}});import{c as S1}from"react/compiler-runtime";import{jsx as Cr}from"react/jsx-runtime";import{ShimmerEffect as y1}from"@payloadcms/ui";import{lazy as v1,Suspense as M1,useEffect as D1,useState as A1}from"react";var ls={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",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",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",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:"editor-upload"};var oo={namespace:"lexical",theme:ls};function ss({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:r}){for(let s of r.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.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.");r.features=r.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let n=new Map;for(let s of r.features)n.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of r.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:n,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:r}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var as=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function gr(t,e,o){return{admin:o,features:as(t),lexical:e,resolvedFeatureMap:t}}var F1=v1(()=>import("./Field-F5XP4HL4.js").then(t=>({default:t.RichText}))),O1=t=>{let e=S1(14),{admin:o,clientFeatures:r,featureClientSchemaMap:n,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let d=a,c=l===void 0?oo:l,[u,m]=A1(null),p,f;e[2]!==d||e[3]!==r||e[4]!==n||e[5]!==i||e[6]!==u||e[7]!==c||e[8]!==s?(p=()=>{if(u)return;let x=[];for(let[D,g]of Object.entries(r))g.clientFeatureProvider&&x.push(g.clientFeatureProvider(g.clientFeatureProps));let _=c||oo,y=ss({featureClientSchemaMap:n,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:x,lexical:_}});m(gr(y,_,d))},f=[c,d,u,r,n,i,s],e[2]=d,e[3]=r,e[4]=n,e[5]=i,e[6]=u,e[7]=c,e[8]=s,e[9]=p,e[10]=f):(p=e[9],f=e[10]),D1(p,f);let h;return e[11]!==u||e[12]!==t?(h=Cr(M1,{fallback:Cr(y1,{height:"35vh"}),children:u&&Cr(F1,{...t,editorConfig:u})}),e[11]=u,e[12]=t,e[13]=h):h=e[13],h};function $1(...t){return t.filter(Boolean).join(" ")}var ro=new WeakMap;function cs(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function no(t,e){let o=ro.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=cs(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=cs(l);for(let d of r)a!==null&&d([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},ro.set(t,o)}return o.listeners.add(e),()=>{P1(t,e)}}function P1(t,e){let o=ro.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(ro.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function B1(t,e){return no(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function H1(t,e){return no(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function j1(t,e){return no(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function G1(t,e){return no(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},U1=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,W1="\xA0",V1=`
34
+ `},[t,e]),p=Ne((g,w)=>{o(C=>{let b=e.length-1,I=e[b];if(I&&I.name===g){if(g==="type")return[...e.slice(0,b),{...I,value:I.value+w}];if(I.value===w)return[...e.slice(0,b),{...I,count:I.count+1}]}return[...C,{name:g,count:1,value:w}]})},[e,o]);zr(()=>{let g=C=>{if(!r)return;let b=C.key;Pa(C)?p("selectAll",""):Yr.has(b)?p("press",C.key):[...b].length>1?p("keydown",C.key):p("type",C.key)},w=C=>{if(!r)return;let b=C.key;!Yr.has(b)&&[...b].length>1&&p("keyup",C.key)};return t.registerRootListener((C,b)=>{b!==null&&(b.removeEventListener("keydown",g),b.removeEventListener("keyup",w)),C!==null&&(C.addEventListener("keydown",g),C.addEventListener("keyup",w))})},[t,r,p]),zr(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),wo(()=>{if(e){let g=m();g!==null&&s(g),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),wo(()=>t.registerUpdateListener(({dirtyElements:w,dirtyLeaves:C,editorState:b})=>{if(!r)return;let I=b._selection,N=a.current,k=d.current;if(N!==I){if(C.size===0&&w.size===0&&!k){let T=To(t._window);if(T&&(T.anchorNode==null||T.focusNode==null))return}a.current=I}d.current=!1;let R=m();R!==null&&s(R)}),[t,m,r,p]),wo(()=>r?t.registerUpdateListener(()=>{let w=t.getRootElement();w!==null&&i(w?.innerHTML)}):void 0,[t,r]);let f=Ne(g=>{r||(g.update(()=>{let w=Aa();w.clear();let C=Da();w.append(Ma().append(C)),C.select()}),o([])),n(w=>!w)},[r]),h=Ne(()=>{if(!r)return;let g=To(t._window);if(g===null||g.anchorNode==null||g.focusNode==null)return;let{anchorNode:w,anchorOffset:C,focusNode:b,focusOffset:I}=Ba(g),N=u().getRootElement(),k;w!==null&&(k=Zr(w,N));let R;b!==null&&(R=Zr(b,N)),p("snapshot",{anchorNode:w,anchorOffset:C,anchorPath:k,focusNode:b,focusOffset:I,focusPath:R})},[p,r,u]),x=Ne(()=>{Fa(m())},[m]),_=Ne(()=>{Oa("test.js",m())},[m]);return[Le("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:g=>{f(u()),g.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?ko("div",{className:"test-recorder-output",children:[ko("div",{className:"test-recorder-toolbar",children:[Le("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:g=>{h(),g.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Le("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:g=>{x(),g.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Le("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:g=>{_(),g.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Le("pre",{id:"test-recorder",ref:c,children:l})]}):null]}var Jr=()=>{let t=ya(3),[e]=va(),[o,r]=Ha(e),n;return t[0]!==o||t[1]!==r?(n=ko(Xr.Fragment,{children:[Le("p",{children:"HI"}),o,r,Le("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var ja=v({plugins:[{Component:Jr,position:"bottom"}]});import{c as Ga}from"react/compiler-runtime";import{jsx as Ua}from"react/jsx-runtime";import{useLexicalComposerContext as Wa}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Va}from"@lexical/react/LexicalTreeView.js";import"react";var qr=()=>{let t=Ga(2),[e]=Wa(),o;return t[0]!==e?(o=Ua(Va,{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 Ka=v({plugins:[{Component:qr,position:"bottom"}]});import{$isTableSelection as za}from"@lexical/table";import{$isRangeSelection as Za,FORMAT_TEXT_COMMAND as Ya}from"lexical";import{jsx as Qr}from"react/jsx-runtime";import"react";var en=()=>Qr("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:Qr("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 Y=t=>({type:"buttons",items:t,key:"format",order:40});var tn={type:"text-format",format:["bold","italic"],tag:"***"},on={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},rn={type:"text-format",format:["bold"],tag:"**"},nn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var ln=[Y([{ChildComponent:en,isActive:({selection:t})=>Za(t)||za(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Ya,"bold")},order:1}])],Xa=v(({featureProviderMap:t})=>{let e=[rn,nn];return t.get("italic")&&e.push(on,tn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:ln},toolbarInline:{groups:ln}}});import{$isTableSelection as qa}from"@lexical/table";import{$isRangeSelection as Qa,FORMAT_TEXT_COMMAND as ec}from"lexical";import{jsx as sn,jsxs as Ja}from"react/jsx-runtime";import"react";var an=()=>Ja("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",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),sn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var cn={type:"text-format",format:["code"],tag:"`"};var un=[Y([{ChildComponent:an,isActive:({selection:t})=>Qa(t)||qa(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(ec,"code")},order:7}])],tc=v({enableFormats:["code"],markdownTransformers:[cn],toolbarFixed:{groups:un},toolbarInline:{groups:un}});import{$isTableSelection as oc}from"@lexical/table";import{$isRangeSelection as rc,FORMAT_TEXT_COMMAND as nc}from"lexical";import{jsx as dn}from"react/jsx-runtime";import"react";var mn=()=>dn("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:dn("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 pn={type:"text-format",format:["italic"],tag:"*"},fn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var hn=[Y([{ChildComponent:mn,isActive:({selection:t})=>rc(t)||oc(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(nc,"italic")},order:2}])],ic=v({enableFormats:["italic"],markdownTransformers:[pn,fn],toolbarFixed:{groups:hn},toolbarInline:{groups:hn}});import{$isTableSelection as sc}from"@lexical/table";import{$isRangeSelection as ac,FORMAT_TEXT_COMMAND as cc}from"lexical";import{jsx as gn,jsxs as lc}from"react/jsx-runtime";import"react";var Cn=()=>lc("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:"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"}),gn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var xn={type:"text-format",format:["strikethrough"],tag:"~~"};var bn=[Y([{ChildComponent:Cn,isActive:({selection:t})=>ac(t)||sc(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(cc,"strikethrough")},order:4}])],uc=v({enableFormats:["strikethrough"],markdownTransformers:[xn],toolbarFixed:{groups:bn},toolbarInline:{groups:bn}});import{$isTableSelection as dc}from"@lexical/table";import{$isRangeSelection as mc,FORMAT_TEXT_COMMAND as pc}from"lexical";import{jsx as _n}from"react/jsx-runtime";import"react";var Tn=()=>_n("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:_n("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 wn=[Y([{ChildComponent:Tn,isActive:({selection:t})=>mc(t)||dc(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(pc,"subscript")},order:5}])],fc=v({enableFormats:["subscript"],toolbarFixed:{groups:wn},toolbarInline:{groups:wn}});import{$isTableSelection as hc}from"@lexical/table";import{$isRangeSelection as gc,FORMAT_TEXT_COMMAND as Cc}from"lexical";import{jsx as En}from"react/jsx-runtime";import"react";var kn=()=>En("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:En("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 Nn=[Y([{ChildComponent:kn,isActive:({selection:t})=>gc(t)||hc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Cc,"superscript")},order:6}])],xc=v({enableFormats:["superscript"],toolbarFixed:{groups:Nn},toolbarInline:{groups:Nn}});import{$isTableSelection as _c}from"@lexical/table";import{$isRangeSelection as Tc,FORMAT_TEXT_COMMAND as wc}from"lexical";import{jsx as Ln,jsxs as bc}from"react/jsx-runtime";import"react";var In=()=>bc("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:[Ln("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"}),Ln("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Rn=[Y([{ChildComponent:In,isActive:({selection:t})=>Tc(t)||_c(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(wc,"underline")},order:3}])],Ec=v({enableFormats:["underline"],toolbarFixed:{groups:Rn},toolbarInline:{groups:Rn}});import{$createHeadingNode as Ic,$isHeadingNode as Gn,HeadingNode as Rc}from"@lexical/rich-text";import{$setBlocksType as Sc}from"@lexical/selection";import{$getSelection as yc,$isRangeSelection as vc}from"lexical";import{jsx as Sn}from"react/jsx-runtime";import"react";var yn=()=>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",{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 vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("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:vn("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 Dn}from"react/jsx-runtime";import"react";var An=()=>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:"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 Fn}from"react/jsx-runtime";import"react";var On=()=>Fn("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:Fn("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 $n}from"react/jsx-runtime";import"react";var Pn=()=>$n("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$n("path",{d:"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 Bn}from"react/jsx-runtime";import"react";var Hn=()=>Bn("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:Bn("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 kc,$isHeadingNode as Nc,HeadingNode as Lc}from"@lexical/rich-text";var No=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var jn=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Lc],export:(n,i)=>{if(!Nc(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:No(n=>{let i="h"+n[1].length;return kc(i)})}};var Un=t=>{let e=yc();Sc(e,()=>Ic(t))},Wn={h1:yn,h2:Mn,h3:An,h4:On,h5:Pn,h6:Hn},Mc=v(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[J(e.map((r,n)=>({ChildComponent:Wn[r],isActive:({selection:i})=>{if(!vc(i))return!1;for(let l of i.getNodes()){if(Gn(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(Gn(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Un(r)})},order:n+2})))];return{markdownTransformers:[jn(e)],nodes:[Rc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Wn[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(()=>{Un(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Gc}from"lexical";import{jsx as Vn}from"react/jsx-runtime";import"react";var Lo=()=>Vn("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:Vn("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Kn,jsxs as Dc}from"react/jsx-runtime";import"react";var zn=()=>Dc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Kn("path",{d:"M5 10h10",stroke:"currentColor"}),Kn("path",{d:"M10 15V5",stroke:"currentColor"})]});var de=t=>({type:"dropdown",ChildComponent:zn,items:t,key:"add",order:10});var Zn={type:"element",dependencies:[_t],export:(t,e)=>wt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Tt();e&&t.replace(e)}};import{c as Ac}from"react/compiler-runtime";import{useLexicalComposerContext as Fc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Oc}from"@lexical/utils";import{$getSelection as $c,$isRangeSelection as Pc,COMMAND_PRIORITY_EDITOR as Bc}from"lexical";import{useEffect as Hc}from"react";var Yn=()=>{let t=Ac(3),[e]=Fc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(We,jc,Bc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Hc(o,r),null};function jc(t){let e=$c();if(!Pc(e))return!1;if(e.focus.getNode()!==null){let r=Tt();Oc(r)}return!0}var Uc=v({markdownTransformers:[Zn],nodes:[_t],plugins:[{Component:Yn,position:"normal"}],slashMenu:{groups:[Z([{Icon:Lo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,void 0)}}])]},toolbarFixed:{groups:[de([{ChildComponent:Lo,isActive:({selection:t})=>{if(!Gc(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,void 0)}}])]}});import{TabIndentationPlugin as Kc}from"@lexical/react/LexicalTabIndentationPlugin";import{INDENT_CONTENT_COMMAND as zc,OUTDENT_CONTENT_COMMAND as Zc}from"lexical";import{jsx as Ft,jsxs as Wc}from"react/jsx-runtime";import"react";var Xn=()=>Wc("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("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Ft("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Ft("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ft("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Ot,jsxs as Vc}from"react/jsx-runtime";import"react";var Jn=()=>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:[Ot("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var qn=t=>({type:"buttons",items:t,key:"indent",order:35});var Qn=[qn([{ChildComponent:Xn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Zc,void 0)},order:1},{ChildComponent:Jn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(zc,void 0)},order:2}])],Yc=v({plugins:[{Component:Kc,position:"normal"}],toolbarFixed:{groups:Qn},toolbarInline:{groups:Qn}});import{$findMatchingParent as sd}from"@lexical/utils";import{$getSelection as Fo,$isRangeSelection as yi}from"lexical";import{jsx as ei}from"react/jsx-runtime";import"react";var ti=()=>ei("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:ei("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 oi}from"@lexical/selection";function Fe(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?oi(o)?r:n:oi(e)?r:n}var Io=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as lu}from"lexical";import{addClassNamesToElement as Xc,isHTMLAnchorElement as Jc}from"@lexical/utils";import yo from"bson-objectid";import{$applyNodeReplacement as qc,$createTextNode as ri,$getSelection as Qc,$isElementNode as ni,$isRangeSelection as So,createCommand as eu,ElementNode as tu}from"lexical";var ou=new Set(["http:","https:","mailto:","sms:","tel:"]),q=class t extends tu{__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 t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:ru,priority:1})}}static importJSON(e){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 yo.default().toHexString(),e.version=3);let o=me({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),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=Ro(o.rel,"add","noopener")),Xc(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(!So(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&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(ni(r)){let n=me({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!ou.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,r){let n=this.__fields?.url,i=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=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Ro(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Ro(o.rel,"remove","noopener"))),!1}};function ru(t){let e=null;if(Jc(t)){let o=t.textContent;o!==null&&o!==""&&(e=me({id:new yo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function me({id:t,fields:e}){return qc(new q({id:t??new yo.default().toHexString(),fields:e}))}function z(t){return t instanceof q}var ne=eu("TOGGLE_LINK_COMMAND");function vo(t){let e=Qc();if(!So(e)&&(t===null||!t.selectedNodes?.length))return;let o=So(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(i=>{let l=i.getParent();if(z(l)){let s=l.getChildren();for(let a=0;a<s.length;a+=1)l.insertBefore(s[a]);l.remove()}});return}if(o?.length===1){let i=o[0],l=z(i)?i:nu(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(ri(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||ni(i)&&!i.isInline())){if(z(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(ri(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=me({fields:t.fields}),z(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),z(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)n.append(s[a])}i.remove();return}n!==null&&n.append(i)}})}function nu(t){return iu(t,e=>z(e))}function iu(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Ro(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var ii={type:"text-match",dependencies:[q],export:(t,e)=>{if(!z(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=me({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=lu(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as su,$isElementNode as au}from"lexical";var pe=class t extends q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){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);let o=nt({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),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(au(r)){let n=nt({fields:this.__fields});return r.append(n),n}return null}};function nt({fields:t}){return su(new pe({id:"",fields:t}))}function fe(t){return t instanceof pe}import{c as cu}from"react/compiler-runtime";import{useLexicalComposerContext as uu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as du}from"@lexical/utils";import{$createTextNode as li,$getSelection as mu,$isElementNode as ai,$isLineBreakNode as ci,$isNodeSelection as pu,$isRangeSelection as fu,$isTextNode as it,TextNode as hu}from"lexical";import{useEffect as gu}from"react";function si(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 ui(t,e){for(let o=0;o<e.length;o++){let r=e[o](t);if(r!=null)return r}return null}var Cu=/[.,;\s]/;function Pt(t){return Cu.test(t)}function di(t){return Pt(t[t.length-1])}function Do(t){return Pt(t[0])}function xu(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function mi(t){let e=t.getPreviousSibling();return ai(e)&&(e=e.getLastDescendant()),e===null||ci(e)||it(e)&&di(e.getTextContent())}function pi(t){let e=t.getNextSibling();return ai(e)&&(e=e.getFirstDescendant()),e===null||ci(e)||it(e)&&Do(e.getTextContent())}function bu(t,e,o,r){return(t>0?Pt(o[t-1]):mi(r[0]))?e<o.length?Pt(o[e]):pi(r[r.length-1]):!1}function _u(t,e,o){let r=[],n=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let d=a[0],u=d.getTextContent().length,m=s;s+u<=e?(r.push(d),l+=u):m>=o?i.push(d):n.push(d),s+=u,a.shift()}return[l,r,n,i]}function Tu(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=nt({fields:n});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=li(r.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let d=[],c;for(let f=1;f<t.length;f++){let h=t[f],_=h.getTextContent().length,y=s,D=s+_;if(y<o)if(D<=o)d.push(h);else{let[g,w]=h.splitText(o-y);d.push(g),c=w}s+=_}let u=mu(),m=u?u.getNodes().find(it):void 0,p=li(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...d),m&&m===a&&(fu(u)?p.select(u.anchor.offset,u.focus.offset):pu(u)&&p.select(0,p.getTextContent().length)),a.replace(i),c}}function wu(t,e,o){let r=[...t],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=ui(i,e))!=null&&l!==null;){let a=l.index,d=l.length,c=a+d;if(bu(s+a,s+c,n,r)){let[m,,p,f]=_u(r,s+a,s+c),h=s+a-m,x=s+c-m,_=Tu(p,h,x,l);r=_?[_,...f]:f,o(l.url,null),s=0}else s+=c;i=i.substring(c)}}function Mo(t,e,o){let r=t.getChildren(),n=r.length;for(let a=0;a<n;a++){let d=r[a];if(!it(d)||!d.isSimpleText()){$t(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=ui(i,e);if(l===null||l.text!==i){$t(t),o(null,t.getFields()?.url??null);return}if(!mi(t)||!pi(t)){$t(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function Eu(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(fe(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Do(i)||xu(i,l))&&(r.append(t),Mo(r,e,o),o(null,r.getFields()?.url??null))}fe(n)&&!di(i)&&($t(n),Mo(n,e,o),o(null,n.getFields()?.url??null))}function $t(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 ku(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 Nu(t,e,o){let r=cu(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([pe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return du(t.registerNodeTransform(hu,s=>{let a=s.getParentOrThrow(),d=s.getPreviousSibling();if(fe(a))Mo(a,e,l);else if(!z(a)){if(s.isSimpleText()&&(Do(s.getTextContent())||!fe(d))){let c=ku(s);wu(c,e,l)}Eu(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=i):(n=r[3],i=r[4]),gu(n,i)}var Lu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Iu=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ru=[si(Lu,t=>t.startsWith("http")?t:`https://${t}`),si(Iu,t=>`mailto:${t}`)],fi=()=>{let[t]=uu();return Nu(t,Ru),null};import{jsx as Su}from"react/jsx-runtime";import{ClickableLinkPlugin as yu}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var hi=()=>Su(yu,{});import{jsx as Zu}from"react/jsx-runtime";import"react";import{createPortal as Yu}from"react-dom";import{jsx as he,jsxs as lt,Fragment as Mu}from"react/jsx-runtime";import{useLexicalComposerContext as Du}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as gi,mergeRegister as Ci}from"@lexical/utils";import{getTranslation as Ao}from"@payloadcms/translations";import{CloseMenuIcon as Au,EditIcon as Fu,ExternalLinkIcon as xi,formatDrawerSlug as Ou,useConfig as $u,useEditDepth as Pu,useLocale as Bu,useTranslation as Hu}from"@payloadcms/ui";import{requests as ju}from"@payloadcms/ui/shared";import{$getSelection as bi,$isLineBreakNode as Gu,$isRangeSelection as _i,COMMAND_PRIORITY_HIGH as Uu,COMMAND_PRIORITY_LOW as Ti,getDOMSelection as Wu,KEY_ESCAPE_COMMAND as Vu,SELECTION_CHANGE_COMMAND as Ku}from"lexical";import wi,{useCallback as Ei,useEffect as jt,useRef as zu,useState as Ie}from"react";function Bt(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),d=t.top-r,c=t.left-n;d<a.top&&(d+=l.height+t.height+r*2),c+l.width>a.right&&(c=a.right-l.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as vu}from"lexical";var Ht=vu("TOGGLE_LINK_WITH_MODAL_COMMAND");function ki(t){t.preventDefault()}function Ni({anchorElem:t}){let[e]=Du(),[o,r]=Ie(),n=zu(null),[i,l]=Ie(null),[s,a]=Ie(null),{fieldProps:{schemaPath:d},uuid:c}=B(),{config:u}=$u(),{i18n:m,t:p}=Hu(),[f,h]=Ie(),x=Pu(),[_,y]=Ie(!1),[D,g]=Ie([]),w=Bu(),[C,b]=Ie(!1),I=Ou({slug:"lexical-rich-text-link-"+c,depth:x}),{toggleDrawer:N}=ae(I),k=Ei(()=>{y(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),b(!1),l(null),a(null),g([]),h(void 0)},[y,l,a,g]),R=Ei(()=>{let T=bi(),E;if(!_i(T)||!T){k();return}let S=Fe(T);E=e.getElementByKey(S.getKey())?.getBoundingClientRect();let L=gi(S,z),A=T.getNodes().filter(U=>!Gu(U)).find(U=>{let j=gi(U,z);return L&&!L.is(j)||j&&!j.is(L)});if(L==null||A){k();return}r(L);let M=L.getFields(),O={...M,id:L.getID(),text:L.getTextContent()};if(M?.linkType==="custom")l(M?.url??null),a(null);else{l(`${u.routes.admin==="/"?"":u.routes.admin}/collections/${M?.doc?.relationTo}/${M?.doc?.value}`);let U=u.collections.find(j=>j.slug===M?.doc?.relationTo);if(!U)a(M?.label?String(M?.label):null),l(M?.url?String(M?.url):null);else{let j=typeof M.doc?.value=="object"?M.doc.value.id:M.doc?.value,Ee=M.doc?.relationTo;if(!j||!Ee)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let xe=p("fields:linkedTo",{label:`${Ao(U.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(xe),ju.get(`${u.serverURL}${u.routes.api}/${Ee}/${j}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:w?.code}}).then(async be=>{if(!be.ok)throw new Error(`HTTP error! Status: ${be.status}`);let ve=await be.json(),Me=U?.admin?.useAsTitle||"id",Ue=ve[Me],bt=p("fields:linkedTo",{label:`${Ao(U.labels.singular,m)} - ${Ue}`}).replace(/<[^>]*>?/g,"");a(bt)}).catch(()=>{let be=p("fields:linkedTo",{label:`${Ao(U.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${j}`}).replace(/<[^>]*>?/g,"");a(be)})}}h(O),y(!0),g(T?T?.getNodes():[]),fe(L)?b(!0):b(!1);let G=n.current,P=Wu(e._window),{activeElement:H}=document;if(G===null)return;let oe=e.getRootElement();return P!==null&&oe!==null&&oe.contains(P.anchorNode)?(E||(E=P.getRangeAt(0).getBoundingClientRect()),E!=null&&(E.y+=40,Bt(E,G,t))):(H==null||H.className!=="link-input")&&(oe!==null&&Bt(null,G,t),l(null),a(null)),!0},[e,k,u.routes.admin,u.routes.api,u.collections,u.serverURL,p,m,w?.code,t]);return jt(()=>Ci(e.registerCommand(Ht,T=>(e.dispatchCommand(ne,T),R(),N(),!0),Ti)),[e,R,N,I]),jt(()=>{let T=t.parentElement,E=()=>{e.getEditorState().read(()=>{R()})};return window.addEventListener("resize",E),T?.addEventListener("scroll",E),()=>{window.removeEventListener("resize",E),T?.removeEventListener("scroll",E)}},[t.parentElement,e,R]),jt(()=>Ci(e.registerUpdateListener(({editorState:T})=>{T.read(()=>{R()})}),e.registerCommand(Ku,()=>(R(),!0),Ti),e.registerCommand(Vu,()=>_?(k(),!0):!1,Uu)),[e,R,_,k]),jt(()=>{e.getEditorState().read(()=>{R()})},[e,R]),lt(wi.Fragment,{children:[he("div",{className:"link-editor",ref:n,children:lt("div",{className:"link-input",children:[i&&i.length>0?lt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?he(xi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?lt(Mu,{children:[o?.__fields.newTab?he(xi,{}):null,he("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&lt(wi.Fragment,{children:[he("button",{"aria-label":"Edit link",className:"link-edit",onClick:T=>{T.preventDefault(),N()},onMouseDown:ki,tabIndex:0,type:"button",children:he(Fu,{})}),!C&&he("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ne,null)},onMouseDown:ki,tabIndex:0,type:"button",children:he(Au,{})})]})]})}),he(Ve,{className:"lexical-link-edit-drawer",data:f,drawerSlug:I,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(T,E)=>{let S=E,L={...S};delete L.text,e.update(()=>{let A=bi(),M=null;if(_i(A)?M=Fe(A).getParent():D.length&&(M=D[0].getParent()),M&&fe(M)){let O=me({fields:L});M.replace(O,!0)}}),e.dispatchCommand(ne,{fields:L,selectedNodes:D,text:S.text})},schemaPath:d,schemaPathSuffix:"fields"})]})}var Li=t=>{let{anchorElem:e=document.body}=t;return Yu(Zu(Ni,{anchorElem:e}),e)};import{c as qu}from"react/compiler-runtime";import{useLexicalComposerContext as Qu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ed}from"@lexical/utils";import{$getSelection as td,$isElementNode as od,$isRangeSelection as rd,COMMAND_PRIORITY_LOW as Ri,PASTE_COMMAND as nd}from"lexical";import{useEffect as id}from"react";var Xu=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Ju=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Ii(t){if(!t)return!1;if(t==="https://"||Xu.test(t)||Ju.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Si=t=>{let e=qu(5),{clientProps:o}=t,[r]=Qu(),n,i;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return ed(r.registerCommand(ne,l=>l===null?(vo(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),vo(l),!0),Ri),r.registerCommand(nd,l=>{let s=td();if(!rd(s)||s.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let a=l.clipboardData.getData("text");if(!Ii(a))return!1;if(!s.getNodes().some(ld)){let d={doc:null,linkType:"custom",newTab:!1,url:a};return r.dispatchCommand(ne,{fields:d,text:null}),l.preventDefault(),!0}return!1},Ri))},i=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=i):(n=e[3],i=e[4]),id(n,i),null};function ld(t){return od(t)}var vi=[Io([{ChildComponent:ti,isActive:({selection:t})=>{if(yi(t)){let e=Fe(t);return sd(e,z)!=null}return!1},isEnabled:({selection:t})=>!!(yi(t)&&Fo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ne,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Fo()?.getTextContent(),r=Fo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,newTab:!1};t.dispatchCommand(Ht,{fields:n,selectedNodes:r,text:o})}},order:1}])],ad=v({markdownTransformers:[ii],nodes:[q,pe],plugins:[{Component:Si,position:"normal"},{Component:fi,position:"normal"},{Component:hi,position:"normal"},{Component:Li,position:"floatingAnchorElem"}],toolbarFixed:{groups:vi},toolbarInline:{groups:vi}});import{$isListNode as Po,INSERT_CHECK_LIST_COMMAND as $i,ListItemNode as _d,ListNode as Td}from"@lexical/list";import{$isRangeSelection as wd}from"lexical";import{jsx as Mi,jsxs as cd}from"react/jsx-runtime";import"react";var Oo=()=>cd("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:[Mi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Mi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as ud}from"react/jsx-runtime";import{ListPlugin as dd}from"@lexical/react/LexicalListPlugin.js";import"react";var Oe=()=>ud(dd,{});function $e(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as hd,ListItemNode as gd,ListNode as Cd}from"@lexical/list";import{$createListItemNode as md,$createListNode as pd,$isListItemNode as fd,$isListNode as $o}from"@lexical/list";var Di=4,Pe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=md(t==="check"?r[3]==="x":void 0);if($o(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if($o(n)&&n.getListType()===t)n.append(l),e.remove();else{let a=pd(t,t==="number"?Number(r[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Di);s&&l.setIndent(s)},Re=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(fd(l)){if(l.getChildrenSize()===1){let c=l.getFirstChild();if($o(c)){r.push(Re(c,e,o+1));continue}}let s=" ".repeat(o*Di),a=t.getListType(),d=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+d+e(l)),i++}return r.join(`
35
+ `)};var Ai={type:"element",dependencies:[Cd,gd],export:(t,e)=>hd(t)?Re(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Pe("check")};import{jsx as xd}from"react/jsx-runtime";import{CheckListPlugin as bd}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Fi=()=>xd(bd,{});var Oi=[J([{ChildComponent:Oo,isActive:({selection:t})=>{if(!wd(t))return!1;for(let e of t.getNodes()){if(Po(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Po(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Po(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand($i,void 0)},order:12}])],Ed=v(({featureProviderMap:t})=>{let e=[{Component:Fi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Oe,position:"normal"}),{markdownTransformers:[Ai],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Td,_d],plugins:e,slashMenu:{groups:[$e([{Icon:Oo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand($i,void 0)}}])]},toolbarFixed:{groups:Oi},toolbarInline:{groups:Oi}}});import{$isListNode as Ho,INSERT_ORDERED_LIST_COMMAND as Hi,ListItemNode as Rd,ListNode as Sd}from"@lexical/list";import{$isRangeSelection as yd}from"lexical";import{jsx as st,jsxs as kd}from"react/jsx-runtime";import"react";var Bo=()=>kd("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:[st("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"}),st("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"}),st("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Nd,ListItemNode as Ld,ListNode as Id}from"@lexical/list";var Pi={type:"element",dependencies:[Id,Ld],export:(t,e)=>Nd(t)?Re(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Pe("number")};var Bi=[J([{ChildComponent:Bo,isActive:({selection:t})=>{if(!yd(t))return!1;for(let e of t.getNodes()){if(Ho(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Ho(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Ho(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Hi,void 0)},order:10}])],vd=v(({featureProviderMap:t})=>({markdownTransformers:[Pi],nodes:t.has("orderedList")?[]:[Sd,Rd],plugins:t.has("orderedList")?[]:[{Component:Oe,position:"normal"}],slashMenu:{groups:[$e([{Icon:Bo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Hi,void 0)}}])]},toolbarFixed:{groups:Bi},toolbarInline:{groups:Bi}}));import{$isListNode as Go,INSERT_UNORDERED_LIST_COMMAND as Ui,ListItemNode as Od,ListNode as $d}from"@lexical/list";import{$isRangeSelection as Pd}from"lexical";import{jsx as Be,jsxs as Md}from"react/jsx-runtime";import"react";var jo=()=>Md("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Be("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Be("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Be("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Be("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Be("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Be("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Dd,ListItemNode as Ad,ListNode as Fd}from"@lexical/list";var ji={type:"element",dependencies:[Fd,Ad],export:(t,e)=>Dd(t)?Re(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Pe("bullet")};var Gi=[J([{ChildComponent:jo,isActive:({selection:t})=>{if(!Pd(t))return!1;for(let e of t.getNodes()){if(Go(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Go(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Go(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ui,void 0)},order:11}])],Bd=v({markdownTransformers:[ji],nodes:[$d,Od],plugins:[{Component:Oe,position:"normal"}],slashMenu:{groups:[$e([{Icon:jo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ui,void 0)}}])]},toolbarFixed:{groups:Gi},toolbarInline:{groups:Gi}});import{jsx as Hd}from"react/jsx-runtime";import{addClassNamesToElement as jd}from"@lexical/utils";import{DecoratorNode as Gd}from"lexical";import*as Wi from"react";var Ud=Wi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),at=class t extends Gd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Wd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return jd(o,"unknownConverted"),o}decorate(){return Hd(Ud,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Wd({data:t}){return new at({data:t})}var Vd=v(()=>({nodes:[at]}));import{jsx as Kd}from"react/jsx-runtime";import{addClassNamesToElement as zd}from"@lexical/utils";import{DecoratorNode as Zd}from"lexical";import*as Vi from"react";var Yd=Vi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),ct=class t extends Zd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Xd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return zd(o,"unknownConverted"),o}decorate(){return Kd(Yd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Xd({data:t}){return new ct({data:t})}var Jd=v(()=>({nodes:[ct]}));import{$setBlocksType as Zi}from"@lexical/selection";import{$createParagraphNode as Yi,$getSelection as Xi,$isParagraphNode as Ki,$isRangeSelection as qd}from"lexical";var zi=[J([{ChildComponent:Je,isActive:({selection:t})=>{if(!qd(t))return!1;for(let e of t.getNodes())if(!Ki(e)&&!Ki(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Xi();Zi(e,()=>Yi())})},order:1}])],Qd=v({slashMenu:{groups:[Z([{Icon:Je,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Xi();Zi(e,()=>Yi())})}}])]},toolbarFixed:{groups:zi},toolbarInline:{groups:zi}});import{$isNodeSelection as Mm}from"lexical";import{jsx as ut,jsxs as em}from"react/jsx-runtime";import"react";var Uo=()=>em("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:[ut("g",{clipPath:"url(#clip0_4397_10817)",children:ut("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"})}),ut("defs",{children:ut("clipPath",{id:"clip0_4397_10817",children:ut("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as xm}from"react/compiler-runtime";import{jsx as bm}from"react/jsx-runtime";import{useLexicalComposerContext as _m}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Tm}from"@lexical/utils";import{useConfig as wm}from"@payloadcms/ui";import{$getPreviousSelection as Em,$getSelection as km,$isParagraphNode as ol,$isRangeSelection as Nm,COMMAND_PRIORITY_EDITOR as Lm,createCommand as Im}from"lexical";import{useEffect as Rm}from"react";import{c as mm}from"react/compiler-runtime";import{jsx as Gt}from"react/jsx-runtime";import{useLexicalComposerContext as pm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as fm,COMMAND_PRIORITY_EDITOR as hm}from"lexical";import{useEffect as gm,useState as Qi}from"react";import{c as tm}from"react/compiler-runtime";import{jsx as om}from"react/jsx-runtime";import{useLexicalComposerContext as rm}from"@lexical/react/LexicalComposerContext";import{useListDrawer as nm,useModal as im}from"@payloadcms/ui";import{$getNodeByKey as Ji,$getPreviousSelection as lm,$getRoot as sm,$getSelection as am,$isRangeSelection as cm,$setSelection as um}from"lexical";import{useEffect as dm,useState as qi}from"react";var dt=t=>{let e=tm(23),[o]=rm(),[r,n]=qi(null),[i,l]=qi(!1),[s,a,d]=nm(t),{closeDrawer:c,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=im(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let k=am()??lm();n(k)},e[0]=h):h=e[0];let x=h,_;e[1]!==o||e[2]!==r?(_=()=>{r&&o.update(()=>{if(cm(r)){let{anchor:k,focus:R}=r;Ji(k.key)&&Ji(R.key)&&um(r.clone())}else sm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=_):_=e[3];let y=_,D;e[4]!==c?(D=()=>{c()},e[4]=c,e[5]=D):D=e[5];let g=D,w,C;e[6]!==u||e[7]!==f||e[8]!==y||e[9]!==i?(w=()=>{if(!i)return;let k=f[u];k&&!k?.isOpen&&(l(!1),setTimeout(()=>{y()},1))},C=[f,u,y,i],e[6]=u,e[7]=f,e[8]=y,e[9]=i,e[10]=w,e[11]=C):(w=e[10],C=e[11]),dm(w,C);let b;e[12]!==a?(b=k=>om(a,{...k,onClick:()=>{x()}}),e[12]=a,e[13]=b):b=e[13];let I;e[14]!==p?(I=()=>{x(),p(),l(!0)},e[14]=p,e[15]=I):I=e[15];let N;return e[16]!==s||e[17]!==g||e[18]!==m||e[19]!==u||e[20]!==b||e[21]!==I?(N={closeListDrawer:g,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:b,openListDrawer:I},e[16]=s,e[17]=g,e[18]=m,e[19]=u,e[20]=b,e[21]=I,e[22]=N):N=e[22],N};var Cm=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=fm(o);n&&n.replace(Ze({relationTo:e,value:r}))}):t.dispatchCommand(Wo,{relationTo:e,value:r})},el=t=>{let e=mm(16),{enabledCollectionSlugs:o}=t,[r]=pm(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i]=Qi(n),[l,s]=Qi(null),a=o||void 0,d;e[2]!==i||e[3]!==a?(d={collectionSlugs:a,selectedCollection:i},e[2]=i,e[3]=a,e[4]=d):d=e[4];let{closeListDrawer:c,ListDrawer:u,openListDrawer:m}=dt(d),p,f;e[5]!==r||e[6]!==m?(p=()=>r.registerCommand(Ke,y=>(s(y?.replace?y?.replace.nodeKey:null),m(),!0),hm),f=[r,m],e[5]=r,e[6]=m,e[7]=p,e[8]=f):(p=e[7],f=e[8]),gm(p,f);let h;e[9]!==c||e[10]!==r||e[11]!==l?(h=y=>{let{collectionSlug:D,docID:g}=y;Cm({editor:r,relationTo:D,replaceNodeKey:l,value:g}),c()},e[9]=c,e[10]=r,e[11]=l,e[12]=h):h=e[12];let x=h,_;return e[13]!==u||e[14]!==x?(_=Gt(u,{onSelect:x}),e[13]=u,e[14]=x,e[15]=_):_=e[15],_},tl=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Gt(el,{...t}):Gt(Et,{...t,children:Gt(el,{...t})});var Wo=Im("INSERT_RELATIONSHIP_COMMAND"),rl=t=>{let e=xm(10),{clientProps:o}=t,[r]=_m(),{config:n}=wm(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o?.disabledCollections||e[1]!==i){let u;e[3]!==o?.disabledCollections?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o?.disabledCollections,e[4]=u):u=e[4],c=i.filter(u).map(Sm),e[0]=o?.disabledCollections,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==r?(s=()=>{if(!r.hasNodes([ze]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Wo,vm,Lm)},a=[r],e[5]=r,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Rm(s,a);let d;return e[8]!==l?(d=bm(tl,{enabledCollectionSlugs:l}),e[8]=l,e[9]=d):d=e[9],d};function Sm(t){let{slug:e}=t;return e}function ym(t){return ol(t)}function vm(t){let e=km()||Em();if(Nm(e)){let o=Ze(t);Tm(o);let{focus:r}=e,n=r.getNode();ol(n)&&n.getTextContentSize()===0&&n.getParentOrThrow().getChildren().filter(ym).length>1&&n.remove()}return!0}var Dm=v({nodes:[ze],plugins:[{Component:rl,position:"normal"}],slashMenu:{groups:[Z([{Icon:Uo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:Uo,isActive:({selection:t})=>{if(!Mm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ao(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as ul}from"react/compiler-runtime";import{jsx as te,jsxs as Jm}from"react/jsx-runtime";import{useLexicalComposerContext as qm}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Qm,useThrottledEffect as ep,useTranslation as tp}from"@payloadcms/ui";import*as ge from"react";import{useMemo as op}from"react";import{c as Am}from"react/compiler-runtime";import{jsx as Fm}from"react/jsx-runtime";import{mergeRegister as Om}from"@lexical/utils";import{$addUpdateTag as $m,$getSelection as Pm}from"lexical";import{useEffect as Ut,useState as Vo}from"react";var Ko="toolbar-popup__button",mt=t=>{let e=Am(34),{children:o,editor:r,item:n}=t,[i,l]=Vo(!0),[s,a]=Vo(!1),[d,c]=Vo(Ko),u=B(),m;e[0]!==s||e[1]!==r||e[2]!==u||e[3]!==i||e[4]!==n?(m=()=>{r.getEditorState().read(()=>{let I=Pm();if(I){if(n.isActive){let N=n.isActive({editor:r,editorConfigContext:u,selection:I});s!==N&&a(N)}if(n.isEnabled){let N=n.isEnabled({editor:r,editorConfigContext:u,selection:I});i!==N&&l(N)}}})},e[0]=s,e[1]=r,e[2]=u,e[3]=i,e[4]=n,e[5]=m):m=e[5];let p=m,f,h;e[6]!==p?(f=()=>{p()},h=[p],e[6]=p,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Ut(f,h);let x,_;e[9]!==p?(x=()=>(document.addEventListener("mouseup",p),()=>{document.removeEventListener("mouseup",p)}),_=[p],e[9]=p,e[10]=x,e[11]=_):(x=e[10],_=e[11]),Ut(x,_);let y,D;e[12]!==r||e[13]!==p?(y=()=>Om(r.registerUpdateListener(()=>{p()})),D=[r,p],e[12]=r,e[13]=p,e[14]=y,e[15]=D):(y=e[14],D=e[15]),Ut(y,D);let g;e[16]!==s||e[17]!==i||e[18]!==n.key?(g=()=>{c([Ko,i===!1?"disabled":"",s?"active":"",n?.key?`${Ko}-`+n.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=n.key,e[19]=g):g=e[19];let w;e[20]!==s||e[21]!==d||e[22]!==i||e[23]!==n.key?(w=[i,s,d,n.key],e[20]=s,e[21]=d,e[22]=i,e[23]=n.key,e[24]=w):w=e[24],Ut(g,w);let C;e[25]!==s||e[26]!==r||e[27]!==i||e[28]!==n?(C=()=>{if(i!==!1)return r.focus(()=>{r.update(Bm),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=i,e[28]=n,e[29]=C):C=e[29];let b;return e[30]!==o||e[31]!==d||e[32]!==C?(b=Fm("button",{className:d,onClick:C,onMouseDown:Hm,type:"button",children:o}),e[30]=o,e[31]=d,e[32]=C,e[33]=b):b=e[33],b};function Bm(){$m("toolbar")}function Hm(t){t.preventDefault()}import{c as cl}from"react/compiler-runtime";import{jsx as He}from"react/jsx-runtime";import Yo,{useEffect as al}from"react";import{mergeRegister as zm}from"@lexical/utils";import{useTranslation as Zm}from"@payloadcms/ui";import{$getSelection as Ym}from"lexical";import{jsx as Te,jsxs as nl}from"react/jsx-runtime";import{Button as jm}from"@payloadcms/ui";import{$addUpdateTag as Gm}from"lexical";import Wt,{useCallback as Um,useEffect as pt,useMemo as Wm,useRef as Zo,useState as Vt}from"react";import{createPortal as Vm}from"react-dom";var zo="toolbar-popup__dropdown-item",il=Wt.createContext(null);function ll({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,a]=Vt(zo);pt(()=>{a([zo,r===!1?"disabled":"",t?"active":"",i?.key?`${zo}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let d=Zo(null),c=Wt.useContext(il);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return pt(()=>{d?.current!=null&&u(d)},[d,u]),Te(jm,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Gm("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:l,type:"button",children:e})}function Km({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=Vt(),[l,s]=Vt(),a=Um(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),d=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},c=Wm(()=>({registerItem:a}),[a]);return pt(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),Te(il.Provider,{value:c,children:Te("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:d,ref:e,children:t})})}function sl({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Zo(null),d=Zo(null),[c,u]=Vt(!1),m=()=>{u(!1),d?.current!=null&&d.current.focus()};pt(()=>{let f=d.current,h=a.current;if(c&&f!==null&&h!==null){let{left:x,top:_}=f.getBoundingClientRect(),y=window.scrollY||document.documentElement.scrollTop;h.style.top=`${_+y+f.offsetHeight+5}px`,h.style.left=`${Math.min(x-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,d,c]),pt(()=>{let f=d.current;if(f!==null&&c){let h=x=>{let{target:_}=x;s!=null&&a.current!=null&&a.current.contains(_)||f.contains(_)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,d,c,s]);let p=Vm(Te(Km,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return nl(Wt.Fragment,{children:[nl("button",{"aria-label":t,className:e+(c?" active":""),disabled:r,onClick:f=>{f.preventDefault(),u(!c)},onMouseDown:f=>{f.preventDefault()},ref:d,type:"button",children:[n&&Te(n,{}),l&&Te("span",{className:"toolbar-popup__dropdown-label",children:l}),Te("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&Te(Wt.Fragment,{children:p})]})}var Xo="toolbar-popup__dropdown",Xm=t=>{let e=cl(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=Zm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a;if(l.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==l?(f=l?.Component&&He(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=o,e[1]=r,e[2]=n,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let u=l.key,m;if(l.label){let f;e[6]!==d||e[7]!==s||e[8]!==l||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):l.label,e[6]=d,e[7]=s,e[8]=l,e[9]=c,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==o||e[12]!==m||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==u?(p=He(ll,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?He(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:He("span",{className:"text",children:m})},l.key),e[11]=o,e[12]=m,e[13]=n,e[14]=i,e[15]=l,e[16]=u,e[17]=p):p=e[17],p},Se=t=>{let e=cl(36),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:d,onActiveChange:c}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=Yo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,x]=Yo.useState(f),[_,y]=Yo.useState(!0),D=B(),{items:g,key:w}=i,C;e[2]!==n||e[3]!==D||e[4]!==i||e[5]!==g||e[6]!==d||e[7]!==c?(C=()=>{n.getEditorState().read(()=>{let P=Ym();if(!P)return;let H=[],oe=[],U=[];for(let j of g)j.isActive&&(!d||H.length<d)&&j.isActive({editor:n,editorConfigContext:D,selection:P})&&(H.push(j.key),oe.push(j)),j.isEnabled?j.isEnabled({editor:n,editorConfigContext:D,selection:P})&&U.push(j.key):U.push(j.key);i.isEnabled&&y(i.isEnabled({editor:n,editorConfigContext:D,selection:P})),p(H),x(U),c&&c({activeItems:oe})})},e[2]=n,e[3]=D,e[4]=i,e[5]=g,e[6]=d,e[7]=c,e[8]=C):C=e[8];let b=C,I,N;e[9]!==b?(I=()=>{b()},N=[b],e[9]=b,e[10]=I,e[11]=N):(I=e[10],N=e[11]),al(I,N);let k,R;e[12]!==n||e[13]!==b?(k=()=>zm(n.registerUpdateListener(()=>{b()})),R=[n,b],e[12]=n,e[13]=b,e[14]=k,e[15]=R):(k=e[14],R=e[15]),al(k,R);let T=`${w} dropdown`,E=`${Xo}-${w}`,S;e[16]!==r?(S=r||[],e[16]=r,e[17]=S):S=e[17];let L;e[18]!==S||e[19]!==E?(L=[Xo,E,...S].filter(Boolean),e[18]=S,e[19]=E,e[20]=L):L=e[20];let A=L.join(" "),M=!_,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let G;return e[23]!==l||e[24]!==m||e[25]!==o||e[26]!==n||e[27]!==h||e[28]!==w||e[29]!==g||e[30]!==a||e[31]!==A||e[32]!==M||e[33]!==O||e[34]!==T?(G=He(sl,{buttonAriaLabel:T,buttonClassName:A,disabled:M,Icon:l,itemsContainerClassNames:[`${Xo}-items`,...O],label:a,children:g.length?g.map(P=>He(Xm,{active:m.includes(P.key),anchorElem:o,editor:n,enabled:h.includes(P.key),item:P},P.key)):null},w),e[23]=l,e[24]=m,e[25]=o,e[26]=n,e[27]=h,e[28]=w,e[29]=g,e[30]=a,e[31]=A,e[32]=M,e[33]=O,e[34]=T,e[35]=G):G=e[35],G};function rp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&te(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?te(mt,{editor:e,item:o,children:te(o.ChildComponent,{})},o.key):null}function np(t){let e=ul(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=tp(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a,[u,m]=ge.useState(void 0),[p,f]=ge.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let x;e[4]!==i?(x=[i],e[4]=i,e[5]=x):x=e[5],ge.useEffect(h,x);let _;e[6]!==d||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==c?(_=w=>{let{activeItems:C}=w;if(!C.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let b=C[0],I=b.key;b.label&&(I=typeof b.label=="function"?b.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):b.label),I.length>25&&(I=I.substring(0,25)+"..."),C.length===1?(m(I),f(()=>b.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:C.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=d,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=c,e[12]=_):_=e[12];let y=_,D=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,g;return e[13]!==p||e[14]!==o||e[15]!==u||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==y||e[21]!==D?(g=Jm("div",{className:D,children:[i.type==="dropdown"&&i.items.length?p?te(Se,{anchorElem:o,editor:r,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:y}):te(Se,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:y}):null,i.type==="buttons"&&i.items.length?i.items.map(w=>te(rp,{anchorElem:o,editor:r,item:w},w.key)):null,l<n.features.toolbarFixed?.groups.length-1&&te("div",{className:"divider"})]},i.key),e[13]=p,e[14]=o,e[15]=u,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=y,e[21]=D,e[22]=g):g=e[22],g}function ip({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=ge.useRef(null),{y:l}=Qm(),s=op(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let d=n.editorContainerRef.current.previousElementSibling;for(;d;){if(d.classList.contains("fixed-toolbar"))return d;d=d.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return ep(()=>{if(!s)return;let a=i.current;if(!a)return;let d=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(d.bottom<c.top||d.top>c.bottom))a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.classList.remove("fixed-toolbar--overlapping"),a.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),te("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&te(ge.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,d)=>te(np,{anchorElem:t,editor:o,editorConfig:r,group:a,index:d},a.key))})})}var dl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return dl(t.parentEditor)}return!1},ml=t=>{let e=ul(6),{clientProps:o}=t,[r]=qm(),n=B(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,a,d;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==n){d=Symbol.for("react.early_return_sentinel");e:{let c=dl(n);if(o?.disableIfParentHasFixedToolbar&&c){d=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){d=null;break e}a=te(ip,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:c})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,e[3]=n,e[4]=a,e[5]=d}else a=e[4],d=e[5];return d!==Symbol.for("react.early_return_sentinel")?d:a};var lp=v({plugins:[{Component:ml,position:"aboveContainer"}]});import{c as hl}from"react/compiler-runtime";import{jsx as ie,jsxs as gl}from"react/jsx-runtime";import{useLexicalComposerContext as sp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cl}from"@lexical/utils";import{$getSelection as xl,$isRangeSelection as pl,$isTextNode as ap,COMMAND_PRIORITY_LOW as cp,getDOMSelection as bl,SELECTION_CHANGE_COMMAND as up}from"lexical";import{useCallback as zt,useEffect as ft,useRef as fl,useState as dp}from"react";import*as Zt from"react";import{createPortal as mp}from"react-dom";function Jo(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 Kt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:d=10}=t,c=o.parentElement;if(a===null||c==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-u.height-d,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let x=0;return!e&&f<p.top&&!s&&(x=u.height+a.height+d*2,f+=x),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function pp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ie(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ie(mt,{editor:e,item:o,children:ie(o.ChildComponent,{})},o.key):null}function fp(t){let e=hl(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=B(),[s,a]=Zt.useState(),d;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(d=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=d):d=e[3];let c;e[4]!==n?(c=[n],e[4]=n,e[5]=c):c=e[5],Zt.useEffect(d,c);let u;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(u=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0);return}let _=x[0];a(()=>_.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=u):u=e[9];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==l.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==i||e[16]!==m||e[17]!==p?(f=gl("div",{className:p,children:[n.type==="dropdown"&&n.items.length?s?ie(Se,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):ie(Se,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ie(pp,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&ie("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=l.features.toolbarInline?.groups.length,e[14]=n,e[15]=i,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function hp({anchorElem:t,editor:e}){let o=fl(null),r=fl(null),{editorConfig:n}=B(),i=zt(()=>{if(o?.current){let d=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";d||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=zt(d=>{if(o?.current&&(d.buttons===1||d.buttons===3)){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!c||!u){let m=d.clientX,p=d.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=zt(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ft(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=zt(()=>{let d=xl(),c=bl(e._window);if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(d!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Jo(c,p),h=Kt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Kt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ft(()=>{let d=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),d&&d.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),d&&d.removeEventListener("scroll",c)}},[e,a,t]),ft(()=>(e.getEditorState().read(()=>{a()}),Cl(e.registerUpdateListener(({editorState:d})=>{d.read(()=>{a()})}),e.registerCommand(up,()=>(a(),!1),cp))),[e,a]),gl("div",{className:"inline-toolbar-popup",ref:o,children:[ie("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((d,c)=>ie(fp,{anchorElem:t,editor:e,group:d,index:c},d.key))]})}function gp(t,e){let o=hl(12),[r,n]=dp(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=xl(),p=bl(t._window),f=t.getRootElement();if(p!==null&&(!pl(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!pl(m))return;if(m.getTextContent()!==""){let x=m.getNodes(),_=!1;for(let y of x)if(ap(y)){n(!0),_=!0;break}_||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ft(s,a);let d,c;if(o[5]!==t||o[6]!==l?(d=()=>Cl(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=d,o[8]=c):(d=o[7],c=o[8]),ft(d,c),!r||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=mp(ie(hp,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var _l=t=>{let{anchorElem:e}=t,[o]=sp();return gp(o,e)};var Cp=v({plugins:[{Component:_l,position:"floatingAnchorElem"}]});import{TableCellNode as t1,TableNode as o1,TableRowNode as r1}from"@lexical/table";import{jsx as Tl}from"react/jsx-runtime";import"react";var qo=()=>Tl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tl("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 xp,$createTableNode as bp,$createTableRowNode as _p,$isTableCellNode as wl,$isTableNode as Qo,$isTableRowNode as er,TableCellHeaderStates as Yt,TableCellNode as Tp,TableNode as wp,TableRowNode as Ep}from"@lexical/table";import{$isParagraphNode as kp,$isTextNode as Np}from"lexical";var kl=/^\|(.+)\|\s?$/,Lp=/^(\| ?:?-*:? ?)+\|\s?$/,Nl=({allTransformers:t})=>({type:"element",dependencies:[wp,Ep,Tp],export:e=>{if(!Qo(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!er(r))continue;let i=!1;for(let l of r.getChildren())wl(l)&&(n.push(Tr(t,l).replace(/\n/g,"\\n")),l.__headerState===Yt.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
36
+ `)},regExp:kl,replace:(e,o,r)=>{if(Lp.test(r[0])){let c=e.getPreviousSibling();if(!c||!Qo(c))return;let u=c.getChildren(),m=u[u.length-1];if(!m||!er(m))return;m.getChildren().forEach(p=>{wl(p)&&p.setHeaderStyles(Yt.ROW,Yt.ROW)}),e.remove();return}let n=El(r[0],t);if(n==null)return;let i=[n],l=e.getPreviousSibling(),s=n.length;for(;l&&!(!kp(l)||l.getChildrenSize()!==1);){let c=l.getFirstChild();if(!Np(c))break;let u=El(c.getTextContent(),t);if(u==null)break;s=Math.max(s,u.length),i.unshift(u);let m=l.getPreviousSibling();l.remove(),l=m}let a=bp();for(let c of i){let u=_p();a.append(u);for(let m=0;m<s;m++)u.append(m<c.length?c[m]:Ll("",t))}let d=e.getPreviousSibling();Qo(d)&&Ip(d)===s?(d.append(...a.getChildren()),e.remove()):e.replace(a),a.selectEnd()}});function Ip(t){let e=t.getFirstChild();return er(e)?e.getChildrenSize():0}var Ll=(t,e)=>{t=t.replace(/\\n/g,`
37
+ `);let o=xp(Yt.NO_STATUS);return _r(t,e,o),o},El=(t,e)=>{let o=t.match(kl);return!o||!o[1]?null:o[1].split("|").map(r=>Ll(r,e))};import{c as Sp}from"react/compiler-runtime";import{jsx as $,jsxs as Ce}from"react/jsx-runtime";import{useLexicalComposerContext as vl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as yp}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as vp,$deleteTableRow__EXPERIMENTAL as Mp,$getNodeTriplet as Dp,$getTableCellNodeFromLexicalNode as Rl,$getTableColumnIndexFromTableCellNode as Ap,$getTableNodeFromLexicalNodeOrThrow as ye,$getTableRowIndexFromTableCellNode as Fp,$insertTableColumn__EXPERIMENTAL as Op,$insertTableRow__EXPERIMENTAL as $p,$isTableCellNode as ht,$isTableRowNode as Sl,$isTableSelection as gt,$unmergeCell as Pp,getTableElement as rr,getTableObserverFromTableElement as nr,TableCellHeaderStates as we,TableCellNode as Bp}from"@lexical/table";import{mergeRegister as Hp}from"@lexical/utils";import{useScrollInfo as jp}from"@payloadcms/ui";import{$createParagraphNode as Gp,$getRoot as Up,$getSelection as Jt,$isElementNode as Wp,$isParagraphNode as Ml,$isRangeSelection as ir,$isTextNode as Vp,COMMAND_PRIORITY_CRITICAL as Kp,getDOMSelection as zp,SELECTION_CHANGE_COMMAND as Zp}from"lexical";import*as lr from"react";import{useCallback as le,useEffect as je,useRef as Xt,useState as Ge}from"react";import{createPortal as Dl}from"react-dom";import{jsx as tr,jsxs as Rp}from"react/jsx-runtime";import"react";var Il=()=>Rp("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[tr("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"}),tr("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"}),tr("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 or(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Yp(){let t=Jt();if(ir(t)&&!t.isCollapsed()||gt(t)&&!t.anchor.is(t.focus)||!ir(t)&&!gt(t))return!1;let[e]=Dp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function yl(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Ml(e)||!e.isEmpty())}function Xp(t){let e=t.getLastDescendant();Vp(e)?e.select():Wp(e)?e.selectEnd():e!==null&&e.selectNext()}function Jp({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=vl(),l=Xt(null),[s,a]=Ge(n),[d,c]=Ge({columns:1,rows:1}),[u,m]=Ge(!1),[p,f]=Ge(!1),{y:h}=jp();je(()=>i.registerMutationListener(Bp,T=>{T.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),je(()=>{i.getEditorState().read(()=>{let T=Jt();if(gt(T)){let E=or(T);c(or(T)),m(E.columns>1||E.rows>1)}f(Yp())})},[i]),je(()=>{let T=e.current,E=l.current,S=i.getRootElement();if(T!=null&&E!=null&&S!=null){let L=S.getBoundingClientRect(),A=T.getBoundingClientRect();E.style.opacity="1";let M=E.getBoundingClientRect(),O=5,G=A.right+O;if(G+M.width>window.innerWidth||G+M.width>L.right){let H=A.left-M.width-O;G=(H<0?O:H)+window.pageXOffset}E.style.left=`${G+window.pageXOffset}px`;let P=A.top;if(P+M.height>window.innerHeight){let H=A.bottom-M.height;P=(H<0?O:H)+window.pageYOffset}E.style.top=`${P}px`}},[e,l,i,h]),je(()=>{function T(E){l.current!=null&&e.current!=null&&!l.current.contains(E.target)&&!e.current.contains(E.target)&&r(!1)}return window.addEventListener("click",T),()=>window.removeEventListener("click",T)},[r,e]);let x=le(()=>{i.update(()=>{if(s.isAttached()){let E=ye(s),S=rr(E,i.getElementByKey(E.getKey()));if(S===null)throw new Error("Expected to find tableElement in DOM");let L=nr(S);L!==null&&L.$clearHighlight(),E.markDirty(),a(s.getLatest())}Up().selectStart()})},[i,s]),_=()=>{i.update(()=>{let T=Jt();if(gt(T)){let{columns:E,rows:S}=or(T),L=T.getNodes(),A=null;for(let M=0;M<L.length;M++){let O=L[M];if(ht(O))if(A===null){O.setColSpan(E).setRowSpan(S),A=O;let G=yl(O),P;G&&Ml(P=O.getFirstChild())&&P.remove()}else ht(A)&&(yl(O)||A.append(...O.getChildren()),O.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(Gp()),Xp(A)),o()}})},y=()=>{i.update(()=>{Pp()})},D=le(T=>{i.update(()=>{$p(T),o()})},[i,o]),g=le(T=>{i.update(()=>{for(let E=0;E<d.columns;E++)Op(T);o()})},[i,o,d.columns]),w=le(()=>{i.update(()=>{Mp(),o()})},[i,o]),C=le(()=>{i.update(()=>{ye(s).remove(),x(),o()})},[i,s,x,o]),b=le(()=>{i.update(()=>{vp(),o()})},[i,o]),I=le(()=>{i.update(()=>{let T=ye(s),E=Fp(s),S=T.getChildren();if(E>=S.length||E<0)throw new Error("Expected table cell to be inside of table row.");let L=S[E];if(!Sl(L))throw new Error("Expected table row");let A=s.getHeaderStyles()^we.ROW;L.getChildren().forEach(M=>{if(!ht(M))throw new Error("Expected table cell");M.setHeaderStyles(A,we.ROW)}),x(),o()})},[i,s,x,o]),N=le(()=>{i.update(()=>{let T=ye(s),E=Ap(s),S=T.getChildren(),L=Math.max(...S.map(M=>M.getChildren().length));if(E>=L||E<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^we.COLUMN;for(let M=0;M<S.length;M++){let O=S[M];if(!Sl(O))throw new Error("Expected table row");let G=O.getChildren();if(E>=G.length)continue;let P=G[E];if(!ht(P))throw new Error("Expected table cell");P.setHeaderStyles(A,we.COLUMN)}x(),o()})},[i,s,x,o]),k=le(()=>{i.update(()=>{if(s.isAttached()){let T=ye(s);T&&T.setRowStriping(!T.getRowStriping())}x(),o()})},[i,s,x,o]),R=null;return t&&(u?R=$("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:$("span",{className:"text",children:"Merge cells"})}):p&&(R=$("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>y(),type:"button",children:$("span",{className:"text",children:"Unmerge cells"})}))),Dl(Ce("div",{className:"table-action-menu-dropdown",onClick:T=>{T.stopPropagation()},ref:l,children:[R?Ce(lr.Fragment,{children:[R,$("hr",{})]}):null,$("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>k(),type:"button",children:$("span",{className:"text",children:"Toggle Row Striping"})}),$("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),$("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),$("hr",{}),$("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>g(!1),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),$("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>g(!0),type:"button",children:Ce("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),$("hr",{}),$("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>b(),type:"button",children:$("span",{className:"text",children:"Delete column"})}),$("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>w(),type:"button",children:$("span",{className:"text",children:"Delete row"})}),$("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:$("span",{className:"text",children:"Delete table"})}),$("hr",{}),$("button",{className:"item",onClick:()=>I(),type:"button",children:Ce("span",{className:"text",children:[(s.__headerState&we.ROW)===we.ROW?"Remove":"Add"," ","row header"]})}),$("button",{className:"item","data-test-id":"table-column-header",onClick:()=>N(),type:"button",children:Ce("span",{className:"text",children:[(s.__headerState&we.COLUMN)===we.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function qp({anchorElem:t,cellMerge:e}){let[o]=vl(),r=Xt(null),n=Xt(null),[i,l]=Ge(!1),[s,a]=Ge(null),d=le(()=>{let u=r.current,m=Jt(),p=zp(o._window),f=document.activeElement;function h(){u&&(u.classList.remove("table-cell-action-button-container--active"),u.classList.add("table-cell-action-button-container--inactive")),a(null)}if(m==null||u==null)return h();let x=o.getRootElement(),_=null,y=null;if(ir(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let g=Rl(m.anchor.getNode());if(g==null||(y=o.getElementByKey(g.getKey()),y==null||!g.isAttached()))return h();let w=ye(g),C=rr(w,o.getElementByKey(w.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=nr(C),a(g)}else if(gt(m)){let g=Rl(m.anchor.getNode());if(!ht(g))throw new Error("TableSelection anchorNode must be a TableCellNode");let w=ye(g),C=rr(w,o.getElementByKey(w.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=nr(C),y=o.getElementByKey(g.getKey())}else if(!f)return h();if(_===null||y===null)return h();let D=!_||!_.isSelecting;if(u.classList.toggle("table-cell-action-button-container--active",D),u.classList.toggle("table-cell-action-button-container--inactive",!D),D){let g=y.getBoundingClientRect(),w=t.getBoundingClientRect(),C=g.top-w.top,b=g.right-w.left;u.style.transform=`translate(${b}px, ${C}px)`}},[o,t]);je(()=>{let u,m=()=>{u=void 0,o.getEditorState().read(d)},p=()=>(u===void 0&&(u=setTimeout(m,0)),!1);return Hp(o.registerUpdateListener(p),o.registerCommand(Zp,p,Kp),o.registerRootListener((f,h)=>{h&&h.removeEventListener("mouseup",p),f&&(f.addEventListener("mouseup",p),p())}),()=>clearTimeout(u))});let c=Xt(s);return je(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),$("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Ce(lr.Fragment,{children:[$("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:n,type:"button",children:$(Il,{})}),i&&$(Jp,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Al=t=>{let e=Sp(3),{anchorElem:o}=t,r=yp(),n;return e[0]!==o||e[1]!==r?(n=Dl(r?$(qp,{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 Qp}from"react/compiler-runtime";import{jsx as Qt,jsxs as ef}from"react/jsx-runtime";import{useLexicalComposerContext as tf}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as of}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as rf,$getTableNodeFromLexicalNodeOrThrow as sr,$getTableRowIndexFromTableCellNode as nf,$isTableCellNode as Fl,$isTableRowNode as lf,getDOMCellFromTarget as sf,getTableElement as af,TableNode as cf}from"@lexical/table";import{calculateZoomLevel as Ol}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ar}from"lexical";import*as Pl from"react";import{useCallback as Ct,useEffect as cr,useRef as qt,useState as xt}from"react";import{createPortal as uf}from"react-dom";var df=33,$l=92;function mf({editor:t}){let e=qt(null),o=qt(null),r=qt(null),n=B(),i=qt(null),[l,s]=xt(null),[a,d]=xt(null),[c,u]=xt(!1),[m,p]=xt(null),f=Ct(()=>{d(null),e.current=null,p(null),i.current=null,r.current=null},[]),h=N=>(N.buttons&1)===1;cr(()=>t.registerNodeTransform(cf,N=>{if(N.getColWidths())return N;let k=N.getColumnCount(),R=$l;return N.setColWidths(Array(k).fill(R)),N}),[t]),cr(()=>{let N=E=>{let S=E.target;if(m){s({x:E.clientX,y:E.clientY});return}if(u(h(E)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let L=sf(S);L&&a!==L?t.getEditorState().read(()=>{let A=ar(L.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=sr(A),O=af(M,t.getElementByKey(M.getKey()));if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=S,r.current=O.getBoundingClientRect(),d(L)},{editor:t}):L==null&&f()}},k=E=>{u(!0)},R=E=>{u(!1)},T=t.registerRootListener((E,S)=>{S?.removeEventListener("mousemove",N),S?.removeEventListener("mousedown",k),S?.removeEventListener("mouseup",R),E?.addEventListener("mousemove",N),E?.addEventListener("mousedown",k),E?.addEventListener("mouseup",R)});return()=>{T()}},[a,m,t,f]);let x=N=>N==="bottom",_=Ct(N=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let k=ar(a.elem);if(!Fl(k))throw new Error("TableCellResizer: Table cell node not found.");let R=sr(k),T=nf(k)+k.getRowSpan()-1,E=R.getChildren();if(T>=E.length||T<0)throw new Error("Expected table cell to be inside of table row.");let S=E[T];if(!lf(S))throw new Error("Expected table row");let L=S.getHeight();if(L===void 0){let M=S.getChildren();L=Math.min(...M.map(O=>y(O,t)??1/0))}let A=Math.max(L+N,df);S.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),y=(N,k)=>k.getElementByKey(N.getKey())?.clientHeight,D=(N,k)=>{for(let R=0;R<k.length;R++)for(let T=0;T<k[R].length;T++)if(k[R][T].cell===N)return T},g=Ct(N=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let k=ar(a.elem);if(!Fl(k))throw new Error("TableCellResizer: Table cell node not found.");let R=sr(k),[T]=rf(R,null,null),E=D(k,T);if(E===void 0)throw new Error("TableCellResizer: Table column not found.");let S=R.getColWidths();if(!S)return;let L=S[E];if(L===void 0)return;let A=[...S],M=Math.max(L+N,$l);A[E]=M,R.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),w=Ct(N=>{let k=R=>{if(R.preventDefault(),R.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:T,y:E}=i.current;if(a===null)return;let S=Ol(R.target);if(x(N)){let L=(R.clientY-E)/S;_(L)}else{let L=(R.clientX-T)/S;g(L)}f(),document.removeEventListener("mouseup",k)}};return k},[a,f,g,_]),C=Ct(N=>k=>{if(k.preventDefault(),k.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:k.clientX,y:k.clientY},s(i.current),p(N),document.addEventListener("mouseup",w(N))},[a,w]),[b,I]=xt({bottom:null,left:null,right:null,top:null});return cr(()=>{if(a){let{height:N,left:k,top:R,width:T}=a.elem.getBoundingClientRect(),E=Ol(a.elem),S=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+k}px`,top:`${window.scrollY+R+N-S/2}px`,width:`${T}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${N}px`,left:`${window.scrollX+k+T-S/2}px`,top:`${window.scrollY+R}px`,width:`${S}px`}},A=r.current;m&&l&&A&&(x(m)?(L[m].left=`${window.scrollX+A.left}px`,L[m].top=`${window.scrollY+l.y/E}px`,L[m].height="3px",L[m].width=`${A.width}px`):(L[m].top=`${window.scrollY+A.top}px`,L[m].left=`${window.scrollX+l.x/E}px`,L[m].width="3px",L[m].height=`${A.height}px`),L[m].backgroundColor="#adf"),I(L)}else I({bottom:null,left:null,right:null,top:null})},[a,m,l]),Qt("div",{ref:o,children:a!=null&&!c&&ef(Pl.Fragment,{children:[Qt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:C("right"),style:b.right||void 0}),Qt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:C("bottom"),style:b.bottom||void 0})]})})}var Bl=()=>{let t=Qp(3),[e]=tf(),o=of(),r,n;return t[0]!==e||t[1]!==o?(n=o?uf(Qt(mf,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as _f}from"react/compiler-runtime";import{jsx as ur,jsxs as Tf,Fragment as wf}from"react/jsx-runtime";import{useLexicalComposerContext as zl}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as Ef,$getTableColumnIndexFromTableCellNode as kf,$getTableRowIndexFromTableCellNode as Nf,$insertTableColumn__EXPERIMENTAL as Lf,$insertTableRow__EXPERIMENTAL as If,$isTableCellNode as Rf,$isTableNode as Gl,getTableElement as Sf,TableNode as yf}from"@lexical/table";import{$findMatchingParent as vf,mergeRegister as Mf}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ul}from"lexical";import{useEffect as Wl,useMemo as Df,useRef as Vl,useState as eo}from"react";import"react";import{createPortal as Af}from"react-dom";import{c as Cf}from"react/compiler-runtime";import{useEffect as xf,useRef as bf}from"react";var pf="Expected a function",ff=Math.max,hf=Math.min;function gf(t,e,o){let r,n,i=0,l,s=!1,a=!1,d,c,u,m=!0;if(typeof t!="function")throw new TypeError(pf);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,d=a?ff(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function p(C){let b=r,I=l;return r=l=void 0,i=C,c=t.apply(I,b),c}function f(C){return i=C,u=setTimeout(_,e),s?p(C):c}function h(C){let b=C-n,I=C-i,N=e-b;return a?hf(N,d-I):N}function x(C){let b=C-n,I=C-i;return n===void 0||b>=e||b<0||a&&I>=d}function _(){let C=Date.now();if(x(C))return y(C);u=setTimeout(_,h(C))}function y(C){return u=void 0,m&&r?p(C):(r=l=void 0,c)}function D(){u!==void 0&&clearTimeout(u),i=0,r=n=l=u=void 0}function g(){return u===void 0?c:y(Date.now())}function w(){let C=Date.now(),b=x(C);if(r=arguments,l=this,n=C,b){if(u===void 0)return f(n);if(a)return clearTimeout(u),u=setTimeout(_,e),p(n)}return u===void 0&&(u=setTimeout(_,e)),c}return w.cancel=D,w.flush=g,w}var Hl=gf;function jl(t,e,o){let r=Cf(6),n=bf(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=Hl(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=i,r[4]=l):(i=r[3],l=r[4]),xf(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...d)=>{let c=d;n.current&&n.current(...c)},r[5]=s):s=r[5],s}var Kl=20;function Ff({anchorElem:t}){let[e]=zl(),o=B(),[r,n]=eo(!1),[i,l]=eo(!1),[s,a]=eo(!1),[d,c]=eo({}),u=Vl(new Set),m=Vl(null),p=jl(x=>{let{isOutside:_,tableDOMNode:y}=Of(x,o.editorConfig?.lexical);if(_){n(!1),l(!1);return}if(!y)return;m.current=y;let D=null,g=null,w=null;if(e.getEditorState().read(()=>{let C=Ul(y);if(Rf(C)){let b=vf(C,I=>Gl(I));if(!Gl(b))return;if(w=Sf(b,e.getElementByKey(b.getKey())),w){let I=b.getChildrenSize(),N=b.getChildAtIndex(0)?.getChildrenSize(),k=Nf(C),R=kf(C);k===I-1?D=C:R===N-1&&(g=C)}}},{editor:e}),w){let{bottom:C,height:b,left:I,right:N,width:k,y:R}=w.getBoundingClientRect(),{left:T,y:E}=t.getBoundingClientRect();D?(l(!1),n(!0),c({height:Kl,left:I-T,top:C-E+5,width:k})):g&&(l(!0),n(!1),c({height:b,left:N-T+5,top:R-E,width:Kl}))}},50,250),f=Df(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);Wl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Wl(()=>Mf(e.registerMutationListener(yf,x=>{e.getEditorState().read(()=>{let _=!1;for(let[y,D]of x)switch(D){case"created":{u.current.add(y),_=!0;break}case"destroyed":{u.current.delete(y),_=!0;break}default:break}if(_){f.disconnect();for(let y of u.current){let{tableElement:D}=Ef(y);f.observe(D)}a(u.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{m.current&&(Ul(m.current)?.selectEnd(),x?(If(),n(!1)):(Lf(),l(!1)))})};return e?.isEditable()?Tf(wf,{children:[r&&ur("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...d},type:"button"}),i&&ur("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...d},type:"button"})]}):null}function Of(t,e){let o=t.target;if(o&&o instanceof HTMLElement){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 Zl(t){let e=_f(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=zl();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=Af(ur(Ff,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as $f}from"react/compiler-runtime";import{jsx as dr,jsxs as Pf}from"react/jsx-runtime";import{useLexicalComposerContext as Bf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Hf}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as jf,TableNode as Gf}from"@lexical/table";import{mergeRegister as Uf}from"@lexical/utils";import{formatDrawerSlug as Wf,useEditDepth as Vf}from"@payloadcms/ui";import{$getSelection as Kf,$isRangeSelection as zf,COMMAND_PRIORITY_EDITOR as Zf,createCommand as Yf}from"lexical";import{createContext as Xf,useContext as Jf,useEffect as qf,useMemo as Qf,useState as e1}from"react";import*as Yl from"react";var to=Yf("OPEN_EMBED_DRAWER_COMMAND"),Xl=Xf({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Jl({children:t}){let[e,o]=e1({cellEditorConfig:null,cellEditorPlugins:null});return dr(Xl.Provider,{value:Qf(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ql=()=>{let t=$f(16),[e]=Bf(),o=Jf(Xl),r=Vf(),{fieldProps:n,uuid:i}=B(),{schemaPath:l}=n,s="lexical-table-create-"+i,a;t[0]!==r||t[1]!==s?(a=Wf({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=a):a=t[2];let d=a,{toggleDrawer:c}=ae(d,!0),u;t[3]!==e||t[4]!==c?(u=()=>{if(!e.hasNodes([Gf]))throw new Error("TablePlugin: TableNode is not registered on editor");return Uf(e.registerCommand(to,()=>{let h;return h=null,e.getEditorState().read(()=>{let x=Kf();zf(x)&&(h=x)}),h&&c(),!0},Zf))},t[3]=e,t[4]=c,t[5]=u):u=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],qf(u,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(jf,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==d||t[13]!==l||t[14]!==p?(f=Pf(Yl.Fragment,{children:[dr(Ve,{drawerSlug:d,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),dr(Hf,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=d,t[13]=l,t[14]=p,t[15]=f):f=t[15],f};var n1=v({markdownTransformers:[Nl],nodes:[o1,t1,r1],plugins:[{Component:ql,position:"normal"},{Component:Bl,position:"normal"},{Component:Al,position:"floatingAnchorElem"},{Component:Zl,position:"floatingAnchorElem"}],providers:[Jl],slashMenu:{groups:[Z([{Icon:qo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(to,{})}}])]},toolbarFixed:{groups:[de([{ChildComponent:qo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(to,{})}}])]}});import{$isNodeSelection as I1}from"lexical";import{jsx as mr,jsxs as i1}from"react/jsx-runtime";import"react";var pr=()=>i1("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:[mr("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"}),mr("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"}),mr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as p1}from"react/compiler-runtime";import{jsx as f1}from"react/jsx-runtime";import{useLexicalComposerContext as h1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as g1,mergeRegister as C1}from"@lexical/utils";import{useConfig as x1}from"@payloadcms/ui";import{$getPreviousSelection as b1,$getSelection as _1,$isParagraphNode as T1,$isRangeSelection as w1,COMMAND_PRIORITY_EDITOR as E1,createCommand as k1}from"lexical";import{useEffect as N1}from"react";import{c as Ql}from"react/compiler-runtime";import{jsx as fr}from"react/jsx-runtime";import{useLexicalComposerContext as es}from"@lexical/react/LexicalComposerContext.js";import{toast as l1}from"@payloadcms/ui";import{$getNodeByKey as s1,COMMAND_PRIORITY_EDITOR as ts}from"lexical";import{useEffect as os,useState as a1}from"react";var c1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=s1(o);n&&n.replace(Xe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(hr,{fields:null,relationTo:e,value:r})},u1=t=>{let e=Ql(13),{enabledCollectionSlugs:o}=t,[r]=es(),[n,i]=a1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:d}=dt(l),c,u;e[2]!==r||e[3]!==d?(c=()=>r.registerCommand(Ae,h=>(i(h?.replace?h?.replace.nodeKey:null),d(),!0),ts),u=[r,d],e[2]=r,e[3]=d,e[4]=c,e[5]=u):(c=e[4],u=e[5]),os(c,u);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,docID:_}=h;s(),c1({editor:r,relationTo:x,replaceNodeKey:n,value:_})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==a||e[11]!==p?(f=fr(a,{onSelect:p}),e[10]=a,e[11]=p,e[12]=f):f=e[12],f},d1=()=>{let t=Ql(3),[e]=es(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ae,m1,ts),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),os(o,r),null},rs=t=>fr(Et,{...t,FallbackComponent:d1,uploads:!0,children:fr(u1,{...t})});function m1(){return l1.error("No upload collections enabled"),!0}var hr=k1("INSERT_UPLOAD_COMMAND"),ns=t=>{let e=p1(5),[o]=h1(),{config:r}=x1(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ye]))throw new Error("UploadPlugin: UploadNode not registered on editor");return C1(o.registerCommand(hr,a=>(o.update(()=>{let d=_1()||b1();if(w1(d)){let c=Xe({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});g1(c);let{focus:u}=d,m=u.getNode();T1(m)&&!m.__first&&(m.__prev||m.__next)&&m.remove()}}),!0),E1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),N1(i,l);let s;return e[3]!==n?(s=f1(rs,{enabledCollectionSlugs:n.map(L1)}),e[3]=n,e[4]=s):s=e[4],s};function L1(t){let{slug:e}=t;return e}var R1=v({nodes:[Ye],plugins:[{Component:ns,position:"normal"}],slashMenu:{groups:[Z([{Icon:pr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ae,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:pr,isActive:({selection:t})=>{if(!I1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return co(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ae,{replace:!1})}}])]}});import{c as S1}from"react/compiler-runtime";import{jsx as Cr}from"react/jsx-runtime";import{ShimmerEffect as y1}from"@payloadcms/ui";import{lazy as v1,Suspense as M1,useEffect as D1,useState as A1}from"react";var is={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",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",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",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:"editor-upload"};var oo={namespace:"lexical",theme:is};function ls({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:r}){for(let s of r.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.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.");r.features=r.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let n=new Map;for(let s of r.features)n.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of r.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:n,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:r}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var ss=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function gr(t,e,o){return{admin:o,features:ss(t),lexical:e,resolvedFeatureMap:t}}var F1=v1(()=>import("./Field-F5XP4HL4.js").then(t=>({default:t.RichText}))),O1=t=>{let e=S1(14),{admin:o,clientFeatures:r,featureClientSchemaMap:n,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let d=a,c=l===void 0?oo:l,[u,m]=A1(null),p,f;e[2]!==d||e[3]!==r||e[4]!==n||e[5]!==i||e[6]!==u||e[7]!==c||e[8]!==s?(p=()=>{if(u)return;let x=[];for(let[D,g]of Object.entries(r))g.clientFeatureProvider&&x.push(g.clientFeatureProvider(g.clientFeatureProps));let _=c||oo,y=ls({featureClientSchemaMap:n,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:x,lexical:_}});m(gr(y,_,d))},f=[c,d,u,r,n,i,s],e[2]=d,e[3]=r,e[4]=n,e[5]=i,e[6]=u,e[7]=c,e[8]=s,e[9]=p,e[10]=f):(p=e[9],f=e[10]),D1(p,f);let h;return e[11]!==u||e[12]!==t?(h=Cr(M1,{fallback:Cr(y1,{height:"35vh"}),children:u&&Cr(F1,{...t,editorConfig:u})}),e[11]=u,e[12]=t,e[13]=h):h=e[13],h};function $1(...t){return t.filter(Boolean).join(" ")}var ro=new WeakMap;function as(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function no(t,e){let o=ro.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=as(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=as(l);for(let d of r)a!==null&&d([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},ro.set(t,o)}return o.listeners.add(e),()=>{P1(t,e)}}function P1(t,e){let o=ro.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(ro.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function B1(t,e){return no(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function H1(t,e){return no(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function j1(t,e){return no(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function G1(t,e){return no(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},U1=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,W1="\xA0",V1=`
38
38
 
39
- `,us="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ds="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",K1=new RegExp("^[^"+ds+"]*["+us+"]"),z1=new RegExp("^[^"+us+"]*["+ds+"]"),Z1={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},Y1={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},X1={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},J1={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},q1={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},Q1={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};import{c as eh}from"react/compiler-runtime";import{jsx as th}from"react/jsx-runtime";import"react";var oh=()=>{let t=eh(2),{EditButton:e}=ce(),o;return t[0]!==e?(o=e?th(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as rh}from"react/compiler-runtime";import{jsx as nh}from"react/jsx-runtime";import"react";var ih=()=>{let t=rh(2),{RemoveButton:e}=ce(),o;return t[0]!==e?(o=e?nh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as lh}from"react/compiler-runtime";import{jsx as sh}from"react/jsx-runtime";import"react";var ah=()=>{let t=lh(2),{Label:e}=ce(),o;return t[0]!==e?(o=e?sh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as ch}from"react/compiler-runtime";import{jsx as uh}from"react/jsx-runtime";import"react";var dh=t=>{let e=ch(3),{children:o}=t,{InlineBlockContainer:r}=ce(),n;return e[0]!==r||e[1]!==o?(n=r?uh(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as mh}from"react/compiler-runtime";import{jsx as ph}from"react/jsx-runtime";import"react";var fh=t=>{let e=mh(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=ke(),s;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(s=l?ph(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=s):s=e[5],s};import{c as hh}from"react/compiler-runtime";import{jsx as gh}from"react/jsx-runtime";import"react";var Ch=()=>{let t=hh(2),{EditButton:e}=ke(),o;return t[0]!==e?(o=e?gh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as xh}from"react/compiler-runtime";import{jsx as bh}from"react/jsx-runtime";import"react";var _h=()=>{let t=xh(2),{RemoveButton:e}=ke(),o;return t[0]!==e?(o=e?bh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};export{nt as $createAutoLinkNode,Mt as $createBlockNode,lo as $createInlineBlockNode,me as $createLinkNode,Ze as $createRelationshipNode,Xe as $createUploadNode,fe as $isAutoLinkNode,vt as $isBlockNode,so as $isInlineBlockNode,z as $isLinkNode,ao as $isRelationshipNode,co as $isUploadNode,Ls as AlignFeatureClient,pe as AutoLinkNode,fh as BlockCollapsible,Ch as BlockEditButton,ue as BlockNode,_h as BlockRemoveButton,Ms as BlockquoteFeatureClient,Sa as BlocksFeatureClient,Xa as BoldFeatureClient,fs as CAN_USE_DOM,Ed as ChecklistFeatureClient,Y1 as DETAIL_TYPE_TO_DETAIL,V1 as DOUBLE_LINE_BREAK,J1 as ELEMENT_FORMAT_TO_TYPE,X1 as ELEMENT_TYPE_TO_FORMAT,bs as ENABLE_SLASH_MENU_COMMAND,ps as EditorConfigProvider,Ve as FieldsDrawer,lp as FixedToolbarFeatureClient,Mc as HeadingFeatureClient,Uc as HorizontalRuleFeatureClient,U1 as IS_ALL_FORMATTING,Yc as IndentFeatureClient,dh as InlineBlockContainer,oh as InlineBlockEditButton,ah as InlineBlockLabel,io as InlineBlockNode,ih as InlineBlockRemoveButton,tc as InlineCodeFeatureClient,Cp as InlineToolbarFeatureClient,ic as ItalicFeatureClient,z1 as LTR_REGEX,Vd as LexicalPluginToLexicalFeatureClient,ad as LinkFeatureClient,q as LinkNode,W1 as NON_BREAKING_SPACE,F as NodeFormat,vd as OrderedListFeatureClient,Qd as ParagraphFeatureClient,Cs as Point,K1 as RTL_REGEX,_s as Rect,Dm as RelationshipFeatureClient,ze as RelationshipNode,O1 as RichTextField,Jd as SlateToLexicalFeatureClient,uc as StrikethroughFeatureClient,fc as SubscriptFeatureClient,xc as SuperscriptFeatureClient,q1 as TEXT_MODE_TO_TYPE,Z1 as TEXT_TYPE_TO_FORMAT,Q1 as TEXT_TYPE_TO_MODE,ne as TOGGLE_LINK_COMMAND,n1 as TableFeatureClient,ja as TestRecorderFeatureClient,mt as ToolbarButton,Se as ToolbarDropdown,Ka as TreeViewFeatureClient,Ec as UnderlineFeatureClient,Bd as UnorderedListFeatureClient,R1 as UploadFeatureClient,Ye as UploadNode,G1 as addSwipeDownListener,B1 as addSwipeLeftListener,H1 as addSwipeRightListener,j1 as addSwipeUpListener,No as createBlockNode,v as createClientFeature,oo as defaultEditorLexicalConfig,Jo as getDOMRangeRect,Ts as getEnabledNodes,Fe as getSelectedNode,gs as isHTMLElement,xs as isPoint,$1 as joinClasses,gr as sanitizeClientEditorConfig,as as sanitizeClientFeatures,Kt as setFloatingElemPosition,Bt as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,de as toolbarAddDropdownGroupWithItems,Io as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,J as toolbarTextDropdownGroupWithItems,ke as useBlockComponentContext,B as useEditorConfigContext,ce as useInlineBlockComponentContext,hs as useLexicalDocumentDrawer,ae as useLexicalDrawer,dt as useLexicalListDrawer};
39
+ `,cs="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",us="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",K1=new RegExp("^[^"+us+"]*["+cs+"]"),z1=new RegExp("^[^"+cs+"]*["+us+"]"),Z1={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},Y1={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},X1={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},J1={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},q1={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},Q1={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};import{c as eh}from"react/compiler-runtime";import{jsx as th}from"react/jsx-runtime";import"react";var oh=()=>{let t=eh(2),{EditButton:e}=ce(),o;return t[0]!==e?(o=e?th(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as rh}from"react/compiler-runtime";import{jsx as nh}from"react/jsx-runtime";import"react";var ih=()=>{let t=rh(2),{RemoveButton:e}=ce(),o;return t[0]!==e?(o=e?nh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as lh}from"react/compiler-runtime";import{jsx as sh}from"react/jsx-runtime";import"react";var ah=()=>{let t=lh(2),{Label:e}=ce(),o;return t[0]!==e?(o=e?sh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as ch}from"react/compiler-runtime";import{jsx as uh}from"react/jsx-runtime";import"react";var dh=t=>{let e=ch(3),{children:o}=t,{InlineBlockContainer:r}=ce(),n;return e[0]!==r||e[1]!==o?(n=r?uh(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as mh}from"react/compiler-runtime";import{jsx as ph}from"react/jsx-runtime";import"react";var fh=t=>{let e=mh(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=ke(),s;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(s=l?ph(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=s):s=e[5],s};import{c as hh}from"react/compiler-runtime";import{jsx as gh}from"react/jsx-runtime";import"react";var Ch=()=>{let t=hh(2),{EditButton:e}=ke(),o;return t[0]!==e?(o=e?gh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as xh}from"react/compiler-runtime";import{jsx as bh}from"react/jsx-runtime";import"react";var _h=()=>{let t=xh(2),{RemoveButton:e}=ke(),o;return t[0]!==e?(o=e?bh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};export{nt as $createAutoLinkNode,Mt as $createBlockNode,lo as $createInlineBlockNode,me as $createLinkNode,Ze as $createRelationshipNode,Xe as $createUploadNode,fe as $isAutoLinkNode,vt as $isBlockNode,so as $isInlineBlockNode,z as $isLinkNode,ao as $isRelationshipNode,co as $isUploadNode,Ns as AlignFeatureClient,pe as AutoLinkNode,fh as BlockCollapsible,Ch as BlockEditButton,ue as BlockNode,_h as BlockRemoveButton,vs as BlockquoteFeatureClient,Sa as BlocksFeatureClient,Xa as BoldFeatureClient,ps as CAN_USE_DOM,Ed as ChecklistFeatureClient,Y1 as DETAIL_TYPE_TO_DETAIL,V1 as DOUBLE_LINE_BREAK,J1 as ELEMENT_FORMAT_TO_TYPE,X1 as ELEMENT_TYPE_TO_FORMAT,xs as ENABLE_SLASH_MENU_COMMAND,ms as EditorConfigProvider,Ve as FieldsDrawer,lp as FixedToolbarFeatureClient,Mc as HeadingFeatureClient,Uc as HorizontalRuleFeatureClient,U1 as IS_ALL_FORMATTING,Yc as IndentFeatureClient,dh as InlineBlockContainer,oh as InlineBlockEditButton,ah as InlineBlockLabel,io as InlineBlockNode,ih as InlineBlockRemoveButton,tc as InlineCodeFeatureClient,Cp as InlineToolbarFeatureClient,ic as ItalicFeatureClient,z1 as LTR_REGEX,Vd as LexicalPluginToLexicalFeatureClient,ad as LinkFeatureClient,q as LinkNode,W1 as NON_BREAKING_SPACE,F as NodeFormat,vd as OrderedListFeatureClient,Qd as ParagraphFeatureClient,gs as Point,K1 as RTL_REGEX,bs as Rect,Dm as RelationshipFeatureClient,ze as RelationshipNode,O1 as RichTextField,Jd as SlateToLexicalFeatureClient,uc as StrikethroughFeatureClient,fc as SubscriptFeatureClient,xc as SuperscriptFeatureClient,q1 as TEXT_MODE_TO_TYPE,Z1 as TEXT_TYPE_TO_FORMAT,Q1 as TEXT_TYPE_TO_MODE,ne as TOGGLE_LINK_COMMAND,n1 as TableFeatureClient,ja as TestRecorderFeatureClient,mt as ToolbarButton,Se as ToolbarDropdown,Ka as TreeViewFeatureClient,Ec as UnderlineFeatureClient,Bd as UnorderedListFeatureClient,R1 as UploadFeatureClient,Ye as UploadNode,G1 as addSwipeDownListener,B1 as addSwipeLeftListener,H1 as addSwipeRightListener,j1 as addSwipeUpListener,No as createBlockNode,v as createClientFeature,oo as defaultEditorLexicalConfig,Jo as getDOMRangeRect,_s as getEnabledNodes,Fe as getSelectedNode,hs as isHTMLElement,Cs as isPoint,$1 as joinClasses,gr as sanitizeClientEditorConfig,ss as sanitizeClientFeatures,Kt as setFloatingElemPosition,Bt as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,de as toolbarAddDropdownGroupWithItems,Io as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,J as toolbarTextDropdownGroupWithItems,ke as useBlockComponentContext,B as useEditorConfigContext,ce as useInlineBlockComponentContext,fs as useLexicalDocumentDrawer,ae as useLexicalDrawer,dt as useLexicalListDrawer};
40
40
  //# sourceMappingURL=index.js.map