@payloadcms/richtext-lexical 3.0.1-canary.34c6cc0 → 3.0.1-canary.c98d392

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 (28) hide show
  1. package/dist/exports/client/{Component-MBLHTKDK.js → Component-6GHP74S6.js} +1 -1
  2. package/dist/exports/client/{Component-MBLHTKDK.js.map → Component-6GHP74S6.js.map} +1 -1
  3. package/dist/exports/client/{Component-DOSSWC76.js → Component-N526MGPV.js} +1 -1
  4. package/dist/exports/client/Component-N526MGPV.js.map +7 -0
  5. package/dist/exports/client/index.js +1 -1
  6. package/dist/exports/client/index.js.map +2 -2
  7. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts +1 -1
  8. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts.map +1 -1
  9. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  10. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -4
  11. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  12. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  13. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/types.d.ts +5 -0
  14. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/types.d.ts.map +1 -0
  15. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/types.js +2 -0
  16. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/types.js.map +1 -0
  17. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts +1 -1
  18. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts.map +1 -1
  19. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  20. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -4
  21. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  22. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  23. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/types.d.ts +5 -0
  24. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/types.d.ts.map +1 -0
  25. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/types.js +2 -0
  26. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/types.js.map +1 -0
  27. package/package.json +7 -7
  28. package/dist/exports/client/Component-DOSSWC76.js.map +0 -7
@@ -1,2 +1,2 @@
1
1
  "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import"react";var a=n=>{let{data:o}=n;return t("div",{children:["Unknown converted payload-plugin-lexical node: ",e("strong",{children:o?.nodeType})]})};export{a as UnknownConvertedNodeComponent};
2
- //# sourceMappingURL=Component-MBLHTKDK.js.map
2
+ //# sourceMappingURL=Component-6GHP74S6.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.tsx"],
4
- "sourcesContent": ["'use client'\nimport React from 'react'\n\nimport type { UnknownConvertedNodeData } from './index.js'\n\nimport './index.scss'\n\ntype Props = {\n data: UnknownConvertedNodeData\n}\n\nexport const UnknownConvertedNodeComponent: React.FC<Props> = (props) => {\n const { data } = props\n\n return (\n <div>\n Unknown converted payload-plugin-lexical node: <strong>{data?.nodeType}</strong>\n </div>\n )\n}\n"],
4
+ "sourcesContent": ["'use client'\nimport React from 'react'\n\nimport './index.scss'\n\nimport type { UnknownConvertedNodeData } from './types.js'\n\ntype Props = {\n data: UnknownConvertedNodeData\n}\n\nexport const UnknownConvertedNodeComponent: React.FC<Props> = (props) => {\n const { data } = props\n\n return (\n <div>\n Unknown converted payload-plugin-lexical node: <strong>{data?.nodeType}</strong>\n </div>\n )\n}\n"],
5
5
  "mappings": "+DACA,MAAkB,QAUX,IAAMA,EAAkDC,GAAA,CAC7D,GAAM,CAAEC,KAAAA,CAAI,EAAKD,EAEjB,OACEE,EAAC,MAAA,WAAI,kDAC4CC,EAAC,SAAA,UAAQF,GAAMG,aAGpE",
6
6
  "names": ["UnknownConvertedNodeComponent", "props", "data", "_jsxs", "_jsx", "nodeType"]
7
7
  }
@@ -1,2 +1,2 @@
1
1
  "use client";import{jsx as o,jsxs as t}from"react/jsx-runtime";import"react";var c=n=>{let{data:e}=n;return t("div",{children:["Unknown converted Slate node: ",o("strong",{children:e?.nodeType})]})};export{c as UnknownConvertedNodeComponent};
2
- //# sourceMappingURL=Component-DOSSWC76.js.map
2
+ //# sourceMappingURL=Component-N526MGPV.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.tsx"],
4
+ "sourcesContent": ["'use client'\nimport React from 'react'\n\nimport './index.scss'\nimport type { UnknownConvertedNodeData } from './types.js'\n\ntype Props = {\n data: UnknownConvertedNodeData\n}\n\nexport const UnknownConvertedNodeComponent: React.FC<Props> = (props) => {\n const { data } = props\n\n return (\n <div>\n Unknown converted Slate node: <strong>{data?.nodeType}</strong>\n </div>\n )\n}\n"],
5
+ "mappings": "+DACA,MAAkB,QASX,IAAMA,EAAkDC,GAAA,CAC7D,GAAM,CAAEC,KAAAA,CAAI,EAAKD,EAEjB,OACEE,EAAC,MAAA,WAAI,iCAC2BC,EAAC,SAAA,UAAQF,GAAMG,aAGnD",
6
+ "names": ["UnknownConvertedNodeComponent", "props", "data", "_jsxs", "_jsx", "nodeType"]
7
+ }
@@ -32,7 +32,7 @@ ${e.map(Ta).join(`
32
32
  });
33
33
  });
34
34
  `},[t,e]),p=Ne((C,w)=>{o(x=>{let N=e.length-1,S=e[N];if(S&&S.name===C){if(C==="type")return[...e.slice(0,N),{...S,value:S.value+w}];if(S.value===w)return[...e.slice(0,N),{...S,count:S.count+1}]}return[...x,{name:C,count:1,value:w}]})},[e,o]);Pr(()=>{let C=x=>{if(!r)return;let N=x.key;wa(x)?p("selectAll",""):Hr.has(N)?p("press",x.key):[...N].length>1?p("keydown",x.key):p("type",x.key)},w=x=>{if(!r)return;let N=x.key;!Hr.has(N)&&[...N].length>1&&p("keyup",x.key)};return t.registerRootListener((x,N)=>{N!==null&&(N.removeEventListener("keydown",C),N.removeEventListener("keyup",w)),x!==null&&(x.addEventListener("keydown",C),x.addEventListener("keyup",w))})},[t,r,p]),Pr(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),Co(()=>{if(e){let C=m();C!==null&&s(C),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),Co(()=>t.registerUpdateListener(({dirtyElements:w,dirtyLeaves:x,editorState:N})=>{if(!r)return;let S=N._selection,E=a.current,k=d.current;if(E!==S){if(x.size===0&&w.size===0&&!k){let b=window.getSelection();if(b&&(b.anchorNode==null||b.focusNode==null))return}a.current=S}d.current=!1;let I=m();I!==null&&s(I)}),[t,m,r,p]),Co(()=>r?t.registerUpdateListener(()=>{let w=t.getRootElement();w!==null&&i(w?.innerHTML)}):void 0,[t,r]);let f=Ne(C=>{r||(C.update(()=>{let w=xa();w.clear();let x=Ca();w.append(ga().append(x)),x.select()}),o([])),n(w=>!w)},[r]),h=Ne(()=>{if(!r)return;let C=window.getSelection();if(C===null||C.anchorNode==null||C.focusNode==null)return;let{anchorNode:w,anchorOffset:x,focusNode:N,focusOffset:S}=Ea(C),E=u().getRootElement(),k;w!==null&&(k=Br(w,E));let I;N!==null&&(I=Br(N,E)),p("snapshot",{anchorNode:w,anchorOffset:x,anchorPath:k,focusNode:N,focusOffset:S,focusPath:I})},[p,r,u]),g=Ne(()=>{ba(m())},[m]),T=Ne(()=>{_a("test.js",m())},[m]);return[ke("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:C=>{f(u()),C.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?bo("div",{className:"test-recorder-output",children:[bo("div",{className:"test-recorder-toolbar",children:[ke("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:C=>{h(),C.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ke("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:C=>{g(),C.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ke("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:C=>{T(),C.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ke("pre",{id:"test-recorder",ref:c,children:l})]}):null]}var Gr=()=>{let t=fa(3),[e]=ha(),[o,r]=Na(e),n;return t[0]!==o||t[1]!==r?(n=bo(jr.Fragment,{children:[ke("p",{children:"HI"}),o,r,ke("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var ka=y({plugins:[{Component:Gr,position:"bottom"}]});import{c as La}from"react/compiler-runtime";import{jsx as Ia}from"react/jsx-runtime";import{useLexicalComposerContext as Sa}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ra}from"@lexical/react/LexicalTreeView.js";import"react";var Wr=()=>{let t=La(2),[e]=Sa(),o;return t[0]!==e?(o=Ia(Ra,{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 ya=y({plugins:[{Component:Wr,position:"bottom"}]});import{$isTableSelection as va}from"@lexical/table";import{$isRangeSelection as Ma,FORMAT_TEXT_COMMAND as Da}from"lexical";import{jsx as Ur}from"react/jsx-runtime";import"react";var Vr=()=>Ur("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:Ur("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 Kr={type:"text-format",format:["bold","italic"],tag:"***"},zr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Zr={type:"text-format",format:["bold"],tag:"**"},Yr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Xr=[Z([{ChildComponent:Vr,isActive:({selection:t})=>Ma(t)||va(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Da,"bold")},order:1}])],Aa=y(({featureProviderMap:t})=>{let e=[Zr,Yr];return t.get("italic")&&e.push(zr,Kr),{markdownTransformers:e,toolbarFixed:{groups:Xr},toolbarInline:{groups:Xr}}});import{$isTableSelection as Fa}from"@lexical/table";import{$isRangeSelection as $a,FORMAT_TEXT_COMMAND as Pa}from"lexical";import{jsx as Jr,jsxs as Oa}from"react/jsx-runtime";import"react";var qr=()=>Oa("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:[Jr("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Jr("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Qr={type:"text-format",format:["code"],tag:"`"};var en=[Z([{ChildComponent:qr,isActive:({selection:t})=>$a(t)||Fa(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Pa,"code")},order:7}])],Ba=y({markdownTransformers:[Qr],toolbarFixed:{groups:en},toolbarInline:{groups:en}});import{$isTableSelection as Ha}from"@lexical/table";import{$isRangeSelection as ja,FORMAT_TEXT_COMMAND as Ga}from"lexical";import{jsx as tn}from"react/jsx-runtime";import"react";var on=()=>tn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:tn("path",{d:"M11.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 rn={type:"text-format",format:["italic"],tag:"*"},nn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var ln=[Z([{ChildComponent:on,isActive:({selection:t})=>ja(t)||Ha(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Ga,"italic")},order:2}])],Wa=y({markdownTransformers:[rn,nn],toolbarFixed:{groups:ln},toolbarInline:{groups:ln}});import{$isTableSelection as Va}from"@lexical/table";import{$isRangeSelection as Ka,FORMAT_TEXT_COMMAND as za}from"lexical";import{jsx as sn,jsxs as Ua}from"react/jsx-runtime";import"react";var an=()=>Ua("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[sn("path",{d:"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"}),sn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var cn={type:"text-format",format:["strikethrough"],tag:"~~"};var un=[Z([{ChildComponent:an,isActive:({selection:t})=>Ka(t)||Va(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(za,"strikethrough")},order:4}])],Za=y({markdownTransformers:[cn],toolbarFixed:{groups:un},toolbarInline:{groups:un}});import{$isTableSelection as Ya}from"@lexical/table";import{$isRangeSelection as Xa,FORMAT_TEXT_COMMAND as Ja}from"lexical";import{jsx as dn}from"react/jsx-runtime";import"react";var mn=()=>dn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dn("path",{d:"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 pn=[Z([{ChildComponent:mn,isActive:({selection:t})=>Xa(t)||Ya(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Ja,"subscript")},order:5}])],qa=y({toolbarFixed:{groups:pn},toolbarInline:{groups:pn}});import{$isTableSelection as Qa}from"@lexical/table";import{$isRangeSelection as ec,FORMAT_TEXT_COMMAND as tc}from"lexical";import{jsx as fn}from"react/jsx-runtime";import"react";var hn=()=>fn("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:fn("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 gn=[Z([{ChildComponent:hn,isActive:({selection:t})=>ec(t)||Qa(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(tc,"superscript")},order:6}])],oc=y({toolbarFixed:{groups:gn},toolbarInline:{groups:gn}});import{$isTableSelection as nc}from"@lexical/table";import{$isRangeSelection as ic,FORMAT_TEXT_COMMAND as lc}from"lexical";import{jsx as Cn,jsxs as rc}from"react/jsx-runtime";import"react";var xn=()=>rc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Cn("path",{d:"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"}),Cn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var bn=[Z([{ChildComponent:xn,isActive:({selection:t})=>ic(t)||nc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(lc,"underline")},order:3}])],sc=y({toolbarFixed:{groups:bn},toolbarInline:{groups:bn}});import{$createHeadingNode as dc,$isHeadingNode as Dn,HeadingNode as mc}from"@lexical/rich-text";import{$setBlocksType as pc}from"@lexical/selection";import{$getSelection as fc,$isRangeSelection as hc}from"lexical";import{jsx as _n}from"react/jsx-runtime";import"react";var Tn=()=>_n("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_n("path",{d:"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 wn}from"react/jsx-runtime";import"react";var En=()=>wn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:wn("path",{d:"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 Nn}from"react/jsx-runtime";import"react";var kn=()=>Nn("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:Nn("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 Ln}from"react/jsx-runtime";import"react";var In=()=>Ln("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:Ln("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 Sn}from"react/jsx-runtime";import"react";var Rn=()=>Sn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Sn("path",{d:"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 yn}from"react/jsx-runtime";import"react";var vn=()=>yn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yn("path",{d:"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 ac,$isHeadingNode as cc,HeadingNode as uc}from"@lexical/rich-text";var _o=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Mn=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[uc],export:(n,i)=>{if(!cc(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:_o(n=>{let i="h"+n[1].length;return ac(i)})}};var An=t=>{let e=fc();pc(e,()=>dc(t))},On={h1:Tn,h2:En,h3:kn,h4:In,h5:Rn,h6:vn},gc=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[J(e.map((r,n)=>({ChildComponent:On[r],isActive:({selection:i})=>{if(!hc(i))return!1;for(let l of i.getNodes()){if(Dn(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(Dn(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{An(r)})},order:n+2})))];return{markdownTransformers:[Mn(e)],nodes:[mc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[K(e.map(r=>({Icon:On[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(()=>{An(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as kc}from"lexical";import{jsx as Fn}from"react/jsx-runtime";import"react";var To=()=>Fn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Fn("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as $n,jsxs as Cc}from"react/jsx-runtime";import"react";var Pn=()=>Cc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$n("path",{d:"M5 10h10",stroke:"currentColor"}),$n("path",{d:"M10 15V5",stroke:"currentColor"})]});var ue=t=>({type:"dropdown",ChildComponent:Pn,items:t,key:"add",order:10});var Bn={type:"element",dependencies:[mt],export:(t,e)=>ft(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=pt();e&&t.replace(e)}};import{c as xc}from"react/compiler-runtime";import{useLexicalComposerContext as bc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as _c}from"@lexical/utils";import{$getSelection as Tc,$isRangeSelection as wc,COMMAND_PRIORITY_EDITOR as Ec}from"lexical";import{useEffect as Nc}from"react";var Hn=()=>{let t=xc(3),[e]=bc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(je,n=>{let i=Tc();if(!wc(i))return!1;if(i.focus.getNode()!==null){let s=pt();_c(s)}return!0},Ec),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Nc(o,r),null};var Lc=y({markdownTransformers:[Bn],nodes:[mt],plugins:[{Component:Hn,position:"normal"}],slashMenu:{groups:[K([{Icon:To,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,void 0)}}])]},toolbarFixed:{groups:[ue([{ChildComponent:To,isActive:({selection:t})=>{if(!kc(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ft(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as Rc,OUTDENT_CONTENT_COMMAND as yc}from"lexical";import{jsx as It,jsxs as Ic}from"react/jsx-runtime";import"react";var jn=()=>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:[It("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),It("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),It("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),It("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as St,jsxs as Sc}from"react/jsx-runtime";import"react";var Gn=()=>Sc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[St("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var Wn=t=>({type:"buttons",items:t,key:"indent",order:35});var Un=[Wn([{ChildComponent:jn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(yc,void 0)},order:1},{ChildComponent:Gn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Rc,void 0)},order:2}])],vc=y({toolbarFixed:{groups:Un},toolbarInline:{groups:Un}});import{$findMatchingParent as Gu}from"@lexical/utils";import{$getSelection as Ro,$isRangeSelection as Ti}from"lexical";import{jsx as Vn}from"react/jsx-runtime";import"react";var Kn=()=>Vn("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:Vn("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 zn}from"@lexical/selection";function De(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?zn(o)?r:n:zn(e)?r:n}var wo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Gc,$isTextNode as Wc}from"lexical";import{addClassNamesToElement as Mc,isHTMLAnchorElement as Dc}from"@lexical/utils";import ko from"bson-objectid";import{$applyNodeReplacement as Ac,$createTextNode as Zn,$getSelection as Oc,$isElementNode as Yn,$isRangeSelection as No,createCommand as Fc,ElementNode as $c}from"lexical";var Pc=new Set(["http:","https:","mailto:","sms:","tel:"]),q=class t extends $c{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Bc,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new ko.default().toHexString(),e.version=3);let o=de({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Eo(o.rel,"add","noopener")),Mc(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,r){if(!No(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Yn(r)){let n=de({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Pc.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,r){let n=this.__fields?.url,i=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Eo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Eo(o.rel,"remove","noopener"))),!1}};function Bc(t){let e=null;if(Dc(t)){let o=t.textContent;o!==null&&o!==""&&(e=de({id:new ko.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function de({id:t,fields:e}){return Ac(new q({id:t??new ko.default().toHexString(),fields:e}))}function V(t){return t instanceof q}var ie=Fc("TOGGLE_LINK_COMMAND");function Xn(t){let e=Oc();if(!No(e)&&!t.selectedNodes?.length)return;let o=No(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(r=>{let n=r.getParent();if(V(n)){let i=n.getChildren();for(let l=0;l<i.length;l+=1)n.insertBefore(i[l]);n.remove()}});else{if(o?.length===1){let i=o[0],l=V(i)?i:Hc(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Zn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||Yn(i)&&!i.isInline())){if(V(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Zn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=de({fields:t.fields}),V(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),V(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)n.append(s[a])}i.remove();return}n!==null&&n.append(i)}})}}function Hc(t){return jc(t,e=>V(e))}function jc(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Eo(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var Jn={type:"text-match",dependencies:[q],export:(t,e,o)=>{if(!V(t))return null;let r=t,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&Wc(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=de({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Gc(o);i.setFormat(t.getFormat()),n.append(i),t.replace(n)},trigger:")"};import{$applyNodeReplacement as Uc,$isElementNode as Vc}from"lexical";var me=class t extends q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=et({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Vc(r)){let n=et({fields:this.__fields});return r.append(n),n}return null}};function et({fields:t}){return Uc(new me({id:"",fields:t}))}function pe(t){return t instanceof me}import{c as Kc}from"react/compiler-runtime";import{useLexicalComposerContext as zc}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Zc}from"@lexical/utils";import{$createTextNode as qn,$getSelection as Yc,$isElementNode as ei,$isLineBreakNode as ti,$isNodeSelection as Xc,$isRangeSelection as Jc,$isTextNode as tt,TextNode as qc}from"lexical";import{useEffect as Qc}from"react";function Qn(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 oi(t,e){for(let o=0;o<e.length;o++){let r=e[o](t);if(r!=null)return r}return null}var eu=/[.,;\s]/;function yt(t){return eu.test(t)}function ri(t){return yt(t[t.length-1])}function Io(t){return yt(t[0])}function tu(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function ni(t){let e=t.getPreviousSibling();return ei(e)&&(e=e.getLastDescendant()),e===null||ti(e)||tt(e)&&ri(e.getTextContent())}function ii(t){let e=t.getNextSibling();return ei(e)&&(e=e.getFirstDescendant()),e===null||ti(e)||tt(e)&&Io(e.getTextContent())}function ou(t,e,o,r){return(t>0?yt(o[t-1]):ni(r[0]))?e<o.length?yt(o[e]):ii(r[r.length-1]):!1}function ru(t,e,o){let r=[],n=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let d=a[0],u=d.getTextContent().length,m=s;s+u<=e?(r.push(d),l+=u):m>=o?i.push(d):n.push(d),s+=u,a.shift()}return[l,r,n,i]}function nu(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=et({fields:n});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=qn(r.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let d=[],c;for(let f=1;f<t.length;f++){let h=t[f],T=h.getTextContent().length,M=s,A=s+T;if(M<o)if(A<=o)d.push(h);else{let[C,w]=h.splitText(o-M);d.push(C),c=w}s+=T}let u=Yc(),m=u?u.getNodes().find(tt):void 0,p=qn(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...d),m&&m===a&&(Jc(u)?p.select(u.anchor.offset,u.focus.offset):Xc(u)&&p.select(0,p.getTextContent().length)),a.replace(i),c}}function iu(t,e,o){let r=[...t],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=oi(i,e))!=null&&l!==null;){let a=l.index,d=l.length,c=a+d;if(ou(s+a,s+c,n,r)){let[m,,p,f]=ru(r,s+a,s+c),h=s+a-m,g=s+c-m,T=nu(p,h,g,l);r=T?[T,...f]:f,o(l.url,null),s=0}else s+=c;i=i.substring(c)}}function Lo(t,e,o){let r=t.getChildren(),n=r.length;for(let a=0;a<n;a++){let d=r[a];if(!tt(d)||!d.isSimpleText()){Rt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=oi(i,e);if(l===null||l.text!==i){Rt(t),o(null,t.getFields()?.url??null);return}if(!ni(t)||!ii(t)){Rt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function lu(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(pe(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:"):!1;(!Io(i)||tu(i,l))&&(r.append(t),Lo(r,e,o),o(null,r.getFields()?.url??null))}pe(n)&&!ri(i)&&(Rt(n),Lo(n,e,o),o(null,n.getFields()?.url??null))}function Rt(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 su(t){let e=[t],o=t.getNextSibling();for(;o!==null&&tt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function au(t,e,o){let r=Kc(5),n,i;r[0]!==t||r[1]!==o||r[2]!==e?(n=()=>{if(!t.hasNodes([me]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return Zc(t.registerNodeTransform(qc,s=>{let a=s.getParentOrThrow(),d=s.getPreviousSibling();if(pe(a))Lo(a,e,l);else if(!V(a)){if(s.isSimpleText()&&(Io(s.getTextContent())||!pe(d))){let c=su(s);iu(c,e,l)}lu(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=n,r[4]=i):(n=r[3],i=r[4]),Qc(n,i)}var cu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,uu=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,du=[Qn(cu,t=>t.startsWith("http")?t:`https://${t}`),Qn(uu,t=>`mailto:${t}`)],li=()=>{let[t]=zc();return au(t,du),null};import{jsx as mu}from"react/jsx-runtime";import{ClickableLinkPlugin as pu}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var si=()=>mu(pu,{});import{jsx as yu}from"react/jsx-runtime";import"react";import{createPortal as vu}from"react-dom";import{jsx as fe,jsxs as ot,Fragment as hu}from"react/jsx-runtime";import{useLexicalComposerContext as gu}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as ai,mergeRegister as ci}from"@lexical/utils";import{getTranslation as So}from"@payloadcms/translations";import{CloseMenuIcon as Cu,EditIcon as xu,ExternalLinkIcon as ui,formatDrawerSlug as bu,useConfig as _u,useEditDepth as Tu,useLocale as wu,useTranslation as Eu}from"@payloadcms/ui";import{requests as Nu}from"@payloadcms/ui/shared";import{$getSelection as di,$isLineBreakNode as ku,$isRangeSelection as mi,COMMAND_PRIORITY_HIGH as Lu,COMMAND_PRIORITY_LOW as pi,KEY_ESCAPE_COMMAND as Iu,SELECTION_CHANGE_COMMAND as Su}from"lexical";import fi,{useCallback as hi,useEffect as Dt,useRef as Ru,useState as Le}from"react";function vt(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),d=t.top-r,c=t.left-n;d<a.top&&(d+=l.height+t.height+r*2),c+l.width>a.right&&(c=a.right-l.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as fu}from"lexical";var Mt=fu("TOGGLE_LINK_WITH_MODAL_COMMAND");function gi({anchorElem:t}){let[e]=gu(),[o,r]=Le(),n=Ru(null),[i,l]=Le(null),[s,a]=Le(null),{fieldProps:{schemaPath:d},uuid:c}=B(),{config:u}=_u(),{i18n:m,t:p}=Eu(),[f,h]=Le(),g=Tu(),[T,M]=Le(!1),[A,C]=Le([]),w=wu(),[x,N]=Le(!1),S=bu({slug:"lexical-rich-text-link-"+c,depth:g}),{toggleDrawer:E}=be(S),k=hi(()=>{M(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),N(!1),l(null),a(null),C([]),h(void 0)},[M,l,a,C]),I=hi(()=>{let b=di(),_;if(!mi(b)||!b){k();return}let R=De(b);_=e.getElementByKey(R.getKey())?.getBoundingClientRect();let L=ai(R,V),D=b.getNodes().filter(W=>!ku(W)).find(W=>{let G=ai(W,V);return L&&!L.is(G)||G&&!G.is(L)});if(L==null||D){k();return}r(L);let v=L.getFields(),O={...v,id:L.getID(),text:L.getTextContent()};if(v?.linkType==="custom")l(v?.url??null),a(null);else{l(`${u.routes.admin==="/"?"":u.routes.admin}/collections/${v?.doc?.relationTo}/${v?.doc?.value}`);let W=u.collections.find(G=>G.slug===v?.doc?.relationTo);if(!W)a(v?.label?String(v?.label):null),l(v?.url?String(v?.url):null);else{let G=typeof v.doc?.value=="object"?v.doc.value.id:v.doc?.value,ae=v.doc?.relationTo;if(!G||!ae)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ye=p("fields:linkedTo",{label:`${So(W.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(ye),Nu.get(`${u.serverURL}${u.routes.api}/${ae}/${G}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:w?.code}}).then(async Ce=>{if(!Ce.ok)throw new Error(`HTTP error! Status: ${Ce.status}`);let dt=await Ce.json(),cr=W?.admin?.useAsTitle||"id",U=dt[cr],ee=p("fields:linkedTo",{label:`${So(W.labels.singular,m)} - ${U}`}).replace(/<[^>]*>?/g,"");a(ee)}).catch(()=>{let Ce=p("fields:linkedTo",{label:`${So(W.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${G}`}).replace(/<[^>]*>?/g,"");a(Ce)})}}h(O),M(!0),C(b?b?.getNodes():[]),pe(L)?N(!0):N(!1);let H=n.current,$=window.getSelection(),{activeElement:j}=document;if(H===null)return;let Q=e.getRootElement();return $!==null&&Q!==null&&Q.contains($.anchorNode)?(_||(_=$.getRangeAt(0).getBoundingClientRect()),_!=null&&(_.y+=40,vt(_,H,t))):(j==null||j.className!=="link-input")&&(Q!==null&&vt(null,H,t),l(null),a(null)),!0},[e,k,u.routes.admin,u.routes.api,u.collections,u.serverURL,p,m,w?.code,t]);return Dt(()=>ci(e.registerCommand(Mt,b=>(e.dispatchCommand(ie,b),I(),E(),!0),pi)),[e,I,E,S]),Dt(()=>{let b=t.parentElement,_=()=>{e.getEditorState().read(()=>{I()})};return window.addEventListener("resize",_),b?.addEventListener("scroll",_),()=>{window.removeEventListener("resize",_),b?.removeEventListener("scroll",_)}},[t.parentElement,e,I]),Dt(()=>ci(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{I()})}),e.registerCommand(Su,()=>(I(),!0),pi),e.registerCommand(Iu,()=>T?(k(),!0):!1,Lu)),[e,I,T,k]),Dt(()=>{e.getEditorState().read(()=>{I()})},[e,I]),ot(fi.Fragment,{children:[fe("div",{className:"link-editor",ref:n,children:ot("div",{className:"link-input",children:[i&&i.length>0?ot("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?fe(ui,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?ot(hu,{children:[o?.__fields.newTab?fe(ui,{}):null,fe("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&ot(fi.Fragment,{children:[fe("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{E()},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:fe(xu,{})}),!x&&fe("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ie,null)},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:fe(Cu,{})})]})]})}),fe(Ge,{className:"lexical-link-edit-drawer",data:f,drawerSlug:S,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(b,_)=>{let R=_,L={...R};delete L.text,e.update(()=>{let D=di(),v=null;if(mi(D)?v=De(D).getParent():A.length&&(v=A[0].getParent()),v&&pe(v)){let O=de({fields:L});v.replace(O,!0)}}),e.dispatchCommand(ie,{fields:L,selectedNodes:A,text:R.text})},schemaPath:d,schemaPathSuffix:"fields"})]})}var Ci=t=>{let{anchorElem:e=document.body}=t;return vu(yu(gi,{anchorElem:e}),e)};import{c as Au}from"react/compiler-runtime";import{useLexicalComposerContext as Ou}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Fu}from"@lexical/utils";import{$getSelection as $u,$isElementNode as Pu,$isRangeSelection as Bu,COMMAND_PRIORITY_LOW as bi,PASTE_COMMAND as Hu}from"lexical";import{useEffect as ju}from"react";var Mu=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Du=/^[\w\-./]*(?:#\w[\w-]*)?$/;function xi(t){if(!t)return!1;if(t==="https://"||Mu.test(t)||Du.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var _i=()=>{let t=Au(3),[e]=Ou(),o,r;return t[0]!==e?(o=()=>{if(!e.hasNodes([q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Fu(e.registerCommand(ie,n=>(Xn(n),!0),bi),e.registerCommand(Hu,n=>{let i=$u();if(!Bu(i)||i.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let l=n.clipboardData.getData("text");if(!xi(l))return!1;if(!i.getNodes().some(s=>Pu(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(ie,{fields:s,text:null}),n.preventDefault(),!0}return!1},bi))},r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ju(o,r),null};var wi=[wo([{ChildComponent:Kn,isActive:({selection:t})=>{if(Ti(t)){let e=De(t);return Gu(e,V)!=null}return!1},isEnabled:({selection:t})=>!!(Ti(t)&&Ro()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ie,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Ro()?.getTextContent(),r=Ro()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(Mt,{fields:n,selectedNodes:r,text:o})}},order:1}])],Wu=y({markdownTransformers:[Jn],nodes:[q,me],plugins:[{Component:_i,position:"normal"},{Component:li,position:"normal"},{Component:si,position:"normal"},{Component:Ci,position:"floatingAnchorElem"}],toolbarFixed:{groups:wi},toolbarInline:{groups:wi}});import{$isListNode as Mo,INSERT_CHECK_LIST_COMMAND as Si,ListItemNode as td,ListNode as od}from"@lexical/list";import{$isRangeSelection as rd}from"lexical";import{jsx as Ei,jsxs as Uu}from"react/jsx-runtime";import"react";var yo=()=>Uu("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:[Ei("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ei("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Vu}from"react/jsx-runtime";import{ListPlugin as Ku}from"@lexical/react/LexicalListPlugin.js";import"react";var Ae=()=>Vu(Ku,{});function Oe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Xu,ListItemNode as Ju,ListNode as qu}from"@lexical/list";import{$createListItemNode as zu,$createListNode as Zu,$isListItemNode as Yu,$isListNode as vo}from"@lexical/list";var Ni=4,Fe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=zu(t==="check"?r[3]==="x":void 0);if(vo(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(vo(n)&&n.getListType()===t)n.append(l),e.remove();else{let a=Zu(t,t==="number"?Number(r[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Ni);s&&l.setIndent(s)},Ie=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(Yu(l)){if(l.getChildrenSize()===1){let c=l.getFirstChild();if(vo(c)){r.push(Ie(c,e,o+1));continue}}let s=" ".repeat(o*Ni),a=t.getListType(),d=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+d+e(l)),i++}return r.join(`
35
- `)};var ki={type:"element",dependencies:[qu,Ju],export:(t,e)=>Xu(t)?Ie(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Fe("check")};import{jsx as Qu}from"react/jsx-runtime";import{CheckListPlugin as ed}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Li=()=>Qu(ed,{});var Ii=[J([{ChildComponent:yo,isActive:({selection:t})=>{if(!rd(t))return!1;for(let e of t.getNodes()){if(Mo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Mo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Mo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Si,void 0)},order:12}])],nd=y(({featureProviderMap:t})=>{let e=[{Component:Li,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ae,position:"normal"}),{markdownTransformers:[ki],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[od,td],plugins:e,slashMenu:{groups:[Oe([{Icon:yo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Si,void 0)}}])]},toolbarFixed:{groups:Ii},toolbarInline:{groups:Ii}}});import{$isListNode as Ao,INSERT_ORDERED_LIST_COMMAND as vi,ListItemNode as cd,ListNode as ud}from"@lexical/list";import{$isRangeSelection as dd}from"lexical";import{jsx as rt,jsxs as id}from"react/jsx-runtime";import"react";var Do=()=>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:[rt("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"}),rt("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"}),rt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),rt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),rt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as ld,ListItemNode as sd,ListNode as ad}from"@lexical/list";var Ri={type:"element",dependencies:[ad,sd],export:(t,e)=>ld(t)?Ie(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Fe("number")};var yi=[J([{ChildComponent:Do,isActive:({selection:t})=>{if(!dd(t))return!1;for(let e of t.getNodes()){if(Ao(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Ao(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Ao(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(vi,void 0)},order:10}])],md=y(({featureProviderMap:t})=>({markdownTransformers:[Ri],nodes:t.has("orderedList")?[]:[ud,cd],plugins:t.has("orderedList")?[]:[{Component:Ae,position:"normal"}],slashMenu:{groups:[Oe([{Icon:Do,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(vi,void 0)}}])]},toolbarFixed:{groups:yi},toolbarInline:{groups:yi}}));import{$isListNode as Fo,INSERT_UNORDERED_LIST_COMMAND as Ai,ListItemNode as Cd,ListNode as xd}from"@lexical/list";import{$isRangeSelection as bd}from"lexical";import{jsx as $e,jsxs as pd}from"react/jsx-runtime";import"react";var Oo=()=>pd("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:[$e("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as fd,ListItemNode as hd,ListNode as gd}from"@lexical/list";var Mi={type:"element",dependencies:[gd,hd],export:(t,e)=>fd(t)?Ie(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Fe("bullet")};var Di=[J([{ChildComponent:Oo,isActive:({selection:t})=>{if(!bd(t))return!1;for(let e of t.getNodes()){if(Fo(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Fo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Fo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ai,void 0)},order:11}])],_d=y({markdownTransformers:[Mi],nodes:[xd,Cd],plugins:[{Component:Ae,position:"normal"}],slashMenu:{groups:[Oe([{Icon:Oo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ai,void 0)}}])]},toolbarFixed:{groups:Di},toolbarInline:{groups:Di}});import{jsx as Td}from"react/jsx-runtime";import{addClassNamesToElement as wd}from"@lexical/utils";import{DecoratorNode as Ed}from"lexical";import*as Oi from"react";var Nd=Oi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),nt=class t extends Ed{__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 kd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return wd(o,"unknownConverted"),o}decorate(){return Td(Nd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function kd({data:t}){return new nt({data:t})}var Ld=y(()=>({nodes:[nt]}));import{jsx as Id}from"react/jsx-runtime";import{addClassNamesToElement as Sd}from"@lexical/utils";import{DecoratorNode as Rd}from"lexical";import*as Fi from"react";var yd=Fi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),it=class t extends Rd{__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 vd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Sd(o,"unknownConverted"),o}decorate(){return Id(yd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function vd({data:t}){return new it({data:t})}var Md=y(()=>({nodes:[it]}));import{$setBlocksType as Bi}from"@lexical/selection";import{$createParagraphNode as Hi,$getSelection as ji,$isParagraphNode as $i,$isRangeSelection as Dd}from"lexical";var Pi=[J([{ChildComponent:Ye,isActive:({selection:t})=>{if(!Dd(t))return!1;for(let e of t.getNodes())if(!$i(e)&&!$i(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ji();Bi(e,()=>Hi())})},order:1}])],Ad=y({slashMenu:{groups:[K([{Icon:Ye,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ji();Bi(e,()=>Hi())})}}])]},toolbarFixed:{groups:Pi},toolbarInline:{groups:Pi}});import{$isNodeSelection as am}from"lexical";import{jsx as lt,jsxs as Od}from"react/jsx-runtime";import"react";var $o=()=>Od("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[lt("g",{clipPath:"url(#clip0_4397_10817)",children:lt("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"})}),lt("defs",{children:lt("clipPath",{id:"clip0_4397_10817",children:lt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Xd}from"react/compiler-runtime";import{jsx as Jd}from"react/jsx-runtime";import{useLexicalComposerContext as qd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Qd}from"@lexical/utils";import{useConfig as em}from"@payloadcms/ui";import{$getPreviousSelection as tm,$getSelection as om,$isParagraphNode as zi,$isRangeSelection as rm,COMMAND_PRIORITY_EDITOR as nm,createCommand as im}from"lexical";import{useEffect as lm}from"react";import{c as Vd}from"react/compiler-runtime";import{jsx as Ot}from"react/jsx-runtime";import{useLexicalComposerContext as Kd}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as zd,COMMAND_PRIORITY_EDITOR as Zd}from"lexical";import{useEffect as Wi,useState as Ui}from"react";import{c as Fd}from"react/compiler-runtime";import{jsx as $d}from"react/jsx-runtime";import{useLexicalComposerContext as Pd}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Bd,useModal as Hd}from"@payloadcms/ui";import{$getPreviousSelection as jd,$getSelection as Gd,$setSelection as Wd}from"lexical";import{useEffect as Ud,useState as Gi}from"react";var At=t=>{let e=Fd(23),[o]=Pd(),[r,n]=Gi(null),[i,l]=Gi(!1),[s,a,d]=Bd(t),{closeDrawer:c,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=Hd(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let k=Gd()??jd();n(k)},e[0]=h):h=e[0];let g=h,T;e[1]!==r||e[2]!==o?(T=()=>{r&&o.update(()=>{Wd(r.clone())},{discrete:!0,skipTransforms:!0})},e[1]=r,e[2]=o,e[3]=T):T=e[3];let M=T,A;e[4]!==c?(A=()=>{c()},e[4]=c,e[5]=A):A=e[5];let C=A,w,x;e[6]!==i||e[7]!==f||e[8]!==u||e[9]!==M?(w=()=>{if(!i)return;let k=f[u];k&&!k?.isOpen&&(l(!1),setTimeout(()=>{M()},1))},x=[f,u,M,i],e[6]=i,e[7]=f,e[8]=u,e[9]=M,e[10]=w,e[11]=x):(w=e[10],x=e[11]),Ud(w,x);let N;e[12]!==a?(N=k=>$d(a,{...k,onClick:()=>{g()}}),e[12]=a,e[13]=N):N=e[13];let S;e[14]!==p?(S=()=>{g(),p(),l(!0)},e[14]=p,e[15]=S):S=e[15];let E;return e[16]!==C||e[17]!==m||e[18]!==s||e[19]!==u||e[20]!==N||e[21]!==S?(E={closeListDrawer:C,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:N,openListDrawer:S},e[16]=C,e[17]=m,e[18]=s,e[19]=u,e[20]=N,e[21]=S,e[22]=E):E=e[22],E};var Yd=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=zd(o);n&&n.replace(Ve({relationTo:e,value:r}))}):t.dispatchCommand(Po,{relationTo:e,value:r})},Vi=t=>{let e=Vd(21),{enabledCollectionSlugs:o}=t,[r]=Kd(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i,l]=Ui(n),[s,a]=Ui(null),d=o||void 0,c;e[2]!==d||e[3]!==i?(c={collectionSlugs:d,selectedCollection:i},e[2]=d,e[3]=i,e[4]=c):c=e[4];let{closeListDrawer:u,isListDrawerOpen:m,ListDrawer:p,openListDrawer:f}=At(c),h,g;e[5]!==r||e[6]!==f?(h=()=>r.registerCommand(We,x=>(a(x?.replace?x?.replace.nodeKey:null),f(),!0),Zd),g=[r,f],e[5]=r,e[6]=f,e[7]=h,e[8]=g):(h=e[7],g=e[8]),Wi(h,g);let T;e[9]!==r||e[10]!==s||e[11]!==u?(T=x=>{let{collectionSlug:N,docID:S}=x;Yd({editor:r,relationTo:N,replaceNodeKey:s,value:S}),u()},e[9]=r,e[10]=s,e[11]=u,e[12]=T):T=e[12];let M=T,A;e[13]!==o?(A=()=>{l(o?.[0])},e[13]=o,e[14]=A):A=e[14];let C;e[15]!==m||e[16]!==o?(C=[m,o],e[15]=m,e[16]=o,e[17]=C):C=e[17],Wi(A,C);let w;return e[18]!==M||e[19]!==p?(w=Ot(p,{onSelect:M}),e[18]=M,e[19]=p,e[20]=w):w=e[20],w},Ki=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Ot(Vi,{...t}):Ot(ht,{...t,children:Ot(Vi,{...t})});var Po=im("INSERT_RELATIONSHIP_COMMAND"),Zi=t=>{let e=Xd(10),{clientProps:o}=t,[r]=qd(),{config:n}=em(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o||e[1]!==i){let u;e[3]!==o?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=u):u=e[4],c=i.filter(u).map(sm),e[0]=o,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==r?(s=()=>{if(!r.hasNodes([Ue]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Po,c=>{let u=om()||tm();if(rm(u)){let m=Ve(c);Qd(m);let{focus:p}=u,f=p.getNode();zi(f)&&f.getTextContentSize()===0&&f.getParentOrThrow().getChildren().filter(h=>zi(h)).length>1&&f.remove()}return!0},nm)},a=[r],e[5]=r,e[6]=s,e[7]=a):(s=e[6],a=e[7]),lm(s,a);let d;return e[8]!==l?(d=Jd(Ki,{enabledCollectionSlugs:l}),e[8]=l,e[9]=d):d=e[9],d};function sm(t){let{slug:e}=t;return e}var cm=y({nodes:[Ue],plugins:[{Component:Zi,position:"normal"}],slashMenu:{groups:[K([{Icon:$o,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[ue([{ChildComponent:$o,isActive:({selection:t})=>{if(!am(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return no(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as tl}from"react/compiler-runtime";import{jsx as ne,jsxs as Em}from"react/jsx-runtime";import{useLexicalComposerContext as Nm}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as km,useThrottledEffect as Lm,useTranslation as Im}from"@payloadcms/ui";import*as he from"react";import{useMemo as Sm}from"react";import{jsx as um}from"react/jsx-runtime";import{mergeRegister as dm}from"@lexical/utils";import{$getSelection as mm}from"lexical";import{useCallback as pm,useEffect as Ft,useState as Bo}from"react";var Ho="toolbar-popup__button",st=({children:t,editor:e,item:o})=>{let[r,n]=Bo(!0),[i,l]=Bo(!1),[s,a]=Bo(Ho),d=B(),c=pm(()=>{e.getEditorState().read(()=>{let u=mm();if(u){if(o.isActive){let m=o.isActive({editor:e,editorConfigContext:d,selection:u});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:e,editorConfigContext:d,selection:u});r!==m&&n(m)}}})},[i,e,d,r,o]);return Ft(()=>{c()},[c]),Ft(()=>(document.addEventListener("mouseup",c),()=>{document.removeEventListener("mouseup",c)}),[c]),Ft(()=>dm(e.registerUpdateListener(()=>{c()})),[e,c]),Ft(()=>{a([Ho,r===!1?"disabled":"",i?"active":"",o?.key?`${Ho}-`+o.key:""].filter(Boolean).join(" "))},[r,i,s,o.key]),um("button",{className:s,onClick:()=>{if(r!==!1)return e._updateTags=new Set(["toolbar",...e._updateTags]),e.focus(()=>{o.onSelect?.({editor:e,isActive:i})}),!0},onMouseDown:u=>{u.preventDefault()},type:"button",children:t})};import{c as el}from"react/compiler-runtime";import{jsx as Pe}from"react/jsx-runtime";import Wo,{useEffect as Qi}from"react";import{mergeRegister as bm}from"@lexical/utils";import{useTranslation as _m}from"@payloadcms/ui";import{$getSelection as Tm}from"lexical";import{jsx as we,jsxs as Yi}from"react/jsx-runtime";import{Button as fm}from"@payloadcms/ui";import $t,{useCallback as hm,useEffect as at,useMemo as gm,useRef as Go,useState as Pt}from"react";import{createPortal as Cm}from"react-dom";var jo="toolbar-popup__dropdown-item",Xi=$t.createContext(null);function Ji({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,a]=Pt(jo);at(()=>{a([jo,r===!1?"disabled":"",t?"active":"",i?.key?`${jo}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let d=Go(null),c=$t.useContext(Xi);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return at(()=>{d?.current!=null&&u(d)},[d,u]),we(fm,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&(o._updateTags=new Set(["toolbar",...o._updateTags]),o.focus(()=>{i.onSelect?.({editor:o,isActive:t})}))},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:l,type:"button",children:e})}function xm({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=Pt(),[l,s]=Pt(),a=hm(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),d=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},c=gm(()=>({registerItem:a}),[a]);return at(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),we(Xi.Provider,{value:c,children:we("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:d,ref:e,children:t})})}function qi({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Go(null),d=Go(null),[c,u]=Pt(!1),m=()=>{u(!1),d?.current!=null&&d.current.focus()};at(()=>{let f=d.current,h=a.current;if(c&&f!==null&&h!==null){let{left:g,top:T}=f.getBoundingClientRect(),M=window.scrollY||document.documentElement.scrollTop;h.style.top=`${T+M+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,d,c]),at(()=>{let f=d.current;if(f!==null&&c){let h=g=>{let{target:T}=g;s!=null&&a.current!=null&&a.current.contains(T)||f.contains(T)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,d,c,s]);let p=Cm(we(xm,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return Yi($t.Fragment,{children:[Yi("button",{"aria-label":t,className:e+(c?" active":""),disabled:r,onClick:f=>{f.preventDefault(),u(!c)},onMouseDown:f=>{f.preventDefault()},ref:d,type:"button",children:[n&&we(n,{}),l&&we("span",{className:"toolbar-popup__dropdown-label",children:l}),we("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&we($t.Fragment,{children:p})]})}var Uo="toolbar-popup__dropdown",wm=t=>{let e=el(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=_m(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a;if(l.Component){let f;return e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==i?(f=l?.Component&&Pe(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=l,e[1]=o,e[2]=r,e[3]=n,e[4]=i,e[5]=f):f=e[5],f}let u=l.key,m;if(l.label){let f;e[6]!==l||e[7]!==d||e[8]!==s||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):l.label,e[6]=l,e[7]=d,e[8]=s,e[9]=c,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==l||e[12]!==m||e[13]!==o||e[14]!==n||e[15]!==i||e[16]!==u?(p=Pe(Ji,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?Pe(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:Pe("span",{className:"text",children:m})},l.key),e[11]=l,e[12]=m,e[13]=o,e[14]=n,e[15]=i,e[16]=u,e[17]=p):p=e[17],p},Se=t=>{let e=el(42),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:d,onActiveChange:c}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=Wo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,g]=Wo.useState(f),[T,M]=Wo.useState(!0),A=B(),{items:C,key:w}=i,x;e[2]!==n||e[3]!==C||e[4]!==d||e[5]!==A||e[6]!==i||e[7]!==c?(x=()=>{n.getEditorState().read(()=>{let $=Tm();if(!$)return;let j=[],Q=[],W=[];for(let G of C)G.isActive&&(!d||j.length<d)&&G.isActive({editor:n,editorConfigContext:A,selection:$})&&(j.push(G.key),Q.push(G)),G.isEnabled?G.isEnabled({editor:n,editorConfigContext:A,selection:$})&&W.push(G.key):W.push(G.key);i.isEnabled&&M(i.isEnabled({editor:n,editorConfigContext:A,selection:$})),p(j),g(W),c&&c({activeItems:Q})})},e[2]=n,e[3]=C,e[4]=d,e[5]=A,e[6]=i,e[7]=c,e[8]=x):x=e[8];let N=x,S,E;e[9]!==N?(S=()=>{N()},E=[N],e[9]=N,e[10]=S,e[11]=E):(S=e[10],E=e[11]),Qi(S,E);let k,I;e[12]!==n||e[13]!==N?(k=()=>bm(n.registerUpdateListener(()=>{N()})),I=[n,N],e[12]=n,e[13]=N,e[14]=k,e[15]=I):(k=e[14],I=e[15]),Qi(k,I);let b=`${w} dropdown`,_=`${Uo}-${w}`,R;e[16]!==r?(R=r||[],e[16]=r,e[17]=R):R=e[17];let L;e[18]!==_||e[19]!==R?(L=[Uo,_,...R].filter(Boolean),e[18]=_,e[19]=R,e[20]=L):L=e[20];let D=L.join(" "),v=!T,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let H;if(e[23]!==O||e[24]!==C||e[25]!==m||e[26]!==o||e[27]!==n||e[28]!==h||e[29]!==b||e[30]!==D||e[31]!==v||e[32]!==l||e[33]!==a||e[34]!==w){let $;e[36]!==C||e[37]!==m||e[38]!==o||e[39]!==n||e[40]!==h?($=C.length&&C.map(j=>Pe(wm,{active:m.includes(j.key),anchorElem:o,editor:n,enabled:h.includes(j.key),item:j},j.key)),e[36]=C,e[37]=m,e[38]=o,e[39]=n,e[40]=h,e[41]=$):$=e[41],H=Pe(qi,{buttonAriaLabel:b,buttonClassName:D,disabled:v,Icon:l,itemsContainerClassNames:[`${Uo}-items`,...O],label:a,children:$},w),e[23]=O,e[24]=C,e[25]=m,e[26]=o,e[27]=n,e[28]=h,e[29]=b,e[30]=D,e[31]=v,e[32]=l,e[33]=a,e[34]=w,e[35]=H}else H=e[35];return H};function Rm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ne(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ne(st,{editor:e,item:o,children:ne(o.ChildComponent,{})},o.key):null}function ym(t){let e=tl(26),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=Im(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a,[u,m]=he.useState(void 0),[p,f]=he.useState(void 0),h,g;e[0]!==i?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},g=[i],e[0]=i,e[1]=h,e[2]=g):(h=e[1],g=e[2]),he.useEffect(h,g);let T;e[3]!==i||e[4]!==d||e[5]!==s||e[6]!==c?(T=N=>{let{activeItems:S}=N;if(!S.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let E=S[0],k=E.key;E.label&&(k=typeof E.label=="function"?E.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):E.label),k.length>25&&(k=k.substring(0,25)+"..."),m(k),f(()=>E.ChildComponent)},e[3]=i,e[4]=d,e[5]=s,e[6]=c,e[7]=T):T=e[7];let M=T,A=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,C;e[8]!==i||e[9]!==p||e[10]!==o||e[11]!==r||e[12]!==u||e[13]!==M?(C=i.type==="dropdown"&&i.items.length&&(p?ne(Se,{anchorElem:o,editor:r,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:M}):ne(Se,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:M})),e[8]=i,e[9]=p,e[10]=o,e[11]=r,e[12]=u,e[13]=M,e[14]=C):C=e[14];let w;e[15]!==i||e[16]!==o||e[17]!==r?(w=i.type==="buttons"&&i.items.length&&i.items.map(N=>ne(Rm,{anchorElem:o,editor:r,item:N},N.key)),e[15]=i,e[16]=o,e[17]=r,e[18]=w):w=e[18];let x;return e[19]!==n.features.toolbarFixed||e[20]!==l||e[21]!==C||e[22]!==w||e[23]!==A||e[24]!==i.key?(x=Em("div",{className:A,children:[C,w,l<n.features.toolbarFixed?.groups.length-1&&ne("div",{className:"divider"})]},i.key),e[19]=n.features.toolbarFixed,e[20]=l,e[21]=C,e[22]=w,e[23]=A,e[24]=i.key,e[25]=x):x=e[25],x}function vm({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=he.useRef(null),{y:l}=km(),s=Sm(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let d=n.editorContainerRef.current.previousElementSibling;for(;d;){if(d.classList.contains("fixed-toolbar"))return d;d=d.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Lm(()=>{if(!s)return;let a=i.current;if(!a)return;let d=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(d.bottom<c.top||d.top>c.bottom))a.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),ne("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ne(he.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,d)=>ne(ym,{anchorElem:t,editor:o,editorConfig:r,group:a,index:d},a.key))})})}var ol=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ol(t.parentEditor)}return!1},rl=t=>{let e=tl(7),{anchorElem:o,clientProps:r}=t,[n]=Nm(),i=B(),{editorConfig:l}=i,s=r.applyToFocusedEditor&&i.focusedEditor?.editor||n,a=r.applyToFocusedEditor&&i.focusedEditor?.editorConfig||l,d,c;if(e[0]!==i||e[1]!==r?.disableIfParentHasFixedToolbar||e[2]!==a||e[3]!==o||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{let u=ol(i);if(r?.disableIfParentHasFixedToolbar&&u){c=null;break e}if(!a?.features?.toolbarFixed?.groups?.length){c=null;break e}d=ne(vm,{anchorElem:o,editor:s,editorConfig:a,parentWithFixedToolbar:u})}e[0]=i,e[1]=r?.disableIfParentHasFixedToolbar,e[2]=a,e[3]=o,e[4]=s,e[5]=d,e[6]=c}else d=e[5],c=e[6];return c!==Symbol.for("react.early_return_sentinel")?c:d};var Mm=y({plugins:[{Component:rl,position:"aboveContainer"}]});import{c as ll}from"react/compiler-runtime";import{jsx as le,jsxs as sl}from"react/jsx-runtime";import{useLexicalComposerContext as Dm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as al}from"@lexical/utils";import{$getSelection as cl,$isRangeSelection as nl,$isTextNode as Am,COMMAND_PRIORITY_LOW as Om,SELECTION_CHANGE_COMMAND as Fm}from"lexical";import{useCallback as Ht,useEffect as ct,useRef as il,useState as $m}from"react";import*as jt from"react";import{createPortal as Pm}from"react-dom";function Vo(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 Bt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:d=10}=t,c=o.parentElement;if(a===null||c==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-u.height-d,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let g=0;return!e&&f<p.top&&!s&&(g=u.height+a.height+d*2,f+=g),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function Bm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&le(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?le(st,{editor:e,item:o,children:le(o.ChildComponent,{})},o.key):null}function Hm(t){let e=ll(22),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=B(),[s,a]=jt.useState(),d,c;e[0]!==n?(d=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0)},c=[n],e[0]=n,e[1]=d,e[2]=c):(d=e[1],c=e[2]),jt.useEffect(d,c);let u;e[3]!==n?(u=T=>{let{activeItems:M}=T;if(!M.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0);return}let A=M[0];a(()=>A.ChildComponent)},e[3]=n,e[4]=u):u=e[4];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;e[5]!==n||e[6]!==s||e[7]!==o||e[8]!==r||e[9]!==m?(f=n.type==="dropdown"&&n.items.length&&(s?le(Se,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:1,onActiveChange:m}):le(Se,{anchorElem:o,editor:r,group:n,maxActiveItems:1,onActiveChange:m})),e[5]=n,e[6]=s,e[7]=o,e[8]=r,e[9]=m,e[10]=f):f=e[10];let h;e[11]!==n||e[12]!==o||e[13]!==r?(h=n.type==="buttons"&&n.items.length&&n.items.map(T=>le(Bm,{anchorElem:o,editor:r,item:T},T.key)),e[11]=n,e[12]=o,e[13]=r,e[14]=h):h=e[14];let g;return e[15]!==l.features.toolbarInline||e[16]!==i||e[17]!==f||e[18]!==h||e[19]!==p||e[20]!==n.key?(g=sl("div",{className:p,children:[f,h,i<l.features.toolbarInline?.groups.length-1&&le("div",{className:"divider"})]},n.key),e[15]=l.features.toolbarInline,e[16]=i,e[17]=f,e[18]=h,e[19]=p,e[20]=n.key,e[21]=g):g=e[21],g}function jm({anchorElem:t,editor:e}){let o=il(null),r=il(null),{editorConfig:n}=B(),i=Ht(()=>{if(o?.current){let d=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";d||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=Ht(d=>{if(o?.current&&(d.buttons===1||d.buttons===3)){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!c||!u){let m=d.clientX,p=d.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ht(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ht(()=>{let d=cl(),c=window.getSelection();if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(d!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Vo(c,p),h=Bt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Bt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ct(()=>{let d=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),d&&d.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),d&&d.removeEventListener("scroll",c)}},[e,a,t]),ct(()=>(e.getEditorState().read(()=>{a()}),al(e.registerUpdateListener(({editorState:d})=>{d.read(()=>{a()})}),e.registerCommand(Fm,()=>(a(),!1),Om))),[e,a]),sl("div",{className:"inline-toolbar-popup",ref:o,children:[le("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((d,c)=>le(Hm,{anchorElem:t,editor:e,group:d,index:c},d.key))]})}function Gm(t,e){let o=ll(12),[r,n]=$m(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=cl(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!nl(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!nl(m))return;if(m.getTextContent()!==""){let g=m.getNodes(),T=!1;for(let M of g)if(Am(M)){n(!0),T=!0;break}T||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ct(s,a);let d,c;if(o[5]!==t||o[6]!==l?(d=()=>al(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=d,o[8]=c):(d=o[7],c=o[8]),ct(d,c),!r||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=Pm(le(jm,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var ul=t=>{let{anchorElem:e}=t,[o]=Dm();return Gm(o,e)};var Wm=y({plugins:[{Component:ul,position:"floatingAnchorElem"}]});import{TableCellNode as Ef,TableNode as Nf,TableRowNode as kf}from"@lexical/table";import{jsx as dl}from"react/jsx-runtime";import"react";var Ko=()=>dl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dl("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{$convertFromMarkdownString as Um,$convertToMarkdownString as Vm}from"@lexical/markdown";import{$createTableCellNode as Km,$createTableNode as zm,$createTableRowNode as Zm,$isTableCellNode as ml,$isTableNode as zo,$isTableRowNode as Zo,TableCellHeaderStates as Gt,TableCellNode as Ym,TableNode as Xm,TableRowNode as Jm}from"@lexical/table";import{$isParagraphNode as qm,$isTextNode as Qm}from"lexical";var fl=/^\|(.+)\|\s?$/,ep=/^(\| ?:?-*:? ?)+\|\s?$/,hl=({allTransformers:t})=>({type:"element",dependencies:[Xm,Jm,Ym],export:e=>{if(!zo(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Zo(r))continue;let i=!1;for(let l of r.getChildren())ml(l)&&(n.push(Vm(t,l).replace(/\n/g,"\\n")),l.__headerState===Gt.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
35
+ `)};var ki={type:"element",dependencies:[qu,Ju],export:(t,e)=>Xu(t)?Ie(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Fe("check")};import{jsx as Qu}from"react/jsx-runtime";import{CheckListPlugin as ed}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Li=()=>Qu(ed,{});var Ii=[J([{ChildComponent:yo,isActive:({selection:t})=>{if(!rd(t))return!1;for(let e of t.getNodes()){if(Mo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Mo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Mo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Si,void 0)},order:12}])],nd=y(({featureProviderMap:t})=>{let e=[{Component:Li,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ae,position:"normal"}),{markdownTransformers:[ki],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[od,td],plugins:e,slashMenu:{groups:[Oe([{Icon:yo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Si,void 0)}}])]},toolbarFixed:{groups:Ii},toolbarInline:{groups:Ii}}});import{$isListNode as Ao,INSERT_ORDERED_LIST_COMMAND as vi,ListItemNode as cd,ListNode as ud}from"@lexical/list";import{$isRangeSelection as dd}from"lexical";import{jsx as rt,jsxs as id}from"react/jsx-runtime";import"react";var Do=()=>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:[rt("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"}),rt("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"}),rt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),rt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),rt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as ld,ListItemNode as sd,ListNode as ad}from"@lexical/list";var Ri={type:"element",dependencies:[ad,sd],export:(t,e)=>ld(t)?Ie(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Fe("number")};var yi=[J([{ChildComponent:Do,isActive:({selection:t})=>{if(!dd(t))return!1;for(let e of t.getNodes()){if(Ao(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Ao(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Ao(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(vi,void 0)},order:10}])],md=y(({featureProviderMap:t})=>({markdownTransformers:[Ri],nodes:t.has("orderedList")?[]:[ud,cd],plugins:t.has("orderedList")?[]:[{Component:Ae,position:"normal"}],slashMenu:{groups:[Oe([{Icon:Do,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(vi,void 0)}}])]},toolbarFixed:{groups:yi},toolbarInline:{groups:yi}}));import{$isListNode as Fo,INSERT_UNORDERED_LIST_COMMAND as Ai,ListItemNode as Cd,ListNode as xd}from"@lexical/list";import{$isRangeSelection as bd}from"lexical";import{jsx as $e,jsxs as pd}from"react/jsx-runtime";import"react";var Oo=()=>pd("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:[$e("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),$e("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as fd,ListItemNode as hd,ListNode as gd}from"@lexical/list";var Mi={type:"element",dependencies:[gd,hd],export:(t,e)=>fd(t)?Ie(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Fe("bullet")};var Di=[J([{ChildComponent:Oo,isActive:({selection:t})=>{if(!bd(t))return!1;for(let e of t.getNodes()){if(Fo(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Fo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Fo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ai,void 0)},order:11}])],_d=y({markdownTransformers:[Mi],nodes:[xd,Cd],plugins:[{Component:Ae,position:"normal"}],slashMenu:{groups:[Oe([{Icon:Oo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ai,void 0)}}])]},toolbarFixed:{groups:Di},toolbarInline:{groups:Di}});import{jsx as Td}from"react/jsx-runtime";import{addClassNamesToElement as wd}from"@lexical/utils";import{DecoratorNode as Ed}from"lexical";import*as Oi from"react";var Nd=Oi.lazy(()=>import("./Component-6GHP74S6.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),nt=class t extends Ed{__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 kd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return wd(o,"unknownConverted"),o}decorate(){return Td(Nd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function kd({data:t}){return new nt({data:t})}var Ld=y(()=>({nodes:[nt]}));import{jsx as Id}from"react/jsx-runtime";import{addClassNamesToElement as Sd}from"@lexical/utils";import{DecoratorNode as Rd}from"lexical";import*as Fi from"react";var yd=Fi.lazy(()=>import("./Component-N526MGPV.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),it=class t extends Rd{__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 vd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Sd(o,"unknownConverted"),o}decorate(){return Id(yd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function vd({data:t}){return new it({data:t})}var Md=y(()=>({nodes:[it]}));import{$setBlocksType as Bi}from"@lexical/selection";import{$createParagraphNode as Hi,$getSelection as ji,$isParagraphNode as $i,$isRangeSelection as Dd}from"lexical";var Pi=[J([{ChildComponent:Ye,isActive:({selection:t})=>{if(!Dd(t))return!1;for(let e of t.getNodes())if(!$i(e)&&!$i(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ji();Bi(e,()=>Hi())})},order:1}])],Ad=y({slashMenu:{groups:[K([{Icon:Ye,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ji();Bi(e,()=>Hi())})}}])]},toolbarFixed:{groups:Pi},toolbarInline:{groups:Pi}});import{$isNodeSelection as am}from"lexical";import{jsx as lt,jsxs as Od}from"react/jsx-runtime";import"react";var $o=()=>Od("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[lt("g",{clipPath:"url(#clip0_4397_10817)",children:lt("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"})}),lt("defs",{children:lt("clipPath",{id:"clip0_4397_10817",children:lt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Xd}from"react/compiler-runtime";import{jsx as Jd}from"react/jsx-runtime";import{useLexicalComposerContext as qd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Qd}from"@lexical/utils";import{useConfig as em}from"@payloadcms/ui";import{$getPreviousSelection as tm,$getSelection as om,$isParagraphNode as zi,$isRangeSelection as rm,COMMAND_PRIORITY_EDITOR as nm,createCommand as im}from"lexical";import{useEffect as lm}from"react";import{c as Vd}from"react/compiler-runtime";import{jsx as Ot}from"react/jsx-runtime";import{useLexicalComposerContext as Kd}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as zd,COMMAND_PRIORITY_EDITOR as Zd}from"lexical";import{useEffect as Wi,useState as Ui}from"react";import{c as Fd}from"react/compiler-runtime";import{jsx as $d}from"react/jsx-runtime";import{useLexicalComposerContext as Pd}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Bd,useModal as Hd}from"@payloadcms/ui";import{$getPreviousSelection as jd,$getSelection as Gd,$setSelection as Wd}from"lexical";import{useEffect as Ud,useState as Gi}from"react";var At=t=>{let e=Fd(23),[o]=Pd(),[r,n]=Gi(null),[i,l]=Gi(!1),[s,a,d]=Bd(t),{closeDrawer:c,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=Hd(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let k=Gd()??jd();n(k)},e[0]=h):h=e[0];let g=h,T;e[1]!==r||e[2]!==o?(T=()=>{r&&o.update(()=>{Wd(r.clone())},{discrete:!0,skipTransforms:!0})},e[1]=r,e[2]=o,e[3]=T):T=e[3];let M=T,A;e[4]!==c?(A=()=>{c()},e[4]=c,e[5]=A):A=e[5];let C=A,w,x;e[6]!==i||e[7]!==f||e[8]!==u||e[9]!==M?(w=()=>{if(!i)return;let k=f[u];k&&!k?.isOpen&&(l(!1),setTimeout(()=>{M()},1))},x=[f,u,M,i],e[6]=i,e[7]=f,e[8]=u,e[9]=M,e[10]=w,e[11]=x):(w=e[10],x=e[11]),Ud(w,x);let N;e[12]!==a?(N=k=>$d(a,{...k,onClick:()=>{g()}}),e[12]=a,e[13]=N):N=e[13];let S;e[14]!==p?(S=()=>{g(),p(),l(!0)},e[14]=p,e[15]=S):S=e[15];let E;return e[16]!==C||e[17]!==m||e[18]!==s||e[19]!==u||e[20]!==N||e[21]!==S?(E={closeListDrawer:C,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:N,openListDrawer:S},e[16]=C,e[17]=m,e[18]=s,e[19]=u,e[20]=N,e[21]=S,e[22]=E):E=e[22],E};var Yd=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=zd(o);n&&n.replace(Ve({relationTo:e,value:r}))}):t.dispatchCommand(Po,{relationTo:e,value:r})},Vi=t=>{let e=Vd(21),{enabledCollectionSlugs:o}=t,[r]=Kd(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i,l]=Ui(n),[s,a]=Ui(null),d=o||void 0,c;e[2]!==d||e[3]!==i?(c={collectionSlugs:d,selectedCollection:i},e[2]=d,e[3]=i,e[4]=c):c=e[4];let{closeListDrawer:u,isListDrawerOpen:m,ListDrawer:p,openListDrawer:f}=At(c),h,g;e[5]!==r||e[6]!==f?(h=()=>r.registerCommand(We,x=>(a(x?.replace?x?.replace.nodeKey:null),f(),!0),Zd),g=[r,f],e[5]=r,e[6]=f,e[7]=h,e[8]=g):(h=e[7],g=e[8]),Wi(h,g);let T;e[9]!==r||e[10]!==s||e[11]!==u?(T=x=>{let{collectionSlug:N,docID:S}=x;Yd({editor:r,relationTo:N,replaceNodeKey:s,value:S}),u()},e[9]=r,e[10]=s,e[11]=u,e[12]=T):T=e[12];let M=T,A;e[13]!==o?(A=()=>{l(o?.[0])},e[13]=o,e[14]=A):A=e[14];let C;e[15]!==m||e[16]!==o?(C=[m,o],e[15]=m,e[16]=o,e[17]=C):C=e[17],Wi(A,C);let w;return e[18]!==M||e[19]!==p?(w=Ot(p,{onSelect:M}),e[18]=M,e[19]=p,e[20]=w):w=e[20],w},Ki=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Ot(Vi,{...t}):Ot(ht,{...t,children:Ot(Vi,{...t})});var Po=im("INSERT_RELATIONSHIP_COMMAND"),Zi=t=>{let e=Xd(10),{clientProps:o}=t,[r]=qd(),{config:n}=em(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o||e[1]!==i){let u;e[3]!==o?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=u):u=e[4],c=i.filter(u).map(sm),e[0]=o,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==r?(s=()=>{if(!r.hasNodes([Ue]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Po,c=>{let u=om()||tm();if(rm(u)){let m=Ve(c);Qd(m);let{focus:p}=u,f=p.getNode();zi(f)&&f.getTextContentSize()===0&&f.getParentOrThrow().getChildren().filter(h=>zi(h)).length>1&&f.remove()}return!0},nm)},a=[r],e[5]=r,e[6]=s,e[7]=a):(s=e[6],a=e[7]),lm(s,a);let d;return e[8]!==l?(d=Jd(Ki,{enabledCollectionSlugs:l}),e[8]=l,e[9]=d):d=e[9],d};function sm(t){let{slug:e}=t;return e}var cm=y({nodes:[Ue],plugins:[{Component:Zi,position:"normal"}],slashMenu:{groups:[K([{Icon:$o,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[ue([{ChildComponent:$o,isActive:({selection:t})=>{if(!am(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return no(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as tl}from"react/compiler-runtime";import{jsx as ne,jsxs as Em}from"react/jsx-runtime";import{useLexicalComposerContext as Nm}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as km,useThrottledEffect as Lm,useTranslation as Im}from"@payloadcms/ui";import*as he from"react";import{useMemo as Sm}from"react";import{jsx as um}from"react/jsx-runtime";import{mergeRegister as dm}from"@lexical/utils";import{$getSelection as mm}from"lexical";import{useCallback as pm,useEffect as Ft,useState as Bo}from"react";var Ho="toolbar-popup__button",st=({children:t,editor:e,item:o})=>{let[r,n]=Bo(!0),[i,l]=Bo(!1),[s,a]=Bo(Ho),d=B(),c=pm(()=>{e.getEditorState().read(()=>{let u=mm();if(u){if(o.isActive){let m=o.isActive({editor:e,editorConfigContext:d,selection:u});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:e,editorConfigContext:d,selection:u});r!==m&&n(m)}}})},[i,e,d,r,o]);return Ft(()=>{c()},[c]),Ft(()=>(document.addEventListener("mouseup",c),()=>{document.removeEventListener("mouseup",c)}),[c]),Ft(()=>dm(e.registerUpdateListener(()=>{c()})),[e,c]),Ft(()=>{a([Ho,r===!1?"disabled":"",i?"active":"",o?.key?`${Ho}-`+o.key:""].filter(Boolean).join(" "))},[r,i,s,o.key]),um("button",{className:s,onClick:()=>{if(r!==!1)return e._updateTags=new Set(["toolbar",...e._updateTags]),e.focus(()=>{o.onSelect?.({editor:e,isActive:i})}),!0},onMouseDown:u=>{u.preventDefault()},type:"button",children:t})};import{c as el}from"react/compiler-runtime";import{jsx as Pe}from"react/jsx-runtime";import Wo,{useEffect as Qi}from"react";import{mergeRegister as bm}from"@lexical/utils";import{useTranslation as _m}from"@payloadcms/ui";import{$getSelection as Tm}from"lexical";import{jsx as we,jsxs as Yi}from"react/jsx-runtime";import{Button as fm}from"@payloadcms/ui";import $t,{useCallback as hm,useEffect as at,useMemo as gm,useRef as Go,useState as Pt}from"react";import{createPortal as Cm}from"react-dom";var jo="toolbar-popup__dropdown-item",Xi=$t.createContext(null);function Ji({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,a]=Pt(jo);at(()=>{a([jo,r===!1?"disabled":"",t?"active":"",i?.key?`${jo}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let d=Go(null),c=$t.useContext(Xi);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return at(()=>{d?.current!=null&&u(d)},[d,u]),we(fm,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&(o._updateTags=new Set(["toolbar",...o._updateTags]),o.focus(()=>{i.onSelect?.({editor:o,isActive:t})}))},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:l,type:"button",children:e})}function xm({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=Pt(),[l,s]=Pt(),a=hm(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),d=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},c=gm(()=>({registerItem:a}),[a]);return at(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),we(Xi.Provider,{value:c,children:we("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:d,ref:e,children:t})})}function qi({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Go(null),d=Go(null),[c,u]=Pt(!1),m=()=>{u(!1),d?.current!=null&&d.current.focus()};at(()=>{let f=d.current,h=a.current;if(c&&f!==null&&h!==null){let{left:g,top:T}=f.getBoundingClientRect(),M=window.scrollY||document.documentElement.scrollTop;h.style.top=`${T+M+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,d,c]),at(()=>{let f=d.current;if(f!==null&&c){let h=g=>{let{target:T}=g;s!=null&&a.current!=null&&a.current.contains(T)||f.contains(T)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,d,c,s]);let p=Cm(we(xm,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return Yi($t.Fragment,{children:[Yi("button",{"aria-label":t,className:e+(c?" active":""),disabled:r,onClick:f=>{f.preventDefault(),u(!c)},onMouseDown:f=>{f.preventDefault()},ref:d,type:"button",children:[n&&we(n,{}),l&&we("span",{className:"toolbar-popup__dropdown-label",children:l}),we("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&we($t.Fragment,{children:p})]})}var Uo="toolbar-popup__dropdown",wm=t=>{let e=el(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=_m(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a;if(l.Component){let f;return e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==i?(f=l?.Component&&Pe(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=l,e[1]=o,e[2]=r,e[3]=n,e[4]=i,e[5]=f):f=e[5],f}let u=l.key,m;if(l.label){let f;e[6]!==l||e[7]!==d||e[8]!==s||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):l.label,e[6]=l,e[7]=d,e[8]=s,e[9]=c,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==l||e[12]!==m||e[13]!==o||e[14]!==n||e[15]!==i||e[16]!==u?(p=Pe(Ji,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?Pe(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:Pe("span",{className:"text",children:m})},l.key),e[11]=l,e[12]=m,e[13]=o,e[14]=n,e[15]=i,e[16]=u,e[17]=p):p=e[17],p},Se=t=>{let e=el(42),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:d,onActiveChange:c}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=Wo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,g]=Wo.useState(f),[T,M]=Wo.useState(!0),A=B(),{items:C,key:w}=i,x;e[2]!==n||e[3]!==C||e[4]!==d||e[5]!==A||e[6]!==i||e[7]!==c?(x=()=>{n.getEditorState().read(()=>{let $=Tm();if(!$)return;let j=[],Q=[],W=[];for(let G of C)G.isActive&&(!d||j.length<d)&&G.isActive({editor:n,editorConfigContext:A,selection:$})&&(j.push(G.key),Q.push(G)),G.isEnabled?G.isEnabled({editor:n,editorConfigContext:A,selection:$})&&W.push(G.key):W.push(G.key);i.isEnabled&&M(i.isEnabled({editor:n,editorConfigContext:A,selection:$})),p(j),g(W),c&&c({activeItems:Q})})},e[2]=n,e[3]=C,e[4]=d,e[5]=A,e[6]=i,e[7]=c,e[8]=x):x=e[8];let N=x,S,E;e[9]!==N?(S=()=>{N()},E=[N],e[9]=N,e[10]=S,e[11]=E):(S=e[10],E=e[11]),Qi(S,E);let k,I;e[12]!==n||e[13]!==N?(k=()=>bm(n.registerUpdateListener(()=>{N()})),I=[n,N],e[12]=n,e[13]=N,e[14]=k,e[15]=I):(k=e[14],I=e[15]),Qi(k,I);let b=`${w} dropdown`,_=`${Uo}-${w}`,R;e[16]!==r?(R=r||[],e[16]=r,e[17]=R):R=e[17];let L;e[18]!==_||e[19]!==R?(L=[Uo,_,...R].filter(Boolean),e[18]=_,e[19]=R,e[20]=L):L=e[20];let D=L.join(" "),v=!T,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let H;if(e[23]!==O||e[24]!==C||e[25]!==m||e[26]!==o||e[27]!==n||e[28]!==h||e[29]!==b||e[30]!==D||e[31]!==v||e[32]!==l||e[33]!==a||e[34]!==w){let $;e[36]!==C||e[37]!==m||e[38]!==o||e[39]!==n||e[40]!==h?($=C.length&&C.map(j=>Pe(wm,{active:m.includes(j.key),anchorElem:o,editor:n,enabled:h.includes(j.key),item:j},j.key)),e[36]=C,e[37]=m,e[38]=o,e[39]=n,e[40]=h,e[41]=$):$=e[41],H=Pe(qi,{buttonAriaLabel:b,buttonClassName:D,disabled:v,Icon:l,itemsContainerClassNames:[`${Uo}-items`,...O],label:a,children:$},w),e[23]=O,e[24]=C,e[25]=m,e[26]=o,e[27]=n,e[28]=h,e[29]=b,e[30]=D,e[31]=v,e[32]=l,e[33]=a,e[34]=w,e[35]=H}else H=e[35];return H};function Rm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ne(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ne(st,{editor:e,item:o,children:ne(o.ChildComponent,{})},o.key):null}function ym(t){let e=tl(26),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=Im(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a,[u,m]=he.useState(void 0),[p,f]=he.useState(void 0),h,g;e[0]!==i?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},g=[i],e[0]=i,e[1]=h,e[2]=g):(h=e[1],g=e[2]),he.useEffect(h,g);let T;e[3]!==i||e[4]!==d||e[5]!==s||e[6]!==c?(T=N=>{let{activeItems:S}=N;if(!S.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let E=S[0],k=E.key;E.label&&(k=typeof E.label=="function"?E.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):E.label),k.length>25&&(k=k.substring(0,25)+"..."),m(k),f(()=>E.ChildComponent)},e[3]=i,e[4]=d,e[5]=s,e[6]=c,e[7]=T):T=e[7];let M=T,A=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,C;e[8]!==i||e[9]!==p||e[10]!==o||e[11]!==r||e[12]!==u||e[13]!==M?(C=i.type==="dropdown"&&i.items.length&&(p?ne(Se,{anchorElem:o,editor:r,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:M}):ne(Se,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:M})),e[8]=i,e[9]=p,e[10]=o,e[11]=r,e[12]=u,e[13]=M,e[14]=C):C=e[14];let w;e[15]!==i||e[16]!==o||e[17]!==r?(w=i.type==="buttons"&&i.items.length&&i.items.map(N=>ne(Rm,{anchorElem:o,editor:r,item:N},N.key)),e[15]=i,e[16]=o,e[17]=r,e[18]=w):w=e[18];let x;return e[19]!==n.features.toolbarFixed||e[20]!==l||e[21]!==C||e[22]!==w||e[23]!==A||e[24]!==i.key?(x=Em("div",{className:A,children:[C,w,l<n.features.toolbarFixed?.groups.length-1&&ne("div",{className:"divider"})]},i.key),e[19]=n.features.toolbarFixed,e[20]=l,e[21]=C,e[22]=w,e[23]=A,e[24]=i.key,e[25]=x):x=e[25],x}function vm({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=he.useRef(null),{y:l}=km(),s=Sm(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let d=n.editorContainerRef.current.previousElementSibling;for(;d;){if(d.classList.contains("fixed-toolbar"))return d;d=d.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Lm(()=>{if(!s)return;let a=i.current;if(!a)return;let d=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(d.bottom<c.top||d.top>c.bottom))a.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),ne("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ne(he.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,d)=>ne(ym,{anchorElem:t,editor:o,editorConfig:r,group:a,index:d},a.key))})})}var ol=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ol(t.parentEditor)}return!1},rl=t=>{let e=tl(7),{anchorElem:o,clientProps:r}=t,[n]=Nm(),i=B(),{editorConfig:l}=i,s=r.applyToFocusedEditor&&i.focusedEditor?.editor||n,a=r.applyToFocusedEditor&&i.focusedEditor?.editorConfig||l,d,c;if(e[0]!==i||e[1]!==r?.disableIfParentHasFixedToolbar||e[2]!==a||e[3]!==o||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{let u=ol(i);if(r?.disableIfParentHasFixedToolbar&&u){c=null;break e}if(!a?.features?.toolbarFixed?.groups?.length){c=null;break e}d=ne(vm,{anchorElem:o,editor:s,editorConfig:a,parentWithFixedToolbar:u})}e[0]=i,e[1]=r?.disableIfParentHasFixedToolbar,e[2]=a,e[3]=o,e[4]=s,e[5]=d,e[6]=c}else d=e[5],c=e[6];return c!==Symbol.for("react.early_return_sentinel")?c:d};var Mm=y({plugins:[{Component:rl,position:"aboveContainer"}]});import{c as ll}from"react/compiler-runtime";import{jsx as le,jsxs as sl}from"react/jsx-runtime";import{useLexicalComposerContext as Dm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as al}from"@lexical/utils";import{$getSelection as cl,$isRangeSelection as nl,$isTextNode as Am,COMMAND_PRIORITY_LOW as Om,SELECTION_CHANGE_COMMAND as Fm}from"lexical";import{useCallback as Ht,useEffect as ct,useRef as il,useState as $m}from"react";import*as jt from"react";import{createPortal as Pm}from"react-dom";function Vo(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 Bt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:d=10}=t,c=o.parentElement;if(a===null||c==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-u.height-d,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let g=0;return!e&&f<p.top&&!s&&(g=u.height+a.height+d*2,f+=g),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function Bm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&le(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?le(st,{editor:e,item:o,children:le(o.ChildComponent,{})},o.key):null}function Hm(t){let e=ll(22),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=B(),[s,a]=jt.useState(),d,c;e[0]!==n?(d=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0)},c=[n],e[0]=n,e[1]=d,e[2]=c):(d=e[1],c=e[2]),jt.useEffect(d,c);let u;e[3]!==n?(u=T=>{let{activeItems:M}=T;if(!M.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0);return}let A=M[0];a(()=>A.ChildComponent)},e[3]=n,e[4]=u):u=e[4];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;e[5]!==n||e[6]!==s||e[7]!==o||e[8]!==r||e[9]!==m?(f=n.type==="dropdown"&&n.items.length&&(s?le(Se,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:1,onActiveChange:m}):le(Se,{anchorElem:o,editor:r,group:n,maxActiveItems:1,onActiveChange:m})),e[5]=n,e[6]=s,e[7]=o,e[8]=r,e[9]=m,e[10]=f):f=e[10];let h;e[11]!==n||e[12]!==o||e[13]!==r?(h=n.type==="buttons"&&n.items.length&&n.items.map(T=>le(Bm,{anchorElem:o,editor:r,item:T},T.key)),e[11]=n,e[12]=o,e[13]=r,e[14]=h):h=e[14];let g;return e[15]!==l.features.toolbarInline||e[16]!==i||e[17]!==f||e[18]!==h||e[19]!==p||e[20]!==n.key?(g=sl("div",{className:p,children:[f,h,i<l.features.toolbarInline?.groups.length-1&&le("div",{className:"divider"})]},n.key),e[15]=l.features.toolbarInline,e[16]=i,e[17]=f,e[18]=h,e[19]=p,e[20]=n.key,e[21]=g):g=e[21],g}function jm({anchorElem:t,editor:e}){let o=il(null),r=il(null),{editorConfig:n}=B(),i=Ht(()=>{if(o?.current){let d=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";d||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=Ht(d=>{if(o?.current&&(d.buttons===1||d.buttons===3)){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!c||!u){let m=d.clientX,p=d.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ht(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ht(()=>{let d=cl(),c=window.getSelection();if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(d!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Vo(c,p),h=Bt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Bt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ct(()=>{let d=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),d&&d.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),d&&d.removeEventListener("scroll",c)}},[e,a,t]),ct(()=>(e.getEditorState().read(()=>{a()}),al(e.registerUpdateListener(({editorState:d})=>{d.read(()=>{a()})}),e.registerCommand(Fm,()=>(a(),!1),Om))),[e,a]),sl("div",{className:"inline-toolbar-popup",ref:o,children:[le("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((d,c)=>le(Hm,{anchorElem:t,editor:e,group:d,index:c},d.key))]})}function Gm(t,e){let o=ll(12),[r,n]=$m(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=cl(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!nl(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!nl(m))return;if(m.getTextContent()!==""){let g=m.getNodes(),T=!1;for(let M of g)if(Am(M)){n(!0),T=!0;break}T||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ct(s,a);let d,c;if(o[5]!==t||o[6]!==l?(d=()=>al(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=d,o[8]=c):(d=o[7],c=o[8]),ct(d,c),!r||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=Pm(le(jm,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var ul=t=>{let{anchorElem:e}=t,[o]=Dm();return Gm(o,e)};var Wm=y({plugins:[{Component:ul,position:"floatingAnchorElem"}]});import{TableCellNode as Ef,TableNode as Nf,TableRowNode as kf}from"@lexical/table";import{jsx as dl}from"react/jsx-runtime";import"react";var Ko=()=>dl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dl("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{$convertFromMarkdownString as Um,$convertToMarkdownString as Vm}from"@lexical/markdown";import{$createTableCellNode as Km,$createTableNode as zm,$createTableRowNode as Zm,$isTableCellNode as ml,$isTableNode as zo,$isTableRowNode as Zo,TableCellHeaderStates as Gt,TableCellNode as Ym,TableNode as Xm,TableRowNode as Jm}from"@lexical/table";import{$isParagraphNode as qm,$isTextNode as Qm}from"lexical";var fl=/^\|(.+)\|\s?$/,ep=/^(\| ?:?-*:? ?)+\|\s?$/,hl=({allTransformers:t})=>({type:"element",dependencies:[Xm,Jm,Ym],export:e=>{if(!zo(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Zo(r))continue;let i=!1;for(let l of r.getChildren())ml(l)&&(n.push(Vm(t,l).replace(/\n/g,"\\n")),l.__headerState===Gt.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
36
36
  `)},regExp:fl,replace:(e,o,r)=>{if(ep.test(r[0])){let c=e.getPreviousSibling();if(!c||!zo(c))return;let u=c.getChildren(),m=u[u.length-1];if(!m||!Zo(m))return;m.getChildren().forEach(p=>{ml(p)&&p.setHeaderStyles(Gt.ROW,Gt.ROW)}),e.remove();return}let n=pl(r[0],t);if(n==null)return;let i=[n],l=e.getPreviousSibling(),s=n.length;for(;l&&!(!qm(l)||l.getChildrenSize()!==1);){let c=l.getFirstChild();if(!Qm(c))break;let u=pl(c.getTextContent(),t);if(u==null)break;s=Math.max(s,u.length),i.unshift(u);let m=l.getPreviousSibling();l.remove(),l=m}let a=zm();for(let c of i){let u=Zm();a.append(u);for(let m=0;m<s;m++)u.append(m<c.length?c[m]:gl("",t))}let d=e.getPreviousSibling();zo(d)&&tp(d)===s?(d.append(...a.getChildren()),e.remove()):e.replace(a),a.selectEnd()}});function tp(t){let e=t.getFirstChild();return Zo(e)?e.getChildrenSize():0}var gl=(t,e)=>{t=t.replace(/\\n/g,`
37
37
  `);let o=Km(Gt.NO_STATUS);return Um(t,e,o),o},pl=(t,e)=>{let o=t.match(fl);return!o||!o[1]?null:o[1].split("|").map(r=>gl(r,e))};import{c as rp}from"react/compiler-runtime";import{jsx as P,jsxs as ge}from"react/jsx-runtime";import{useLexicalComposerContext as _l}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as np}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as ip,$deleteTableRow__EXPERIMENTAL as lp,$getNodeTriplet as sp,$getTableCellNodeFromLexicalNode as ap,$getTableColumnIndexFromTableCellNode as cp,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as up,$insertTableColumn__EXPERIMENTAL as dp,$insertTableRow__EXPERIMENTAL as mp,$isTableCellNode as Wt,$isTableRowNode as xl,$isTableSelection as Vt,$unmergeCell as pp,getTableObserverFromTableElement as fp,TableCellHeaderStates as Ee,TableCellNode as hp}from"@lexical/table";import{useScrollInfo as gp}from"@payloadcms/ui";import{$createParagraphNode as Cp,$getRoot as xp,$getSelection as Kt,$isElementNode as bp,$isParagraphNode as Tl,$isRangeSelection as Jo,$isTextNode as _p}from"lexical";import*as qo from"react";import{useCallback as se,useEffect as Re,useRef as Ut,useState as Be}from"react";import{createPortal as wl}from"react-dom";import{jsx as Yo,jsxs as op}from"react/jsx-runtime";import"react";var Cl=()=>op("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Yo("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"}),Yo("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"}),Yo("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 Xo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Tp(){let t=Kt();if(Jo(t)&&!t.isCollapsed()||Vt(t)&&!t.anchor.is(t.focus)||!Jo(t)&&!Vt(t))return!1;let[e]=sp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function bl(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Tl(e)||!e.isEmpty())}function wp(t){let e=t.getLastDescendant();_p(e)?e.select():bp(e)?e.selectEnd():e!==null&&e.selectNext()}function Ep({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=_l(),l=Ut(null),[s,a]=Be(n),[d,c]=Be({columns:1,rows:1}),[u,m]=Be(!1),[p,f]=Be(!1),{y:h}=gp();Re(()=>i.registerMutationListener(hp,b=>{b.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),Re(()=>{i.getEditorState().read(()=>{let b=Kt();if(Vt(b)){let _=Xo(b);c(Xo(b)),m(_.columns>1||_.rows>1)}f(Tp())})},[i]),Re(()=>{let b=e.current,_=l.current,R=i.getRootElement();if(b!=null&&_!=null&&R!=null){let L=R.getBoundingClientRect(),D=b.getBoundingClientRect();_.style.opacity="1";let v=_.getBoundingClientRect(),O=5,H=D.right+O;if(H+v.width>window.innerWidth||H+v.width>L.right){let j=D.left-v.width-O;H=(j<0?O:j)+window.pageXOffset}_.style.left=`${H+window.pageXOffset}px`;let $=D.top;if($+v.height>window.innerHeight){let j=D.bottom-v.height;$=(j<0?O:j)+window.pageYOffset}_.style.top=`${$}px`}},[e,l,i,h]),Re(()=>{function b(_){l.current!=null&&e.current!=null&&!l.current.contains(_.target)&&!e.current.contains(_.target)&&r(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[r,e]);let g=se(()=>{i.update(()=>{if(s.isAttached()){let _=ut(s),R=i.getElementByKey(_.getKey());if(!R)throw new Error("Expected to find tableElement in DOM");let L=fp(R);L!==null&&L.clearHighlight(),_.markDirty(),a(s.getLatest())}xp().selectStart()})},[i,s]),T=()=>{i.update(()=>{let b=Kt();if(Vt(b)){let{columns:_,rows:R}=Xo(b),L=b.getNodes(),D=null;for(let v=0;v<L.length;v++){let O=L[v];if(Wt(O))if(D===null){O.setColSpan(_).setRowSpan(R),D=O;let H=bl(O),$;H&&Tl($=O.getFirstChild())&&$.remove()}else Wt(D)&&(bl(O)||D.append(...O.getChildren()),O.remove())}D!==null&&(D.getChildrenSize()===0&&D.append(Cp()),wp(D)),o()}})},M=()=>{i.update(()=>{pp()})},A=se(b=>{i.update(()=>{mp(b),o()})},[i,o]),C=se(b=>{i.update(()=>{for(let _=0;_<d.columns;_++)dp(b);o()})},[i,o,d.columns]),w=se(()=>{i.update(()=>{lp(),o()})},[i,o]),x=se(()=>{i.update(()=>{ut(s).remove(),g(),o()})},[i,s,g,o]),N=se(()=>{i.update(()=>{ip(),o()})},[i,o]),S=se(()=>{i.update(()=>{let b=ut(s),_=up(s),R=b.getChildren();if(_>=R.length||_<0)throw new Error("Expected table cell to be inside of table row.");let L=R[_];if(!xl(L))throw new Error("Expected table row");let D=s.getHeaderStyles()^Ee.ROW;L.getChildren().forEach(v=>{if(!Wt(v))throw new Error("Expected table cell");v.setHeaderStyles(D,Ee.ROW)}),g(),o()})},[i,s,g,o]),E=se(()=>{i.update(()=>{let b=ut(s),_=cp(s),R=b.getChildren(),L=Math.max(...R.map(v=>v.getChildren().length));if(_>=L||_<0)throw new Error("Expected table cell to be inside of table row.");let D=s.getHeaderStyles()^Ee.COLUMN;for(let v=0;v<R.length;v++){let O=R[v];if(!xl(O))throw new Error("Expected table row");let H=O.getChildren();if(_>=H.length)continue;let $=H[_];if(!Wt($))throw new Error("Expected table cell");$.setHeaderStyles(D,Ee.COLUMN)}g(),o()})},[i,s,g,o]),k=se(()=>{i.update(()=>{if(s.isAttached()){let b=ut(s);b&&b.setRowStriping(!b.getRowStriping())}g(),o()})},[i,s,g,o]),I=null;return t&&(u?I=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),type:"button",children:"Merge cells"}):p&&(I=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>M(),type:"button",children:"Unmerge cells"}))),wl(ge("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[I?ge(qo.Fragment,{children:[I,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>A(!1),type:"button",children:ge("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>A(!0),type:"button",children:ge("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>C(!1),type:"button",children:ge("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>C(!0),type:"button",children:ge("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>N(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>S(),type:"button",children:ge("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>E(),type:"button",children:ge("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Np({anchorElem:t,cellMerge:e}){let[o]=_l(),r=Ut(null),n=Ut(null),[i,l]=Be(!1),[s,a]=Be(null),d=se(()=>{let u=r.current,m=Kt(),p=window.getSelection(),f=document.activeElement;if(m==null||u==null){a(null);return}let h=o.getRootElement();if(Jo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let g=ap(m.anchor.getNode());if(g==null){a(null);return}if(o.getElementByKey(g.getKey())==null){a(null);return}a(g)}else f||a(null)},[o]);Re(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{d()})})),Re(()=>{let u=r.current;if(u!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=u.getBoundingClientRect(),h=t.getBoundingClientRect(),g=p.top-h.top+4,T=p.right-f.width-10-h.left;u.style.opacity="1",u.style.transform=`translate(${T}px, ${g}px)`}else u.style.opacity="0",u.style.transform="translate(-10000px, -10000px)"}},[r,s,o,t]);let c=Ut(s);return Re(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&ge(qo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:n,type:"button",children:P(Cl,{})}),i&&P(Ep,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var El=t=>{let e=rp(3),{anchorElem:o}=t,r=np(),n;return e[0]!==r||e[1]!==o?(n=wl(r?P(Np,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as kp}from"react/compiler-runtime";import{jsx as Yt,jsxs as Lp}from"react/jsx-runtime";import{useLexicalComposerContext as Ip}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Sp}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Rp,$getTableNodeFromLexicalNodeOrThrow as Qo,$getTableRowIndexFromTableCellNode as yp,$isTableCellNode as Nl,$isTableRowNode as vp,getDOMCellFromTarget as Mp,TableNode as Dp}from"@lexical/table";import{calculateZoomLevel as kl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as er}from"lexical";import*as Sl from"react";import{useCallback as He,useEffect as Ll,useRef as zt,useState as Zt}from"react";import{createPortal as Ap}from"react-dom";var Op=33,Il=92;function Fp({editor:t}){let e=zt(null),o=zt(null),r=zt(null),n=B(),i=zt(null),[l,s]=Zt(null),[a,d]=Zt(null),[c,u]=Zt(!1),[m,p]=Zt(null),f=He(()=>{d(null),e.current=null,p(null),i.current=null,r.current=null},[]),h=E=>(E.buttons&1)===1;Ll(()=>t.registerNodeTransform(Dp,E=>{if(E.getColWidths())return E;let k=E.getColumnCount(),I=Il;return E.setColWidths(Array(k).fill(I)),E}),[t]),Ll(()=>{let E=_=>{setTimeout(()=>{let R=_.target;if(m){s({x:_.clientX,y:_.clientY});return}if(u(h(_)),!(o.current&&o.current.contains(R))&&e.current!==R){e.current=R;let L=Mp(R);L&&a!==L?t.update(()=>{let D=er(L.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let v=Qo(D),O=t.getElementByKey(v.getKey());if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=R,r.current=O.getBoundingClientRect(),d(L)}):L==null&&f()}},0)},k=_=>{setTimeout(()=>{u(!0)},0)},I=_=>{setTimeout(()=>{u(!1)},0)},b=t.registerRootListener((_,R)=>{R?.removeEventListener("mousemove",E),R?.removeEventListener("mousedown",k),R?.removeEventListener("mouseup",I),_?.addEventListener("mousemove",E),_?.addEventListener("mousedown",k),_?.addEventListener("mouseup",I)});return()=>{b()}},[a,m,t,f]);let g=E=>E==="bottom",T=He(E=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let k=er(a.elem);if(!Nl(k))throw new Error("TableCellResizer: Table cell node not found.");let I=Qo(k),b=yp(k)+k.getRowSpan()-1,_=I.getChildren();if(b>=_.length||b<0)throw new Error("Expected table cell to be inside of table row.");let R=_[b];if(!vp(R))throw new Error("Expected table row");let L=R.getHeight();if(L===void 0){let v=R.getChildren();L=Math.min(...v.map(O=>M(O,t)??1/0))}let D=Math.max(L+E,Op);R.setHeight(D)},{tag:"skip-scroll-into-view"})},[a,t]),M=(E,k)=>k.getElementByKey(E.getKey())?.clientHeight,A=(E,k)=>{for(let I=0;I<k.length;I++)for(let b=0;b<k[I].length;b++)if(k[I][b].cell===E)return b},C=He(E=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let k=er(a.elem);if(!Nl(k))throw new Error("TableCellResizer: Table cell node not found.");let I=Qo(k),[b]=Rp(I,null,null),_=A(k,b);if(_===void 0)throw new Error("TableCellResizer: Table column not found.");let R=I.getColWidths();if(!R)return;let L=R[_];if(L===void 0)return;let D=[...R],v=Math.max(L+E,Il);D[_]=v,I.setColWidths(D)},{tag:"skip-scroll-into-view"})},[a,t]),w=He(E=>{let k=I=>{if(I.preventDefault(),I.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:b,y:_}=i.current;if(a===null)return;let R=kl(I.target);if(g(E)){let L=(I.clientY-_)/R;T(L)}else{let L=(I.clientX-b)/R;C(L)}f(),document.removeEventListener("mouseup",k)}};return k},[a,f,C,T]),x=He(E=>k=>{if(k.preventDefault(),k.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:k.clientX,y:k.clientY},s(i.current),p(E),document.addEventListener("mouseup",w(E))},[a,w]),S=He(()=>{if(a){let{height:E,left:k,top:I,width:b}=a.elem.getBoundingClientRect(),_=kl(a.elem),R=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${R}px`,left:`${window.pageXOffset+k}px`,top:`${window.pageYOffset+I+E-R/2}px`,width:`${b}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${E}px`,left:`${window.pageXOffset+k+b-R/2}px`,top:`${window.pageYOffset+I}px`,width:`${R}px`}},D=r.current;return m&&l&&D&&(g(m)?(L[m].left=`${window.pageXOffset+D.left}px`,L[m].top=`${window.pageYOffset+l.y/_}px`,L[m].height="3px",L[m].width=`${D.width}px`):(L[m].top=`${window.pageYOffset+D.top}px`,L[m].left=`${window.pageXOffset+l.x/_}px`,L[m].width="3px",L[m].height=`${D.height}px`),L[m].backgroundColor="#adf"),L}return{bottom:null,left:null,right:null,top:null}},[a,m,l])();return Yt("div",{ref:o,children:a!=null&&!c&&Lp(Sl.Fragment,{children:[Yt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:x("right"),style:S.right||void 0}),Yt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:x("bottom"),style:S.bottom||void 0})]})})}var Rl=()=>{let t=kp(3),[e]=Ip(),o=Sp(),r,n;return t[0]!==o||t[1]!==e?(n=o?Ap(Yt(Fp,{editor:e}),document.body):null,t[0]=o,t[1]=e,t[2]=n):n=t[2],r=n,r};import{c as Wp}from"react/compiler-runtime";import{jsx as tr,jsxs as Up,Fragment as Vp}from"react/jsx-runtime";import{useLexicalComposerContext as $l}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as Kp,$getTableRowIndexFromTableCellNode as zp,$insertTableColumn__EXPERIMENTAL as Zp,$insertTableRow__EXPERIMENTAL as Yp,$isTableCellNode as Xp,$isTableNode as Ml,TableNode as Jp}from"@lexical/table";import{$findMatchingParent as qp,mergeRegister as Qp}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Dl}from"lexical";import{useEffect as Al,useMemo as ef,useRef as Ol,useState as Xt}from"react";import"react";import{createPortal as tf}from"react-dom";import{useMemo as jp,useRef as Gp}from"react";var $p="Expected a function",Pp=Math.max,Bp=Math.min;function Hp(t,e,o){let r,n,i=0,l,s=!1,a=!1,d,c,u,m=!0;if(typeof t!="function")throw new TypeError($p);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,d=a?Pp(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function p(x){let N=r,S=l;return r=l=void 0,i=x,c=t.apply(S,N),c}function f(x){return i=x,u=setTimeout(T,e),s?p(x):c}function h(x){let N=x-n,S=x-i,E=e-N;return a?Bp(E,d-S):E}function g(x){let N=x-n,S=x-i;return n===void 0||N>=e||N<0||a&&S>=d}function T(){let x=Date.now();if(g(x))return M(x);u=setTimeout(T,h(x))}function M(x){return u=void 0,m&&r?p(x):(r=l=void 0,c)}function A(){u!==void 0&&clearTimeout(u),i=0,r=n=l=u=void 0}function C(){return u===void 0?c:M(Date.now())}function w(){let x=Date.now(),N=g(x);if(r=arguments,l=this,n=x,N){if(u===void 0)return f(n);if(a)return clearTimeout(u),u=setTimeout(T,e),p(n)}return u===void 0&&(u=setTimeout(T,e)),c}return w.cancel=A,w.flush=C,w}var yl=Hp;function vl(t,e,o){let r=Gp(null);return r.current=t,jp(()=>yl((...n)=>{r.current&&r.current(...n)},e,{maxWait:o}),[e,o])}var Fl=20;function of({anchorElem:t}){let[e]=$l(),o=B(),[r,n]=Xt(!1),[i,l]=Xt(!1),[s,a]=Xt(!1),[d,c]=Xt({}),u=Ol(new Set),m=Ol(null),p=vl(g=>{let{isOutside:T,tableDOMNode:M}=rf(g,o.editorConfig?.lexical);if(T){n(!1),l(!1);return}if(!M)return;m.current=M;let A=null,C=null,w=null;if(e.update(()=>{let x=Dl(M);if(Xp(x)){let N=qp(x,S=>Ml(S));if(!Ml(N))return;if(w=e.getElementByKey(N?.getKey()),w){let S=N.getChildrenSize(),E=N.getChildAtIndex(0)?.getChildrenSize(),k=zp(x),I=Kp(x);k===S-1?A=x:I===E-1&&(C=x)}}}),w){let{bottom:x,height:N,left:S,right:E,width:k,y:I}=w.getBoundingClientRect(),{left:b,y:_}=t.getBoundingClientRect();A?(l(!1),n(!0),c({height:Fl,left:S-b,top:x-_+5,width:k})):C&&(l(!0),n(!1),c({height:N,left:E-b+5,top:I-_,width:Fl}))}},50,250),f=ef(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);Al(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Al(()=>Qp(e.registerMutationListener(Jp,g=>{e.getEditorState().read(()=>{for(let[T,M]of g){let A=e.getElementByKey(T);switch(M){case"created":u.current.add(T),a(u.current.size>0),A&&f.observe(A);break;case"destroyed":u.current.delete(T),a(u.current.size>0),f.disconnect(),u.current.forEach(C=>{let w=e.getElementByKey(C);w&&f.observe(w)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{m.current&&(Dl(m.current)?.selectEnd(),g?(Yp(),n(!1)):(Zp(),l(!1)))})};return e?.isEditable()?Up(Vp,{children:[r&&tr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...d}}),i&&tr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...d}})]}):null}function rf(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Pl(t){let e=Wp(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=$l();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=tf(tr(of,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as nf}from"react/compiler-runtime";import{jsx as or,jsxs as lf}from"react/jsx-runtime";import{useLexicalComposerContext as sf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as af}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as cf,TableNode as uf}from"@lexical/table";import{mergeRegister as df}from"@lexical/utils";import{formatDrawerSlug as mf,useEditDepth as pf}from"@payloadcms/ui";import{$getSelection as ff,$isRangeSelection as hf,COMMAND_PRIORITY_EDITOR as gf,createCommand as Cf}from"lexical";import{createContext as xf,useContext as bf,useEffect as _f,useMemo as Tf,useState as wf}from"react";import*as Bl from"react";var Jt=Cf("OPEN_EMBED_DRAWER_COMMAND"),Hl=xf({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function jl({children:t}){let[e,o]=wf({cellEditorConfig:null,cellEditorPlugins:null});return or(Hl.Provider,{value:Tf(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Gl=()=>{let t=nf(16),[e]=sf(),o=bf(Hl),r=pf(),{fieldProps:n,uuid:i}=B(),{schemaPath:l}=n,s="lexical-table-create-"+i,a;t[0]!==s||t[1]!==r?(a=mf({slug:s,depth:r}),t[0]=s,t[1]=r,t[2]=a):a=t[2];let d=a,{toggleDrawer:c}=be(d,!0),u;t[3]!==e||t[4]!==c?(u=()=>{if(!e.hasNodes([uf]))throw new Error("TablePlugin: TableNode is not registered on editor");return df(e.registerCommand(Jt,()=>{let h;return h=null,e.getEditorState().read(()=>{let g=ff();hf(g)&&(h=g)}),h&&c(),!0},gf))},t[3]=e,t[4]=c,t[5]=u):u=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],_f(u,m);let p;t[10]!==e?(p=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(cf,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==d||t[13]!==p||t[14]!==l?(f=lf(Bl.Fragment,{children:[or(Ge,{drawerSlug:d,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),or(af,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=d,t[13]=p,t[14]=l,t[15]=f):f=t[15],f};var Lf=y({markdownTransformers:[hl],nodes:[Nf,Ef,kf],plugins:[{Component:Gl,position:"normal"},{Component:Rl,position:"normal"},{Component:El,position:"floatingAnchorElem"},{Component:Pl,position:"floatingAnchorElem"}],providers:[jl],slashMenu:{groups:[K([{Icon:Ko,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Jt,{})}}])]},toolbarFixed:{groups:[ue([{ChildComponent:Ko,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Jt,{})}}])]}});import{$isNodeSelection as Yf}from"lexical";import{jsx as rr,jsxs as If}from"react/jsx-runtime";import"react";var nr=()=>If("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:[rr("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"}),rr("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"}),rr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as Ff}from"react/compiler-runtime";import{jsx as $f}from"react/jsx-runtime";import{useLexicalComposerContext as Pf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Bf,mergeRegister as Hf}from"@lexical/utils";import{useConfig as jf}from"@payloadcms/ui";import{$getPreviousSelection as Gf,$getSelection as Wf,$isParagraphNode as Ul,$isRangeSelection as Uf,COMMAND_PRIORITY_EDITOR as Vf,createCommand as Kf}from"lexical";import{useEffect as zf}from"react";import{c as Sf}from"react/compiler-runtime";import{jsx as ir}from"react/jsx-runtime";import{useLexicalComposerContext as Rf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as yf,COMMAND_PRIORITY_EDITOR as vf}from"lexical";import{useEffect as Mf,useState as Df}from"react";var Af=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=yf(o);n&&n.replace(Ze({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(lr,{fields:null,relationTo:e,value:r})},Of=t=>{let e=Sf(13),{enabledCollectionSlugs:o}=t,[r]=Rf(),[n,i]=Df(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:d}=At(l),c,u;e[2]!==r||e[3]!==d?(c=()=>r.registerCommand(Ke,h=>(i(h?.replace?h?.replace.nodeKey:null),d(),!0),vf),u=[r,d],e[2]=r,e[3]=d,e[4]=c,e[5]=u):(c=e[4],u=e[5]),Mf(c,u);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:g,docID:T}=h;s(),Af({editor:r,relationTo:g,replaceNodeKey:n,value:T})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==p||e[11]!==a?(f=ir(a,{onSelect:p}),e[10]=p,e[11]=a,e[12]=f):f=e[12],f},Wl=t=>ir(ht,{...t,uploads:!0,children:ir(Of,{...t})});var lr=Kf("INSERT_UPLOAD_COMMAND"),Vl=t=>{let e=Ff(5),[o]=Pf(),{config:r}=jf(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([ze]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Hf(o.registerCommand(lr,a=>(o.update(()=>{let d=Wf()||Gf();if(Uf(d)){let c=Ze({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});Bf(c);let{focus:u}=d,m=u.getNode();Ul(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(p=>Ul(p)).length>1&&m.remove()}}),!0),Vf))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),zf(i,l);let s;return e[3]!==n?(s=$f(Wl,{enabledCollectionSlugs:n.map(Zf)}),e[3]=n,e[4]=s):s=e[4],s};function Zf(t){let{slug:e}=t;return e}var Xf=y({nodes:[ze],plugins:[{Component:Vl,position:"normal"}],slashMenu:{groups:[K([{Icon:nr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[ue([{ChildComponent:nr,isActive:({selection:t})=>{if(!Yf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return io(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as Jf}from"react/compiler-runtime";import{jsx as ar}from"react/jsx-runtime";import{ShimmerEffect as qf}from"@payloadcms/ui";import{lazy as Qf,Suspense as e1,useEffect as t1,useState as o1}from"react";var Kl={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",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 qt={namespace:"lexical",theme:Kl};function zl({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:r}){for(let s of r.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");r.features=r.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let n=new Map;for(let s of r.features)n.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of r.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:n,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:r}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var Zl=t=>{let e={enabledFeatures:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function sr(t,e,o){return{admin:o,features:Zl(t),lexical:e,resolvedFeatureMap:t}}var r1=Qf(()=>import("./Field-KKSJXHR7.js").then(t=>({default:t.RichText}))),n1=t=>{let e=Jf(14),{admin:o,clientFeatures:r,featureClientSchemaMap:n,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let d=a,c=l===void 0?qt:l,[u,m]=o1(null),p,f;e[2]!==u||e[3]!==r||e[4]!==c||e[5]!==n||e[6]!==i||e[7]!==s||e[8]!==d?(p=()=>{if(u)return;let g=[];for(let[A,C]of Object.entries(r))C.clientFeatureProvider&&g.push(C.clientFeatureProvider(C.clientFeatureProps));let T=c||qt,M=zl({featureClientSchemaMap:n,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:g,lexical:T}});m(sr(M,T,d))},f=[c,d,u,r,n,i,s],e[2]=u,e[3]=r,e[4]=c,e[5]=n,e[6]=i,e[7]=s,e[8]=d,e[9]=p,e[10]=f):(p=e[9],f=e[10]),t1(p,f);let h;return e[11]!==u||e[12]!==t?(h=ar(e1,{fallback:ar(qf,{height:"35vh"}),children:u&&ar(r1,{...t,editorConfig:u})}),e[11]=u,e[12]=t,e[13]=h):h=e[13],h};function i1(...t){return t.filter(Boolean).join(" ")}var Qt=new WeakMap;function Yl(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function eo(t,e){let o=Qt.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=Yl(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=Yl(l);for(let d of r)a!==null&&d([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},Qt.set(t,o)}return o.listeners.add(e),()=>{l1(t,e)}}function l1(t,e){let o=Qt.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Qt.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function s1(t,e){return eo(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function a1(t,e){return eo(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function c1(t,e){return eo(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function u1(t,e){return eo(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},d1=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,m1="\xA0",p1=`
38
38