@payloadcms/richtext-lexical 3.60.0-canary.2 → 3.60.0-internal.2828177

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 (55) hide show
  1. package/dist/exports/client/{chunk-XNERFY6G.js → chunk-ADWHGDDR.js} +2 -2
  2. package/dist/exports/client/{chunk-XNERFY6G.js.map → chunk-ADWHGDDR.js.map} +2 -2
  3. package/dist/exports/client/componentInline-MIPTDFRK.js +2 -0
  4. package/dist/exports/client/index.d.ts +1 -1
  5. package/dist/exports/client/index.d.ts.map +1 -1
  6. package/dist/exports/client/index.js +13 -13
  7. package/dist/exports/client/index.js.map +3 -3
  8. package/dist/features/blockquote/server/index.d.ts +3 -4
  9. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  10. package/dist/features/blockquote/server/index.js.map +1 -1
  11. package/dist/features/blocks/premade/CodeBlock/index.d.ts +3 -1
  12. package/dist/features/blocks/premade/CodeBlock/index.d.ts.map +1 -1
  13. package/dist/features/blocks/premade/CodeBlock/index.js +7 -2
  14. package/dist/features/blocks/premade/CodeBlock/index.js.map +1 -1
  15. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +4 -5
  16. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  17. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  18. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +4 -5
  19. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  20. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  21. package/dist/features/experimental_table/server/index.d.ts +5 -10
  22. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  23. package/dist/features/experimental_table/server/index.js.map +1 -1
  24. package/dist/features/heading/server/index.d.ts +3 -4
  25. package/dist/features/heading/server/index.d.ts.map +1 -1
  26. package/dist/features/heading/server/index.js.map +1 -1
  27. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +3 -5
  28. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  29. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  30. package/dist/features/link/nodes/types.d.ts +6 -6
  31. package/dist/features/link/nodes/types.d.ts.map +1 -1
  32. package/dist/features/link/nodes/types.js.map +1 -1
  33. package/dist/features/lists/plugin/index.d.ts +6 -7
  34. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  35. package/dist/features/lists/plugin/index.js.map +1 -1
  36. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +3 -5
  37. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  38. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  39. package/dist/features/upload/server/nodes/UploadNode.d.ts +3 -5
  40. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  41. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  42. package/dist/index.d.ts +1 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +1 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/nodeTypes.d.ts +46 -20
  47. package/dist/nodeTypes.d.ts.map +1 -1
  48. package/dist/nodeTypes.js.map +1 -1
  49. package/dist/utilities/buildEditorState.d.ts +47 -6
  50. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  51. package/dist/utilities/buildEditorState.js +10 -1
  52. package/dist/utilities/buildEditorState.js.map +1 -1
  53. package/package.json +7 -7
  54. package/dist/exports/client/componentInline-NGTRUSGB.js +0 -2
  55. /package/dist/exports/client/{componentInline-NGTRUSGB.js.map → componentInline-MIPTDFRK.js.map} +0 -0
@@ -1,13 +1,13 @@
1
- "use client";import{a as ge,c as dt,d as mt,e as pt}from"./chunk-XNERFY6G.js";import{a as Je}from"./chunk-DBWINSQN.js";import{a as ft,b as Xe}from"./chunk-O6XRT2H3.js";import{a as he}from"./chunk-INBEEENE.js";import{a as fc}from"./chunk-F26IQ5RE.js";import{b as Ht,c as Ut,d as ne,e as Wt,f as hc,g as gc,i as xc,k as Cc,l as bc}from"./chunk-TLQLXR6Q.js";import{a as pc,b as j}from"./chunk-BZZVLW4U.js";function z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as ye,$isRangeSelection as Vt,FORMAT_ELEMENT_COMMAND as Kt}from"lexical";import{jsx as Oo,jsxs as kc}from"react/jsx-runtime";import"react";var rn=()=>kc("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:[Oo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Oo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Oo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Fo,jsxs as _c}from"react/jsx-runtime";import"react";var nn=()=>_c("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[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:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Po,jsxs as Tc}from"react/jsx-runtime";import"react";var Gt=()=>Tc("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 Bo,jsxs as wc}from"react/jsx-runtime";import"react";var ln=()=>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:[Bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var M=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var sn=t=>({type:"dropdown",ChildComponent:Gt,items:t,key:"align",order:30});var an=[sn([{ChildComponent:Gt,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"left")},order:1},{ChildComponent:rn,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"center")},order:2},{ChildComponent:ln,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"right")},order:3},{ChildComponent:nn,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"justify")},order:4}])],Ec=M({toolbarFixed:{groups:an},toolbarInline:{groups:an}});import{$createQuoteNode as hn,$isQuoteNode as pn,QuoteNode as Nc}from"@lexical/rich-text";import{$setBlocksType as gn}from"@lexical/selection";import{$getSelection as xn,$isRangeSelection as yc}from"lexical";import{jsx as cn}from"react/jsx-runtime";import"react";var jo=()=>cn("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:cn("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 un}from"react/jsx-runtime";import"react";var ht=()=>un("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:un("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 Q=t=>({type:"dropdown",ChildComponent:ht,items:t,key:"text",order:25});import{$createQuoteNode as Sc,$isQuoteNode as dn,QuoteNode as Lc}from"@lexical/rich-text";var mn={type:"element",dependencies:[Lc],export:(t,e)=>{if(!dn(t))return null;let o=e(t).split(`
1
+ "use client";import{a as ge,c as dt,d as mt,e as pt}from"./chunk-ADWHGDDR.js";import{a as Je}from"./chunk-DBWINSQN.js";import{a as ft,b as Xe}from"./chunk-O6XRT2H3.js";import{a as he}from"./chunk-INBEEENE.js";import{a as hc}from"./chunk-F26IQ5RE.js";import{b as Ht,c as Ut,d as ne,e as Wt,f as gc,g as xc,i as Cc,k as bc,l as kc}from"./chunk-TLQLXR6Q.js";import{a as fc,b as j}from"./chunk-BZZVLW4U.js";function z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as ye,$isRangeSelection as Vt,FORMAT_ELEMENT_COMMAND as Kt}from"lexical";import{jsx as Oo,jsxs as _c}from"react/jsx-runtime";import"react";var rn=()=>_c("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Oo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Oo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Oo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Fo,jsxs as Tc}from"react/jsx-runtime";import"react";var nn=()=>Tc("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:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Po,jsxs as wc}from"react/jsx-runtime";import"react";var Gt=()=>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:[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 Bo,jsxs as Ec}from"react/jsx-runtime";import"react";var ln=()=>Ec("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var M=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var sn=t=>({type:"dropdown",ChildComponent:Gt,items:t,key:"align",order:30});var an=[sn([{ChildComponent:Gt,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"left")},order:1},{ChildComponent:rn,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"center")},order:2},{ChildComponent:ln,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"right")},order:3},{ChildComponent:nn,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"justify")},order:4}])],Sc=M({toolbarFixed:{groups:an},toolbarInline:{groups:an}});import{$createQuoteNode as hn,$isQuoteNode as pn,QuoteNode as yc}from"@lexical/rich-text";import{$setBlocksType as gn}from"@lexical/selection";import{$getSelection as xn,$isRangeSelection as Rc}from"lexical";import{jsx as cn}from"react/jsx-runtime";import"react";var jo=()=>cn("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:cn("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 un}from"react/jsx-runtime";import"react";var ht=()=>un("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:un("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 Q=t=>({type:"dropdown",ChildComponent:ht,items:t,key:"text",order:25});import{$createQuoteNode as Lc,$isQuoteNode as dn,QuoteNode as Nc}from"@lexical/rich-text";var mn={type:"element",dependencies:[Nc],export:(t,e)=>{if(!dn(t))return null;let o=e(t).split(`
2
2
  `),r=[];for(let n of o)r.push("> "+n);return r.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(dn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Sc();n.append(...e),t.replace(n),n.select(0,0)}};var fn=[Q([{ChildComponent:jo,isActive:({selection:t})=>{if(!yc(t))return!1;for(let e of t.getNodes())if(!pn(e)&&!pn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=xn();gn(e,()=>hn())})},order:20}])],Rc=M({markdownTransformers:[mn],nodes:[Nc],slashMenu:{groups:[z([{Icon:jo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=xn();gn(e,()=>hn())})}}])]},toolbarFixed:{groups:fn},toolbarInline:{groups:fn}});import{getTranslation as oo}from"@payloadcms/translations";import{jsx as Ho,jsxs as Ic}from"react/jsx-runtime";import"react";var Jt=()=>Ic("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Cn}from"react/jsx-runtime";import"react";var Xt=()=>Cn("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:Cn("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as vc}from"react/jsx-runtime";import"react";function zt(t,e){return t?()=>vc("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Jt}import{$parseSerializedNode as Rn}from"lexical";import{JSOX as Uo}from"jsox";function Zt({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let i=Mc(t,n);e[o]=i.value,n=i.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Mc(t,e){let o=t[e];return o==='"'?bn(t,e):o==="'"?bn(t,e,!0):o==="{"?Ac(t,e):o==="["?Dc(t,e):Oc(t,e)}function Dc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Uo.parse(`[${r}]`)}}function bn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function Ac(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:$c(r)}}function $c(t){return t[0]!=="{"?Uo.parse(t):Uo.parse(t.replace(/(\w+):/g,'"$1":'))}function Oc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function gt({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${Fc(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,kn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,kn)}}`));return e.join(" ")}function Fc(t){return t.replace(/"/g,"&quot;")}function kn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Yt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let i="",s="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,f=0,h=d[0].slice(0,n.index),x=0,T=r;e:for(let[S,_]of d.entries()){let k=l?_.trim():_,g=0;if(l)for(let b=0;b<_.length&&_[b]===" ";b++)g++;let C=0;for(S===0&&(C=(n.index??0)+n[0].length-g);C<k.length;){let b=k[C],y=k[C+1];if(c){if(b==="`"&&f++,f%2===0)if(b==="<"&&y==="/"){if(u--,u<0){s[s.length-1]===`
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(dn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Lc();n.append(...e),t.replace(n),n.select(0,0)}};var fn=[Q([{ChildComponent:jo,isActive:({selection:t})=>{if(!Rc(t))return!1;for(let e of t.getNodes())if(!pn(e)&&!pn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=xn();gn(e,()=>hn())})},order:20}])],Ic=M({markdownTransformers:[mn],nodes:[yc],slashMenu:{groups:[z([{Icon:jo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=xn();gn(e,()=>hn())})}}])]},toolbarFixed:{groups:fn},toolbarInline:{groups:fn}});import{getTranslation as oo}from"@payloadcms/translations";import{jsx as Ho,jsxs as vc}from"react/jsx-runtime";import"react";var Jt=()=>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:[Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Cn}from"react/jsx-runtime";import"react";var Xt=()=>Cn("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:Cn("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 Mc}from"react/jsx-runtime";import"react";function zt(t,e){return t?()=>Mc("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Jt}import{$parseSerializedNode as Rn}from"lexical";import{JSOX as Uo}from"jsox";function Zt({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let i=Dc(t,n);e[o]=i.value,n=i.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Dc(t,e){let o=t[e];return o==='"'?bn(t,e):o==="'"?bn(t,e,!0):o==="{"?$c(t,e):o==="["?Ac(t,e):Fc(t,e)}function Ac(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Uo.parse(`[${r}]`)}}function bn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function $c(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Oc(r)}}function Oc(t){return t[0]!=="{"?Uo.parse(t):Uo.parse(t.replace(/(\w+):/g,'"$1":'))}function Fc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function gt({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${Pc(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,kn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,kn)}}`));return e.join(" ")}function Pc(t){return t.replace(/"/g,"&quot;")}function kn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Yt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let i="",s="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,f=0,h=d[0].slice(0,n.index),x=0,T=r;e:for(let[S,_]of d.entries()){let k=l?_.trim():_,g=0;if(l)for(let b=0;b<_.length&&_[b]===" ";b++)g++;let C=0;for(S===0&&(C=(n.index??0)+n[0].length-g);C<k.length;){let b=k[C],y=k[C+1];if(c){if(b==="`"&&f++,f%2===0)if(b==="<"&&y==="/"){if(u--,u<0){s[s.length-1]===`
4
4
  `&&(s=s.slice(0,-1)),T=S;for(let A=C;A<k.length;A++)if(k[A]===">"){x=A+1;break}break e}}else if(b==="/"&&y===">"){if(u--,u<0){s[s.length-1]===`
5
5
  `&&(s=s.slice(0,-1)),T=S,x=C+2;break e}}else b==="<"&&y!=="/"&&u++;s+=b}else{if(b==="{"&&!m?a++:b==="}"&&!m?a--:(b==='"'||b==="'")&&!m?m=b:b===m&&(m=null),b==="/"&&y===">"&&a===0&&!m){p=!0,T=S,x=C+2;break e}else if(b===">"&&a===0&&!m){c=!0,C++;continue}i+=b}C++}if(c?s?.length>0&&S>0&&(s+=`
6
6
  `):i+=`
7
7
  `,o&&u<0){let b=k.match(o);if(b?.index!==void 0){T=S,x=b.index+b[0].length-1;break}}if(S===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
8
8
  `)+`
9
9
 
10
- . Start match: `+JSON.stringify(n))}return{afterEndLine:d[T].trim().slice(x),beforeStartLine:h,content:s,endLineIndex:r+T,endlineLastCharIndex:x,propsString:i}}import{jsx as fu}from"react/jsx-runtime";import hu from"bson-objectid";import"react";import{DecoratorBlockNode as Pc}from"@lexical/react/LexicalDecoratorBlockNode.js";import Bc from"bson-objectid";var xt=class extends Pc{__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=jc(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 jc(t){return new xt({fields:{...t,id:t?.id||new Bc.default().toHexString()}})}import{jsx as G,jsxs as Ct,Fragment as En}from"react/jsx-runtime";import{Button as Sn,Collapsible as Xc,Drawer as zc,EditDepthProvider as Zc,ErrorPill as Yc,Form as qc,formatDrawerSlug as Qc,FormSubmit as eu,Pill as tu,RenderFields as ou,SectionTitle as ru,useConfig as nu,useDocumentForm as lu,useDocumentInfo as Ln,useEditDepth as iu,useFormSubmitted as su,useServerFunctions as au,useTranslation as cu}from"@payloadcms/ui";import{abortAndIgnore as Wo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Qt,reduceFieldsToValues as Nn}from"payload/shared";import bt,{useCallback as Go,useEffect as Vo,useMemo as kt,useRef as Ko}from"react";import{useLexicalComposerContext as uu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as du}from"@lexical/react/useLexicalEditable";import{getTranslation as mu}from"@payloadcms/translations";import{$getNodeByKey as eo}from"lexical";import{v4 as pu}from"uuid";import{c as Hc}from"react/compiler-runtime";import{jsx as qt,jsxs as Uc}from"react/jsx-runtime";import{useLexicalEditable as Wc}from"@lexical/react/useLexicalEditable";import{RenderFields as Gc,useFormSubmitted as Vc}from"@payloadcms/ui";import Kc,{createContext as Jc}from"react";var _n=Jc({baseClass:"lexical-block",BlockCollapsible:()=>null,BlockDrawer:()=>null,CustomBlock:null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),xe=()=>Kc.use(_n),Tn=t=>{let e=Hc(4),{Collapsible:o,...r}=t,{BlockDrawer:n,CustomBlock:l,errorCount:i,formSchema:s}=r,c=Vc()&&i>0,u=Wc(),a;e[0]!==o||e[1]!==i||e[2]!==c?(a=p=>{let{children:f,...h}=p;return qt(o,{errorCount:i,fieldHasErrors:c,...h,children:f})},e[0]=o,e[1]=i,e[2]=c,e[3]=a):a=e[3];let m=a;return l?Uc(_n,{value:{...r,BlockCollapsible:m},children:[l,qt(n,{})]}):qt(m,{children:qt(Gc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!u})})};function wn({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",yn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=su(),{id:l,collectionSlug:i,globalSlug:s}=Ln(),{fieldProps:{featureClientSchemaMap:d,field:c,initialLexicalFormState:u,schemaPath:a},uuid:m}=j(),{fields:p}=lu(),f=Ko(new AbortController),h=iu(),[x,T]=bt.useState(0),{config:E}=nu(),S=Qc({slug:`lexical-blocks-create-${m}-${o.id}`,depth:h}),{toggleDrawer:_}=he(S),{getDocPreferences:k,setDocFieldPreferences:g}=Ln(),[C]=uu(),b=du(),y=o.blockType,{getFormState:A}=au(),I=`${a}.lexical_internal_feature.blocks.lexical_blocks.${y}.fields`,[L,w]=bt.useState(()=>u?.[o.id]?.formState?{...u?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),N=Ko(!1),R=Ko(e);Vo(()=>{N.current?(R.current!==e&&w(!1),R.current=e):N.current=!0},[e]);let[$,v]=bt.useState(L?._components?.customComponents?.BlockLabel??void 0),[O,D]=bt.useState(L?._components?.customComponents?.Block??void 0);Vo(()=>{let H=new AbortController;return o&&!L&&(async()=>{let{state:V}=await A({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:Qt(p),globalSlug:s,initialBlockData:o,operation:"update",readOnly:!b,renderAllFields:!0,schemaPath:I,signal:H.signal});if(V){V.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let X=Nn(Qt(V),!0);C.update(()=>{let Y=eo(r);if(Y&&Ae(Y)){let re=X;re.blockType=y,Y.setFields(re,!0)}}),w(V),v(V._components?.customComponents?.BlockLabel??void 0),D(V._components?.customComponents?.Block??void 0)}})(),()=>{Wo(H)}},[A,I,b,l,o,C,r,L,i,s,k,p,y]);let[W,q]=bt.useState(u?.[o.id]?.collapsed??!1),J=`${a}.lexical_internal_feature.blocks.lexical_blocks.${y}`,pe=d.blocks?.[J]?.[0],U=pe.blockReferences?typeof pe?.blockReferences?.[0]=="string"?E.blocksMap[pe?.blockReferences?.[0]]:pe?.blockReferences?.[0]:pe?.blocks?.[0],{i18n:ie,t:fe}=cu(),ut=Go(async({formState:H,submit:ue})=>{Wo(f.current);let V=new AbortController;f.current=V;let{state:X}=await A({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:Qt(p),formState:H,globalSlug:s,initialBlockFormState:H,operation:"update",readOnly:!b,renderAllFields:!!ue,schemaPath:I,signal:V.signal});if(!X)return H;H.blockName&&(X.blockName=H.blockName);let Y=Nn(wn({fields:Qt(X)}),!0);if(setTimeout(()=>{C.update(()=>{let re=eo(r);if(re&&Ae(re)){let Ke=Y;Ke.blockType=y,re.setFields(Ke,!0)}})},0),ue){v(X._components?.customComponents?.BlockLabel??void 0),D(X._components?.customComponents?.Block??void 0);let re=0;for(let Ke of Object.values(X))Ke?.valid===!1&&re++;T(re)}return X},[A,l,i,k,s,I,y,p,b,C,r]);Vo(()=>()=>{Wo(f.current)},[]);let Le=Go(()=>{C.update(()=>{eo(r)?.remove()})},[C,r]),Ne=U?.labels?.singular?mu(U.labels.singular,ie):U?.slug,jt=Go(H=>{k().then(ue=>{let X=ue?.fields?.[c.name]?.collapsed,Y=X&&X?.length?X:[];H?Y.includes(o.id)||Y.push(o.id):Y.includes(o.id)&&Y.splice(Y.indexOf(o.id),1),g(c.name,{collapsed:Y,hello:"hi"})})},[k,c.name,g,o.id]),Ge=kt(()=>()=>G(Sn,{buttonStyle:"icon-label",className:`${ee}__editButton`,disabled:!b,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),_(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"small",tooltip:fe("lexical:blocks:inlineBlocks:edit",{label:Ne})}),[Ne,fe,b,_]),Ve=kt(()=>()=>G(Sn,{buttonStyle:"icon-label",className:`${ee}__removeButton`,disabled:!b,icon:"x",onClick:H=>{H.preventDefault(),Le()},round:!0,tooltip:"Remove Block"}),[b,Le]),Ao=kt(()=>({Actions:H,children:ue,className:V,collapsibleProps:X,disableBlockName:Y,editButton:re,errorCount:Ke,fieldHasErrors:$o,Label:en,Pill:tn,removeButton:mc})=>G("div",{className:ee+" "+ee+"-"+y,children:G(Xc,{className:[`${ee}__row`,$o?`${ee}__row--has-errors`:`${ee}__row--no-errors`,V].filter(Boolean).join(" "),collapsibleStyle:$o?"error":"default",header:Ct("div",{className:`${ee}__block-header`,children:[typeof en<"u"?en:typeof $<"u"?$:Ct("div",{className:`${ee}__block-label`,children:[typeof tn<"u"?tn:G(tu,{className:`${ee}__block-pill ${ee}__block-pill-${y}`,pillStyle:"white",size:"small",children:Ne??y}),!Y&&!U?.admin?.disableBlockName&&G(ru,{path:"blockName",readOnly:!b}),$o&&G(Yc,{count:Ke??0,i18n:ie,withMessage:!0})]}),G("div",{className:`${ee}__block-actions`,children:typeof H<"u"?H:Ct(En,{children:[O&&re!==!1||!O&&re?G(Ge,{}):null,mc!==!1&&b?G(Ve,{}):null]})})]}),isCollapsed:W,onToggle:on=>{jt(on),q(on)},...X||{},children:ue},0)}),[O,$,Ge,Ve,Ne,U?.admin?.disableBlockName,y,ie,W,jt,b]),qr=o?.id,Qr=kt(()=>()=>G(Zc,{children:G(zc,{className:"",slug:S,title:fe(`lexical:blocks:inlineBlocks:${qr?"edit":"create"}`,{label:Ne??fe("lexical:blocks:inlineBlocks:label")}),children:L?Ct(En,{children:[G(ou,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:I,permissions:!0,readOnly:!b}),G(eu,{programmaticSubmit:!0,children:fe("fields:saveChanges")})]}):null})}),[L,S,qr,Ne,fe,b,U?.fields,I]),dc=kt(()=>L?G(qc,{beforeSubmit:[async({formState:H})=>await ut({formState:H,submit:!0})],el:"div",fields:U?.fields??[],initialState:L,onChange:[ut],onSubmit:(H,ue)=>{ue.blockType=y,C.update(()=>{let V=eo(r);V&&Ae(V)&&V.setFields(ue,!0)}),_()},submitted:n,uuid:pu(),children:G(Tn,{baseClass:ee,BlockDrawer:Qr,Collapsible:Ao,CustomBlock:O,EditButton:Ge,errorCount:x,formSchema:U?.fields??[],initialState:L,nodeKey:r,RemoveButton:Ve})}):null,[Ao,Qr,O,y,Ve,Ge,C,x,_,U?.fields,L,r,ut,n]);return U?dc:G(Ao,{disableBlockName:!0,fieldHasErrors:!0,children:Ct("div",{className:"lexical-block-not-found",children:["Error: Block '",y,"' not found in the config but exists in the lexical data"]})})};var se=class extends xt{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=$e(e.fields);return o.setFormat(e.format),o}decorate(e,o){return fu(yn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function $e(t){return new se({fields:{...t,id:t?.id||new hu.default().toHexString()}})}function Ae(t){return t instanceof se}import{createHeadlessEditor as gu}from"@lexical/headless";function Jo(t,e){return({editorState:r})=>{let n=gu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(i){console.error("getLexicalToMarkdown: ERROR parsing editor state",i)}let l="";return n.getEditorState().read(()=>{l=Ut(e)}),l}}import{createHeadlessEditor as xu}from"@lexical/headless";function to(t,e){return({markdown:r})=>{let n=xu({nodes:t});return n.update(()=>{Ht(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Cu(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var vn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=In(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=In(r,!0);n&&(o=o.concat(n))}return o};function In(t,e){if(!t.jsx)return null;let o=Cu(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[dt],export:i=>{if(!pt(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Jo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${s.blockType}${u?" "+gt({props:a}):""}>${c.children}</${s.blockType}>`:`<${s.blockType}${u?" "+gt({props:a}):""}/>`},getEndIndex:(i,s)=>{let{endlineLastCharIndex:d}=Yt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:s,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(i,s){let{content:d,propsString:c}=Yt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...s,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=to(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:s,props:c?Zt({propsString:c}):{}});if(a===!1)return;let m=mt({blockType:t.slug,...a});i.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[se],export:i=>{if(!Ae(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Jo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
10
+ . Start match: `+JSON.stringify(n))}return{afterEndLine:d[T].trim().slice(x),beforeStartLine:h,content:s,endLineIndex:r+T,endlineLastCharIndex:x,propsString:i}}import{jsx as hu}from"react/jsx-runtime";import gu from"bson-objectid";import"react";import{DecoratorBlockNode as Bc}from"@lexical/react/LexicalDecoratorBlockNode.js";import jc from"bson-objectid";var xt=class extends Bc{__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=Hc(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 Hc(t){return new xt({fields:{...t,id:t?.id||new jc.default().toHexString()}})}import{jsx as G,jsxs as Ct,Fragment as En}from"react/jsx-runtime";import{Button as Sn,Collapsible as zc,Drawer as Zc,EditDepthProvider as Yc,ErrorPill as qc,Form as Qc,formatDrawerSlug as eu,FormSubmit as tu,Pill as ou,RenderFields as ru,SectionTitle as nu,useConfig as lu,useDocumentForm as iu,useDocumentInfo as Ln,useEditDepth as su,useFormSubmitted as au,useServerFunctions as cu,useTranslation as uu}from"@payloadcms/ui";import{abortAndIgnore as Wo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Qt,reduceFieldsToValues as Nn}from"payload/shared";import bt,{useCallback as Go,useEffect as Vo,useMemo as kt,useRef as Ko}from"react";import{useLexicalComposerContext as du}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as mu}from"@lexical/react/useLexicalEditable";import{getTranslation as pu}from"@payloadcms/translations";import{$getNodeByKey as eo}from"lexical";import{v4 as fu}from"uuid";import{c as Uc}from"react/compiler-runtime";import{jsx as qt,jsxs as Wc}from"react/jsx-runtime";import{useLexicalEditable as Gc}from"@lexical/react/useLexicalEditable";import{RenderFields as Vc,useFormSubmitted as Kc}from"@payloadcms/ui";import Jc,{createContext as Xc}from"react";var _n=Xc({baseClass:"lexical-block",BlockCollapsible:()=>null,BlockDrawer:()=>null,CustomBlock:null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),xe=()=>Jc.use(_n),Tn=t=>{let e=Uc(4),{Collapsible:o,...r}=t,{BlockDrawer:n,CustomBlock:l,errorCount:i,formSchema:s}=r,c=Kc()&&i>0,u=Gc(),a;e[0]!==o||e[1]!==i||e[2]!==c?(a=p=>{let{children:f,...h}=p;return qt(o,{errorCount:i,fieldHasErrors:c,...h,children:f})},e[0]=o,e[1]=i,e[2]=c,e[3]=a):a=e[3];let m=a;return l?Wc(_n,{value:{...r,BlockCollapsible:m},children:[l,qt(n,{})]}):qt(m,{children:qt(Vc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!u})})};function wn({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",yn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=au(),{id:l,collectionSlug:i,globalSlug:s}=Ln(),{fieldProps:{featureClientSchemaMap:d,field:c,initialLexicalFormState:u,schemaPath:a},uuid:m}=j(),{fields:p}=iu(),f=Ko(new AbortController),h=su(),[x,T]=bt.useState(0),{config:E}=lu(),S=eu({slug:`lexical-blocks-create-${m}-${o.id}`,depth:h}),{toggleDrawer:_}=he(S),{getDocPreferences:k,setDocFieldPreferences:g}=Ln(),[C]=du(),b=mu(),y=o.blockType,{getFormState:A}=cu(),I=`${a}.lexical_internal_feature.blocks.lexical_blocks.${y}.fields`,[L,w]=bt.useState(()=>u?.[o.id]?.formState?{...u?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),N=Ko(!1),R=Ko(e);Vo(()=>{N.current?(R.current!==e&&w(!1),R.current=e):N.current=!0},[e]);let[$,v]=bt.useState(L?._components?.customComponents?.BlockLabel??void 0),[O,D]=bt.useState(L?._components?.customComponents?.Block??void 0);Vo(()=>{let H=new AbortController;return o&&!L&&(async()=>{let{state:V}=await A({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:Qt(p),globalSlug:s,initialBlockData:o,operation:"update",readOnly:!b,renderAllFields:!0,schemaPath:I,signal:H.signal});if(V){V.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let X=Nn(Qt(V),!0);C.update(()=>{let Y=eo(r);if(Y&&Ae(Y)){let re=X;re.blockType=y,Y.setFields(re,!0)}}),w(V),v(V._components?.customComponents?.BlockLabel??void 0),D(V._components?.customComponents?.Block??void 0)}})(),()=>{Wo(H)}},[A,I,b,l,o,C,r,L,i,s,k,p,y]);let[W,q]=bt.useState(u?.[o.id]?.collapsed??!1),J=`${a}.lexical_internal_feature.blocks.lexical_blocks.${y}`,pe=d.blocks?.[J]?.[0],U=pe.blockReferences?typeof pe?.blockReferences?.[0]=="string"?E.blocksMap[pe?.blockReferences?.[0]]:pe?.blockReferences?.[0]:pe?.blocks?.[0],{i18n:ie,t:fe}=uu(),ut=Go(async({formState:H,submit:ue})=>{Wo(f.current);let V=new AbortController;f.current=V;let{state:X}=await A({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:Qt(p),formState:H,globalSlug:s,initialBlockFormState:H,operation:"update",readOnly:!b,renderAllFields:!!ue,schemaPath:I,signal:V.signal});if(!X)return H;H.blockName&&(X.blockName=H.blockName);let Y=Nn(wn({fields:Qt(X)}),!0);if(setTimeout(()=>{C.update(()=>{let re=eo(r);if(re&&Ae(re)){let Ke=Y;Ke.blockType=y,re.setFields(Ke,!0)}})},0),ue){v(X._components?.customComponents?.BlockLabel??void 0),D(X._components?.customComponents?.Block??void 0);let re=0;for(let Ke of Object.values(X))Ke?.valid===!1&&re++;T(re)}return X},[A,l,i,k,s,I,y,p,b,C,r]);Vo(()=>()=>{Wo(f.current)},[]);let Le=Go(()=>{C.update(()=>{eo(r)?.remove()})},[C,r]),Ne=U?.labels?.singular?pu(U.labels.singular,ie):U?.slug,jt=Go(H=>{k().then(ue=>{let X=ue?.fields?.[c.name]?.collapsed,Y=X&&X?.length?X:[];H?Y.includes(o.id)||Y.push(o.id):Y.includes(o.id)&&Y.splice(Y.indexOf(o.id),1),g(c.name,{collapsed:Y,hello:"hi"})})},[k,c.name,g,o.id]),Ge=kt(()=>()=>G(Sn,{buttonStyle:"icon-label",className:`${ee}__editButton`,disabled:!b,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),_(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"small",tooltip:fe("lexical:blocks:inlineBlocks:edit",{label:Ne})}),[Ne,fe,b,_]),Ve=kt(()=>()=>G(Sn,{buttonStyle:"icon-label",className:`${ee}__removeButton`,disabled:!b,icon:"x",onClick:H=>{H.preventDefault(),Le()},round:!0,tooltip:"Remove Block"}),[b,Le]),Ao=kt(()=>({Actions:H,children:ue,className:V,collapsibleProps:X,disableBlockName:Y,editButton:re,errorCount:Ke,fieldHasErrors:$o,Label:en,Pill:tn,removeButton:pc})=>G("div",{className:ee+" "+ee+"-"+y,children:G(zc,{className:[`${ee}__row`,$o?`${ee}__row--has-errors`:`${ee}__row--no-errors`,V].filter(Boolean).join(" "),collapsibleStyle:$o?"error":"default",header:Ct("div",{className:`${ee}__block-header`,children:[typeof en<"u"?en:typeof $<"u"?$:Ct("div",{className:`${ee}__block-label`,children:[typeof tn<"u"?tn:G(ou,{className:`${ee}__block-pill ${ee}__block-pill-${y}`,pillStyle:"white",size:"small",children:Ne??y}),!Y&&!U?.admin?.disableBlockName&&G(nu,{path:"blockName",readOnly:!b}),$o&&G(qc,{count:Ke??0,i18n:ie,withMessage:!0})]}),G("div",{className:`${ee}__block-actions`,children:typeof H<"u"?H:Ct(En,{children:[O&&re!==!1||!O&&re?G(Ge,{}):null,pc!==!1&&b?G(Ve,{}):null]})})]}),isCollapsed:W,onToggle:on=>{jt(on),q(on)},...X||{},children:ue},0)}),[O,$,Ge,Ve,Ne,U?.admin?.disableBlockName,y,ie,W,jt,b]),qr=o?.id,Qr=kt(()=>()=>G(Yc,{children:G(Zc,{className:"",slug:S,title:fe(`lexical:blocks:inlineBlocks:${qr?"edit":"create"}`,{label:Ne??fe("lexical:blocks:inlineBlocks:label")}),children:L?Ct(En,{children:[G(ru,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:I,permissions:!0,readOnly:!b}),G(tu,{programmaticSubmit:!0,children:fe("fields:saveChanges")})]}):null})}),[L,S,qr,Ne,fe,b,U?.fields,I]),mc=kt(()=>L?G(Qc,{beforeSubmit:[async({formState:H})=>await ut({formState:H,submit:!0})],el:"div",fields:U?.fields??[],initialState:L,onChange:[ut],onSubmit:(H,ue)=>{ue.blockType=y,C.update(()=>{let V=eo(r);V&&Ae(V)&&V.setFields(ue,!0)}),_()},submitted:n,uuid:fu(),children:G(Tn,{baseClass:ee,BlockDrawer:Qr,Collapsible:Ao,CustomBlock:O,EditButton:Ge,errorCount:x,formSchema:U?.fields??[],initialState:L,nodeKey:r,RemoveButton:Ve})}):null,[Ao,Qr,O,y,Ve,Ge,C,x,_,U?.fields,L,r,ut,n]);return U?mc:G(Ao,{disableBlockName:!0,fieldHasErrors:!0,children:Ct("div",{className:"lexical-block-not-found",children:["Error: Block '",y,"' not found in the config but exists in the lexical data"]})})};var se=class extends xt{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=$e(e.fields);return o.setFormat(e.format),o}decorate(e,o){return hu(yn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function $e(t){return new se({fields:{...t,id:t?.id||new gu.default().toHexString()}})}function Ae(t){return t instanceof se}import{createHeadlessEditor as xu}from"@lexical/headless";function Jo(t,e){return({editorState:r})=>{let n=xu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(i){console.error("getLexicalToMarkdown: ERROR parsing editor state",i)}let l="";return n.getEditorState().read(()=>{l=Ut(e)}),l}}import{createHeadlessEditor as Cu}from"@lexical/headless";function to(t,e){return({markdown:r})=>{let n=Cu({nodes:t});return n.update(()=>{Ht(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function bu(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var vn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=In(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=In(r,!0);n&&(o=o.concat(n))}return o};function In(t,e){if(!t.jsx)return null;let o=bu(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[dt],export:i=>{if(!pt(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Jo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${s.blockType}${u?" "+gt({props:a}):""}>${c.children}</${s.blockType}>`:`<${s.blockType}${u?" "+gt({props:a}):""}/>`},getEndIndex:(i,s)=>{let{endlineLastCharIndex:d}=Yt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:s,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(i,s){let{content:d,propsString:c}=Yt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...s,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=to(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:s,props:c?Zt({propsString:c}):{}});if(a===!1)return;let m=mt({blockType:t.slug,...a});i.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[se],export:i=>{if(!Ae(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Jo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
11
11
  `))for(let f of m.split(`
12
12
  `)){let h="";!t?.jsx?.doNotTrimChildren&&f!==""&&(h=" "),h+=f+`
13
13
  `,p+=h}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
@@ -20,7 +20,7 @@ ${p}</${s.blockType}>`}return`<${s.blockType}${u?" "+gt({props:a}):""}/>`},handl
20
20
  `}}else E=(h.startsWith(" ")?h.slice(2):h)+`
21
21
  `;if(!t?.jsx?.import)return[!1,d];let S=to(n,l),_=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:S,openMatch:c,props:T?Zt({propsString:T}):{}});if(_===!1)return[!1,d];let k=$e({blockType:t.slug,..._});if(k){let g=null,C=null;if(f?.length){g=S({markdown:f})?.root?.children??[];let b=g?.[0];b&&s.append(Rn(b))}if(s.append(k),p?.length){C=S({markdown:p})?.root?.children;let b=s.getChildren()[s.getChildren().length-1],y=Rn(C[0])?.getChildren();if(y?.length)for(let A of y)b.append(A)}}return[!0,x]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(i,s,d,c,u)=>{if(t?.jsx?.import){if(!u){let x="";if(s)for(let T of s)x+=T.getTextContent();u=[x]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
22
22
  `):a=u.join(`
23
- `).trim();let m=d[1]?.trim(),p=to(n,l),f=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?Zt({propsString:m}):{}});if(f===!1)return!1;let h=$e({blockType:t.slug,...f});h&&i.append(h);return}return!1}})),r)}import{createCommand as Mn}from"lexical";var ze=Mn("INSERT_BLOCK_COMMAND"),Ze=Mn("INSERT_INLINE_BLOCK_COMMAND");import{c as bu}from"react/compiler-runtime";import{useLexicalComposerContext as ku}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as _u,$wrapNodeInElement as Tu,mergeRegister as wu}from"@lexical/utils";import{formatDrawerSlug as Eu,useEditDepth as Su}from"@payloadcms/ui";import{$createParagraphNode as Lu,$getNodeByKey as Nu,$getPreviousSelection as yu,$getSelection as Ru,$insertNodes as Iu,$isParagraphNode as vu,$isRangeSelection as Mu,$isRootOrShadowRoot as Du,COMMAND_PRIORITY_EDITOR as Dn}from"lexical";import{useEffect as Au,useState as $u}from"react";var An=()=>{let t=bu(12),[e]=ku(),[o,r]=$u(null),{setCreatedInlineBlock:n,uuid:l}=j(),i=Su(),s="lexical-inlineBlocks-create-"+l,d;t[0]!==i||t[1]!==s?(d=Eu({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=he(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([se]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return wu(e.registerCommand(ze,p=>(e.update(()=>{let f=Ru()||yu();if(Mu(f)){let h=$e(p),{focus:x}=f,T=x.getNode();_u(h),vu(T)&&!T.__first&&T.remove()}}),!0),Dn),e.registerCommand(Ze,p=>{if(o){let h=Nu(o);return!h||!pt(h)?!1:(h.setFields(p),r(null),!0)}let f=mt(p);return n?.(f),Iu([f]),Du(f.getParentOrThrow())&&Tu(f,Lu).selectEnd(),!0},Dn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==u?(m=[e,n,o,u],t[7]=e,t[8]=n,t[9]=o,t[10]=u,t[11]=m):m=t[11],Au(a,m),null};var Ou=M(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),u=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:vn({blocks:c,inlineBlocks:u}),nodes:[se,dt],plugins:[{Component:An,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:zt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?oo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ze,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:Xt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?oo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ze,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Jt,items:c.map((a,m)=>({ChildComponent:zt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?oo(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(ze,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:Xt,items:u.map((a,m)=>({ChildComponent:a.imageURL?zt(a.imageURL,a.imageAltText):Xt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?oo(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ze,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Bu}from"react/compiler-runtime";import{jsx as Fe,jsxs as Yo}from"react/jsx-runtime";import{useLexicalComposerContext as ju}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Hu,$createTextNode as Uu,$getRoot as Wu,getDOMSelection as Xo}from"lexical";import*as Bn from"react";import{useCallback as Oe,useEffect as zo,useLayoutEffect as On,useRef as Zo,useState as ro}from"react";var Fu=ne&&"documentMode"in document?document.documentMode:null,$n=ne&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),g5=ne&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),x5=ne&&"InputEvent"in window&&!Fu?"getTargetRanges"in new window.InputEvent("input"):!1,C5=ne&&/Version\/[\d.].*Safari/.test(navigator.userAgent),b5=ne&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,k5=ne&&/Android/.test(navigator.userAgent),_5=ne&&/Win/.test(navigator.platform),Pu=ne&&/^(?=.*Chrome).*/i.test(navigator.userAgent),T5=ne&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Pu;var Gu=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)},Vu=(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)},Ku=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
23
+ `).trim();let m=d[1]?.trim(),p=to(n,l),f=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?Zt({propsString:m}):{}});if(f===!1)return!1;let h=$e({blockType:t.slug,...f});h&&i.append(h);return}return!1}})),r)}import{createCommand as Mn}from"lexical";var ze=Mn("INSERT_BLOCK_COMMAND"),Ze=Mn("INSERT_INLINE_BLOCK_COMMAND");import{c as ku}from"react/compiler-runtime";import{useLexicalComposerContext as _u}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Tu,$wrapNodeInElement as wu,mergeRegister as Eu}from"@lexical/utils";import{formatDrawerSlug as Su,useEditDepth as Lu}from"@payloadcms/ui";import{$createParagraphNode as Nu,$getNodeByKey as yu,$getPreviousSelection as Ru,$getSelection as Iu,$insertNodes as vu,$isParagraphNode as Mu,$isRangeSelection as Du,$isRootOrShadowRoot as Au,COMMAND_PRIORITY_EDITOR as Dn}from"lexical";import{useEffect as $u,useState as Ou}from"react";var An=()=>{let t=ku(12),[e]=_u(),[o,r]=Ou(null),{setCreatedInlineBlock:n,uuid:l}=j(),i=Lu(),s="lexical-inlineBlocks-create-"+l,d;t[0]!==i||t[1]!==s?(d=Su({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=he(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([se]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Eu(e.registerCommand(ze,p=>(e.update(()=>{let f=Iu()||Ru();if(Du(f)){let h=$e(p),{focus:x}=f,T=x.getNode();Tu(h),Mu(T)&&!T.__first&&T.remove()}}),!0),Dn),e.registerCommand(Ze,p=>{if(o){let h=yu(o);return!h||!pt(h)?!1:(h.setFields(p),r(null),!0)}let f=mt(p);return n?.(f),vu([f]),Au(f.getParentOrThrow())&&wu(f,Nu).selectEnd(),!0},Dn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==u?(m=[e,n,o,u],t[7]=e,t[8]=n,t[9]=o,t[10]=u,t[11]=m):m=t[11],$u(a,m),null};var Fu=M(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),u=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:vn({blocks:c,inlineBlocks:u}),nodes:[se,dt],plugins:[{Component:An,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:zt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?oo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ze,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:Xt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?oo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ze,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Jt,items:c.map((a,m)=>({ChildComponent:zt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?oo(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(ze,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:Xt,items:u.map((a,m)=>({ChildComponent:a.imageURL?zt(a.imageURL,a.imageAltText):Xt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?oo(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ze,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as ju}from"react/compiler-runtime";import{jsx as Fe,jsxs as Yo}from"react/jsx-runtime";import{useLexicalComposerContext as Hu}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Uu,$createTextNode as Wu,$getRoot as Gu,getDOMSelection as Xo}from"lexical";import*as Bn from"react";import{useCallback as Oe,useEffect as zo,useLayoutEffect as On,useRef as Zo,useState as ro}from"react";var Pu=ne&&"documentMode"in document?document.documentMode:null,$n=ne&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),x5=ne&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),C5=ne&&"InputEvent"in window&&!Pu?"getTargetRanges"in new window.InputEvent("input"):!1,b5=ne&&/Version\/[\d.].*Safari/.test(navigator.userAgent),k5=ne&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,_5=ne&&/Android/.test(navigator.userAgent),T5=ne&&/Win/.test(navigator.platform),Bu=ne&&/^(?=.*Chrome).*/i.test(navigator.userAgent),w5=ne&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Bu;var Vu=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)},Ku=(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)},Ju=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
24
24
  await assertSelection(page, {
25
25
  anchorPath: [${n.anchorPath.toString()}],
26
26
  anchorOffset: ${n.anchorOffset},
@@ -30,7 +30,7 @@ ${p}</${s.blockType}>`}return`<${s.blockType}${u?" "+gt({props:a}):""}/>`},handl
30
30
  `;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
31
31
  `);default:return` await repeat(${t.count}, async () => {
32
32
  ${o}
33
- );`}};function Ju(t){return t.key.toLowerCase()==="a"&&($n?t.metaKey:t.ctrlKey)}function Xu(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 Fn(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 Pn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function zu(t){let[e,o]=ro([]),[r,n]=ro(!1),[,l]=ro(""),[i,s]=ro(""),d=Zo(null),c=Zo(!1),u=Zo(null),a=Oe(()=>t,[t]),m=Oe(()=>{let _=t.getRootElement(),k=Xo(t._window);return _==null||k==null||k.anchorNode==null||k.focusNode==null||!_.contains(k.anchorNode)||!_.contains(k.focusNode)?null:`
33
+ );`}};function Xu(t){return t.key.toLowerCase()==="a"&&($n?t.metaKey:t.ctrlKey)}function zu(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 Fn(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 Pn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Zu(t){let[e,o]=ro([]),[r,n]=ro(!1),[,l]=ro(""),[i,s]=ro(""),d=Zo(null),c=Zo(!1),u=Zo(null),a=Oe(()=>t,[t]),m=Oe(()=>{let _=t.getRootElement(),k=Xo(t._window);return _==null||k==null||k.anchorNode==null||k.focusNode==null||!_.contains(k.anchorNode)||!_.contains(k.focusNode)?null:`
34
34
  import {
35
35
  initializeE2E,
36
36
  assertHTMLSnapshot,
@@ -47,20 +47,20 @@ describe('Test case', () => {
47
47
  const {page} = e2e;
48
48
 
49
49
  await page.focus('div[contenteditable="true"]');
50
- ${e.map(Ku).join(`
50
+ ${e.map(Ju).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=Oe((_,k)=>{o(g=>{let C=e.length-1,b=e[C];if(b&&b.name===_){if(_==="type")return[...e.slice(0,C),{...b,value:b.value+k}];if(b.value===k)return[...e.slice(0,C),{...b,count:b.count+1}]}return[...g,{name:_,count:1,value:k}]})},[e,o]);On(()=>{let _=g=>{if(!r)return;let C=g.key;Ju(g)?p("selectAll",""):Pn.has(C)?p("press",g.key):[...C].length>1?p("keydown",g.key):p("type",g.key)},k=g=>{if(!r)return;let C=g.key;!Pn.has(C)&&[...C].length>1&&p("keyup",g.key)};return t.registerRootListener((g,C)=>{C!==null&&(C.removeEventListener("keydown",_),C.removeEventListener("keyup",k)),g!==null&&(g.addEventListener("keydown",_),g.addEventListener("keyup",k))})},[t,r,p]),On(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),zo(()=>{if(e){let _=m();_!==null&&s(_),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),zo(()=>t.registerUpdateListener(({dirtyElements:k,dirtyLeaves:g,editorState:C})=>{if(!r)return;let b=C._selection,y=d.current,A=c.current;if(y!==b){if(g.size===0&&k.size===0&&!A){let L=Xo(t._window);if(L&&(L.anchorNode==null||L.focusNode==null))return}d.current=b}c.current=!1;let I=m();I!==null&&s(I)}),[t,m,r,p]),zo(()=>r?t.registerUpdateListener(()=>{let k=t.getRootElement();k!==null&&l(k?.innerHTML)}):void 0,[t,r]);let f=Oe(_=>{r||(_.update(()=>{let k=Wu();k.clear();let g=Uu();k.append(Hu().append(g)),g.select()}),o([])),n(k=>!k)},[r]),h=Oe(()=>{if(!r)return;let _=Xo(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:k,anchorOffset:g,focusNode:C,focusOffset:b}=Xu(_),y=a().getRootElement(),A;k!==null&&(A=Fn(k,y));let I;C!==null&&(I=Fn(C,y)),p("snapshot",{anchorNode:k,anchorOffset:g,anchorPath:A,focusNode:C,focusOffset:b,focusPath:I})},[p,r,a]),x=Oe(()=>{Gu(m())},[m]),T=Oe(()=>{Vu("test.js",m())},[m]);return[Fe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{f(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Yo("div",{className:"test-recorder-output",children:[Yo("div",{className:"test-recorder-toolbar",children:[Fe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{x(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{T(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Fe("pre",{id:"test-recorder",ref:u,children:i})]}):null]}var jn=()=>{let t=Bu(3),[e]=ju(),[o,r]=zu(e),n;return t[0]!==o||t[1]!==r?(n=Yo(Bn.Fragment,{children:[Fe("p",{children:"HI"}),o,r,Fe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Zu=M({plugins:[{Component:jn,position:"bottom"}]});import{c as Yu}from"react/compiler-runtime";import{jsx as qu}from"react/jsx-runtime";import{useLexicalComposerContext as Qu}from"@lexical/react/LexicalComposerContext.js";import{TreeView as ed}from"@lexical/react/LexicalTreeView.js";import"react";var Hn=()=>{let t=Yu(2),[e]=Qu(),o;return t[0]!==e?(o=qu(ed,{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 td=M({plugins:[{Component:Hn,position:"bottom"}]});import{$isTableSelection as od}from"@lexical/table";import{$isRangeSelection as rd,FORMAT_TEXT_COMMAND as nd}from"lexical";import{jsx as Un}from"react/jsx-runtime";import"react";var Wn=()=>Un("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:Un("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var Gn={type:"text-format",format:["bold","italic"],tag:"***"},Vn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Kn={type:"text-format",format:["bold"],tag:"**"},Jn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Xn=[Z([{ChildComponent:Wn,isActive:({selection:t})=>rd(t)||od(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(nd,"bold")},order:1}])],ld=M(({featureProviderMap:t})=>{let e=[Kn,Jn];return t.get("italic")&&e.push(Vn,Gn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}}});import{$isTableSelection as sd}from"@lexical/table";import{$isRangeSelection as ad,FORMAT_TEXT_COMMAND as cd}from"lexical";import{jsx as zn,jsxs as id}from"react/jsx-runtime";import"react";var Zn=()=>id("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:[zn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),zn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Yn={type:"text-format",format:["code"],tag:"`"};var qn=[Z([{ChildComponent:Zn,isActive:({selection:t})=>ad(t)||sd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(cd,"code")},order:7}])],ud=M({enableFormats:["code"],markdownTransformers:[Yn],toolbarFixed:{groups:qn},toolbarInline:{groups:qn}});import{$isTableSelection as dd}from"@lexical/table";import{$isRangeSelection as md,FORMAT_TEXT_COMMAND as pd}from"lexical";import{jsx as Qn}from"react/jsx-runtime";import"react";var el=()=>Qn("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:Qn("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 tl={type:"text-format",format:["italic"],tag:"*"},ol={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var rl=[Z([{ChildComponent:el,isActive:({selection:t})=>md(t)||dd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(pd,"italic")},order:2}])],fd=M({enableFormats:["italic"],markdownTransformers:[tl,ol],toolbarFixed:{groups:rl},toolbarInline:{groups:rl}});import{$isTableSelection as gd}from"@lexical/table";import{$isRangeSelection as xd,FORMAT_TEXT_COMMAND as Cd}from"lexical";import{jsx as nl,jsxs as hd}from"react/jsx-runtime";import"react";var ll=()=>hd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[nl("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"}),nl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var il={type:"text-format",format:["strikethrough"],tag:"~~"};var sl=[Z([{ChildComponent:ll,isActive:({selection:t})=>xd(t)||gd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Cd,"strikethrough")},order:4}])],bd=M({enableFormats:["strikethrough"],markdownTransformers:[il],toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{$isTableSelection as kd}from"@lexical/table";import{$isRangeSelection as _d,FORMAT_TEXT_COMMAND as Td}from"lexical";import{jsx as al}from"react/jsx-runtime";import"react";var cl=()=>al("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:al("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 ul=[Z([{ChildComponent:cl,isActive:({selection:t})=>_d(t)||kd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Td,"subscript")},order:5}])],wd=M({enableFormats:["subscript"],toolbarFixed:{groups:ul},toolbarInline:{groups:ul}});import{$isTableSelection as Ed}from"@lexical/table";import{$isRangeSelection as Sd,FORMAT_TEXT_COMMAND as Ld}from"lexical";import{jsx as dl}from"react/jsx-runtime";import"react";var ml=()=>dl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dl("path",{d:"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 pl=[Z([{ChildComponent:ml,isActive:({selection:t})=>Sd(t)||Ed(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Ld,"superscript")},order:6}])],Nd=M({enableFormats:["superscript"],toolbarFixed:{groups:pl},toolbarInline:{groups:pl}});import{$isTableSelection as Rd}from"@lexical/table";import{$isRangeSelection as Id,FORMAT_TEXT_COMMAND as vd}from"lexical";import{jsx as fl,jsxs as yd}from"react/jsx-runtime";import"react";var hl=()=>yd("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:[fl("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"}),fl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var gl=[Z([{ChildComponent:hl,isActive:({selection:t})=>Id(t)||Rd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(vd,"underline")},order:3}])],Md=M({enableFormats:["underline"],toolbarFixed:{groups:gl},toolbarInline:{groups:gl}});import{jsx as er}from"react/jsx-runtime";import{jsx as Dd}from"react/jsx-runtime";function Ad(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var no=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Ad(o),r])):{};return Dd("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as $d}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Od}from"@lexical/selection";import{$getNodeByKey as Fd,$getState as Pd,$setState as Bd,createState as jd,TextNode as Hd}from"lexical";import{useEffect as Ud}from"react";var qo=new Map;function xl(t){for(let e in t){let o=t[e],r=jd(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});qo.set(e,{stateConfig:r,stateValues:o})}}function Qo(t,e,o){t.update(()=>{Od(r=>{let n=qo.get(e);if(!n)throw new Error(`State config for ${e} not found`);Bd(r,n.stateConfig,o)})})}function Cl(){let[t]=$d();return Ud(()=>t.registerMutationListener(Hd,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Fd(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);qo.forEach((s,d)=>{let c=Pd(n,s.stateConfig);if(!c){delete l.dataset[d];return}l.dataset[d]=c;let u=s.stateValues[c]?.css;u&&Object.assign(i,u)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var bl=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>er(no,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Qo(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>er(no,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>er(no,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let n in t.state)Qo(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},Wd=M(({props:t})=>(xl(t.state),{plugins:[{Component:Cl,position:"normal"}],toolbarFixed:{groups:bl(t)},toolbarInline:{groups:bl(t)}}));import{c as Jd}from"react/compiler-runtime";import{useLexicalComposerContext as Xd}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as zd,$isHeadingNode as Dl,HeadingNode as Ol}from"@lexical/rich-text";import{$setBlocksType as Zd}from"@lexical/selection";import{$getSelection as Yd,$isRangeSelection as qd}from"lexical";import{useEffect as Qd}from"react";import{jsx as kl}from"react/jsx-runtime";import"react";var _l=()=>kl("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:kl("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 Tl}from"react/jsx-runtime";import"react";var wl=()=>Tl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tl("path",{d:"M4.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 El}from"react/jsx-runtime";import"react";var Sl=()=>El("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.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 Ll}from"react/jsx-runtime";import"react";var Nl=()=>Ll("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ll("path",{d:"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 yl}from"react/jsx-runtime";import"react";var Rl=()=>yl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.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 Il}from"react/jsx-runtime";import"react";var vl=()=>Il("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Il("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.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 Gd,$isHeadingNode as Vd,HeadingNode as Kd}from"@lexical/rich-text";var tr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Ml=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Kd],export:(n,l)=>{if(!Vd(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:tr(n=>{let l="h"+n[1]?.length;return Gd(l)})}};var Al=t=>{let e=Yd();Zd(e,()=>zd(t))},$l={h1:_l,h2:wl,h3:Sl,h4:Nl,h5:Rl,h6:vl},em=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[Q(e.map((r,n)=>({ChildComponent:$l[r],isActive:({selection:l})=>{if(!qd(l))return!1;for(let i of l.getNodes()){if(Dl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(Dl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Al(r)})},order:n+2})))];return{markdownTransformers:[Ml(e)],nodes:[Ol],plugins:[{Component:tm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:$l[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(()=>{Al(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),tm=t=>{let e=Jd(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[d]=Xd(),c,u;return e[4]!==d||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return d.registerNodeTransform(Ol,a=>{l.includes(a.getTag())||a.setTag(s)})},u=[d,l,s],e[4]=d,e[5]=l,e[6]=s,e[7]=c,e[8]=u):(c=e[7],u=e[8]),Qd(c,u),null};import{$isNodeSelection as xm}from"lexical";import{jsx as Fl}from"react/jsx-runtime";import"react";var or=()=>Fl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Fl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Pl,jsxs as om}from"react/jsx-runtime";import"react";var Bl=()=>om("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pl("path",{d:"M5 10h10",stroke:"currentColor"}),Pl("path",{d:"M10 15V5",stroke:"currentColor"})]});var Ce=t=>({type:"dropdown",ChildComponent:Bl,items:t,key:"add",order:10});import{addClassNamesToElement as rm}from"@lexical/utils";import{$applyNodeReplacement as nm,createCommand as lm,DecoratorNode as im}from"lexical";var Tt=lm("INSERT_HORIZONTAL_RULE_COMMAND"),_t=class extends im{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:sm,priority:0})}}static importJSON(e){return jl()}createDOM(e){let o=document.createElement("hr");return rm(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
- `}isInline(){return!1}updateDOM(){return!1}};function sm(){return{node:jl()}}function jl(){return nm(new _t)}import{$applyNodeReplacement as am}from"lexical";import"react";var Re=class extends _t{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return wt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function wt(){return am(new Re)}function lo(t){return t instanceof Re}var Hl={type:"element",dependencies:[Re],export:(t,e)=>lo(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=wt();e&&t.replace(e)}};import{c as cm}from"react/compiler-runtime";import{useLexicalComposerContext as um}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as dm}from"@lexical/utils";import{$getSelection as mm,$isRangeSelection as pm,COMMAND_PRIORITY_EDITOR as fm}from"lexical";import{useEffect as hm}from"react";var Ul=()=>{let t=cm(3),[e]=um(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Tt,gm,fm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),hm(o,r),null};function gm(t){let e=mm();if(!pm(e))return!1;if(e.focus.getNode()!==null){let r=wt();dm(r)}return!0}var Cm=M({markdownTransformers:[Hl],nodes:[Re],plugins:[{Component:Ul,position:"normal"}],slashMenu:{groups:[z([{Icon:or,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,void 0)}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:or,isActive:({selection:t})=>{if(!xm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return lo(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,void 0)}}])]}});import{$findMatchingParent as ql}from"@lexical/utils";import{$isElementNode as vm,INDENT_CONTENT_COMMAND as Mm,OUTDENT_CONTENT_COMMAND as Dm}from"lexical";import{jsx as io,jsxs as bm}from"react/jsx-runtime";import"react";var Wl=()=>bm("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:[io("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as so,jsxs as km}from"react/jsx-runtime";import"react";var Gl=()=>km("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:[so("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as _m}from"react/jsx-runtime";import{useLexicalComposerContext as Tm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as wm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Em,mergeRegister as Vl}from"@lexical/utils";import{$getSelection as Sm,$isElementNode as zl,$isRangeSelection as Lm,COMMAND_PRIORITY_LOW as Kl,INDENT_CONTENT_COMMAND as Jl,KEY_TAB_COMMAND as Nm,OUTDENT_CONTENT_COMMAND as ym,TabNode as Rm}from"lexical";import{useEffect as Xl}from"react";var Zl=({clientProps:t})=>{let[e]=Tm(),{disabledNodes:o,disableTabNode:r}=t;return Xl(()=>{if(!(!e||!o?.length))return Vl(e.registerCommand(Jl,()=>Im(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Kl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);zl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Xl(()=>{if(!(!e||!r))return Vl(e.registerCommand(Nm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?ym:Jl,void 0)),Kl),e.registerNodeTransform(Rm,n=>{n.remove()}))},[e,r]),_m(wm,{})};function Im(t){let e=Sm();if(!Lm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=Em(l,c=>zl(c)&&!c.isInline());if(s===null)continue;let d=s.getKey();s.canIndent()&&!o.has(d)&&(o.add(d),t(s))}return o.size>0}var Yl=t=>({type:"buttons",items:t,key:"indent",order:35});var Ql=({disabledNodes:t})=>[Yl([{ChildComponent:Wl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ei(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ql(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Dm,void 0)},order:1},{ChildComponent:Gl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ei(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ql(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Mm,void 0)},order:2}])],Am=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Zl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ql({disabledNodes:e})},toolbarInline:{groups:Ql({disabledNodes:e})}}}),ei=t=>vm(t)&&t.canIndent();import{$findMatchingParent as Jp}from"@lexical/utils";import{$getSelection as dr,$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 Ye(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 rr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Vm}from"lexical";import{addClassNamesToElement as $m,isHTMLAnchorElement as Om}from"@lexical/utils";import ir from"bson-objectid";import{$applyNodeReplacement as Fm,$createTextNode as ni,$getSelection as Pm,$isElementNode as li,$isRangeSelection as lr,createCommand as Bm,ElementNode as jm}from"lexical";var Hm=new Set(["http:","https:","mailto:","sms:","tel:"]),te=class t extends jm{__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:Um,priority:1})}}static importJSON(e){let o=be({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new ir.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=nr(o.rel,"add","noopener")),$m(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(!lr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(li(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Hm.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=nr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=nr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Um(t){let e=null;if(Om(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new ir.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return Fm(new te({id:t??new ir.default().toHexString(),fields:e}))}function K(t){return t instanceof te}var de=Bm("TOGGLE_LINK_COMMAND");function sr(t){let e=Pm();if(!lr(e)&&(t===null||!t.selectedNodes?.length))return;let o=lr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();K(i)&&(i.getChildren().forEach(d=>{i.insertBefore(d)}),i.remove())});return}if(o?.length===1){let l=o[0],i=K(l)?l:Wm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ni(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||li(l)&&!l.isInline())){if(K(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ni(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=be({fields:t.fields}),K(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Wm(t){return Gm(t,e=>K(e))}function Gm(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function nr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var ii={type:"text-match",dependencies:[te],export:(t,e)=>{if(!K(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Vm(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Km,$isElementNode as Jm}from"lexical";var ke=class t extends te{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Et({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Jm(r)){let n=Et({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Et({fields:t}){return Km(new ke({id:"",fields:t}))}function _e(t){return t instanceof ke}import{c as Xm}from"react/compiler-runtime";import{useLexicalComposerContext as zm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Zm}from"@lexical/utils";import{$createTextNode as si,$getSelection as Ym,$isElementNode as ci,$isLineBreakNode as ui,$isNodeSelection as qm,$isRangeSelection as Qm,$isTextNode as St,TextNode as ep}from"lexical";import{useEffect as tp}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 of e){let r=o(t);if(r!=null)return r}return null}var op=/[.,;\s]/;function co(t){return t!==void 0&&op.test(t)}function mi(t){return co(t[t.length-1])}function cr(t){return co(t[0])}function rp(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)||St(e)&&mi(e.getTextContent())}function fi(t){let e=t.getNextSibling();return ci(e)&&(e=e.getFirstDescendant()),e===null||ui(e)||St(e)&&cr(e.getTextContent())}function np(t,e,o,r){return(t>0?co(o[t-1]):pi(r[0]))?e<o.length?co(o[e]):fi(r[r.length-1]):!1}function lp(t,e,o){let r=[],n=[],l=[],i=0,s=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,d.shift()}return[i,r,n,l]}function ip(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Et({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let d=si(r.text);d.setFormat(s.getFormat()),d.setDetail(s.getDetail()),d.setStyle(s.getStyle()),l.append(d),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,d;e===0?d=i:[,d]=i.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[x,T]=a.splitText(o-f);x&&c.push(x),u=T}s+=p}),d){let a=Ym(),m=a?a.getNodes().find(St):void 0,p=si(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(Qm(a)?p.select(a.anchor.offset,a.focus.offset):qm(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function sp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,i,s=0;for(;(i=di(l,e))!=null&&i!==null;){let d=i.index,c=i.length,u=d+c;if(np(s+d,s+u,n,r)){let[m,,p,f]=lp(r,s+d,s+u),h=s+d-m,x=s+u-m,T=ip(p,h,x,i);r=T?[T,...f]:f,o(i.url,null),s=0}else s+=u;l=l.substring(u)}}function ar(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!St(c)||!c.isSimpleText()){ao(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=di(l,e);if(i===null||i.text!==l){ao(t),o(null,t.getFields()?.url??null);return}if(!pi(t)||!fi(t)){ao(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let d=t.getFields();d.url=i?.url,t.setFields(d),o(i.url,s??null)}}function ap(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(_e(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!cr(l)||rp(l,i))&&(r.append(t),ar(r,e,o),o(null,r.getFields()?.url??null))}_e(n)&&!mi(l)&&(ao(n),ar(n,e,o),o(null,n.getFields()?.url??null))}function ao(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 cp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&St(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function up(t,e,o){let r=Xm(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,d)=>{o?.(s,d)};return Zm(t.registerNodeTransform(ep,s=>{let d=s.getParentOrThrow(),c=s.getPreviousSibling();if(_e(d))ar(d,e,i);else if(!K(d)){if(s.isSimpleText()&&(cr(s.getTextContent())||!_e(c))){let u=cp(s);sp(u,e,i)}ap(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),tp(n,l)}var dp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,mp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,pp=[ai(dp,t=>t.startsWith("http")?t:`https://${t}`),ai(mp,t=>`mailto:${t}`)],hi=()=>{let[t]=zm();return up(t,pp),null};import{jsx as fp}from"react/jsx-runtime";import{ClickableLinkPlugin as hp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var gi=()=>fp(hp,{});import{jsx as Ap}from"react/jsx-runtime";import"react";import{createPortal as $p}from"react-dom";import{jsx as Te,jsxs as Lt,Fragment as xp}from"react/jsx-runtime";import{useLexicalComposerContext as Cp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as bp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as xi,mergeRegister as Ci}from"@lexical/utils";import{getTranslation as ur}from"@payloadcms/translations";import{CloseMenuIcon as kp,EditIcon as _p,ExternalLinkIcon as bi,formatDrawerSlug as Tp,useConfig as wp,useEditDepth as Ep,useLocale as Sp,useTranslation as Lp}from"@payloadcms/ui";import{requests as Np}from"@payloadcms/ui/shared";import{$getSelection as ki,$isLineBreakNode as yp,$isRangeSelection as _i,COMMAND_PRIORITY_HIGH as Rp,COMMAND_PRIORITY_LOW as Ti,getDOMSelection as Ip,KEY_ESCAPE_COMMAND as vp,SELECTION_CHANGE_COMMAND as Mp}from"lexical";import wi,{useCallback as Ei,useEffect as po,useRef as Dp,useState as Pe}from"react";function uo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),d=l.getBoundingClientRect(),c=t.top-r,u=t.left-n;c<d.top&&(c+=i.height+t.height+r*2),u+i.width>d.right&&(u=d.right-i.width-n),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as gp}from"lexical";var mo=gp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Si(t){t.preventDefault()}function Li({anchorElem:t}){let[e]=Cp(),[o,r]=Pe(),n=Dp(null),[l,i]=Pe(null),[s,d]=Pe(null),{fieldProps:{schemaPath:c},uuid:u}=j(),a=bp(),{config:m,getEntityConfig:p}=wp(),{i18n:f,t:h}=Lp(),[x,T]=Pe(),E=Ep(),[S,_]=Pe(!1),[k,g]=Pe([]),C=Sp(),[b,y]=Pe(!1),A=Tp({slug:"lexical-rich-text-link-"+u,depth:E}),{toggleDrawer:I}=he(A),L=Ei(()=>{_(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),y(!1),i(null),d(null),g([]),T(void 0)},[_,i,d,g]),w=Ei(()=>{let N=ki(),R;if(!_i(N)||!N){L();return}let $=Ye(N);R=e.getElementByKey($.getKey())?.getBoundingClientRect();let v=xi($,K),O=N.getNodes().filter(U=>!yp(U)).find(U=>{let ie=xi(U,K);return v&&!v.is(ie)||ie&&!ie.is(v)});if(v==null||O){L();return}r(v);let D=v.getFields(),W={...D,id:v.getID(),text:v.getTextContent()};if(D?.linkType==="custom")i(D?.url??null),d(null);else{i(`${m.routes.admin==="/"?"":m.routes.admin}/collections/${D?.doc?.relationTo}/${D?.doc?.value}`);let U=D?.doc?.relationTo?p({collectionSlug:D?.doc?.relationTo}):void 0;if(!U)d(D?.label?String(D?.label):null),i(D?.url?String(D?.url):null);else{let ie=typeof D.doc?.value=="object"?D.doc.value.id:D.doc?.value,fe=D.doc?.relationTo;if(!ie||!fe)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ut=h("fields:linkedTo",{label:`${ur(U.labels.singular,f)} - ${h("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(ut),Np.get(`${m.serverURL}${m.routes.api}/${fe}/${ie}`,{headers:{"Accept-Language":f.language},params:{depth:0,locale:C?.code}}).then(async Le=>{if(!Le.ok)throw new Error(`HTTP error! Status: ${Le.status}`);let Ne=await Le.json(),jt=U?.admin?.useAsTitle||"id",Ge=Ne[jt],Ve=h("fields:linkedTo",{label:`${ur(U.labels.singular,f)} - ${Ge}`}).replace(/<[^>]*>?/g,"");d(Ve)}).catch(()=>{let Le=h("fields:linkedTo",{label:`${ur(U.labels.singular,f)} - ${h("general:untitled",f)} - ID: ${ie}`}).replace(/<[^>]*>?/g,"");d(Le)})}}T(W),_(!0),g(N?N?.getNodes():[]),_e(v)?y(!0):y(!1);let q=n.current,J=Ip(e._window),{activeElement:Do}=document;if(q===null)return;let pe=e.getRootElement();return J!==null&&pe!==null&&pe.contains(J.anchorNode)?(R||(R=J.getRangeAt(0).getBoundingClientRect()),R!=null&&(R.y+=40,uo(R,q,t))):(Do==null||Do.className!=="link-input")&&(pe!==null&&uo(null,q,t),i(null),d(null)),!0},[e,L,m.routes.admin,m.routes.api,m.serverURL,p,h,f,C?.code,t]);return po(()=>Ci(e.registerCommand(mo,N=>(e.dispatchCommand(de,N),w(),I(),!0),Ti)),[e,w,I,A]),po(()=>{let N=t.parentElement,R=()=>{e.getEditorState().read(()=>{w()})};return window.addEventListener("resize",R),N?.addEventListener("scroll",R),()=>{window.removeEventListener("resize",R),N?.removeEventListener("scroll",R)}},[t.parentElement,e,w]),po(()=>Ci(e.registerUpdateListener(({editorState:N})=>{N.read(()=>{w()})}),e.registerCommand(Mp,()=>(w(),!0),Ti),e.registerCommand(vp,()=>S?(L(),!0):!1,Rp)),[e,w,S,L]),po(()=>{e.getEditorState().read(()=>{w()})},[e,w]),Lt(wi.Fragment,{children:[Te("div",{className:"link-editor",ref:n,children:Lt("div",{className:"link-input",children:[l&&l.length>0?Lt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Te(bi,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Lt(xp,{children:[o?.__fields.newTab?Te(bi,{}):null,Te("span",{className:"link-input__label-pure",children:s})]}):null,a&&Lt(wi.Fragment,{children:[Te("button",{"aria-label":"Edit link",className:"link-edit",onClick:N=>{N.preventDefault(),I()},onMouseDown:Si,tabIndex:0,type:"button",children:Te(_p,{})}),!b&&Te("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(de,null)},onMouseDown:Si,tabIndex:0,type:"button",children:Te(kp,{})})]})]})}),Te(ft,{className:"lexical-link-edit-drawer",data:x,drawerSlug:A,drawerTitle:h("fields:editLink"),featureKey:"link",handleDrawerSubmit:(N,R)=>{let $=R,v={...$};delete v.text,e.update(()=>{let O=ki(),D=null;if(_i(O)?D=Ye(O).getParent():k.length&&(D=k[0]?.getParent()??null),D&&_e(D)){let W=be({fields:v});D.replace(W,!0)}}),e.dispatchCommand(de,{fields:v,selectedNodes:k,text:$.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Ni=t=>{let{anchorElem:e=document.body}=t;return $p(Ap(Li,{anchorElem:e}),e)};import{c as Pp}from"react/compiler-runtime";import{useLexicalComposerContext as Bp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as jp}from"@lexical/utils";import{$getSelection as Hp,$isElementNode as Up,$isRangeSelection as Wp,COMMAND_PRIORITY_LOW as Ri,PASTE_COMMAND as Gp}from"lexical";import{useEffect as Vp}from"react";var Op=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Fp=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function yi(t){if(!t)return!1;if(t==="https://"||Op.test(t)||Fp.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ii=t=>{let e=Pp(5),{clientProps:o}=t,[r]=Bp(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([te]))throw new Error("LinkPlugin: LinkNode not registered on editor");return jp(r.registerCommand(de,i=>i===null?(sr(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),sr(i),!0),Ri),r.registerCommand(Gp,i=>{let s=Hp();if(!Wp(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let d=i.clipboardData.getData("text");if(!yi(d))return!1;if(!s.getNodes().some(Kp)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(de,{fields:c,text:null}),i.preventDefault(),!0}return!1},Ri))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Vp(n,l),null};function Kp(t){return Up(t)}var Mi=[rr([{ChildComponent:oi,isActive:({selection:t})=>{if(vi(t)){let e=Ye(t);return Jp(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(vi(t)&&dr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(de,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=dr()?.getTextContent(),r=dr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(mo,{fields:n,selectedNodes:r,text:o})}},order:1}])],Xp=M(({props:t})=>({markdownTransformers:[ii],nodes:[te,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:Ii,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:hi,position:"normal"},{Component:gi,position:"normal"},{Component:Ni,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Mi},toolbarInline:{groups:Mi}}));import{$isListNode as fr,INSERT_CHECK_LIST_COMMAND as Pi,ListItemNode as sf,ListNode as af}from"@lexical/list";import{$isRangeSelection as cf}from"lexical";import{jsx as Di,jsxs as zp}from"react/jsx-runtime";import"react";var mr=()=>zp("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 Zp}from"react/jsx-runtime";import{ListPlugin as Yp}from"@lexical/react/LexicalListPlugin.js";import"react";var qe=()=>Zp(Yp,{});function Qe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as tf,ListItemNode as of,ListNode as rf}from"@lexical/list";import{$createListItemNode as qp,$createListNode as Qp,$isListItemNode as ef,$isListNode as pr}from"@lexical/list";var Ai=4,et=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=qp(t==="check"?r[3]==="x":void 0);if(pr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(i):l.append(i),e.remove()}else if(pr(n)&&n.getListType()===t)n.append(i),e.remove();else{let d=Qp(t,t==="number"?Number(r[2]):void 0);d.append(i),e.replace(d)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/Ai);s&&i.setIndent(s)},Be=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(ef(i)){if(i.getChildrenSize()===1){let u=i.getFirstChild();if(pr(u)){r.push(Be(u,e,o+1));continue}}let s=" ".repeat(o*Ai),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
56
- `)};var $i={type:"element",dependencies:[rf,of],export:(t,e)=>tf(t)?Be(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:et("check")};import{jsx as nf}from"react/jsx-runtime";import{CheckListPlugin as lf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Oi=()=>nf(lf,{});var Fi=[Q([{ChildComponent:mr,isActive:({selection:t})=>{if(!cf(t))return!1;for(let e of t.getNodes()){if(fr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(fr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(fr(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}])],uf=M(({featureProviderMap:t})=>{let e=[{Component:Oi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:qe,position:"normal"}),{markdownTransformers:[$i],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[af,sf],plugins:e,slashMenu:{groups:[Qe([{Icon:mr,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:Fi},toolbarInline:{groups:Fi}}});import{$isListNode as gr,INSERT_ORDERED_LIST_COMMAND as Hi,ListItemNode as hf,ListNode as gf}from"@lexical/list";import{$isRangeSelection as xf}from"lexical";import{jsx as Nt,jsxs as df}from"react/jsx-runtime";import"react";var hr=()=>df("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:[Nt("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"}),Nt("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"}),Nt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Nt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Nt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as mf,ListItemNode as pf,ListNode as ff}from"@lexical/list";var Bi={type:"element",dependencies:[ff,pf],export:(t,e)=>mf(t)?Be(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:et("number")};var ji=[Q([{ChildComponent:hr,isActive:({selection:t})=>{if(!xf(t))return!1;for(let e of t.getNodes()){if(gr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(gr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(gr(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}])],Cf=M(({featureProviderMap:t})=>({markdownTransformers:[Bi],nodes:t.has("orderedList")?[]:[gf,hf],plugins:t.has("orderedList")?[]:[{Component:qe,position:"normal"}],slashMenu:{groups:[Qe([{Icon:hr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Hi,void 0)}}])]},toolbarFixed:{groups:ji},toolbarInline:{groups:ji}}));import{$isListNode as Cr,INSERT_UNORDERED_LIST_COMMAND as Gi,ListItemNode as wf,ListNode as Ef}from"@lexical/list";import{$isRangeSelection as Sf}from"lexical";import{jsx as tt,jsxs as bf}from"react/jsx-runtime";import"react";var xr=()=>bf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[tt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),tt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),tt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),tt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),tt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),tt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as kf,ListItemNode as _f,ListNode as Tf}from"@lexical/list";var Ui={type:"element",dependencies:[Tf,_f],export:(t,e)=>kf(t)?Be(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:et("bullet")};var Wi=[Q([{ChildComponent:xr,isActive:({selection:t})=>{if(!Sf(t))return!1;for(let e of t.getNodes()){if(Cr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Cr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Cr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)},order:11}])],Lf=M({markdownTransformers:[Ui],nodes:[Ef,wf],plugins:[{Component:qe,position:"normal"}],slashMenu:{groups:[Qe([{Icon:xr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)}}])]},toolbarFixed:{groups:Wi},toolbarInline:{groups:Wi}});import{jsx as Nf}from"react/jsx-runtime";import{addClassNamesToElement as yf}from"@lexical/utils";import{DecoratorNode as Rf}from"lexical";import*as Vi from"react";var If=Vi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),yt=class t extends Rf{__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 vf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return yf(o,"unknownConverted"),o}decorate(){return Nf(If,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function vf({data:t}){return new yt({data:t})}var Mf=M(()=>({nodes:[yt]}));import{jsx as Df}from"react/jsx-runtime";import{addClassNamesToElement as Af}from"@lexical/utils";import{DecoratorNode as $f}from"lexical";import*as Ki from"react";var Of=Ki.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Rt=class t extends $f{__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 Ff({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Af(o,"unknownConverted"),o}decorate(){return Df(Of,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Ff({data:t}){return new Rt({data:t})}var Pf=M(()=>({nodes:[Rt]}));import{$setBlocksType as zi}from"@lexical/selection";import{$createParagraphNode as Zi,$getSelection as Yi,$isParagraphNode as Ji,$isRangeSelection as Bf}from"lexical";var Xi=[Q([{ChildComponent:ht,isActive:({selection:t})=>{if(!Bf(t))return!1;for(let e of t.getNodes())if(!Ji(e)&&!Ji(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Yi();zi(e,()=>Zi())})},order:1}])],jf=M({slashMenu:{groups:[z([{Icon:ht,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Yi();zi(e,()=>Zi())})}}])]},toolbarFixed:{groups:Xi},toolbarInline:{groups:Xi}});import{c as s0}from"react/compiler-runtime";import{jsx as xs}from"react/jsx-runtime";import{useLexicalComposerContext as a0}from"@lexical/react/LexicalComposerContext";import{useEffect as c0,useState as u0}from"react";import{jsx as gs,Fragment as i0}from"react/jsx-runtime";import"react";import{jsx as Hf}from"react/jsx-runtime";var qi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Hf("blockquote",{children:o})}};import{jsx as Uf}from"react/jsx-runtime";var Qi={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Uf(r,{children:o})}};import{jsx as Wf}from"react/jsx-runtime";var es={horizontalrule:Wf("hr",{})};import{jsx as Gf}from"react/jsx-runtime";var ts={linebreak:Gf("br",{})};import{jsx as os}from"react/jsx-runtime";var rs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return os("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),os("a",{href:i,rel:n,target:l,children:r})}});import{jsx as ot,jsxs as Vf,Fragment as Kf}from"react/jsx-runtime";import{v4 as Jf}from"uuid";var ns={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return ot(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Jf();return ot("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Vf(Kf,{children:[ot("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),ot("label",{htmlFor:l,children:n}),ot("br",{})]})})}else return ot("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as br}from"react/jsx-runtime";var ls={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?br("p",{children:o}):br("p",{children:br("br",{})})}};var is={tab:" "};import{jsx as It}from"react/jsx-runtime";var ss={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return It("div",{className:"lexical-table-container",children:It("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:It("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return It(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return It("tr",{className:"lexical-table-row",children:o})}};import{jsx as je}from"react/jsx-runtime";import"react";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},Xf=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,zf="\xA0",Zf=`
54
+ `},[t,e]),p=Oe((_,k)=>{o(g=>{let C=e.length-1,b=e[C];if(b&&b.name===_){if(_==="type")return[...e.slice(0,C),{...b,value:b.value+k}];if(b.value===k)return[...e.slice(0,C),{...b,count:b.count+1}]}return[...g,{name:_,count:1,value:k}]})},[e,o]);On(()=>{let _=g=>{if(!r)return;let C=g.key;Xu(g)?p("selectAll",""):Pn.has(C)?p("press",g.key):[...C].length>1?p("keydown",g.key):p("type",g.key)},k=g=>{if(!r)return;let C=g.key;!Pn.has(C)&&[...C].length>1&&p("keyup",g.key)};return t.registerRootListener((g,C)=>{C!==null&&(C.removeEventListener("keydown",_),C.removeEventListener("keyup",k)),g!==null&&(g.addEventListener("keydown",_),g.addEventListener("keyup",k))})},[t,r,p]),On(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),zo(()=>{if(e){let _=m();_!==null&&s(_),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),zo(()=>t.registerUpdateListener(({dirtyElements:k,dirtyLeaves:g,editorState:C})=>{if(!r)return;let b=C._selection,y=d.current,A=c.current;if(y!==b){if(g.size===0&&k.size===0&&!A){let L=Xo(t._window);if(L&&(L.anchorNode==null||L.focusNode==null))return}d.current=b}c.current=!1;let I=m();I!==null&&s(I)}),[t,m,r,p]),zo(()=>r?t.registerUpdateListener(()=>{let k=t.getRootElement();k!==null&&l(k?.innerHTML)}):void 0,[t,r]);let f=Oe(_=>{r||(_.update(()=>{let k=Gu();k.clear();let g=Wu();k.append(Uu().append(g)),g.select()}),o([])),n(k=>!k)},[r]),h=Oe(()=>{if(!r)return;let _=Xo(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:k,anchorOffset:g,focusNode:C,focusOffset:b}=zu(_),y=a().getRootElement(),A;k!==null&&(A=Fn(k,y));let I;C!==null&&(I=Fn(C,y)),p("snapshot",{anchorNode:k,anchorOffset:g,anchorPath:A,focusNode:C,focusOffset:b,focusPath:I})},[p,r,a]),x=Oe(()=>{Vu(m())},[m]),T=Oe(()=>{Ku("test.js",m())},[m]);return[Fe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{f(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Yo("div",{className:"test-recorder-output",children:[Yo("div",{className:"test-recorder-toolbar",children:[Fe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{x(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{T(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Fe("pre",{id:"test-recorder",ref:u,children:i})]}):null]}var jn=()=>{let t=ju(3),[e]=Hu(),[o,r]=Zu(e),n;return t[0]!==o||t[1]!==r?(n=Yo(Bn.Fragment,{children:[Fe("p",{children:"HI"}),o,r,Fe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Yu=M({plugins:[{Component:jn,position:"bottom"}]});import{c as qu}from"react/compiler-runtime";import{jsx as Qu}from"react/jsx-runtime";import{useLexicalComposerContext as ed}from"@lexical/react/LexicalComposerContext.js";import{TreeView as td}from"@lexical/react/LexicalTreeView.js";import"react";var Hn=()=>{let t=qu(2),[e]=ed(),o;return t[0]!==e?(o=Qu(td,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var od=M({plugins:[{Component:Hn,position:"bottom"}]});import{$isTableSelection as rd}from"@lexical/table";import{$isRangeSelection as nd,FORMAT_TEXT_COMMAND as ld}from"lexical";import{jsx as Un}from"react/jsx-runtime";import"react";var Wn=()=>Un("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:Un("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var Gn={type:"text-format",format:["bold","italic"],tag:"***"},Vn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Kn={type:"text-format",format:["bold"],tag:"**"},Jn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Xn=[Z([{ChildComponent:Wn,isActive:({selection:t})=>nd(t)||rd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(ld,"bold")},order:1}])],id=M(({featureProviderMap:t})=>{let e=[Kn,Jn];return t.get("italic")&&e.push(Vn,Gn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}}});import{$isTableSelection as ad}from"@lexical/table";import{$isRangeSelection as cd,FORMAT_TEXT_COMMAND as ud}from"lexical";import{jsx as zn,jsxs as sd}from"react/jsx-runtime";import"react";var Zn=()=>sd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[zn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),zn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Yn={type:"text-format",format:["code"],tag:"`"};var qn=[Z([{ChildComponent:Zn,isActive:({selection:t})=>cd(t)||ad(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(ud,"code")},order:7}])],dd=M({enableFormats:["code"],markdownTransformers:[Yn],toolbarFixed:{groups:qn},toolbarInline:{groups:qn}});import{$isTableSelection as md}from"@lexical/table";import{$isRangeSelection as pd,FORMAT_TEXT_COMMAND as fd}from"lexical";import{jsx as Qn}from"react/jsx-runtime";import"react";var el=()=>Qn("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:Qn("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 tl={type:"text-format",format:["italic"],tag:"*"},ol={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var rl=[Z([{ChildComponent:el,isActive:({selection:t})=>pd(t)||md(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(fd,"italic")},order:2}])],hd=M({enableFormats:["italic"],markdownTransformers:[tl,ol],toolbarFixed:{groups:rl},toolbarInline:{groups:rl}});import{$isTableSelection as xd}from"@lexical/table";import{$isRangeSelection as Cd,FORMAT_TEXT_COMMAND as bd}from"lexical";import{jsx as nl,jsxs as gd}from"react/jsx-runtime";import"react";var ll=()=>gd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[nl("path",{d:"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"}),nl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var il={type:"text-format",format:["strikethrough"],tag:"~~"};var sl=[Z([{ChildComponent:ll,isActive:({selection:t})=>Cd(t)||xd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(bd,"strikethrough")},order:4}])],kd=M({enableFormats:["strikethrough"],markdownTransformers:[il],toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{$isTableSelection as _d}from"@lexical/table";import{$isRangeSelection as Td,FORMAT_TEXT_COMMAND as wd}from"lexical";import{jsx as al}from"react/jsx-runtime";import"react";var cl=()=>al("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:al("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 ul=[Z([{ChildComponent:cl,isActive:({selection:t})=>Td(t)||_d(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(wd,"subscript")},order:5}])],Ed=M({enableFormats:["subscript"],toolbarFixed:{groups:ul},toolbarInline:{groups:ul}});import{$isTableSelection as Sd}from"@lexical/table";import{$isRangeSelection as Ld,FORMAT_TEXT_COMMAND as Nd}from"lexical";import{jsx as dl}from"react/jsx-runtime";import"react";var ml=()=>dl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dl("path",{d:"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 pl=[Z([{ChildComponent:ml,isActive:({selection:t})=>Ld(t)||Sd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Nd,"superscript")},order:6}])],yd=M({enableFormats:["superscript"],toolbarFixed:{groups:pl},toolbarInline:{groups:pl}});import{$isTableSelection as Id}from"@lexical/table";import{$isRangeSelection as vd,FORMAT_TEXT_COMMAND as Md}from"lexical";import{jsx as fl,jsxs as Rd}from"react/jsx-runtime";import"react";var hl=()=>Rd("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:[fl("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"}),fl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var gl=[Z([{ChildComponent:hl,isActive:({selection:t})=>vd(t)||Id(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Md,"underline")},order:3}])],Dd=M({enableFormats:["underline"],toolbarFixed:{groups:gl},toolbarInline:{groups:gl}});import{jsx as er}from"react/jsx-runtime";import{jsx as Ad}from"react/jsx-runtime";function $d(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var no=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[$d(o),r])):{};return Ad("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Od}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Fd}from"@lexical/selection";import{$getNodeByKey as Pd,$getState as Bd,$setState as jd,createState as Hd,TextNode as Ud}from"lexical";import{useEffect as Wd}from"react";var qo=new Map;function xl(t){for(let e in t){let o=t[e],r=Hd(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});qo.set(e,{stateConfig:r,stateValues:o})}}function Qo(t,e,o){t.update(()=>{Fd(r=>{let n=qo.get(e);if(!n)throw new Error(`State config for ${e} not found`);jd(r,n.stateConfig,o)})})}function Cl(){let[t]=Od();return Wd(()=>t.registerMutationListener(Ud,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Pd(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);qo.forEach((s,d)=>{let c=Bd(n,s.stateConfig);if(!c){delete l.dataset[d];return}l.dataset[d]=c;let u=s.stateValues[c]?.css;u&&Object.assign(i,u)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var bl=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>er(no,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Qo(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>er(no,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>er(no,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let n in t.state)Qo(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},Gd=M(({props:t})=>(xl(t.state),{plugins:[{Component:Cl,position:"normal"}],toolbarFixed:{groups:bl(t)},toolbarInline:{groups:bl(t)}}));import{c as Xd}from"react/compiler-runtime";import{useLexicalComposerContext as zd}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Zd,$isHeadingNode as Dl,HeadingNode as Ol}from"@lexical/rich-text";import{$setBlocksType as Yd}from"@lexical/selection";import{$getSelection as qd,$isRangeSelection as Qd}from"lexical";import{useEffect as em}from"react";import{jsx as kl}from"react/jsx-runtime";import"react";var _l=()=>kl("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:kl("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 Tl}from"react/jsx-runtime";import"react";var wl=()=>Tl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tl("path",{d:"M4.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 El}from"react/jsx-runtime";import"react";var Sl=()=>El("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.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 Ll}from"react/jsx-runtime";import"react";var Nl=()=>Ll("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ll("path",{d:"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 yl}from"react/jsx-runtime";import"react";var Rl=()=>yl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.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 Il}from"react/jsx-runtime";import"react";var vl=()=>Il("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Il("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.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 Vd,$isHeadingNode as Kd,HeadingNode as Jd}from"@lexical/rich-text";var tr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Ml=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Jd],export:(n,l)=>{if(!Kd(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:tr(n=>{let l="h"+n[1]?.length;return Vd(l)})}};var Al=t=>{let e=qd();Yd(e,()=>Zd(t))},$l={h1:_l,h2:wl,h3:Sl,h4:Nl,h5:Rl,h6:vl},tm=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[Q(e.map((r,n)=>({ChildComponent:$l[r],isActive:({selection:l})=>{if(!Qd(l))return!1;for(let i of l.getNodes()){if(Dl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(Dl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Al(r)})},order:n+2})))];return{markdownTransformers:[Ml(e)],nodes:[Ol],plugins:[{Component:om,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:$l[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(()=>{Al(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),om=t=>{let e=Xd(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[d]=zd(),c,u;return e[4]!==d||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return d.registerNodeTransform(Ol,a=>{l.includes(a.getTag())||a.setTag(s)})},u=[d,l,s],e[4]=d,e[5]=l,e[6]=s,e[7]=c,e[8]=u):(c=e[7],u=e[8]),em(c,u),null};import{$isNodeSelection as Cm}from"lexical";import{jsx as Fl}from"react/jsx-runtime";import"react";var or=()=>Fl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Fl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Pl,jsxs as rm}from"react/jsx-runtime";import"react";var Bl=()=>rm("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pl("path",{d:"M5 10h10",stroke:"currentColor"}),Pl("path",{d:"M10 15V5",stroke:"currentColor"})]});var Ce=t=>({type:"dropdown",ChildComponent:Bl,items:t,key:"add",order:10});import{addClassNamesToElement as nm}from"@lexical/utils";import{$applyNodeReplacement as lm,createCommand as im,DecoratorNode as sm}from"lexical";var Tt=im("INSERT_HORIZONTAL_RULE_COMMAND"),_t=class extends sm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:am,priority:0})}}static importJSON(e){return jl()}createDOM(e){let o=document.createElement("hr");return nm(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function am(){return{node:jl()}}function jl(){return lm(new _t)}import{$applyNodeReplacement as cm}from"lexical";import"react";var Re=class extends _t{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return wt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function wt(){return cm(new Re)}function lo(t){return t instanceof Re}var Hl={type:"element",dependencies:[Re],export:(t,e)=>lo(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=wt();e&&t.replace(e)}};import{c as um}from"react/compiler-runtime";import{useLexicalComposerContext as dm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as mm}from"@lexical/utils";import{$getSelection as pm,$isRangeSelection as fm,COMMAND_PRIORITY_EDITOR as hm}from"lexical";import{useEffect as gm}from"react";var Ul=()=>{let t=um(3),[e]=dm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Tt,xm,hm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),gm(o,r),null};function xm(t){let e=pm();if(!fm(e))return!1;if(e.focus.getNode()!==null){let r=wt();mm(r)}return!0}var bm=M({markdownTransformers:[Hl],nodes:[Re],plugins:[{Component:Ul,position:"normal"}],slashMenu:{groups:[z([{Icon:or,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,void 0)}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:or,isActive:({selection:t})=>{if(!Cm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return lo(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,void 0)}}])]}});import{$findMatchingParent as ql}from"@lexical/utils";import{$isElementNode as Mm,INDENT_CONTENT_COMMAND as Dm,OUTDENT_CONTENT_COMMAND as Am}from"lexical";import{jsx as io,jsxs as km}from"react/jsx-runtime";import"react";var Wl=()=>km("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:[io("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as so,jsxs as _m}from"react/jsx-runtime";import"react";var Gl=()=>_m("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:[so("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Tm}from"react/jsx-runtime";import{useLexicalComposerContext as wm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Em}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Sm,mergeRegister as Vl}from"@lexical/utils";import{$getSelection as Lm,$isElementNode as zl,$isRangeSelection as Nm,COMMAND_PRIORITY_LOW as Kl,INDENT_CONTENT_COMMAND as Jl,KEY_TAB_COMMAND as ym,OUTDENT_CONTENT_COMMAND as Rm,TabNode as Im}from"lexical";import{useEffect as Xl}from"react";var Zl=({clientProps:t})=>{let[e]=wm(),{disabledNodes:o,disableTabNode:r}=t;return Xl(()=>{if(!(!e||!o?.length))return Vl(e.registerCommand(Jl,()=>vm(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Kl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);zl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Xl(()=>{if(!(!e||!r))return Vl(e.registerCommand(ym,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Rm:Jl,void 0)),Kl),e.registerNodeTransform(Im,n=>{n.remove()}))},[e,r]),Tm(Em,{})};function vm(t){let e=Lm();if(!Nm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=Sm(l,c=>zl(c)&&!c.isInline());if(s===null)continue;let d=s.getKey();s.canIndent()&&!o.has(d)&&(o.add(d),t(s))}return o.size>0}var Yl=t=>({type:"buttons",items:t,key:"indent",order:35});var Ql=({disabledNodes:t})=>[Yl([{ChildComponent:Wl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ei(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ql(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Am,void 0)},order:1},{ChildComponent:Gl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ei(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ql(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Dm,void 0)},order:2}])],$m=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Zl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ql({disabledNodes:e})},toolbarInline:{groups:Ql({disabledNodes:e})}}}),ei=t=>Mm(t)&&t.canIndent();import{$findMatchingParent as Xp}from"@lexical/utils";import{$getSelection as dr,$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 Ye(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 rr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Km}from"lexical";import{addClassNamesToElement as Om,isHTMLAnchorElement as Fm}from"@lexical/utils";import ir from"bson-objectid";import{$applyNodeReplacement as Pm,$createTextNode as ni,$getSelection as Bm,$isElementNode as li,$isRangeSelection as lr,createCommand as jm,ElementNode as Hm}from"lexical";var Um=new Set(["http:","https:","mailto:","sms:","tel:"]),te=class t extends Hm{__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:Wm,priority:1})}}static importJSON(e){let o=be({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new ir.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=nr(o.rel,"add","noopener")),Om(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(!lr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(li(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Um.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=nr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=nr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Wm(t){let e=null;if(Fm(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new ir.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return Pm(new te({id:t??new ir.default().toHexString(),fields:e}))}function K(t){return t instanceof te}var de=jm("TOGGLE_LINK_COMMAND");function sr(t){let e=Bm();if(!lr(e)&&(t===null||!t.selectedNodes?.length))return;let o=lr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();K(i)&&(i.getChildren().forEach(d=>{i.insertBefore(d)}),i.remove())});return}if(o?.length===1){let l=o[0],i=K(l)?l:Gm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ni(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||li(l)&&!l.isInline())){if(K(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ni(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=be({fields:t.fields}),K(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Gm(t){return Vm(t,e=>K(e))}function Vm(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function nr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var ii={type:"text-match",dependencies:[te],export:(t,e)=>{if(!K(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Km(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Jm,$isElementNode as Xm}from"lexical";var ke=class t extends te{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Et({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Xm(r)){let n=Et({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Et({fields:t}){return Jm(new ke({id:"",fields:t}))}function _e(t){return t instanceof ke}import{c as zm}from"react/compiler-runtime";import{useLexicalComposerContext as Zm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ym}from"@lexical/utils";import{$createTextNode as si,$getSelection as qm,$isElementNode as ci,$isLineBreakNode as ui,$isNodeSelection as Qm,$isRangeSelection as ep,$isTextNode as St,TextNode as tp}from"lexical";import{useEffect as op}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 of e){let r=o(t);if(r!=null)return r}return null}var rp=/[.,;\s]/;function co(t){return t!==void 0&&rp.test(t)}function mi(t){return co(t[t.length-1])}function cr(t){return co(t[0])}function np(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)||St(e)&&mi(e.getTextContent())}function fi(t){let e=t.getNextSibling();return ci(e)&&(e=e.getFirstDescendant()),e===null||ui(e)||St(e)&&cr(e.getTextContent())}function lp(t,e,o,r){return(t>0?co(o[t-1]):pi(r[0]))?e<o.length?co(o[e]):fi(r[r.length-1]):!1}function ip(t,e,o){let r=[],n=[],l=[],i=0,s=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,d.shift()}return[i,r,n,l]}function sp(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Et({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let d=si(r.text);d.setFormat(s.getFormat()),d.setDetail(s.getDetail()),d.setStyle(s.getStyle()),l.append(d),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,d;e===0?d=i:[,d]=i.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[x,T]=a.splitText(o-f);x&&c.push(x),u=T}s+=p}),d){let a=qm(),m=a?a.getNodes().find(St):void 0,p=si(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(ep(a)?p.select(a.anchor.offset,a.focus.offset):Qm(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function ap(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,i,s=0;for(;(i=di(l,e))!=null&&i!==null;){let d=i.index,c=i.length,u=d+c;if(lp(s+d,s+u,n,r)){let[m,,p,f]=ip(r,s+d,s+u),h=s+d-m,x=s+u-m,T=sp(p,h,x,i);r=T?[T,...f]:f,o(i.url,null),s=0}else s+=u;l=l.substring(u)}}function ar(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!St(c)||!c.isSimpleText()){ao(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=di(l,e);if(i===null||i.text!==l){ao(t),o(null,t.getFields()?.url??null);return}if(!pi(t)||!fi(t)){ao(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let d=t.getFields();d.url=i?.url,t.setFields(d),o(i.url,s??null)}}function cp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(_e(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!cr(l)||np(l,i))&&(r.append(t),ar(r,e,o),o(null,r.getFields()?.url??null))}_e(n)&&!mi(l)&&(ao(n),ar(n,e,o),o(null,n.getFields()?.url??null))}function ao(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 up(t){let e=[t],o=t.getNextSibling();for(;o!==null&&St(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function dp(t,e,o){let r=zm(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,d)=>{o?.(s,d)};return Ym(t.registerNodeTransform(tp,s=>{let d=s.getParentOrThrow(),c=s.getPreviousSibling();if(_e(d))ar(d,e,i);else if(!K(d)){if(s.isSimpleText()&&(cr(s.getTextContent())||!_e(c))){let u=up(s);ap(u,e,i)}cp(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),op(n,l)}var mp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,pp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,fp=[ai(mp,t=>t.startsWith("http")?t:`https://${t}`),ai(pp,t=>`mailto:${t}`)],hi=()=>{let[t]=Zm();return dp(t,fp),null};import{jsx as hp}from"react/jsx-runtime";import{ClickableLinkPlugin as gp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var gi=()=>hp(gp,{});import{jsx as $p}from"react/jsx-runtime";import"react";import{createPortal as Op}from"react-dom";import{jsx as Te,jsxs as Lt,Fragment as Cp}from"react/jsx-runtime";import{useLexicalComposerContext as bp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as kp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as xi,mergeRegister as Ci}from"@lexical/utils";import{getTranslation as ur}from"@payloadcms/translations";import{CloseMenuIcon as _p,EditIcon as Tp,ExternalLinkIcon as bi,formatDrawerSlug as wp,useConfig as Ep,useEditDepth as Sp,useLocale as Lp,useTranslation as Np}from"@payloadcms/ui";import{requests as yp}from"@payloadcms/ui/shared";import{$getSelection as ki,$isLineBreakNode as Rp,$isRangeSelection as _i,COMMAND_PRIORITY_HIGH as Ip,COMMAND_PRIORITY_LOW as Ti,getDOMSelection as vp,KEY_ESCAPE_COMMAND as Mp,SELECTION_CHANGE_COMMAND as Dp}from"lexical";import wi,{useCallback as Ei,useEffect as po,useRef as Ap,useState as Pe}from"react";function uo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),d=l.getBoundingClientRect(),c=t.top-r,u=t.left-n;c<d.top&&(c+=i.height+t.height+r*2),u+i.width>d.right&&(u=d.right-i.width-n),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as xp}from"lexical";var mo=xp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Si(t){t.preventDefault()}function Li({anchorElem:t}){let[e]=bp(),[o,r]=Pe(),n=Ap(null),[l,i]=Pe(null),[s,d]=Pe(null),{fieldProps:{schemaPath:c},uuid:u}=j(),a=kp(),{config:m,getEntityConfig:p}=Ep(),{i18n:f,t:h}=Np(),[x,T]=Pe(),E=Sp(),[S,_]=Pe(!1),[k,g]=Pe([]),C=Lp(),[b,y]=Pe(!1),A=wp({slug:"lexical-rich-text-link-"+u,depth:E}),{toggleDrawer:I}=he(A),L=Ei(()=>{_(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),y(!1),i(null),d(null),g([]),T(void 0)},[_,i,d,g]),w=Ei(()=>{let N=ki(),R;if(!_i(N)||!N){L();return}let $=Ye(N);R=e.getElementByKey($.getKey())?.getBoundingClientRect();let v=xi($,K),O=N.getNodes().filter(U=>!Rp(U)).find(U=>{let ie=xi(U,K);return v&&!v.is(ie)||ie&&!ie.is(v)});if(v==null||O){L();return}r(v);let D=v.getFields(),W={...D,id:v.getID(),text:v.getTextContent()};if(D?.linkType==="custom")i(D?.url??null),d(null);else{i(`${m.routes.admin==="/"?"":m.routes.admin}/collections/${D?.doc?.relationTo}/${D?.doc?.value}`);let U=D?.doc?.relationTo?p({collectionSlug:D?.doc?.relationTo}):void 0;if(!U)d(D?.label?String(D?.label):null),i(D?.url?String(D?.url):null);else{let ie=typeof D.doc?.value=="object"?D.doc.value.id:D.doc?.value,fe=D.doc?.relationTo;if(!ie||!fe)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ut=h("fields:linkedTo",{label:`${ur(U.labels.singular,f)} - ${h("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(ut),yp.get(`${m.serverURL}${m.routes.api}/${fe}/${ie}`,{headers:{"Accept-Language":f.language},params:{depth:0,locale:C?.code}}).then(async Le=>{if(!Le.ok)throw new Error(`HTTP error! Status: ${Le.status}`);let Ne=await Le.json(),jt=U?.admin?.useAsTitle||"id",Ge=Ne[jt],Ve=h("fields:linkedTo",{label:`${ur(U.labels.singular,f)} - ${Ge}`}).replace(/<[^>]*>?/g,"");d(Ve)}).catch(()=>{let Le=h("fields:linkedTo",{label:`${ur(U.labels.singular,f)} - ${h("general:untitled",f)} - ID: ${ie}`}).replace(/<[^>]*>?/g,"");d(Le)})}}T(W),_(!0),g(N?N?.getNodes():[]),_e(v)?y(!0):y(!1);let q=n.current,J=vp(e._window),{activeElement:Do}=document;if(q===null)return;let pe=e.getRootElement();return J!==null&&pe!==null&&pe.contains(J.anchorNode)?(R||(R=J.getRangeAt(0).getBoundingClientRect()),R!=null&&(R.y+=40,uo(R,q,t))):(Do==null||Do.className!=="link-input")&&(pe!==null&&uo(null,q,t),i(null),d(null)),!0},[e,L,m.routes.admin,m.routes.api,m.serverURL,p,h,f,C?.code,t]);return po(()=>Ci(e.registerCommand(mo,N=>(e.dispatchCommand(de,N),w(),I(),!0),Ti)),[e,w,I,A]),po(()=>{let N=t.parentElement,R=()=>{e.getEditorState().read(()=>{w()})};return window.addEventListener("resize",R),N?.addEventListener("scroll",R),()=>{window.removeEventListener("resize",R),N?.removeEventListener("scroll",R)}},[t.parentElement,e,w]),po(()=>Ci(e.registerUpdateListener(({editorState:N})=>{N.read(()=>{w()})}),e.registerCommand(Dp,()=>(w(),!0),Ti),e.registerCommand(Mp,()=>S?(L(),!0):!1,Ip)),[e,w,S,L]),po(()=>{e.getEditorState().read(()=>{w()})},[e,w]),Lt(wi.Fragment,{children:[Te("div",{className:"link-editor",ref:n,children:Lt("div",{className:"link-input",children:[l&&l.length>0?Lt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Te(bi,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Lt(Cp,{children:[o?.__fields.newTab?Te(bi,{}):null,Te("span",{className:"link-input__label-pure",children:s})]}):null,a&&Lt(wi.Fragment,{children:[Te("button",{"aria-label":"Edit link",className:"link-edit",onClick:N=>{N.preventDefault(),I()},onMouseDown:Si,tabIndex:0,type:"button",children:Te(Tp,{})}),!b&&Te("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(de,null)},onMouseDown:Si,tabIndex:0,type:"button",children:Te(_p,{})})]})]})}),Te(ft,{className:"lexical-link-edit-drawer",data:x,drawerSlug:A,drawerTitle:h("fields:editLink"),featureKey:"link",handleDrawerSubmit:(N,R)=>{let $=R,v={...$};delete v.text,e.update(()=>{let O=ki(),D=null;if(_i(O)?D=Ye(O).getParent():k.length&&(D=k[0]?.getParent()??null),D&&_e(D)){let W=be({fields:v});D.replace(W,!0)}}),e.dispatchCommand(de,{fields:v,selectedNodes:k,text:$.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Ni=t=>{let{anchorElem:e=document.body}=t;return Op($p(Li,{anchorElem:e}),e)};import{c as Bp}from"react/compiler-runtime";import{useLexicalComposerContext as jp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Hp}from"@lexical/utils";import{$getSelection as Up,$isElementNode as Wp,$isRangeSelection as Gp,COMMAND_PRIORITY_LOW as Ri,PASTE_COMMAND as Vp}from"lexical";import{useEffect as Kp}from"react";var Fp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Pp=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function yi(t){if(!t)return!1;if(t==="https://"||Fp.test(t)||Pp.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ii=t=>{let e=Bp(5),{clientProps:o}=t,[r]=jp(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([te]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Hp(r.registerCommand(de,i=>i===null?(sr(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),sr(i),!0),Ri),r.registerCommand(Vp,i=>{let s=Up();if(!Gp(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let d=i.clipboardData.getData("text");if(!yi(d))return!1;if(!s.getNodes().some(Jp)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(de,{fields:c,text:null}),i.preventDefault(),!0}return!1},Ri))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Kp(n,l),null};function Jp(t){return Wp(t)}var Mi=[rr([{ChildComponent:oi,isActive:({selection:t})=>{if(vi(t)){let e=Ye(t);return Xp(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(vi(t)&&dr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(de,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=dr()?.getTextContent(),r=dr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(mo,{fields:n,selectedNodes:r,text:o})}},order:1}])],zp=M(({props:t})=>({markdownTransformers:[ii],nodes:[te,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:Ii,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:hi,position:"normal"},{Component:gi,position:"normal"},{Component:Ni,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Mi},toolbarInline:{groups:Mi}}));import{$isListNode as fr,INSERT_CHECK_LIST_COMMAND as Pi,ListItemNode as af,ListNode as cf}from"@lexical/list";import{$isRangeSelection as uf}from"lexical";import{jsx as Di,jsxs as Zp}from"react/jsx-runtime";import"react";var mr=()=>Zp("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 Yp}from"react/jsx-runtime";import{ListPlugin as qp}from"@lexical/react/LexicalListPlugin.js";import"react";var qe=()=>Yp(qp,{});function Qe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as of,ListItemNode as rf,ListNode as nf}from"@lexical/list";import{$createListItemNode as Qp,$createListNode as ef,$isListItemNode as tf,$isListNode as pr}from"@lexical/list";var Ai=4,et=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=Qp(t==="check"?r[3]==="x":void 0);if(pr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(i):l.append(i),e.remove()}else if(pr(n)&&n.getListType()===t)n.append(i),e.remove();else{let d=ef(t,t==="number"?Number(r[2]):void 0);d.append(i),e.replace(d)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/Ai);s&&i.setIndent(s)},Be=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(tf(i)){if(i.getChildrenSize()===1){let u=i.getFirstChild();if(pr(u)){r.push(Be(u,e,o+1));continue}}let s=" ".repeat(o*Ai),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
56
+ `)};var $i={type:"element",dependencies:[nf,rf],export:(t,e)=>of(t)?Be(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:et("check")};import{jsx as lf}from"react/jsx-runtime";import{CheckListPlugin as sf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Oi=()=>lf(sf,{});var Fi=[Q([{ChildComponent:mr,isActive:({selection:t})=>{if(!uf(t))return!1;for(let e of t.getNodes()){if(fr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(fr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(fr(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}])],df=M(({featureProviderMap:t})=>{let e=[{Component:Oi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:qe,position:"normal"}),{markdownTransformers:[$i],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[cf,af],plugins:e,slashMenu:{groups:[Qe([{Icon:mr,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:Fi},toolbarInline:{groups:Fi}}});import{$isListNode as gr,INSERT_ORDERED_LIST_COMMAND as Hi,ListItemNode as gf,ListNode as xf}from"@lexical/list";import{$isRangeSelection as Cf}from"lexical";import{jsx as Nt,jsxs as mf}from"react/jsx-runtime";import"react";var hr=()=>mf("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:[Nt("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"}),Nt("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"}),Nt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Nt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Nt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as pf,ListItemNode as ff,ListNode as hf}from"@lexical/list";var Bi={type:"element",dependencies:[hf,ff],export:(t,e)=>pf(t)?Be(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:et("number")};var ji=[Q([{ChildComponent:hr,isActive:({selection:t})=>{if(!Cf(t))return!1;for(let e of t.getNodes()){if(gr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(gr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(gr(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}])],bf=M(({featureProviderMap:t})=>({markdownTransformers:[Bi],nodes:t.has("orderedList")?[]:[xf,gf],plugins:t.has("orderedList")?[]:[{Component:qe,position:"normal"}],slashMenu:{groups:[Qe([{Icon:hr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Hi,void 0)}}])]},toolbarFixed:{groups:ji},toolbarInline:{groups:ji}}));import{$isListNode as Cr,INSERT_UNORDERED_LIST_COMMAND as Gi,ListItemNode as Ef,ListNode as Sf}from"@lexical/list";import{$isRangeSelection as Lf}from"lexical";import{jsx as tt,jsxs as kf}from"react/jsx-runtime";import"react";var xr=()=>kf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[tt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),tt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),tt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),tt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),tt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),tt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as _f,ListItemNode as Tf,ListNode as wf}from"@lexical/list";var Ui={type:"element",dependencies:[wf,Tf],export:(t,e)=>_f(t)?Be(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:et("bullet")};var Wi=[Q([{ChildComponent:xr,isActive:({selection:t})=>{if(!Lf(t))return!1;for(let e of t.getNodes()){if(Cr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Cr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Cr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)},order:11}])],Nf=M({markdownTransformers:[Ui],nodes:[Sf,Ef],plugins:[{Component:qe,position:"normal"}],slashMenu:{groups:[Qe([{Icon:xr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)}}])]},toolbarFixed:{groups:Wi},toolbarInline:{groups:Wi}});import{jsx as yf}from"react/jsx-runtime";import{addClassNamesToElement as Rf}from"@lexical/utils";import{DecoratorNode as If}from"lexical";import*as Vi from"react";var vf=Vi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),yt=class t extends If{__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 Mf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Rf(o,"unknownConverted"),o}decorate(){return yf(vf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Mf({data:t}){return new yt({data:t})}var Df=M(()=>({nodes:[yt]}));import{jsx as Af}from"react/jsx-runtime";import{addClassNamesToElement as $f}from"@lexical/utils";import{DecoratorNode as Of}from"lexical";import*as Ki from"react";var Ff=Ki.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Rt=class t extends Of{__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 Pf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return $f(o,"unknownConverted"),o}decorate(){return Af(Ff,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Pf({data:t}){return new Rt({data:t})}var Bf=M(()=>({nodes:[Rt]}));import{$setBlocksType as zi}from"@lexical/selection";import{$createParagraphNode as Zi,$getSelection as Yi,$isParagraphNode as Ji,$isRangeSelection as jf}from"lexical";var Xi=[Q([{ChildComponent:ht,isActive:({selection:t})=>{if(!jf(t))return!1;for(let e of t.getNodes())if(!Ji(e)&&!Ji(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Yi();zi(e,()=>Zi())})},order:1}])],Hf=M({slashMenu:{groups:[z([{Icon:ht,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Yi();zi(e,()=>Zi())})}}])]},toolbarFixed:{groups:Xi},toolbarInline:{groups:Xi}});import{c as a0}from"react/compiler-runtime";import{jsx as xs}from"react/jsx-runtime";import{useLexicalComposerContext as c0}from"@lexical/react/LexicalComposerContext";import{useEffect as u0,useState as d0}from"react";import{jsx as gs,Fragment as s0}from"react/jsx-runtime";import"react";import{jsx as Uf}from"react/jsx-runtime";var qi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Uf("blockquote",{children:o})}};import{jsx as Wf}from"react/jsx-runtime";var Qi={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Wf(r,{children:o})}};import{jsx as Gf}from"react/jsx-runtime";var es={horizontalrule:Gf("hr",{})};import{jsx as Vf}from"react/jsx-runtime";var ts={linebreak:Vf("br",{})};import{jsx as os}from"react/jsx-runtime";var rs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return os("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),os("a",{href:i,rel:n,target:l,children:r})}});import{jsx as ot,jsxs as Kf,Fragment as Jf}from"react/jsx-runtime";import{v4 as Xf}from"uuid";var ns={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return ot(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Xf();return ot("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Kf(Jf,{children:[ot("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),ot("label",{htmlFor:l,children:n}),ot("br",{})]})})}else return ot("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as br}from"react/jsx-runtime";var ls={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?br("p",{children:o}):br("p",{children:br("br",{})})}};var is={tab:" "};import{jsx as It}from"react/jsx-runtime";var ss={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return It("div",{className:"lexical-table-container",children:It("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:It("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return It(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return It("tr",{className:"lexical-table-row",children:o})}};import{jsx as je}from"react/jsx-runtime";import"react";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},zf=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,Zf="\xA0",Yf=`
57
57
 
58
- `,as="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",cs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Yf=new RegExp("^[^"+cs+"]*["+as+"]"),qf=new RegExp("^[^"+as+"]*["+cs+"]"),Qf={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},e0={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},t0={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},o0={[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"},r0={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},n0={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};var us={text:({node:t})=>{let e=t.text;return t.format&F.IS_BOLD&&(e=je("strong",{children:e})),t.format&F.IS_ITALIC&&(e=je("em",{children:e})),t.format&F.IS_STRIKETHROUGH&&(e=je("span",{style:{textDecoration:"line-through"},children:e})),t.format&F.IS_UNDERLINE&&(e=je("span",{style:{textDecoration:"underline"},children:e})),t.format&F.IS_CODE&&(e=je("code",{children:e})),t.format&F.IS_SUBSCRIPT&&(e=je("sub",{children:e})),t.format&F.IS_SUPERSCRIPT&&(e=je("sup",{children:e})),e}};import{jsx as vt}from"react/jsx-runtime";var ds={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return vt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return vt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(vt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(vt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),vt("picture",{children:n})}};var rt={...ls,...us,...ts,...qi,...ss,...Qi,...es,...ns,...rs({}),...ds,...is};import{jsx as ps,Fragment as l0}from"react/jsx-runtime";import kr from"react";function ms(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function fs({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return ms(e)?hs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):ps(l0,{})}function hs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,d)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:s,nodesToJSX:p=>hs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:u=ps("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),kr.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return kr.cloneElement(u,{key:d,style:m})}return kr.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",s),null}}).filter(Boolean)}var _r=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:rt}):i=e:i=rt;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&fs({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?gs(i0,{children:s}):gs("div",{className:t??"payload-richtext",children:s})};function Cs(){let t=s0(7),[e]=a0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=u0(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),c0(l,i);let s;return t[5]!==r?(s=xs("div",{className:"debug-jsx-converter",children:xs(_r,{converters:rt,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var d0=M({plugins:[{Component:Cs,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},m0={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Y0}from"lexical";import{jsx as Mt,jsxs as p0}from"react/jsx-runtime";import"react";var Tr=()=>p0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mt("g",{clipPath:"url(#clip0_4397_10817)",children:Mt("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"})}),Mt("defs",{children:Mt("clipPath",{id:"clip0_4397_10817",children:Mt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as g0}from"react/jsx-runtime";import*as ks from"react";import{DecoratorBlockNode as f0}from"@lexical/react/LexicalDecoratorBlockNode.js";function h0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:bs({relationTo:o,value:e})}:null}var Dt=class extends f0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:h0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=bs(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function bs(t){return new Dt({data:t})}var x0=ks.lazy(()=>import("./RelationshipComponent-JXQOFHXF.js").then(t=>({default:t.RelationshipComponent})));function C0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:He({relationTo:o,value:e})}:null}var we=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:C0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=He(o);return r.setFormat(e.format),r}decorate(e,o){return g0(x0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function He(t){return new we({data:t})}function wr(t){return t instanceof we}import{c as B0}from"react/compiler-runtime";import{jsx as j0}from"react/jsx-runtime";import{useLexicalComposerContext as H0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as U0}from"@lexical/utils";import{$getPreviousSelection as W0,$getSelection as G0,$isParagraphNode as V0,$isRangeSelection as K0,COMMAND_PRIORITY_EDITOR as J0,createCommand as X0}from"lexical";import{useEffect as z0}from"react";import{c as ws}from"react/compiler-runtime";import{jsx as Er}from"react/jsx-runtime";import{useLexicalComposerContext as Es}from"@lexical/react/LexicalComposerContext.js";import{toast as I0}from"@payloadcms/ui";import{$getNodeByKey as v0,COMMAND_PRIORITY_EDITOR as Ss}from"lexical";import{useEffect as Ls,useState as M0}from"react";import{c as b0}from"react/compiler-runtime";import{jsx as k0}from"react/jsx-runtime";import{useLexicalComposerContext as _0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as T0,useModal as w0}from"@payloadcms/ui";import{$getNodeByKey as _s,$getPreviousSelection as E0,$getRoot as S0,$getSelection as L0,$isRangeSelection as N0,$setSelection as y0}from"lexical";import{useEffect as R0,useState as Ts}from"react";var At=t=>{let e=b0(23),[o]=_0(),[r,n]=Ts(null),[l,i]=Ts(!1),[s,d,c]=T0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=w0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let A=L0()??E0();n(A)},e[0]=h):h=e[0];let x=h,T;e[1]!==o||e[2]!==r?(T=()=>{r&&o.update(()=>{if(N0(r)){let{anchor:A,focus:I}=r;_s(A.key)&&_s(I.key)&&y0(r.clone())}else S0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=T):T=e[3];let E=T,S;e[4]!==u?(S=()=>{u()},e[4]=u,e[5]=S):S=e[5];let _=S,k,g;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(k=()=>{if(!l)return;let A=f[a];A&&!A?.isOpen&&(i(!1),setTimeout(()=>{E()},1))},g=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=k,e[11]=g):(k=e[10],g=e[11]),R0(k,g);let C;e[12]!==d?(C=A=>k0(d,{...A,onClick:()=>{x()}}),e[12]=d,e[13]=C):C=e[13];let b;e[14]!==p?(b=()=>{x(),p(),i(!0)},e[14]=p,e[15]=b):b=e[15];let y;return e[16]!==s||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==C||e[21]!==b?(y={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:C,openListDrawer:b},e[16]=s,e[17]=_,e[18]=m,e[19]=a,e[20]=C,e[21]=b,e[22]=y):y=e[22],y};var D0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=v0(o);n&&n.replace(He({relationTo:e,value:r}))}):t.dispatchCommand(Sr,{relationTo:e,value:r})},A0=t=>{let e=ws(14),{enabledCollectionSlugs:o}=t,[r]=Es(),[n,l]=M0(null),i=o?.[0],s;e[0]!==o||e[1]!==i?(s={collectionSlugs:o,selectedCollection:i},e[0]=o,e[1]=i,e[2]=s):s=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=At(s),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Je,x=>(l(x?.replace?x?.replace.nodeKey:null),u(),!0),Ss),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Ls(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=x=>{let{collectionSlug:T,doc:E}=x;D0({editor:r,relationTo:T,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let f=p,h;return e[11]!==c||e[12]!==f?(h=Er(c,{onSelect:f}),e[11]=c,e[12]=f,e[13]=h):h=e[13],h},$0=()=>{let t=ws(3),[e]=Es(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Je,O0,Ss),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ls(o,r),null},Ns=({enabledCollectionSlugs:t})=>t?.length?Er(A0,{enabledCollectionSlugs:t}):Er($0,{});function O0(){return I0.error("No relationship collections enabled"),!0}import{useConfig as F0,useEntityVisibility as P0}from"@payloadcms/ui";import*as ys from"react";var fo=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=F0(),{visibleEntities:l}=P0();return ys.useMemo(()=>{let s=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:f}=a;if(l?.collections.includes(m)){if(r){if(!p||!f)continue}else if(f||!p)continue;c&&!c.has(m)||u&&u.has(m)||(s.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:s}},[n,l,r,o,e])};var Sr=X0("INSERT_RELATIONSHIP_COMMAND"),Rs=t=>{let e=B0(8),{clientProps:o}=t,[r]=H0(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=fo(i),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Sr,Z0,J0)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),z0(d,c);let u;return e[6]!==s?(u=j0(Ns,{enabledCollectionSlugs:s}),e[6]=s,e[7]=u):u=e[7],u};function Z0(t){let e=G0()||W0();if(K0(e)){let o=He(t),{focus:r}=e,n=r.getNode();U0(o),V0(n)&&!n.__first&&n.remove()}return!0}var q0=M({nodes:[we],plugins:[{Component:Rs,position:"normal"}],slashMenu:{groups:[z([{Icon:Tr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:Tr,isActive:({selection:t})=>{if(!Y0(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]}});import{c as Ps}from"react/compiler-runtime";import{jsx as ae,jsxs as S1}from"react/jsx-runtime";import{useLexicalComposerContext as L1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Bs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as N1,useThrottledEffect as y1,useTranslation as R1}from"@payloadcms/ui";import*as Ee from"react";import{useMemo as I1}from"react";import{c as Q0}from"react/compiler-runtime";import{jsx as e1}from"react/jsx-runtime";import{mergeRegister as t1}from"@lexical/utils";import{$addUpdateTag as o1,$getSelection as r1}from"lexical";import{useDeferredValue as n1,useEffect as l1,useState as i1}from"react";var Is="toolbar-popup__button",$t=t=>{let e=Q0(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=i1(l),d=n1(i),c=j(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Is}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Is,u,a,m].filter(Boolean),e[1]=u,e[2]=a,e[3]=m,e[4]=p):p=e[4];let f=p.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let b=r1();if(!b)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:b}):!1,A=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:b}):!0;s(I=>I.active===y&&I.enabled===A?I:{active:y,enabled:A})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,T=Wt(),E,S;e[9]!==r||e[10]!==T||e[11]!==x?(E=()=>{T(x);let b=()=>T(x),y=t1(r.registerUpdateListener(b));return document.addEventListener("mouseup",b),()=>{y(),document.removeEventListener("mouseup",b)}},S=[r,T,x],e[9]=r,e[10]=T,e[11]=x,e[12]=E,e[13]=S):(E=e[12],S=e[13]),l1(E,S);let _;e[14]!==i||e[15]!==r||e[16]!==n?(_=()=>{i.enabled&&r.focus(()=>{r.update(s1),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=_):_=e[17];let k=_,g=a1,C;return e[18]!==o||e[19]!==f||e[20]!==k||e[21]!==n.key?(C=e1("button",{className:f,"data-button-key":n.key,onClick:k,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=k,e[21]=n.key,e[22]=C):C=e[22],C};function s1(){o1("toolbar")}function a1(t){t.preventDefault()}import{c as h1}from"react/compiler-runtime";import{jsx as nt}from"react/jsx-runtime";import Fs,{useCallback as g1,useDeferredValue as x1,useEffect as C1,useMemo as b1}from"react";import{mergeRegister as k1}from"@lexical/utils";import{useTranslation as _1}from"@payloadcms/ui";import{$getSelection as T1}from"lexical";import{jsx as Ie,jsxs as vs}from"react/jsx-runtime";import{Button as c1}from"@payloadcms/ui";import{$addUpdateTag as u1,isDOMNode as d1}from"lexical";import ho,{useCallback as m1,useEffect as go,useMemo as Ds,useRef as Lr,useState as Nr}from"react";import{createPortal as p1}from"react-dom";var Ms="toolbar-popup__dropdown-item",As=ho.createContext(null);function $s({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let d=Ds(()=>[Ms,r===!1?"disabled":"",t?"active":"",l?.key?`${Ms}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Lr(null),u=ho.use(As);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return go(()=>{c?.current!=null&&a(c)},[c,a]),Ie(c1,{"aria-label":s,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{u1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function f1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Nr(),[i,s]=Nr(),d=m1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?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])},u=Ds(()=>({registerItem:d}),[d]);return go(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Ie(As,{value:u,children:Ie("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Os({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:d}){let c=Lr(null),u=Lr(null),[a,m]=Nr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};go(()=>{let h=u.current,x=c.current;if(a&&h!==null&&x!==null){let{left:T,top:E}=h.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;x.style.top=`${E+S+h.offsetHeight+5}px`,x.style.left=`${Math.min(T-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),go(()=>{let h=u.current;if(h!==null&&a){let x=T=>{let E=T.target;d1(E)&&(d&&c.current&&c.current.contains(E)||h.contains(E)||m(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,u,a,d]);let f=p1(Ie(f1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return vs(ho.Fragment,{children:[vs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:u,type:"button",children:[l&&Ie(l,{}),s&&Ie("span",{className:"toolbar-popup__dropdown-label",children:s}),Ie("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Ie(ho.Fragment,{children:f})]})}var yr="toolbar-popup__dropdown",w1=t=>{let e=h1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=_1(),{fieldProps:d}=j(),{featureClientSchemaMap:c,schemaPath:u}=d;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&nt(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==u){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=nt($s,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?nt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:nt("span",{className:"text",children:p})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=u,e[13]=a}else a=e[13];return a},E1=Fs.memo(w1),Ue=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:d})=>{let[c,u]=Fs.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=x1(c),m=j(),{items:p,key:f}=r,h=Wt(),x=g1(()=>{o.getEditorState().read(()=>{let E=T1();if(!E)return;let S=[],_=[],k=[];for(let g of p)g.isActive&&(!s||S.length<s)&&g.isActive({editor:o,editorConfigContext:m,selection:E})&&(S.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:E})&&k.push(g.key):k.push(g.key);u({activeItemKeys:S,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:E}):!0,enabledItemKeys:k}),d&&d({activeItems:_})})},[o,m,r,p,s,d]);C1(()=>(h(x),k1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let T=b1(()=>p?.length?p.map(E=>nt(E1,{active:a.activeItemKeys.includes(E.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(E.key),item:E},E.key)):null,[p,a,t,o]);return nt(Os,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[yr,`${yr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${yr}-items`,...l||[]],label:i,children:T},f)};function v1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ae(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ae($t,{editor:e,item:o,children:ae(o.ChildComponent,{})},o.key):null}function M1(t){let e=Ps(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=R1(),{fieldProps:d}=j(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Ee.useState(void 0),[p,f]=Ee.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Ee.useEffect(h,x);let T;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==u?(T=k=>{let{activeItems:g}=k;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let C=g[0],b=C.key;C.label&&(b=typeof C.label=="function"?C.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):C.label),b.length>25&&(b=b.substring(0,25)+"..."),g.length===1?(m(b),f(()=>C.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=u,e[12]=T):T=e[12];let E=T,S=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==E||e[21]!==S?(_=S1("div",{className:S,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?ae(Ue,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):ae(Ue,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):null,l.type==="buttons"&&l.items.length?l.items.map(k=>ae(v1,{anchorElem:o,editor:r,item:k},k.key)):null,i<n.features.toolbarFixed?.groups.length-1&&ae("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=E,e[21]=S,e[22]=_):_=e[22],_}function D1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ee.useRef(null),i=Bs(),{y:s}=N1(),d=I1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return y1(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,s]),ae("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:i&&ae(Ee.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>ae(M1,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var js=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return js(t.parentEditor)}return!1},Hs=t=>{let e=Ps(6),{clientProps:o}=t,[r]=L1(),n=j();if(!Bs())return null;let{editorConfig:i}=n,s=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==s||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=js(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=ae(D1,{anchorElem:document.body,editor:s,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=s,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var A1=M({plugins:[{Component:Hs,position:"aboveContainer"}]});import{c as Gs}from"react/compiler-runtime";import{jsx as me,jsxs as Vs}from"react/jsx-runtime";import{useLexicalComposerContext as $1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as O1}from"@lexical/react/useLexicalEditable";import{mergeRegister as Ks}from"@lexical/utils";import{$getSelection as Js,$isRangeSelection as Us,$isTextNode as F1,COMMAND_PRIORITY_LOW as P1,getDOMSelection as Xs,SELECTION_CHANGE_COMMAND as B1}from"lexical";import{useCallback as Co,useEffect as Ot,useRef as Ws,useState as j1}from"react";import*as bo from"react";import{createPortal as H1}from"react-dom";function Rr(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 xo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=d.top-a.height-c,h=d.left-l;i==="center"&&(h=d.left+d.width/2-a.width/2);let x=0;return!e&&f<p.top&&!s&&(x=a.height+d.height+c*2,f+=x),i==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+a.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 U1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&me(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?me($t,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function W1(t){let e=Gs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=j(),[s,d]=bo.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],bo.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let T=x[0];d(()=>T?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(f=Vs("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?me(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):me(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>me(U1,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&me("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function G1({anchorElem:t,editor:e}){let o=Ws(null),r=Ws(null),{editorConfig:n}=j(),l=Co(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),i=Co(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),s=Co(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ot(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let d=Co(()=>{let c=Js(),u=Xs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let f=Rr(u,p),h=xo({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&xo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Ot(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),Ot(()=>(e.getEditorState().read(()=>{d()}),Ks(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(B1,()=>(d(),!1),P1))),[e,d]),Vs("div",{className:"inline-toolbar-popup",ref:o,children:[me("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>me(W1,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function V1(t,e){let o=Gs(12),[r,n]=j1(!1),l=O1(),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Js(),f=Xs(t._window),h=t.getRootElement();if(f!==null&&(!Us(p)||h===null||!h.contains(f.anchorNode))){n(!1);return}if(!Us(p))return;if(p.getTextContent()!==""){let T=p.getNodes(),E=!1;for(let S of T)if(F1(S)){n(!0),E=!0;break}E||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let s=i,d,c;o[2]!==s?(d=()=>(document.addEventListener("selectionchange",s),document.addEventListener("mouseup",s),()=>{document.removeEventListener("selectionchange",s),document.removeEventListener("mouseup",s)}),c=[s],o[2]=s,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Ot(d,c);let u,a;if(o[5]!==t||o[6]!==s?(u=()=>Ks(t.registerUpdateListener(()=>{s()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,s],o[5]=t,o[6]=s,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Ot(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=H1(me(G1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var zs=t=>{let{anchorElem:e}=t,[o]=$1();return V1(o,e)};var K1=M({plugins:[{Component:zs,position:"floatingAnchorElem"}]});import{TableCellNode as $g,TableNode as Og,TableRowNode as Fg}from"@lexical/table";import{jsx as Zs}from"react/jsx-runtime";import"react";var Ir=()=>Zs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Zs("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 J1,$createTableNode as X1,$createTableRowNode as z1,$isTableCellNode as Ys,$isTableNode as vr,$isTableRowNode as Mr,TableCellHeaderStates as ko,TableCellNode as Z1,TableNode as Y1,TableRowNode as q1}from"@lexical/table";import{$isParagraphNode as Q1,$isTextNode as eh}from"lexical";var Qs=/^\|(.+)\|\s?$/,th=/^(\| ?:?-*:? ?)+\|\s?$/,ea=({allTransformers:t})=>({type:"element",dependencies:[Y1,q1,Z1],export:e=>{if(!vr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Mr(r))continue;let l=!1;for(let i of r.getChildren())Ys(i)&&(n.push(Ut(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===ko.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
59
- `)},regExp:Qs,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(th.test(n)){let a=e.getPreviousSibling();if(!a||!vr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Mr(p))return;p.getChildren().forEach(f=>{Ys(f)&&f.setHeaderStyles(ko.ROW,ko.ROW)}),e.remove();return}let l=qs(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),d=l.length;for(;s&&!(!Q1(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!eh(a))break;let m=qs(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),i.unshift(m);let p=s.getPreviousSibling();s.remove(),s=p}let c=X1();for(let a of i){let m=z1();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ta("",t))}let u=e.getPreviousSibling();vr(u)&&oh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function oh(t){let e=t.getFirstChild();return Mr(e)?e.getChildrenSize():0}var ta=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=J1(ko.NO_STATUS);return Ht(t,e,o),o},qs=(t,e)=>{let o=t.match(Qs);return!o||!o[1]?null:o[1].split("|").map(r=>ta(r,e))};import{c as nh}from"react/compiler-runtime";import{jsx as P,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as lh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ra,$deleteTableColumnAtSelection as ih,$deleteTableRowAtSelection as sh,$getNodeTriplet as ah,$getTableCellNodeFromLexicalNode as na,$getTableColumnIndexFromTableCellNode as ch,$getTableNodeFromLexicalNodeOrThrow as Me,$getTableRowIndexFromTableCellNode as uh,$insertTableColumnAtSelection as dh,$insertTableRowAtSelection as mh,$isTableCellNode as sa,$isTableSelection as Ft,$mergeCells as ph,$unmergeCell as fh,getTableElement as Ar,getTableObserverFromTableElement as $r,TableCellHeaderStates as ve,TableCellNode as hh}from"@lexical/table";import{mergeRegister as gh}from"@lexical/utils";import{useScrollInfo as xh}from"@payloadcms/ui";import{$getSelection as To,$isElementNode as Ch,$isRangeSelection as Or,$isTextNode as bh,$setSelection as kh,COMMAND_PRIORITY_CRITICAL as _h,getDOMSelection as Th,isDOMNode as wh,SELECTION_CHANGE_COMMAND as Eh}from"lexical";import*as Fr from"react";import{useCallback as ce,useEffect as lt,useRef as _o,useState as it}from"react";import{createPortal as aa}from"react-dom";import{jsx as Dr,jsxs as rh}from"react/jsx-runtime";import"react";var oa=()=>rh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Dr("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"}),Dr("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"}),Dr("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 la(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Sh(){let t=To();if(Or(t)&&!t.isCollapsed()||Ft(t)&&!t.anchor.is(t.focus)||!Or(t)&&!Ft(t))return!1;let[e]=ah(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Lh(t){let e=t.getLastDescendant();bh(e)?e.select():Ch(e)?e.selectEnd():e!==null&&e.selectNext()}function Nh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=ia(),i=_o(null),[s,d]=it(n),[c,u]=it({columns:1,rows:1}),[a,m]=it(!1),[p,f]=it(!1),{y:h}=xh();lt(()=>l.registerMutationListener(hh,w=>{w.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{d(s.getLatest())})},{skipInitialization:!0}),[l,s]),lt(()=>{l.getEditorState().read(()=>{let w=To();if(Ft(w)){let N=la(w);u(la(w)),m(N.columns>1||N.rows>1)}f(Sh())})},[l]),lt(()=>{let w=e.current,N=i.current,R=l.getRootElement();if(w!=null&&N!=null&&R!=null){let $=R.getBoundingClientRect(),v=w.getBoundingClientRect();N.style.opacity="1";let O=N.getBoundingClientRect(),D=5,W=v.right+D;if(W+O.width>window.innerWidth||W+O.width>$.right){let J=v.left-O.width-D;W=(J<0?D:J)+window.pageXOffset}N.style.left=`${W+window.pageXOffset}px`;let q=v.top;if(q+O.height>window.innerHeight){let J=v.bottom-O.height;q=J<0?D:J}N.style.top=`${q}px`}},[e,i,l,h]),lt(()=>{function w(N){i.current!=null&&e.current!=null&&wh(N.target)&&!i.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let x=ce(()=>{l.update(()=>{if(s.isAttached()){let w=Me(s),N=Ar(w,l.getElementByKey(w.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let R=$r(N);R!==null&&R.$clearHighlight(),w.markDirty(),d(s.getLatest())}kh(null)})},[l,s]),T=()=>{l.update(()=>{let w=To();if(!Ft(w))return;let R=w.getNodes().filter(sa),$=ph(R);$&&(Lh($),o())})},E=()=>{l.update(()=>{fh()})},S=ce(w=>{l.update(()=>{for(let N=0;N<c.rows;N++)mh(w);o()})},[l,o,c.rows]),_=ce(w=>{l.update(()=>{for(let N=0;N<c.columns;N++)dh(w);o()})},[l,o,c.columns]),k=ce(()=>{l.update(()=>{sh(),o()})},[l,o]),g=ce(()=>{l.update(()=>{Me(s).remove(),x(),o()})},[l,s,x,o]),C=ce(()=>{l.update(()=>{ih(),o()})},[l,o]),b=ce(()=>{l.update(()=>{let w=Me(s),N=uh(s),[R]=ra(w,null,null),$=new Set,v=s.getHeaderStyles()^ve.ROW;if(R[N])for(let O=0;O<R[N].length;O++){let D=R[N][O];D?.cell&&($.has(D.cell)||($.add(D.cell),D.cell.setHeaderStyles(v,ve.ROW)))}x(),o()})},[l,s,x,o]),y=ce(()=>{l.update(()=>{let w=Me(s),N=ch(s),[R]=ra(w,null,null),$=new Set,v=s.getHeaderStyles()^ve.COLUMN;if(R)for(let O=0;O<R.length;O++){let D=R?.[O]?.[N];D?.cell&&($.has(D.cell)||($.add(D.cell),D.cell.setHeaderStyles(v,ve.COLUMN)))}x(),o()})},[l,s,x,o]),A=ce(()=>{l.update(()=>{if(s.isAttached()){let w=Me(s);w&&w.setRowStriping(!w.getRowStriping())}x(),o()})},[l,s,x,o]),I=ce(()=>{l.update(()=>{if(s.isAttached()){let w=Me(s);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),L=null;return t&&(a?L=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(L=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),aa(Se("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:i,children:[L?Se(Fr.Fragment,{children:[L,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>A(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>I(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>S(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>S(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>_(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>_(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>b(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&ve.ROW)===ve.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&ve.COLUMN)===ve.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function yh({anchorElem:t,cellMerge:e}){let[o]=ia(),r=_o(null),n=_o(null),[l,i]=it(!1),[s,d]=it(null),c=ce(()=>{let a=r.current,m=To(),p=Th(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return h();let x=o.getRootElement(),T=null,E=null;if(Or(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=na(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return h();let k=Me(_),g=Ar(k,o.getElementByKey(k.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=$r(g),d(_)}else if(Ft(m)){let _=na(m.anchor.getNode());if(!sa(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=Me(_),g=Ar(k,o.getElementByKey(k.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=$r(g),E=o.getElementByKey(_.getKey())}else if(!f)return h();if(T===null||E===null)return h();let S=!T||!T.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let _=E.getBoundingClientRect(),k=t.getBoundingClientRect(),g=_.top-k.top,C=_.right-k.left;a.style.transform=`translate(${C}px, ${g}px)`}},[o,t]);lt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return gh(o.registerUpdateListener(p),o.registerCommand(Eh,p,_h),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=_o(s);return lt(()=>{u.current!==s&&i(!1),u.current=s},[u,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Se(Fr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(oa,{})}),l&&P(Nh,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var ca=t=>{let e=nh(3),{anchorElem:o}=t,r=lh(),n;return e[0]!==o||e[1]!==r?(n=aa(r?P(yh,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as Rh}from"react/compiler-runtime";import{jsx as Eo,jsxs as Ih}from"react/jsx-runtime";import{useLexicalComposerContext as vh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Mh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Dh,$getTableNodeFromLexicalNodeOrThrow as Pr,$getTableRowIndexFromTableCellNode as Ah,$isTableCellNode as ua,$isTableRowNode as $h,getDOMCellFromTarget as Oh,getTableElement as Fh,TableNode as da}from"@lexical/table";import{calculateZoomLevel as ma,mergeRegister as Ph}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Br,isHTMLElement as Bh,SKIP_SCROLL_INTO_VIEW_TAG as pa}from"lexical";import*as ha from"react";import{useCallback as Pt,useEffect as jr,useRef as wo,useState as st}from"react";import{createPortal as jh}from"react-dom";var Hh=33,fa=92;function Uh({editor:t}){let e=wo(null),o=wo(null),r=wo(null),[n,l]=st(!1),i=j(),s=wo(null),[d,c]=st(null),[u,a]=st(null),[m,p]=st(!1),[f,h]=st(null),x=Pt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),T=I=>(I.buttons&1)===1;jr(()=>{let I=new Set;return Ph(t.registerMutationListener(da,L=>{for(let[w,N]of L)N==="destroyed"?I.delete(w):I.add(w);l(I.size>0)}),t.registerNodeTransform(da,L=>{if(L.getColWidths())return L;let w=L.getColumnCount(),N=fa;return L.setColWidths(Array(w).fill(N)),L}))},[t]),jr(()=>{if(!n)return;let I=R=>{let $=R.target;if(Bh($)){if(f){c({x:R.clientX,y:R.clientY});return}if(p(T(R)),!(o.current&&o.current.contains($))&&e.current!==$){e.current=$;let v=Oh($);v&&u!==v?t.getEditorState().read(()=>{let O=Br(v.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let D=Pr(O),W=Fh(D,t.getElementByKey(D.getKey()));if(!W)throw new Error("TableCellResizer: Table element not found.");e.current=$,r.current=W.getBoundingClientRect(),a(v)},{editor:t}):v==null&&x()}}},L=R=>{p(!0)},w=R=>{p(!1)},N=t.registerRootListener((R,$)=>{$?.removeEventListener("mousemove",I),$?.removeEventListener("mousedown",L),$?.removeEventListener("mouseup",w),R?.addEventListener("mousemove",I),R?.addEventListener("mousedown",L),R?.addEventListener("mouseup",w)});return()=>{N()}},[u,f,t,n,x]);let E=I=>I==="bottom",S=Pt(I=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Br(u.elem);if(!ua(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Pr(L),N=Ah(L),R=w.getChildren(),v=L.getColSpan()===w.getColumnCount()?N:N+L.getRowSpan()-1;if(v>=R.length||v<0)throw new Error("Expected table cell to be inside of table row.");let O=R[v];if(!$h(O))throw new Error("Expected table row");let D=O.getHeight();if(D===void 0){let q=O.getChildren();D=Math.min(...q.map(J=>_(J,t)??1/0))}let W=Math.max(D+I,Hh);O.setHeight(W)},{tag:pa})},[u,t]),_=(I,L)=>L.getElementByKey(I.getKey())?.clientHeight,k=(I,L)=>{let w;return L.forEach(N=>{N.forEach((R,$)=>{R.cell===I&&(w=$)})}),w},g=Pt(I=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Br(u.elem);if(!ua(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Pr(L),[N]=Dh(w,null,null),R=k(L,N);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");let $=w.getColWidths();if(!$)return;let v=$[R];if(v===void 0)return;let O=[...$],D=Math.max(v+I,fa);O[R]=D,w.setColWidths(O)},{tag:pa})},[u,t]),C=Pt(I=>{let L=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y:R}=s.current;if(u===null)return;let $=ma(w.target);if(E(I)){let v=(w.clientY-R)/$;S(v)}else{let v=(w.clientX-N)/$;g(v)}x(),document.removeEventListener("mouseup",L)}};return L},[u,x,g,S]),b=Pt(I=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");s.current={x:L.clientX,y:L.clientY},c(s.current),h(I),document.addEventListener("mouseup",C(I))},[u,C]),[y,A]=st({bottom:null,left:null,right:null,top:null});return jr(()=>{if(u){let{height:I,left:L,top:w,width:N}=u.elem.getBoundingClientRect(),R=ma(u.elem),$=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${$}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+w+I-$/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${I}px`,left:`${window.scrollX+L+N-$/2}px`,top:`${window.scrollY+w}px`,width:`${$}px`}},O=r.current;f&&d&&O&&(E(f)?(v[f].left=`${window.scrollX+O.left}px`,v[f].top=`${window.scrollY+d.y/R}px`,v[f].height="3px",v[f].width=`${O.width}px`):(v[f].top=`${window.scrollY+O.top}px`,v[f].left=`${window.scrollX+d.x/R}px`,v[f].width="3px",v[f].height=`${O.height}px`),v[f].backgroundColor="#adf"),A(v)}else A({bottom:null,left:null,right:null,top:null})},[u,f,d]),Eo("div",{ref:o,children:u!=null&&!m&&Ih(ha.Fragment,{children:[Eo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:b("right"),style:y.right||void 0}),Eo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:b("bottom"),style:y.bottom||void 0})]})})}var ga=()=>{let t=Rh(3),[e]=vh(),o=Mh(),r;return t[0]!==e||t[1]!==o?(r=o?jh(Eo(Uh,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Zh}from"react/compiler-runtime";import{jsx as Hr,jsxs as Yh,Fragment as qh}from"react/jsx-runtime";import{useLexicalComposerContext as Qh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ea}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as eg,$getTableColumnIndexFromTableCellNode as tg,$getTableRowIndexFromTableCellNode as og,$insertTableColumnAtSelection as rg,$insertTableRowAtSelection as ng,$isTableCellNode as lg,$isTableNode as ba,getTableElement as ig,TableNode as sg}from"@lexical/table";import{$findMatchingParent as ag,mergeRegister as cg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ka,isHTMLElement as ug}from"lexical";import{useEffect as _a,useMemo as dg,useRef as Ta,useState as So}from"react";import"react";import{createPortal as mg}from"react-dom";import{c as Jh}from"react/compiler-runtime";import{useEffect as Xh,useRef as zh}from"react";var Wh="Expected a function",Gh=Math.max,Vh=Math.min;function Kh(t,e,o){let r,n,l=0,i,s=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(Wh);e=e||0,typeof o=="object"&&(s=!!o.leading,d="maxWait"in o,c=d?Gh(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let C=r,b=i;return r=i=void 0,l=g,u=t.apply(b,C),u}function f(g){return l=g,a=setTimeout(T,e),s?p(g):u}function h(g){let C=g-n,b=g-l,y=e-C;return d?Vh(y,c-b):y}function x(g){let C=g-n,b=g-l;return n===void 0||C>=e||C<0||d&&b>=c}function T(){let g=Date.now();if(x(g))return E(g);a=setTimeout(T,h(g))}function E(g){return a=void 0,m&&r?p(g):(r=i=void 0,u)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function _(){return a===void 0?u:E(Date.now())}function k(){let g=Date.now(),C=x(g);if(r=arguments,i=this,n=g,C){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(T,e),p(n)}return a===void 0&&(a=setTimeout(T,e)),u}return k.cancel=S,k.flush=_,k}var xa=Kh;function Ca(t,e,o){let r=Jh(6),n=zh(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=xa(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),Xh(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=s):s=r[5],s}var wa=20;function pg({anchorElem:t}){let[e]=Qh(),o=Ea(),r=j(),[n,l]=So(!1),[i,s]=So(!1),[d,c]=So(!1),[u,a]=So({}),m=Ta(new Set),p=Ta(null),f=Ca(T=>{let{isOutside:E,tableDOMNode:S}=fg(T,r.editorConfig?.lexical);if(E){l(!1),s(!1);return}if(!S)return;p.current=S;let _=null,k=null,g=null;if(e.getEditorState().read(()=>{let v=ka(S);if(lg(v)){let O=ag(v,D=>ba(D));if(!ba(O))return;if(g=ig(O,e.getElementByKey(O.getKey())),g){let D=O.getChildrenSize(),W=O.getChildAtIndex(0)?.getChildrenSize(),q=og(v),J=tg(v);q===D-1?_=v:J===W-1&&(k=v)}}},{editor:e}),!g)return;let C=g.parentElement;if(!C)return;let{bottom:b,height:y,left:A,right:I,width:L,y:w}=g.getBoundingClientRect(),N=!1;C&&C.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(N=C.scrollWidth>C.clientWidth);let{left:R,y:$}=t.getBoundingClientRect();_?(s(!1),l(!0),a({height:wa,left:N&&C?C.offsetLeft:A-R,top:b-$+5,width:N&&C?C.offsetWidth:L})):k&&(s(!0),l(!1),a({height:y,left:I-R+5,top:w-$,width:wa}))},50,250),h=dg(()=>new ResizeObserver(()=>{l(!1),s(!1)}),[]);_a(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),s(!1),document.removeEventListener("mousemove",f)}},[d,f]),_a(()=>cg(e.registerMutationListener(sg,T=>{e.getEditorState().read(()=>{let E=!1;for(let[S,_]of T)switch(_){case"created":{m.current.add(S),E=!0;break}case"destroyed":{m.current.delete(S),E=!0;break}default:break}if(E){h.disconnect();for(let S of m.current){let{tableElement:_}=eg(S);h.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=T=>{e.update(()=>{p.current&&(ka(p.current)?.selectEnd(),T?(ng(),l(!1)):(rg(),s(!1)))})};return o?Yh(qh,{children:[n&&Hr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),i&&Hr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function fg(t,e){let o=t.target;if(ug(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Sa(t){let e=Zh(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Ea())return null;let l;return e[0]!==r?(l=mg(Hr(pg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as hg}from"react/compiler-runtime";import{jsx as Ur,jsxs as gg}from"react/jsx-runtime";import{useLexicalComposerContext as xg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Cg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as bg,TableCellNode as kg,TableNode as _g,TableRowNode as Tg}from"@lexical/table";import{mergeRegister as wg}from"@lexical/utils";import{formatDrawerSlug as Eg,useEditDepth as Sg}from"@payloadcms/ui";import{$getSelection as Lg,$isRangeSelection as Ng,COMMAND_PRIORITY_EDITOR as yg,createCommand as Rg}from"lexical";import{createContext as Ig,use as vg,useEffect as Mg,useMemo as Dg,useState as Ag}from"react";import*as La from"react";var Lo=Rg("OPEN_EMBED_DRAWER_COMMAND"),Na=Ig({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ya({children:t}){let[e,o]=Ag({cellEditorConfig:null,cellEditorPlugins:null});return Ur(Na,{value:Dg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ra=()=>{let t=hg(16),[e]=xg(),o=vg(Na),r=Sg(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,d;t[0]!==r||t[1]!==s?(d=Eg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=he(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([_g,Tg,kg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return wg(e.registerCommand(Lo,()=>{let h=null;return e.getEditorState().read(()=>{let x=Lg();Ng(x)&&(h=x)}),h&&u(),!0},yg))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],Mg(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(bg,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==p?(f=gg(La.Fragment,{children:[Ur(ft,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Ur(Cg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var Pg=M({markdownTransformers:[ea],nodes:[Og,$g,Fg],plugins:[{Component:Ra,position:"normal"},{Component:ga,position:"normal"},{Component:ca,position:"floatingAnchorElem"},{Component:Sa,position:"floatingAnchorElem"}],providers:[ya],slashMenu:{groups:[z([{Icon:Ir,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Lo,{})}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:Ir,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Lo,{})}}])]}});import{$isNodeSelection as bx}from"lexical";import{jsx as Wr,jsxs as Bg}from"react/jsx-runtime";import"react";var Gr=()=>Bg("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:[Wr("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"}),Wr("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"}),Wr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Aa}from"react/jsx-runtime";import $a from"bson-objectid";import{$applyNodeReplacement as Gg}from"lexical";import*as Oa from"react";import jg from"bson-objectid";function No(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new jg.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as Hg}from"@lexical/react/LexicalDecoratorBlockNode.js";import va from"bson-objectid";import{$applyNodeReplacement as Ug}from"lexical";var Bt=class extends Hg{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>No(o,Ia),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new va.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ia({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function Ia({data:t}){return t?.id||(t.id=new va.default().toHexString()),Ug(new Bt({data:t}))}import{jsx as Ma}from"react/jsx-runtime";import{ShimmerEffect as Wg}from"@payloadcms/ui";var Da=()=>Ma("div",{className:"lexical-upload",children:Ma(Wg,{height:"95px",width:"203px"})});var Vg=Oa.lazy(()=>import("./component-WT25HAJA.js").then(t=>({default:t.UploadComponent}))),le=class extends Bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>No(o,De),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new $a.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=De({data:o});return r.setFormat(e.format),r}decorate(){return this.__data.pending?Aa(Da,{}):Aa(Vg,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function De({data:t}){return t?.id||(t.id=new $a.default().toHexString()),Gg(new le({data:t}))}function at(t){return t instanceof le}import{c as Qg}from"react/compiler-runtime";import{jsx as ex}from"react/jsx-runtime";import{useLexicalComposerContext as tx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ja,$insertNodeToNearestRoot as Jr,mergeRegister as ox}from"@lexical/utils";import{useBulkUpload as rx,useEffectEvent as nx,useModal as lx}from"@payloadcms/ui";import Xr from"bson-objectid";import{$createRangeSelection as ix,$getPreviousSelection as Ua,$getSelection as Wa,$isParagraphNode as zr,$isRangeSelection as Ga,$setSelection as sx,COMMAND_PRIORITY_EDITOR as ax,COMMAND_PRIORITY_LOW as Va,createCommand as cx,DROP_COMMAND as ux,getDOMSelectionFromTarget as dx,isHTMLElement as Ka,PASTE_COMMAND as mx}from"lexical";import{useEffect as px}from"react";import{c as Fa}from"react/compiler-runtime";import{jsx as Vr}from"react/jsx-runtime";import{useLexicalComposerContext as Pa}from"@lexical/react/LexicalComposerContext.js";import{toast as Kg}from"@payloadcms/ui";import{$getNodeByKey as Jg,COMMAND_PRIORITY_EDITOR as Ba}from"lexical";import{useEffect as ja,useState as Xg}from"react";var zg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Jg(o);n&&n.replace(De({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Kr,{fields:null,relationTo:e,value:r})},Zg=t=>{let e=Fa(13),{enabledCollectionSlugs:o}=t,[r]=Pa(),[n,l]=Xg(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:d,openListDrawer:c}=At(i),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Xe,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Ba),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),ja(u,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:T}=h;s(),zg({editor:r,relationTo:x,replaceNodeKey:n,value:T.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==d||e[11]!==p?(f=Vr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},Yg=()=>{let t=Fa(3),[e]=Pa(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Xe,qg,Ba),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ja(o,r),null},Ha=({enabledCollectionSlugs:t})=>t?.length?Vr(Zg,{enabledCollectionSlugs:t}):Vr(Yg,{});function qg(){return Kg.error("No upload collections enabled"),!0}function fx(t){let e=t.target;return!!(Ka(e)&&!e.closest("code, span.editor-image")&&Ka(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function hx(t){let e,o=dx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Kr=cx("INSERT_UPLOAD_COMMAND"),Xa=t=>{let e=Qg(21),{clientProps:o}=t,[r]=tx(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=fo(i),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=rx(),{isModalOpen:f,openModal:h}=lx(),x;e[3]!==d||e[4]!==r||e[5]!==s||e[6]!==f||e[7]!==h||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(x=k=>{let{files:g}=k;if(g?.length!==0&&(u(C=>[...C??[],...g.map(gx)]),!f(d))){if(!s.length||!s[0])return;c(s[0]),p(s),a(()=>{r.update(xx)}),m(C=>{let b=new Map(C.map(Cx));r.update(()=>{for(let y of Ja()){let A=y.node;if(at(A)){let I=A.getData();if(I?.pending){let L=b.get(I.pending?.formID);L&&A.replace(De({data:{id:new Xr.default().toHexString(),fields:{},relationTo:L.collectionSlug,value:L.doc.id}}))}}}})}),h(d)}},e[3]=d,e[4]=r,e[5]=s,e[6]=f,e[7]=h,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=x):x=e[13];let T=nx(x),E;e[14]!==r||e[15]!==T?(E=()=>{if(!r.hasNodes([le]))throw new Error("UploadPlugin: UploadNode not registered on editor");return ox(r.registerNodeTransform(le,k=>{let g=k.getData();if(!g?.pending)return;(async function(){let y=null,A=g?.pending?.src,I=g?.pending?.formID;if(A?.startsWith("data:")){let L=A.match(/data:(image\/[a-zA-Z]+);base64,/),w=L?L[1]:"image/png",N=A.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob(N),$=new Array(R.length);for(let D=0;D<R.length;D++)$[D]=R.charCodeAt(D);let v=new Uint8Array($);y={alt:void 0,file:new File([v],"pasted-image."+w?.split("/")[1],{type:w}),formID:I}}else if(A?.startsWith("http")||A?.startsWith("https")){let w=await(await fetch(A)).blob(),N=A.split("/").pop()||"pasted-image"+w.type.split("/")[1];y={alt:void 0,file:new File([w],N,{type:w.type}),formID:I}}y&&T({files:[y]})})()}),r.registerCommand(Kr,k=>(r.update(()=>{let g=Wa()||Ua();if(Ga(g)){let C=De({data:{id:k.id,fields:k.fields,relationTo:k.relationTo,value:k.value}}),{focus:b}=g,y=b.getNode();Jr(C),zr(y)&&!y.__first&&y.remove()}}),!0),ax),r.registerCommand(mx,k=>{if(!(k instanceof ClipboardEvent))return!1;let g=k.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(b=>{C.push({alt:"",file:b,formID:new Xr.default().toHexString()})}),C.length?(r.update(()=>{let b=Wa()||Ua();if(Ga(b))for(let y of C){let A=new le({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:I}=b,L=I.getNode();Jr(A),zr(L)&&!L.__first&&L.remove()}}),T({files:C}),!0):!1},Va),r.registerCommand(ux,k=>{if(!(k instanceof DragEvent))return!1;let g=k.dataTransfer;if(!g?.types?.length)return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(b=>{C.push({alt:"",file:b,formID:new Xr.default().toHexString()})}),C.length?(k.preventDefault(),k.stopPropagation(),r.update(()=>{if(fx(k)){let b=hx(k),y=ix();b!=null&&y.applyDOMRange(b),sx(y);for(let A of C){let I=new le({data:{pending:{formID:A.formID,src:URL.createObjectURL(A.file)}}}),{focus:L}=y,w=L.getNode();Jr(I),zr(w)&&!w.__first&&w.remove()}}}),T({files:C}),!0):!1},Va))},e[14]=r,e[15]=T,e[16]=E):E=e[16];let S;e[17]!==r?(S=[r],e[17]=r,e[18]=S):S=e[18],px(E,S);let _;return e[19]!==s?(_=ex(Ha,{enabledCollectionSlugs:s}),e[19]=s,e[20]=_):_=e[20],_};function gx(t){return{file:t.file,formID:t.formID}}function xx(){for(let t of Ja()){let e=t.node;at(e)&&e.getData()?.pending&&e.remove()}}function Cx(t){return[t.formID,t]}var kx=M({nodes:[le],plugins:[{Component:Xa,position:"normal"}],slashMenu:{groups:[z([{Icon:Gr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:Gr,isActive:({selection:t})=>{if(!bx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return at(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]}});import{c as Tx}from"react/compiler-runtime";import{jsx as Yr}from"react/jsx-runtime";import{ShimmerEffect as wx,useConfig as Ex}from"@payloadcms/ui";import{lazy as Sx,Suspense as Lx,useEffect as Nx,useState as yx}from"react";var za={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",hrSelected:"LexicalEditorTheme__hrSelected",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",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var yo={namespace:"lexical",theme:za};function Za({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let c of l.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,s.set(c.clientFeatureProps.featureKey,u),d++}return s}import{deepMerge as _x}from"payload/shared";var Ya=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?_x(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Zr(t,e,o){return{admin:o,features:Ya(t),lexical:e,resolvedFeatureMap:t}}var Rx=Sx(()=>import("./Field-CJFETHA3.js").then(t=>({default:t.RichText}))),Ix=t=>{let e=Tx(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let u=c,a=s===void 0?yo:s,{config:m}=Ex(),[p,f]=yx(null),h,x;e[2]!==u||e[3]!==r||e[4]!==m||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==p||e[9]!==a||e[10]!==d?(h=()=>{if(p)return;let E=[];for(let[k,g]of Object.entries(r))g.clientFeatureProvider&&E.push(g.clientFeatureProvider(g.clientFeatureProps));let S=a||yo,_=Za({config:m,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:d??i.name,unSanitizedEditorConfig:{features:E,lexical:S}});f(Zr(_,S,u))},x=[a,u,p,r,n,l,i,m,d],e[2]=u,e[3]=r,e[4]=m,e[5]=n,e[6]=l,e[7]=i,e[8]=p,e[9]=a,e[10]=d,e[11]=h,e[12]=x):(h=e[11],x=e[12]),Nx(h,x);let T;return e[13]!==p||e[14]!==t?(T=Yr(Lx,{fallback:Yr(wx,{height:"35vh"}),children:p&&Yr(Rx,{...t,editorConfig:p})}),e[13]=p,e[14]=t,e[15]=T):T=e[15],T};function vx(t){return t instanceof HTMLElement}function Mx(...t){return t.filter(Boolean).join(" ")}var Ro=new WeakMap;function qa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Io(t,e){let o=Ro.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=qa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let d=qa(i);for(let c of r)d!==null&&c([d[0]-s[0],d[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Ro.set(t,o)}return o.listeners.add(e),()=>{Dx(t,e)}}function Dx(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 Ax(t,e){return Io(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function $x(t,e){return Io(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Ox(t,e){return Io(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Fx(t,e){return Io(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Px}from"react/compiler-runtime";import{jsx as Bx}from"react/jsx-runtime";import"react";var jx=()=>{let t=Px(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?Bx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Hx}from"react/compiler-runtime";import{jsx as Ux}from"react/jsx-runtime";import"react";var Wx=()=>{let t=Hx(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?Ux(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Gx}from"react/compiler-runtime";import{jsx as Vx}from"react/jsx-runtime";import"react";var Kx=()=>{let t=Gx(2),{Label:e}=ge(),o;return t[0]!==e?(o=e?Vx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Jx}from"react/compiler-runtime";import{jsx as Xx}from"react/jsx-runtime";import"react";var zx=t=>{let e=Jx(3),{children:o}=t,{InlineBlockContainer:r}=ge(),n;return e[0]!==r||e[1]!==o?(n=r?Xx(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as Zx}from"react/jsx-runtime";import"react";var Yx=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=xe();return r?Zx(r,{...o,children:e}):null};import{c as qx}from"react/compiler-runtime";import{jsx as Qx}from"react/jsx-runtime";import"react";var eC=()=>{let t=qx(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?Qx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as tC}from"react/compiler-runtime";import{jsx as oC}from"react/jsx-runtime";import"react";var rC=()=>{let t=tC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?oC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as nC}from"qs-esm";var lC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let d=nC({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var Qa={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
58
+ `,as="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",cs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",qf=new RegExp("^[^"+cs+"]*["+as+"]"),Qf=new RegExp("^[^"+as+"]*["+cs+"]"),e0={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},t0={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},o0={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},r0={[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"},n0={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},l0={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};var us={text:({node:t})=>{let e=t.text;return t.format&F.IS_BOLD&&(e=je("strong",{children:e})),t.format&F.IS_ITALIC&&(e=je("em",{children:e})),t.format&F.IS_STRIKETHROUGH&&(e=je("span",{style:{textDecoration:"line-through"},children:e})),t.format&F.IS_UNDERLINE&&(e=je("span",{style:{textDecoration:"underline"},children:e})),t.format&F.IS_CODE&&(e=je("code",{children:e})),t.format&F.IS_SUBSCRIPT&&(e=je("sub",{children:e})),t.format&F.IS_SUPERSCRIPT&&(e=je("sup",{children:e})),e}};import{jsx as vt}from"react/jsx-runtime";var ds={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return vt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return vt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(vt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(vt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),vt("picture",{children:n})}};var rt={...ls,...us,...ts,...qi,...ss,...Qi,...es,...ns,...rs({}),...ds,...is};import{jsx as ps,Fragment as i0}from"react/jsx-runtime";import kr from"react";function ms(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function fs({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return ms(e)?hs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):ps(i0,{})}function hs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,d)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:s,nodesToJSX:p=>hs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:u=ps("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),kr.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return kr.cloneElement(u,{key:d,style:m})}return kr.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",s),null}}).filter(Boolean)}var _r=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:rt}):i=e:i=rt;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&fs({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?gs(s0,{children:s}):gs("div",{className:t??"payload-richtext",children:s})};function Cs(){let t=a0(7),[e]=c0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=d0(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),u0(l,i);let s;return t[5]!==r?(s=xs("div",{className:"debug-jsx-converter",children:xs(_r,{converters:rt,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var m0=M({plugins:[{Component:Cs,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},p0={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as q0}from"lexical";import{jsx as Mt,jsxs as f0}from"react/jsx-runtime";import"react";var Tr=()=>f0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mt("g",{clipPath:"url(#clip0_4397_10817)",children:Mt("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"})}),Mt("defs",{children:Mt("clipPath",{id:"clip0_4397_10817",children:Mt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as x0}from"react/jsx-runtime";import*as ks from"react";import{DecoratorBlockNode as h0}from"@lexical/react/LexicalDecoratorBlockNode.js";function g0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:bs({relationTo:o,value:e})}:null}var Dt=class extends h0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:g0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=bs(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function bs(t){return new Dt({data:t})}var C0=ks.lazy(()=>import("./RelationshipComponent-JXQOFHXF.js").then(t=>({default:t.RelationshipComponent})));function b0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:He({relationTo:o,value:e})}:null}var we=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:b0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=He(o);return r.setFormat(e.format),r}decorate(e,o){return x0(C0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function He(t){return new we({data:t})}function wr(t){return t instanceof we}import{c as j0}from"react/compiler-runtime";import{jsx as H0}from"react/jsx-runtime";import{useLexicalComposerContext as U0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as W0}from"@lexical/utils";import{$getPreviousSelection as G0,$getSelection as V0,$isParagraphNode as K0,$isRangeSelection as J0,COMMAND_PRIORITY_EDITOR as X0,createCommand as z0}from"lexical";import{useEffect as Z0}from"react";import{c as ws}from"react/compiler-runtime";import{jsx as Er}from"react/jsx-runtime";import{useLexicalComposerContext as Es}from"@lexical/react/LexicalComposerContext.js";import{toast as v0}from"@payloadcms/ui";import{$getNodeByKey as M0,COMMAND_PRIORITY_EDITOR as Ss}from"lexical";import{useEffect as Ls,useState as D0}from"react";import{c as k0}from"react/compiler-runtime";import{jsx as _0}from"react/jsx-runtime";import{useLexicalComposerContext as T0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as w0,useModal as E0}from"@payloadcms/ui";import{$getNodeByKey as _s,$getPreviousSelection as S0,$getRoot as L0,$getSelection as N0,$isRangeSelection as y0,$setSelection as R0}from"lexical";import{useEffect as I0,useState as Ts}from"react";var At=t=>{let e=k0(23),[o]=T0(),[r,n]=Ts(null),[l,i]=Ts(!1),[s,d,c]=w0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=E0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let A=N0()??S0();n(A)},e[0]=h):h=e[0];let x=h,T;e[1]!==o||e[2]!==r?(T=()=>{r&&o.update(()=>{if(y0(r)){let{anchor:A,focus:I}=r;_s(A.key)&&_s(I.key)&&R0(r.clone())}else L0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=T):T=e[3];let E=T,S;e[4]!==u?(S=()=>{u()},e[4]=u,e[5]=S):S=e[5];let _=S,k,g;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(k=()=>{if(!l)return;let A=f[a];A&&!A?.isOpen&&(i(!1),setTimeout(()=>{E()},1))},g=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=k,e[11]=g):(k=e[10],g=e[11]),I0(k,g);let C;e[12]!==d?(C=A=>_0(d,{...A,onClick:()=>{x()}}),e[12]=d,e[13]=C):C=e[13];let b;e[14]!==p?(b=()=>{x(),p(),i(!0)},e[14]=p,e[15]=b):b=e[15];let y;return e[16]!==s||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==C||e[21]!==b?(y={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:C,openListDrawer:b},e[16]=s,e[17]=_,e[18]=m,e[19]=a,e[20]=C,e[21]=b,e[22]=y):y=e[22],y};var A0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=M0(o);n&&n.replace(He({relationTo:e,value:r}))}):t.dispatchCommand(Sr,{relationTo:e,value:r})},$0=t=>{let e=ws(14),{enabledCollectionSlugs:o}=t,[r]=Es(),[n,l]=D0(null),i=o?.[0],s;e[0]!==o||e[1]!==i?(s={collectionSlugs:o,selectedCollection:i},e[0]=o,e[1]=i,e[2]=s):s=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=At(s),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Je,x=>(l(x?.replace?x?.replace.nodeKey:null),u(),!0),Ss),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Ls(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=x=>{let{collectionSlug:T,doc:E}=x;A0({editor:r,relationTo:T,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let f=p,h;return e[11]!==c||e[12]!==f?(h=Er(c,{onSelect:f}),e[11]=c,e[12]=f,e[13]=h):h=e[13],h},O0=()=>{let t=ws(3),[e]=Es(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Je,F0,Ss),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ls(o,r),null},Ns=({enabledCollectionSlugs:t})=>t?.length?Er($0,{enabledCollectionSlugs:t}):Er(O0,{});function F0(){return v0.error("No relationship collections enabled"),!0}import{useConfig as P0,useEntityVisibility as B0}from"@payloadcms/ui";import*as ys from"react";var fo=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=P0(),{visibleEntities:l}=B0();return ys.useMemo(()=>{let s=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:f}=a;if(l?.collections.includes(m)){if(r){if(!p||!f)continue}else if(f||!p)continue;c&&!c.has(m)||u&&u.has(m)||(s.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:s}},[n,l,r,o,e])};var Sr=z0("INSERT_RELATIONSHIP_COMMAND"),Rs=t=>{let e=j0(8),{clientProps:o}=t,[r]=U0(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=fo(i),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Sr,Y0,X0)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),Z0(d,c);let u;return e[6]!==s?(u=H0(Ns,{enabledCollectionSlugs:s}),e[6]=s,e[7]=u):u=e[7],u};function Y0(t){let e=V0()||G0();if(J0(e)){let o=He(t),{focus:r}=e,n=r.getNode();W0(o),K0(n)&&!n.__first&&n.remove()}return!0}var Q0=M({nodes:[we],plugins:[{Component:Rs,position:"normal"}],slashMenu:{groups:[z([{Icon:Tr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:Tr,isActive:({selection:t})=>{if(!q0(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]}});import{c as Ps}from"react/compiler-runtime";import{jsx as ae,jsxs as L1}from"react/jsx-runtime";import{useLexicalComposerContext as N1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Bs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as y1,useThrottledEffect as R1,useTranslation as I1}from"@payloadcms/ui";import*as Ee from"react";import{useMemo as v1}from"react";import{c as e1}from"react/compiler-runtime";import{jsx as t1}from"react/jsx-runtime";import{mergeRegister as o1}from"@lexical/utils";import{$addUpdateTag as r1,$getSelection as n1}from"lexical";import{useDeferredValue as l1,useEffect as i1,useState as s1}from"react";var Is="toolbar-popup__button",$t=t=>{let e=e1(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=s1(l),d=l1(i),c=j(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Is}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Is,u,a,m].filter(Boolean),e[1]=u,e[2]=a,e[3]=m,e[4]=p):p=e[4];let f=p.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let b=n1();if(!b)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:b}):!1,A=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:b}):!0;s(I=>I.active===y&&I.enabled===A?I:{active:y,enabled:A})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,T=Wt(),E,S;e[9]!==r||e[10]!==T||e[11]!==x?(E=()=>{T(x);let b=()=>T(x),y=o1(r.registerUpdateListener(b));return document.addEventListener("mouseup",b),()=>{y(),document.removeEventListener("mouseup",b)}},S=[r,T,x],e[9]=r,e[10]=T,e[11]=x,e[12]=E,e[13]=S):(E=e[12],S=e[13]),i1(E,S);let _;e[14]!==i||e[15]!==r||e[16]!==n?(_=()=>{i.enabled&&r.focus(()=>{r.update(a1),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=_):_=e[17];let k=_,g=c1,C;return e[18]!==o||e[19]!==f||e[20]!==k||e[21]!==n.key?(C=t1("button",{className:f,"data-button-key":n.key,onClick:k,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=k,e[21]=n.key,e[22]=C):C=e[22],C};function a1(){r1("toolbar")}function c1(t){t.preventDefault()}import{c as g1}from"react/compiler-runtime";import{jsx as nt}from"react/jsx-runtime";import Fs,{useCallback as x1,useDeferredValue as C1,useEffect as b1,useMemo as k1}from"react";import{mergeRegister as _1}from"@lexical/utils";import{useTranslation as T1}from"@payloadcms/ui";import{$getSelection as w1}from"lexical";import{jsx as Ie,jsxs as vs}from"react/jsx-runtime";import{Button as u1}from"@payloadcms/ui";import{$addUpdateTag as d1,isDOMNode as m1}from"lexical";import ho,{useCallback as p1,useEffect as go,useMemo as Ds,useRef as Lr,useState as Nr}from"react";import{createPortal as f1}from"react-dom";var Ms="toolbar-popup__dropdown-item",As=ho.createContext(null);function $s({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let d=Ds(()=>[Ms,r===!1?"disabled":"",t?"active":"",l?.key?`${Ms}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Lr(null),u=ho.use(As);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return go(()=>{c?.current!=null&&a(c)},[c,a]),Ie(u1,{"aria-label":s,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{d1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function h1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Nr(),[i,s]=Nr(),d=p1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?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])},u=Ds(()=>({registerItem:d}),[d]);return go(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Ie(As,{value:u,children:Ie("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Os({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:d}){let c=Lr(null),u=Lr(null),[a,m]=Nr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};go(()=>{let h=u.current,x=c.current;if(a&&h!==null&&x!==null){let{left:T,top:E}=h.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;x.style.top=`${E+S+h.offsetHeight+5}px`,x.style.left=`${Math.min(T-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),go(()=>{let h=u.current;if(h!==null&&a){let x=T=>{let E=T.target;m1(E)&&(d&&c.current&&c.current.contains(E)||h.contains(E)||m(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,u,a,d]);let f=f1(Ie(h1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return vs(ho.Fragment,{children:[vs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:u,type:"button",children:[l&&Ie(l,{}),s&&Ie("span",{className:"toolbar-popup__dropdown-label",children:s}),Ie("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Ie(ho.Fragment,{children:f})]})}var yr="toolbar-popup__dropdown",E1=t=>{let e=g1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=T1(),{fieldProps:d}=j(),{featureClientSchemaMap:c,schemaPath:u}=d;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&nt(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==u){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=nt($s,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?nt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:nt("span",{className:"text",children:p})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=u,e[13]=a}else a=e[13];return a},S1=Fs.memo(E1),Ue=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:d})=>{let[c,u]=Fs.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=C1(c),m=j(),{items:p,key:f}=r,h=Wt(),x=x1(()=>{o.getEditorState().read(()=>{let E=w1();if(!E)return;let S=[],_=[],k=[];for(let g of p)g.isActive&&(!s||S.length<s)&&g.isActive({editor:o,editorConfigContext:m,selection:E})&&(S.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:E})&&k.push(g.key):k.push(g.key);u({activeItemKeys:S,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:E}):!0,enabledItemKeys:k}),d&&d({activeItems:_})})},[o,m,r,p,s,d]);b1(()=>(h(x),_1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let T=k1(()=>p?.length?p.map(E=>nt(S1,{active:a.activeItemKeys.includes(E.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(E.key),item:E},E.key)):null,[p,a,t,o]);return nt(Os,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[yr,`${yr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${yr}-items`,...l||[]],label:i,children:T},f)};function M1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ae(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ae($t,{editor:e,item:o,children:ae(o.ChildComponent,{})},o.key):null}function D1(t){let e=Ps(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=I1(),{fieldProps:d}=j(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Ee.useState(void 0),[p,f]=Ee.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Ee.useEffect(h,x);let T;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==u?(T=k=>{let{activeItems:g}=k;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let C=g[0],b=C.key;C.label&&(b=typeof C.label=="function"?C.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):C.label),b.length>25&&(b=b.substring(0,25)+"..."),g.length===1?(m(b),f(()=>C.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=u,e[12]=T):T=e[12];let E=T,S=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==E||e[21]!==S?(_=L1("div",{className:S,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?ae(Ue,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):ae(Ue,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):null,l.type==="buttons"&&l.items.length?l.items.map(k=>ae(M1,{anchorElem:o,editor:r,item:k},k.key)):null,i<n.features.toolbarFixed?.groups.length-1&&ae("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=E,e[21]=S,e[22]=_):_=e[22],_}function A1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ee.useRef(null),i=Bs(),{y:s}=y1(),d=v1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return R1(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,s]),ae("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:i&&ae(Ee.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>ae(D1,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var js=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return js(t.parentEditor)}return!1},Hs=t=>{let e=Ps(6),{clientProps:o}=t,[r]=N1(),n=j();if(!Bs())return null;let{editorConfig:i}=n,s=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==s||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=js(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=ae(A1,{anchorElem:document.body,editor:s,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=s,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var $1=M({plugins:[{Component:Hs,position:"aboveContainer"}]});import{c as Gs}from"react/compiler-runtime";import{jsx as me,jsxs as Vs}from"react/jsx-runtime";import{useLexicalComposerContext as O1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as F1}from"@lexical/react/useLexicalEditable";import{mergeRegister as Ks}from"@lexical/utils";import{$getSelection as Js,$isRangeSelection as Us,$isTextNode as P1,COMMAND_PRIORITY_LOW as B1,getDOMSelection as Xs,SELECTION_CHANGE_COMMAND as j1}from"lexical";import{useCallback as Co,useEffect as Ot,useRef as Ws,useState as H1}from"react";import*as bo from"react";import{createPortal as U1}from"react-dom";function Rr(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 xo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=d.top-a.height-c,h=d.left-l;i==="center"&&(h=d.left+d.width/2-a.width/2);let x=0;return!e&&f<p.top&&!s&&(x=a.height+d.height+c*2,f+=x),i==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+a.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 W1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&me(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?me($t,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function G1(t){let e=Gs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=j(),[s,d]=bo.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],bo.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let T=x[0];d(()=>T?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(f=Vs("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?me(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):me(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>me(W1,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&me("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function V1({anchorElem:t,editor:e}){let o=Ws(null),r=Ws(null),{editorConfig:n}=j(),l=Co(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),i=Co(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),s=Co(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ot(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let d=Co(()=>{let c=Js(),u=Xs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let f=Rr(u,p),h=xo({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&xo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Ot(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),Ot(()=>(e.getEditorState().read(()=>{d()}),Ks(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(j1,()=>(d(),!1),B1))),[e,d]),Vs("div",{className:"inline-toolbar-popup",ref:o,children:[me("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>me(G1,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function K1(t,e){let o=Gs(12),[r,n]=H1(!1),l=F1(),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Js(),f=Xs(t._window),h=t.getRootElement();if(f!==null&&(!Us(p)||h===null||!h.contains(f.anchorNode))){n(!1);return}if(!Us(p))return;if(p.getTextContent()!==""){let T=p.getNodes(),E=!1;for(let S of T)if(P1(S)){n(!0),E=!0;break}E||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let s=i,d,c;o[2]!==s?(d=()=>(document.addEventListener("selectionchange",s),document.addEventListener("mouseup",s),()=>{document.removeEventListener("selectionchange",s),document.removeEventListener("mouseup",s)}),c=[s],o[2]=s,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Ot(d,c);let u,a;if(o[5]!==t||o[6]!==s?(u=()=>Ks(t.registerUpdateListener(()=>{s()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,s],o[5]=t,o[6]=s,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Ot(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=U1(me(V1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var zs=t=>{let{anchorElem:e}=t,[o]=O1();return K1(o,e)};var J1=M({plugins:[{Component:zs,position:"floatingAnchorElem"}]});import{TableCellNode as Og,TableNode as Fg,TableRowNode as Pg}from"@lexical/table";import{jsx as Zs}from"react/jsx-runtime";import"react";var Ir=()=>Zs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Zs("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 X1,$createTableNode as z1,$createTableRowNode as Z1,$isTableCellNode as Ys,$isTableNode as vr,$isTableRowNode as Mr,TableCellHeaderStates as ko,TableCellNode as Y1,TableNode as q1,TableRowNode as Q1}from"@lexical/table";import{$isParagraphNode as eh,$isTextNode as th}from"lexical";var Qs=/^\|(.+)\|\s?$/,oh=/^(\| ?:?-*:? ?)+\|\s?$/,ea=({allTransformers:t})=>({type:"element",dependencies:[q1,Q1,Y1],export:e=>{if(!vr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Mr(r))continue;let l=!1;for(let i of r.getChildren())Ys(i)&&(n.push(Ut(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===ko.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
59
+ `)},regExp:Qs,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(oh.test(n)){let a=e.getPreviousSibling();if(!a||!vr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Mr(p))return;p.getChildren().forEach(f=>{Ys(f)&&f.setHeaderStyles(ko.ROW,ko.ROW)}),e.remove();return}let l=qs(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),d=l.length;for(;s&&!(!eh(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!th(a))break;let m=qs(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),i.unshift(m);let p=s.getPreviousSibling();s.remove(),s=p}let c=z1();for(let a of i){let m=Z1();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ta("",t))}let u=e.getPreviousSibling();vr(u)&&rh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function rh(t){let e=t.getFirstChild();return Mr(e)?e.getChildrenSize():0}var ta=(t,e)=>{t=t.replace(/\\n/g,`
60
+ `);let o=X1(ko.NO_STATUS);return Ht(t,e,o),o},qs=(t,e)=>{let o=t.match(Qs);return!o||!o[1]?null:o[1].split("|").map(r=>ta(r,e))};import{c as lh}from"react/compiler-runtime";import{jsx as P,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ih}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ra,$deleteTableColumnAtSelection as sh,$deleteTableRowAtSelection as ah,$getNodeTriplet as ch,$getTableCellNodeFromLexicalNode as na,$getTableColumnIndexFromTableCellNode as uh,$getTableNodeFromLexicalNodeOrThrow as Me,$getTableRowIndexFromTableCellNode as dh,$insertTableColumnAtSelection as mh,$insertTableRowAtSelection as ph,$isTableCellNode as sa,$isTableSelection as Ft,$mergeCells as fh,$unmergeCell as hh,getTableElement as Ar,getTableObserverFromTableElement as $r,TableCellHeaderStates as ve,TableCellNode as gh}from"@lexical/table";import{mergeRegister as xh}from"@lexical/utils";import{useScrollInfo as Ch}from"@payloadcms/ui";import{$getSelection as To,$isElementNode as bh,$isRangeSelection as Or,$isTextNode as kh,$setSelection as _h,COMMAND_PRIORITY_CRITICAL as Th,getDOMSelection as wh,isDOMNode as Eh,SELECTION_CHANGE_COMMAND as Sh}from"lexical";import*as Fr from"react";import{useCallback as ce,useEffect as lt,useRef as _o,useState as it}from"react";import{createPortal as aa}from"react-dom";import{jsx as Dr,jsxs as nh}from"react/jsx-runtime";import"react";var oa=()=>nh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Dr("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"}),Dr("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"}),Dr("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 la(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Lh(){let t=To();if(Or(t)&&!t.isCollapsed()||Ft(t)&&!t.anchor.is(t.focus)||!Or(t)&&!Ft(t))return!1;let[e]=ch(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Nh(t){let e=t.getLastDescendant();kh(e)?e.select():bh(e)?e.selectEnd():e!==null&&e.selectNext()}function yh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=ia(),i=_o(null),[s,d]=it(n),[c,u]=it({columns:1,rows:1}),[a,m]=it(!1),[p,f]=it(!1),{y:h}=Ch();lt(()=>l.registerMutationListener(gh,w=>{w.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{d(s.getLatest())})},{skipInitialization:!0}),[l,s]),lt(()=>{l.getEditorState().read(()=>{let w=To();if(Ft(w)){let N=la(w);u(la(w)),m(N.columns>1||N.rows>1)}f(Lh())})},[l]),lt(()=>{let w=e.current,N=i.current,R=l.getRootElement();if(w!=null&&N!=null&&R!=null){let $=R.getBoundingClientRect(),v=w.getBoundingClientRect();N.style.opacity="1";let O=N.getBoundingClientRect(),D=5,W=v.right+D;if(W+O.width>window.innerWidth||W+O.width>$.right){let J=v.left-O.width-D;W=(J<0?D:J)+window.pageXOffset}N.style.left=`${W+window.pageXOffset}px`;let q=v.top;if(q+O.height>window.innerHeight){let J=v.bottom-O.height;q=J<0?D:J}N.style.top=`${q}px`}},[e,i,l,h]),lt(()=>{function w(N){i.current!=null&&e.current!=null&&Eh(N.target)&&!i.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let x=ce(()=>{l.update(()=>{if(s.isAttached()){let w=Me(s),N=Ar(w,l.getElementByKey(w.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let R=$r(N);R!==null&&R.$clearHighlight(),w.markDirty(),d(s.getLatest())}_h(null)})},[l,s]),T=()=>{l.update(()=>{let w=To();if(!Ft(w))return;let R=w.getNodes().filter(sa),$=fh(R);$&&(Nh($),o())})},E=()=>{l.update(()=>{hh()})},S=ce(w=>{l.update(()=>{for(let N=0;N<c.rows;N++)ph(w);o()})},[l,o,c.rows]),_=ce(w=>{l.update(()=>{for(let N=0;N<c.columns;N++)mh(w);o()})},[l,o,c.columns]),k=ce(()=>{l.update(()=>{ah(),o()})},[l,o]),g=ce(()=>{l.update(()=>{Me(s).remove(),x(),o()})},[l,s,x,o]),C=ce(()=>{l.update(()=>{sh(),o()})},[l,o]),b=ce(()=>{l.update(()=>{let w=Me(s),N=dh(s),[R]=ra(w,null,null),$=new Set,v=s.getHeaderStyles()^ve.ROW;if(R[N])for(let O=0;O<R[N].length;O++){let D=R[N][O];D?.cell&&($.has(D.cell)||($.add(D.cell),D.cell.setHeaderStyles(v,ve.ROW)))}x(),o()})},[l,s,x,o]),y=ce(()=>{l.update(()=>{let w=Me(s),N=uh(s),[R]=ra(w,null,null),$=new Set,v=s.getHeaderStyles()^ve.COLUMN;if(R)for(let O=0;O<R.length;O++){let D=R?.[O]?.[N];D?.cell&&($.has(D.cell)||($.add(D.cell),D.cell.setHeaderStyles(v,ve.COLUMN)))}x(),o()})},[l,s,x,o]),A=ce(()=>{l.update(()=>{if(s.isAttached()){let w=Me(s);w&&w.setRowStriping(!w.getRowStriping())}x(),o()})},[l,s,x,o]),I=ce(()=>{l.update(()=>{if(s.isAttached()){let w=Me(s);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),L=null;return t&&(a?L=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(L=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),aa(Se("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:i,children:[L?Se(Fr.Fragment,{children:[L,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>A(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>I(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>S(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>S(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>_(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>_(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>b(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&ve.ROW)===ve.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&ve.COLUMN)===ve.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Rh({anchorElem:t,cellMerge:e}){let[o]=ia(),r=_o(null),n=_o(null),[l,i]=it(!1),[s,d]=it(null),c=ce(()=>{let a=r.current,m=To(),p=wh(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return h();let x=o.getRootElement(),T=null,E=null;if(Or(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=na(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return h();let k=Me(_),g=Ar(k,o.getElementByKey(k.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=$r(g),d(_)}else if(Ft(m)){let _=na(m.anchor.getNode());if(!sa(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=Me(_),g=Ar(k,o.getElementByKey(k.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=$r(g),E=o.getElementByKey(_.getKey())}else if(!f)return h();if(T===null||E===null)return h();let S=!T||!T.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let _=E.getBoundingClientRect(),k=t.getBoundingClientRect(),g=_.top-k.top,C=_.right-k.left;a.style.transform=`translate(${C}px, ${g}px)`}},[o,t]);lt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return xh(o.registerUpdateListener(p),o.registerCommand(Sh,p,Th),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=_o(s);return lt(()=>{u.current!==s&&i(!1),u.current=s},[u,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Se(Fr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(oa,{})}),l&&P(yh,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var ca=t=>{let e=lh(3),{anchorElem:o}=t,r=ih(),n;return e[0]!==o||e[1]!==r?(n=aa(r?P(Rh,{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 Ih}from"react/compiler-runtime";import{jsx as Eo,jsxs as vh}from"react/jsx-runtime";import{useLexicalComposerContext as Mh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Dh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Ah,$getTableNodeFromLexicalNodeOrThrow as Pr,$getTableRowIndexFromTableCellNode as $h,$isTableCellNode as ua,$isTableRowNode as Oh,getDOMCellFromTarget as Fh,getTableElement as Ph,TableNode as da}from"@lexical/table";import{calculateZoomLevel as ma,mergeRegister as Bh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Br,isHTMLElement as jh,SKIP_SCROLL_INTO_VIEW_TAG as pa}from"lexical";import*as ha from"react";import{useCallback as Pt,useEffect as jr,useRef as wo,useState as st}from"react";import{createPortal as Hh}from"react-dom";var Uh=33,fa=92;function Wh({editor:t}){let e=wo(null),o=wo(null),r=wo(null),[n,l]=st(!1),i=j(),s=wo(null),[d,c]=st(null),[u,a]=st(null),[m,p]=st(!1),[f,h]=st(null),x=Pt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),T=I=>(I.buttons&1)===1;jr(()=>{let I=new Set;return Bh(t.registerMutationListener(da,L=>{for(let[w,N]of L)N==="destroyed"?I.delete(w):I.add(w);l(I.size>0)}),t.registerNodeTransform(da,L=>{if(L.getColWidths())return L;let w=L.getColumnCount(),N=fa;return L.setColWidths(Array(w).fill(N)),L}))},[t]),jr(()=>{if(!n)return;let I=R=>{let $=R.target;if(jh($)){if(f){c({x:R.clientX,y:R.clientY});return}if(p(T(R)),!(o.current&&o.current.contains($))&&e.current!==$){e.current=$;let v=Fh($);v&&u!==v?t.getEditorState().read(()=>{let O=Br(v.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let D=Pr(O),W=Ph(D,t.getElementByKey(D.getKey()));if(!W)throw new Error("TableCellResizer: Table element not found.");e.current=$,r.current=W.getBoundingClientRect(),a(v)},{editor:t}):v==null&&x()}}},L=R=>{p(!0)},w=R=>{p(!1)},N=t.registerRootListener((R,$)=>{$?.removeEventListener("mousemove",I),$?.removeEventListener("mousedown",L),$?.removeEventListener("mouseup",w),R?.addEventListener("mousemove",I),R?.addEventListener("mousedown",L),R?.addEventListener("mouseup",w)});return()=>{N()}},[u,f,t,n,x]);let E=I=>I==="bottom",S=Pt(I=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Br(u.elem);if(!ua(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Pr(L),N=$h(L),R=w.getChildren(),v=L.getColSpan()===w.getColumnCount()?N:N+L.getRowSpan()-1;if(v>=R.length||v<0)throw new Error("Expected table cell to be inside of table row.");let O=R[v];if(!Oh(O))throw new Error("Expected table row");let D=O.getHeight();if(D===void 0){let q=O.getChildren();D=Math.min(...q.map(J=>_(J,t)??1/0))}let W=Math.max(D+I,Uh);O.setHeight(W)},{tag:pa})},[u,t]),_=(I,L)=>L.getElementByKey(I.getKey())?.clientHeight,k=(I,L)=>{let w;return L.forEach(N=>{N.forEach((R,$)=>{R.cell===I&&(w=$)})}),w},g=Pt(I=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Br(u.elem);if(!ua(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Pr(L),[N]=Ah(w,null,null),R=k(L,N);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");let $=w.getColWidths();if(!$)return;let v=$[R];if(v===void 0)return;let O=[...$],D=Math.max(v+I,fa);O[R]=D,w.setColWidths(O)},{tag:pa})},[u,t]),C=Pt(I=>{let L=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y:R}=s.current;if(u===null)return;let $=ma(w.target);if(E(I)){let v=(w.clientY-R)/$;S(v)}else{let v=(w.clientX-N)/$;g(v)}x(),document.removeEventListener("mouseup",L)}};return L},[u,x,g,S]),b=Pt(I=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");s.current={x:L.clientX,y:L.clientY},c(s.current),h(I),document.addEventListener("mouseup",C(I))},[u,C]),[y,A]=st({bottom:null,left:null,right:null,top:null});return jr(()=>{if(u){let{height:I,left:L,top:w,width:N}=u.elem.getBoundingClientRect(),R=ma(u.elem),$=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${$}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+w+I-$/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${I}px`,left:`${window.scrollX+L+N-$/2}px`,top:`${window.scrollY+w}px`,width:`${$}px`}},O=r.current;f&&d&&O&&(E(f)?(v[f].left=`${window.scrollX+O.left}px`,v[f].top=`${window.scrollY+d.y/R}px`,v[f].height="3px",v[f].width=`${O.width}px`):(v[f].top=`${window.scrollY+O.top}px`,v[f].left=`${window.scrollX+d.x/R}px`,v[f].width="3px",v[f].height=`${O.height}px`),v[f].backgroundColor="#adf"),A(v)}else A({bottom:null,left:null,right:null,top:null})},[u,f,d]),Eo("div",{ref:o,children:u!=null&&!m&&vh(ha.Fragment,{children:[Eo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:b("right"),style:y.right||void 0}),Eo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:b("bottom"),style:y.bottom||void 0})]})})}var ga=()=>{let t=Ih(3),[e]=Mh(),o=Dh(),r;return t[0]!==e||t[1]!==o?(r=o?Hh(Eo(Wh,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Yh}from"react/compiler-runtime";import{jsx as Hr,jsxs as qh,Fragment as Qh}from"react/jsx-runtime";import{useLexicalComposerContext as eg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ea}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as tg,$getTableColumnIndexFromTableCellNode as og,$getTableRowIndexFromTableCellNode as rg,$insertTableColumnAtSelection as ng,$insertTableRowAtSelection as lg,$isTableCellNode as ig,$isTableNode as ba,getTableElement as sg,TableNode as ag}from"@lexical/table";import{$findMatchingParent as cg,mergeRegister as ug}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ka,isHTMLElement as dg}from"lexical";import{useEffect as _a,useMemo as mg,useRef as Ta,useState as So}from"react";import"react";import{createPortal as pg}from"react-dom";import{c as Xh}from"react/compiler-runtime";import{useEffect as zh,useRef as Zh}from"react";var Gh="Expected a function",Vh=Math.max,Kh=Math.min;function Jh(t,e,o){let r,n,l=0,i,s=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(Gh);e=e||0,typeof o=="object"&&(s=!!o.leading,d="maxWait"in o,c=d?Vh(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let C=r,b=i;return r=i=void 0,l=g,u=t.apply(b,C),u}function f(g){return l=g,a=setTimeout(T,e),s?p(g):u}function h(g){let C=g-n,b=g-l,y=e-C;return d?Kh(y,c-b):y}function x(g){let C=g-n,b=g-l;return n===void 0||C>=e||C<0||d&&b>=c}function T(){let g=Date.now();if(x(g))return E(g);a=setTimeout(T,h(g))}function E(g){return a=void 0,m&&r?p(g):(r=i=void 0,u)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function _(){return a===void 0?u:E(Date.now())}function k(){let g=Date.now(),C=x(g);if(r=arguments,i=this,n=g,C){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(T,e),p(n)}return a===void 0&&(a=setTimeout(T,e)),u}return k.cancel=S,k.flush=_,k}var xa=Jh;function Ca(t,e,o){let r=Xh(6),n=Zh(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=xa(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),zh(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=s):s=r[5],s}var wa=20;function fg({anchorElem:t}){let[e]=eg(),o=Ea(),r=j(),[n,l]=So(!1),[i,s]=So(!1),[d,c]=So(!1),[u,a]=So({}),m=Ta(new Set),p=Ta(null),f=Ca(T=>{let{isOutside:E,tableDOMNode:S}=hg(T,r.editorConfig?.lexical);if(E){l(!1),s(!1);return}if(!S)return;p.current=S;let _=null,k=null,g=null;if(e.getEditorState().read(()=>{let v=ka(S);if(ig(v)){let O=cg(v,D=>ba(D));if(!ba(O))return;if(g=sg(O,e.getElementByKey(O.getKey())),g){let D=O.getChildrenSize(),W=O.getChildAtIndex(0)?.getChildrenSize(),q=rg(v),J=og(v);q===D-1?_=v:J===W-1&&(k=v)}}},{editor:e}),!g)return;let C=g.parentElement;if(!C)return;let{bottom:b,height:y,left:A,right:I,width:L,y:w}=g.getBoundingClientRect(),N=!1;C&&C.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(N=C.scrollWidth>C.clientWidth);let{left:R,y:$}=t.getBoundingClientRect();_?(s(!1),l(!0),a({height:wa,left:N&&C?C.offsetLeft:A-R,top:b-$+5,width:N&&C?C.offsetWidth:L})):k&&(s(!0),l(!1),a({height:y,left:I-R+5,top:w-$,width:wa}))},50,250),h=mg(()=>new ResizeObserver(()=>{l(!1),s(!1)}),[]);_a(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),s(!1),document.removeEventListener("mousemove",f)}},[d,f]),_a(()=>ug(e.registerMutationListener(ag,T=>{e.getEditorState().read(()=>{let E=!1;for(let[S,_]of T)switch(_){case"created":{m.current.add(S),E=!0;break}case"destroyed":{m.current.delete(S),E=!0;break}default:break}if(E){h.disconnect();for(let S of m.current){let{tableElement:_}=tg(S);h.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=T=>{e.update(()=>{p.current&&(ka(p.current)?.selectEnd(),T?(lg(),l(!1)):(ng(),s(!1)))})};return o?qh(Qh,{children:[n&&Hr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),i&&Hr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function hg(t,e){let o=t.target;if(dg(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Sa(t){let e=Yh(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Ea())return null;let l;return e[0]!==r?(l=pg(Hr(fg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as gg}from"react/compiler-runtime";import{jsx as Ur,jsxs as xg}from"react/jsx-runtime";import{useLexicalComposerContext as Cg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as bg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as kg,TableCellNode as _g,TableNode as Tg,TableRowNode as wg}from"@lexical/table";import{mergeRegister as Eg}from"@lexical/utils";import{formatDrawerSlug as Sg,useEditDepth as Lg}from"@payloadcms/ui";import{$getSelection as Ng,$isRangeSelection as yg,COMMAND_PRIORITY_EDITOR as Rg,createCommand as Ig}from"lexical";import{createContext as vg,use as Mg,useEffect as Dg,useMemo as Ag,useState as $g}from"react";import*as La from"react";var Lo=Ig("OPEN_EMBED_DRAWER_COMMAND"),Na=vg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ya({children:t}){let[e,o]=$g({cellEditorConfig:null,cellEditorPlugins:null});return Ur(Na,{value:Ag(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ra=()=>{let t=gg(16),[e]=Cg(),o=Mg(Na),r=Lg(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,d;t[0]!==r||t[1]!==s?(d=Sg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=he(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([Tg,wg,_g]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Eg(e.registerCommand(Lo,()=>{let h=null;return e.getEditorState().read(()=>{let x=Ng();yg(x)&&(h=x)}),h&&u(),!0},Rg))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],Dg(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(kg,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==p?(f=xg(La.Fragment,{children:[Ur(ft,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Ur(bg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var Bg=M({markdownTransformers:[ea],nodes:[Fg,Og,Pg],plugins:[{Component:Ra,position:"normal"},{Component:ga,position:"normal"},{Component:ca,position:"floatingAnchorElem"},{Component:Sa,position:"floatingAnchorElem"}],providers:[ya],slashMenu:{groups:[z([{Icon:Ir,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Lo,{})}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:Ir,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Lo,{})}}])]}});import{$isNodeSelection as kx}from"lexical";import{jsx as Wr,jsxs as jg}from"react/jsx-runtime";import"react";var Gr=()=>jg("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:[Wr("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"}),Wr("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"}),Wr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Aa}from"react/jsx-runtime";import $a from"bson-objectid";import{$applyNodeReplacement as Vg}from"lexical";import*as Oa from"react";import Hg from"bson-objectid";function No(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new Hg.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as Ug}from"@lexical/react/LexicalDecoratorBlockNode.js";import va from"bson-objectid";import{$applyNodeReplacement as Wg}from"lexical";var Bt=class extends Ug{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>No(o,Ia),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new va.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ia({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function Ia({data:t}){return t?.id||(t.id=new va.default().toHexString()),Wg(new Bt({data:t}))}import{jsx as Ma}from"react/jsx-runtime";import{ShimmerEffect as Gg}from"@payloadcms/ui";var Da=()=>Ma("div",{className:"lexical-upload",children:Ma(Gg,{height:"95px",width:"203px"})});var Kg=Oa.lazy(()=>import("./component-WT25HAJA.js").then(t=>({default:t.UploadComponent}))),le=class extends Bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>No(o,De),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new $a.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=De({data:o});return r.setFormat(e.format),r}decorate(){return this.__data.pending?Aa(Da,{}):Aa(Kg,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function De({data:t}){return t?.id||(t.id=new $a.default().toHexString()),Vg(new le({data:t}))}function at(t){return t instanceof le}import{c as ex}from"react/compiler-runtime";import{jsx as tx}from"react/jsx-runtime";import{useLexicalComposerContext as ox}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ja,$insertNodeToNearestRoot as Jr,mergeRegister as rx}from"@lexical/utils";import{useBulkUpload as nx,useEffectEvent as lx,useModal as ix}from"@payloadcms/ui";import Xr from"bson-objectid";import{$createRangeSelection as sx,$getPreviousSelection as Ua,$getSelection as Wa,$isParagraphNode as zr,$isRangeSelection as Ga,$setSelection as ax,COMMAND_PRIORITY_EDITOR as cx,COMMAND_PRIORITY_LOW as Va,createCommand as ux,DROP_COMMAND as dx,getDOMSelectionFromTarget as mx,isHTMLElement as Ka,PASTE_COMMAND as px}from"lexical";import{useEffect as fx}from"react";import{c as Fa}from"react/compiler-runtime";import{jsx as Vr}from"react/jsx-runtime";import{useLexicalComposerContext as Pa}from"@lexical/react/LexicalComposerContext.js";import{toast as Jg}from"@payloadcms/ui";import{$getNodeByKey as Xg,COMMAND_PRIORITY_EDITOR as Ba}from"lexical";import{useEffect as ja,useState as zg}from"react";var Zg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Xg(o);n&&n.replace(De({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Kr,{fields:null,relationTo:e,value:r})},Yg=t=>{let e=Fa(13),{enabledCollectionSlugs:o}=t,[r]=Pa(),[n,l]=zg(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:d,openListDrawer:c}=At(i),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Xe,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Ba),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),ja(u,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:T}=h;s(),Zg({editor:r,relationTo:x,replaceNodeKey:n,value:T.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==d||e[11]!==p?(f=Vr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},qg=()=>{let t=Fa(3),[e]=Pa(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Xe,Qg,Ba),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ja(o,r),null},Ha=({enabledCollectionSlugs:t})=>t?.length?Vr(Yg,{enabledCollectionSlugs:t}):Vr(qg,{});function Qg(){return Jg.error("No upload collections enabled"),!0}function hx(t){let e=t.target;return!!(Ka(e)&&!e.closest("code, span.editor-image")&&Ka(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function gx(t){let e,o=mx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Kr=ux("INSERT_UPLOAD_COMMAND"),Xa=t=>{let e=ex(21),{clientProps:o}=t,[r]=ox(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=fo(i),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=nx(),{isModalOpen:f,openModal:h}=ix(),x;e[3]!==d||e[4]!==r||e[5]!==s||e[6]!==f||e[7]!==h||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(x=k=>{let{files:g}=k;if(g?.length!==0&&(u(C=>[...C??[],...g.map(xx)]),!f(d))){if(!s.length||!s[0])return;c(s[0]),p(s),a(()=>{r.update(Cx)}),m(C=>{let b=new Map(C.map(bx));r.update(()=>{for(let y of Ja()){let A=y.node;if(at(A)){let I=A.getData();if(I?.pending){let L=b.get(I.pending?.formID);L&&A.replace(De({data:{id:new Xr.default().toHexString(),fields:{},relationTo:L.collectionSlug,value:L.doc.id}}))}}}})}),h(d)}},e[3]=d,e[4]=r,e[5]=s,e[6]=f,e[7]=h,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=x):x=e[13];let T=lx(x),E;e[14]!==r||e[15]!==T?(E=()=>{if(!r.hasNodes([le]))throw new Error("UploadPlugin: UploadNode not registered on editor");return rx(r.registerNodeTransform(le,k=>{let g=k.getData();if(!g?.pending)return;(async function(){let y=null,A=g?.pending?.src,I=g?.pending?.formID;if(A?.startsWith("data:")){let L=A.match(/data:(image\/[a-zA-Z]+);base64,/),w=L?L[1]:"image/png",N=A.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob(N),$=new Array(R.length);for(let D=0;D<R.length;D++)$[D]=R.charCodeAt(D);let v=new Uint8Array($);y={alt:void 0,file:new File([v],"pasted-image."+w?.split("/")[1],{type:w}),formID:I}}else if(A?.startsWith("http")||A?.startsWith("https")){let w=await(await fetch(A)).blob(),N=A.split("/").pop()||"pasted-image"+w.type.split("/")[1];y={alt:void 0,file:new File([w],N,{type:w.type}),formID:I}}y&&T({files:[y]})})()}),r.registerCommand(Kr,k=>(r.update(()=>{let g=Wa()||Ua();if(Ga(g)){let C=De({data:{id:k.id,fields:k.fields,relationTo:k.relationTo,value:k.value}}),{focus:b}=g,y=b.getNode();Jr(C),zr(y)&&!y.__first&&y.remove()}}),!0),cx),r.registerCommand(px,k=>{if(!(k instanceof ClipboardEvent))return!1;let g=k.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(b=>{C.push({alt:"",file:b,formID:new Xr.default().toHexString()})}),C.length?(r.update(()=>{let b=Wa()||Ua();if(Ga(b))for(let y of C){let A=new le({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:I}=b,L=I.getNode();Jr(A),zr(L)&&!L.__first&&L.remove()}}),T({files:C}),!0):!1},Va),r.registerCommand(dx,k=>{if(!(k instanceof DragEvent))return!1;let g=k.dataTransfer;if(!g?.types?.length)return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(b=>{C.push({alt:"",file:b,formID:new Xr.default().toHexString()})}),C.length?(k.preventDefault(),k.stopPropagation(),r.update(()=>{if(hx(k)){let b=gx(k),y=sx();b!=null&&y.applyDOMRange(b),ax(y);for(let A of C){let I=new le({data:{pending:{formID:A.formID,src:URL.createObjectURL(A.file)}}}),{focus:L}=y,w=L.getNode();Jr(I),zr(w)&&!w.__first&&w.remove()}}}),T({files:C}),!0):!1},Va))},e[14]=r,e[15]=T,e[16]=E):E=e[16];let S;e[17]!==r?(S=[r],e[17]=r,e[18]=S):S=e[18],fx(E,S);let _;return e[19]!==s?(_=tx(Ha,{enabledCollectionSlugs:s}),e[19]=s,e[20]=_):_=e[20],_};function xx(t){return{file:t.file,formID:t.formID}}function Cx(){for(let t of Ja()){let e=t.node;at(e)&&e.getData()?.pending&&e.remove()}}function bx(t){return[t.formID,t]}var _x=M({nodes:[le],plugins:[{Component:Xa,position:"normal"}],slashMenu:{groups:[z([{Icon:Gr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:Gr,isActive:({selection:t})=>{if(!kx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return at(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]}});import{c as wx}from"react/compiler-runtime";import{jsx as Yr}from"react/jsx-runtime";import{ShimmerEffect as Ex,useConfig as Sx}from"@payloadcms/ui";import{lazy as Lx,Suspense as Nx,useEffect as yx,useState as Rx}from"react";var za={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",hrSelected:"LexicalEditorTheme__hrSelected",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",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var yo={namespace:"lexical",theme:za};function Za({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let c of l.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,s.set(c.clientFeatureProps.featureKey,u),d++}return s}import{deepMerge as Tx}from"payload/shared";var Ya=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Tx(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Zr(t,e,o){return{admin:o,features:Ya(t),lexical:e,resolvedFeatureMap:t}}var Ix=Lx(()=>import("./Field-CJFETHA3.js").then(t=>({default:t.RichText}))),vx=t=>{let e=wx(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let u=c,a=s===void 0?yo:s,{config:m}=Sx(),[p,f]=Rx(null),h,x;e[2]!==u||e[3]!==r||e[4]!==m||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==p||e[9]!==a||e[10]!==d?(h=()=>{if(p)return;let E=[];for(let[k,g]of Object.entries(r))g.clientFeatureProvider&&E.push(g.clientFeatureProvider(g.clientFeatureProps));let S=a||yo,_=Za({config:m,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:d??i.name,unSanitizedEditorConfig:{features:E,lexical:S}});f(Zr(_,S,u))},x=[a,u,p,r,n,l,i,m,d],e[2]=u,e[3]=r,e[4]=m,e[5]=n,e[6]=l,e[7]=i,e[8]=p,e[9]=a,e[10]=d,e[11]=h,e[12]=x):(h=e[11],x=e[12]),yx(h,x);let T;return e[13]!==p||e[14]!==t?(T=Yr(Nx,{fallback:Yr(Ex,{height:"35vh"}),children:p&&Yr(Ix,{...t,editorConfig:p})}),e[13]=p,e[14]=t,e[15]=T):T=e[15],T};function Mx(t){return t instanceof HTMLElement}function Dx(...t){return t.filter(Boolean).join(" ")}var Ro=new WeakMap;function qa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Io(t,e){let o=Ro.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=qa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let d=qa(i);for(let c of r)d!==null&&c([d[0]-s[0],d[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Ro.set(t,o)}return o.listeners.add(e),()=>{Ax(t,e)}}function Ax(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 $x(t,e){return Io(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Ox(t,e){return Io(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Fx(t,e){return Io(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Px(t,e){return Io(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Bx}from"react/compiler-runtime";import{jsx as jx}from"react/jsx-runtime";import"react";var Hx=()=>{let t=Bx(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?jx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Ux}from"react/compiler-runtime";import{jsx as Wx}from"react/jsx-runtime";import"react";var Gx=()=>{let t=Ux(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?Wx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Vx}from"react/compiler-runtime";import{jsx as Kx}from"react/jsx-runtime";import"react";var Jx=()=>{let t=Vx(2),{Label:e}=ge(),o;return t[0]!==e?(o=e?Kx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Xx}from"react/compiler-runtime";import{jsx as zx}from"react/jsx-runtime";import"react";var Zx=t=>{let e=Xx(3),{children:o}=t,{InlineBlockContainer:r}=ge(),n;return e[0]!==r||e[1]!==o?(n=r?zx(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as Yx}from"react/jsx-runtime";import"react";var qx=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=xe();return r?Yx(r,{...o,children:e}):null};import{c as Qx}from"react/compiler-runtime";import{jsx as eC}from"react/jsx-runtime";import"react";var tC=()=>{let t=Qx(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?eC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as oC}from"react/compiler-runtime";import{jsx as rC}from"react/jsx-runtime";import"react";var nC=()=>{let t=oC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?rC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as lC}from"qs-esm";var iC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let d=lC({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var Qa={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
61
61
  `)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
62
62
  `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let r=o?.[1];return t.startsWith(`
63
63
  `)&&(t=t.slice(1)),t.endsWith(`
64
64
  `)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
65
- `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as iC}from"react/jsx-runtime";import{CodeField as sC,useFormFields as aC}from"@payloadcms/ui";import{useMemo as cC}from"react";var vo={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var uC=({autoComplete:t,field:e,forceRender:o,languages:r=vo,path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,typescript:c,validate:u})=>{let a=aC(([x])=>x.language),m=a?.value||a?.initialValue||"typescript",p=r[m],f=cC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?"file.tsx":void 0},language:m}}),[e,m]),h=`${e.name}-${m}-${p}`;return f&&iC(sC,{autoComplete:t,field:f,forceRender:o,onMount:(x,T)=>{T.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),T.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),T.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:T.languages.typescript.JsxEmit.React,moduleResolution:T.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:T.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),T.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>{c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async S=>{let k=await(await fetch(S.url)).text();T.languages.typescript.typescriptDefaults.addExtraLib(k,S.filePath)}))})()},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,validate:u},h)};import{jsx as oe,jsxs as sc}from"react/jsx-runtime";import{useLexicalEditable as xC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as CC,Combobox as bC,CopyToClipboard as kC,PopupList as _C,RenderFields as TC,useForm as wC,useFormFields as ac,useTranslation as EC}from"@payloadcms/ui";import SC from"react";import{jsx as ec}from"react/jsx-runtime";import"react";var tc=()=>ec("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:ec("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as rc}from"react/jsx-runtime";import"react";import{useCollapsible as mC}from"@payloadcms/ui";import{jsx as oc}from"react/jsx-runtime";import"react";var Mo=()=>oc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:oc("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var dC="code-block-collapse-button",nc=()=>{let{toggle:t}=mC();return rc("button",{className:dC,onClick:t,type:"button",children:rc(Mo,{})})};import{jsx as lc,jsxs as pC}from"react/jsx-runtime";import"react";import{useCollapsible as hC,useTranslation as gC}from"@payloadcms/ui";var fC="code-block-floating-collapse-button",ic=()=>{let{isCollapsed:t,toggle:e}=hC(),{t:o}=gC();return t?pC("button",{className:fC,onClick:e,type:"button",children:[lc("span",{children:o("general:collapse")}),lc(Mo,{})]}):null};var We="payload-richtext-code-block",LC=t=>{let{languages:e}=t,o=e||vo,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=xe(),{setModified:i}=wC(),{t:s}=EC(),{codeField:d}=ac(([f])=>({codeField:f?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=ac(([f,h])=>({selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),i(!0)}})),a=o[c?.value],m=xC(),p=SC.useMemo(()=>Object.entries(o).map(([f,h])=>({name:`${f} ${h}`,Component:oe(_C.Button,{active:!1,disabled:!1,onClick:()=>{u(f)},children:oe("span",{className:`${We}__language-code`,"data-language":f,children:h})})})),[o,u]);return oe(r,{Actions:sc("div",{className:`${We}__actions`,children:[oe(bC,{button:sc("div",{className:`${We}__language-selector-button`,"data-selected-language":c?.value,children:[oe("span",{children:a}),oe(CC,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:s("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),oe(kC,{value:d?.value??""}),oe(nc,{}),m&&oe(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:oe(ic,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:oe("div",{className:`${We}__pill`,children:oe(tc,{})}),children:oe(TC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as NC}from"react/compiler-runtime";import{jsx as ct}from"react/jsx-runtime";import{FieldContext as yC,FieldPathContext as cc,ServerFunctionsContext as uc,ShimmerEffect as RC,useServerFunctions as IC}from"@payloadcms/ui";import vC,{useEffect as MC,useRef as DC}from"react";var AC=t=>{let e=NC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:d}=t,[c,u]=vC.useState(null),a=IC(),{_internal_renderField:m}=a,[p,f]=i.split("."),h=l??(o&&"name"in o?o?.name:"")??"",x;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==i?(x=()=>{(async function(){let{Field:y}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});u(y)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=x):x=e[5];let T=x,E=DC(!1),S,_;if(e[6]!==T?(S=()=>{E.current||(E.current=!0,T())},_=[T],e[6]=T,e[7]=S,e[8]=_):(S=e[7],_=e[8]),MC(S,_),!c)return typeof n<"u"?n:ct(RC,{});let k={...a,getFormState:async C=>a.getFormState({...C,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof d>"u"&&!s)return ct(uc,{value:{...k},children:ct(cc,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:h,setValue:s??$C,showError:!1,value:d};return ct(uc,{value:{...k},children:ct(cc,{value:h,children:ct(yC,{value:g,children:c})},h)})};function $C(){}function OC({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{Et as $createAutoLinkNode,$e as $createBlockNode,mt as $createInlineBlockNode,be as $createLinkNode,He as $createRelationshipNode,De as $createUploadNode,_e as $isAutoLinkNode,Ae as $isBlockNode,pt as $isInlineBlockNode,K as $isLinkNode,wr as $isRelationshipNode,at as $isUploadNode,Ec as AlignFeatureClient,ke as AutoLinkNode,Yx as BlockCollapsible,eC as BlockEditButton,se as BlockNode,rC as BlockRemoveButton,Rc as BlockquoteFeatureClient,Ou as BlocksFeatureClient,ld as BoldFeatureClient,ne as CAN_USE_DOM,uf as ChecklistFeatureClient,LC as CodeBlockBlockComponent,uC as CodeComponent,e0 as DETAIL_TYPE_TO_DETAIL,Zf as DOUBLE_LINE_BREAK,d0 as DebugJsxConverterFeatureClient,o0 as ELEMENT_FORMAT_TO_TYPE,t0 as ELEMENT_TYPE_TO_FORMAT,xc as ENABLE_SLASH_MENU_COMMAND,pc as EditorConfigProvider,ft as FieldsDrawer,A1 as FixedToolbarFeatureClient,em as HeadingFeatureClient,Cm as HorizontalRuleFeatureClient,ze as INSERT_BLOCK_COMMAND,Ze as INSERT_INLINE_BLOCK_COMMAND,Xf as IS_ALL_FORMATTING,Am as IndentFeatureClient,zx as InlineBlockContainer,jx as InlineBlockEditButton,Kx as InlineBlockLabel,dt as InlineBlockNode,Wx as InlineBlockRemoveButton,ud as InlineCodeFeatureClient,K1 as InlineToolbarFeatureClient,fd as ItalicFeatureClient,qf as LTR_REGEX,Mf as LexicalPluginToLexicalFeatureClient,Xp as LinkFeatureClient,te as LinkNode,zf as NON_BREAKING_SPACE,F as NodeFormat,Cf as OrderedListFeatureClient,jf as ParagraphFeatureClient,hc as Point,Yf as RTL_REGEX,Cc as Rect,q0 as RelationshipFeatureClient,we as RelationshipNode,AC as RenderLexical,Ix as RichTextField,Pf as SlateToLexicalFeatureClient,bd as StrikethroughFeatureClient,wd as SubscriptFeatureClient,Nd as SuperscriptFeatureClient,r0 as TEXT_MODE_TO_TYPE,Qf as TEXT_TYPE_TO_FORMAT,n0 as TEXT_TYPE_TO_MODE,de as TOGGLE_LINK_COMMAND,Pg as TableFeatureClient,Zu as TestRecorderFeatureClient,Wd as TextStateFeatureClient,$t as ToolbarButton,Ue as ToolbarDropdown,td as TreeViewFeatureClient,Md as UnderlineFeatureClient,Lf as UnorderedListFeatureClient,kx as UploadFeatureClient,le as UploadNode,Fx as addSwipeDownListener,Ax as addSwipeLeftListener,$x as addSwipeRightListener,Ox as addSwipeUpListener,OC as buildEditorState,Qa as codeConverterClient,tr as createBlockNode,M as createClientFeature,m0 as defaultColors,yo as defaultEditorLexicalConfig,Rr as getDOMRangeRect,bc as getEnabledNodes,lC as getRestPopulateFn,Ye as getSelectedNode,vx as isHTMLElement,gc as isPoint,Mx as joinClasses,Zr as sanitizeClientEditorConfig,Ya as sanitizeClientFeatures,xo as setFloatingElemPosition,uo as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,Ce as toolbarAddDropdownGroupWithItems,rr as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,Q as toolbarTextDropdownGroupWithItems,xe as useBlockComponentContext,j as useEditorConfigContext,ge as useInlineBlockComponentContext,fc as useLexicalDocumentDrawer,he as useLexicalDrawer,At as useLexicalListDrawer};
65
+ `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as sC}from"react/jsx-runtime";import{CodeField as aC,useFormFields as cC}from"@payloadcms/ui";import{useMemo as uC}from"react";var vo={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var dC=({autoComplete:t,field:e,forceRender:o,languages:r=vo,path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,typescript:c,validate:u})=>{let a=cC(([x])=>x.language),m=a?.value||a?.initialValue||"typescript",p=r[m],f=uC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?"file.tsx":void 0},language:m}}),[e,m]),h=`${e.name}-${m}-${p}`;return f&&sC(aC,{autoComplete:t,field:f,forceRender:o,onMount:(x,T)=>{T.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),T.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),T.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:T.languages.typescript.JsxEmit.React,moduleResolution:T.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:T.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),T.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>{c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async S=>{let k=await(await fetch(S.url)).text();T.languages.typescript.typescriptDefaults.addExtraLib(k,S.filePath)}))})()},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,validate:u},h)};import{jsx as oe,jsxs as sc}from"react/jsx-runtime";import{useLexicalEditable as CC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as bC,Combobox as kC,CopyToClipboard as _C,PopupList as TC,RenderFields as wC,useForm as EC,useFormFields as ac,useTranslation as SC}from"@payloadcms/ui";import LC from"react";import{jsx as ec}from"react/jsx-runtime";import"react";var tc=()=>ec("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:ec("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as rc}from"react/jsx-runtime";import"react";import{useCollapsible as pC}from"@payloadcms/ui";import{jsx as oc}from"react/jsx-runtime";import"react";var Mo=()=>oc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:oc("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var mC="code-block-collapse-button",nc=()=>{let{toggle:t}=pC();return rc("button",{className:mC,onClick:t,type:"button",children:rc(Mo,{})})};import{jsx as lc,jsxs as fC}from"react/jsx-runtime";import"react";import{useCollapsible as gC,useTranslation as xC}from"@payloadcms/ui";var hC="code-block-floating-collapse-button",ic=()=>{let{isCollapsed:t,toggle:e}=gC(),{t:o}=xC();return t?fC("button",{className:hC,onClick:e,type:"button",children:[lc("span",{children:o("general:collapse")}),lc(Mo,{})]}):null};var We="payload-richtext-code-block",NC=t=>{let{languages:e}=t,o=e||vo,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=xe(),{setModified:i}=EC(),{t:s}=SC(),{codeField:d}=ac(([f])=>({codeField:f?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=ac(([f,h])=>({selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),i(!0)}})),a=o[c?.value],m=CC(),p=LC.useMemo(()=>Object.entries(o).map(([f,h])=>({name:`${f} ${h}`,Component:oe(TC.Button,{active:!1,disabled:!1,onClick:()=>{u(f)},children:oe("span",{className:`${We}__language-code`,"data-language":f,children:h})})})),[o,u]);return oe(r,{Actions:sc("div",{className:`${We}__actions`,children:[oe(kC,{button:sc("div",{className:`${We}__language-selector-button`,"data-selected-language":c?.value,children:[oe("span",{children:a}),oe(bC,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:s("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),oe(_C,{value:d?.value??""}),oe(nc,{}),m&&oe(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:oe(ic,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:oe("div",{className:`${We}__pill`,children:oe(tc,{})}),children:oe(wC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as yC}from"react/compiler-runtime";import{jsx as ct}from"react/jsx-runtime";import{FieldContext as RC,FieldPathContext as cc,ServerFunctionsContext as uc,ShimmerEffect as IC,useServerFunctions as vC}from"@payloadcms/ui";import MC,{useEffect as DC,useRef as AC}from"react";var $C=t=>{let e=yC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:d}=t,[c,u]=MC.useState(null),a=vC(),{_internal_renderField:m}=a,[p,f]=i.split("."),h=l??(o&&"name"in o?o?.name:"")??"",x;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==i?(x=()=>{(async function(){let{Field:y}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});u(y)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=x):x=e[5];let T=x,E=AC(!1),S,_;if(e[6]!==T?(S=()=>{E.current||(E.current=!0,T())},_=[T],e[6]=T,e[7]=S,e[8]=_):(S=e[7],_=e[8]),DC(S,_),!c)return typeof n<"u"?n:ct(IC,{});let k={...a,getFormState:async C=>a.getFormState({...C,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof d>"u"&&!s)return ct(uc,{value:{...k},children:ct(cc,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:h,setValue:s??OC,showError:!1,value:d};return ct(uc,{value:{...k},children:ct(cc,{value:h,children:ct(RC,{value:g,children:c})},h)})};function OC(){}function dc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}var FC=dc;export{Et as $createAutoLinkNode,$e as $createBlockNode,mt as $createInlineBlockNode,be as $createLinkNode,He as $createRelationshipNode,De as $createUploadNode,_e as $isAutoLinkNode,Ae as $isBlockNode,pt as $isInlineBlockNode,K as $isLinkNode,wr as $isRelationshipNode,at as $isUploadNode,Sc as AlignFeatureClient,ke as AutoLinkNode,qx as BlockCollapsible,tC as BlockEditButton,se as BlockNode,nC as BlockRemoveButton,Ic as BlockquoteFeatureClient,Fu as BlocksFeatureClient,id as BoldFeatureClient,ne as CAN_USE_DOM,df as ChecklistFeatureClient,NC as CodeBlockBlockComponent,dC as CodeComponent,t0 as DETAIL_TYPE_TO_DETAIL,Yf as DOUBLE_LINE_BREAK,m0 as DebugJsxConverterFeatureClient,r0 as ELEMENT_FORMAT_TO_TYPE,o0 as ELEMENT_TYPE_TO_FORMAT,Cc as ENABLE_SLASH_MENU_COMMAND,fc as EditorConfigProvider,ft as FieldsDrawer,$1 as FixedToolbarFeatureClient,tm as HeadingFeatureClient,bm as HorizontalRuleFeatureClient,ze as INSERT_BLOCK_COMMAND,Ze as INSERT_INLINE_BLOCK_COMMAND,zf as IS_ALL_FORMATTING,$m as IndentFeatureClient,Zx as InlineBlockContainer,Hx as InlineBlockEditButton,Jx as InlineBlockLabel,dt as InlineBlockNode,Gx as InlineBlockRemoveButton,dd as InlineCodeFeatureClient,J1 as InlineToolbarFeatureClient,hd as ItalicFeatureClient,Qf as LTR_REGEX,Df as LexicalPluginToLexicalFeatureClient,zp as LinkFeatureClient,te as LinkNode,Zf as NON_BREAKING_SPACE,F as NodeFormat,bf as OrderedListFeatureClient,Hf as ParagraphFeatureClient,gc as Point,qf as RTL_REGEX,bc as Rect,Q0 as RelationshipFeatureClient,we as RelationshipNode,$C as RenderLexical,vx as RichTextField,Bf as SlateToLexicalFeatureClient,kd as StrikethroughFeatureClient,Ed as SubscriptFeatureClient,yd as SuperscriptFeatureClient,n0 as TEXT_MODE_TO_TYPE,e0 as TEXT_TYPE_TO_FORMAT,l0 as TEXT_TYPE_TO_MODE,de as TOGGLE_LINK_COMMAND,Bg as TableFeatureClient,Yu as TestRecorderFeatureClient,Gd as TextStateFeatureClient,$t as ToolbarButton,Ue as ToolbarDropdown,od as TreeViewFeatureClient,Dd as UnderlineFeatureClient,Nf as UnorderedListFeatureClient,_x as UploadFeatureClient,le as UploadNode,Px as addSwipeDownListener,$x as addSwipeLeftListener,Ox as addSwipeRightListener,Fx as addSwipeUpListener,FC as buildDefaultEditorState,dc as buildEditorState,Qa as codeConverterClient,tr as createBlockNode,M as createClientFeature,p0 as defaultColors,yo as defaultEditorLexicalConfig,Rr as getDOMRangeRect,kc as getEnabledNodes,iC as getRestPopulateFn,Ye as getSelectedNode,Mx as isHTMLElement,xc as isPoint,Dx as joinClasses,Zr as sanitizeClientEditorConfig,Ya as sanitizeClientFeatures,xo as setFloatingElemPosition,uo as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,Ce as toolbarAddDropdownGroupWithItems,rr as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,Q as toolbarTextDropdownGroupWithItems,xe as useBlockComponentContext,j as useEditorConfigContext,ge as useInlineBlockComponentContext,hc as useLexicalDocumentDrawer,he as useLexicalDrawer,At as useLexicalListDrawer};
66
66
  //# sourceMappingURL=index.js.map