@payloadcms/richtext-lexical 3.0.0-beta.79 → 3.0.0-beta.80

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.
@@ -32,7 +32,7 @@ ${t.map(Cs).join(`
32
32
  });
33
33
  });
34
34
  `},[e,t]),m=se((T,y)=>{o(h=>{let w=t.length-1,I=t[w];if(I&&I.name===T){if(T==="type")return[...t.slice(0,w),{...I,value:I.value+y}];if(I.value===y)return[...t.slice(0,w),{...I,count:I.count+1}]}return[...h,{name:T,count:1,value:y}]})},[t,o]);un(()=>{let T=h=>{if(!n)return;let w=h.key;hs(h)?m("selectAll",""):mn.has(w)?m("press",h.key):[...w].length>1?m("keydown",h.key):m("type",h.key)},y=h=>{if(!n)return;let w=h.key;!mn.has(w)&&[...w].length>1&&m("keyup",h.key)};return e.registerRootListener((h,w)=>{w!==null&&(w.removeEventListener("keydown",T),w.removeEventListener("keyup",y)),h!==null&&(h.addEventListener("keydown",T),h.addEventListener("keyup",y))})},[e,n,m]),un(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[u]),Kt(()=>{if(t){let T=u();T!==null&&a(T),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[u,t]),Kt(()=>e.registerUpdateListener(({dirtyElements:y,dirtyLeaves:h,editorState:w})=>{if(!n)return;let I=w._selection,v=s.current,L=c.current;if(v!==I){if(h.size===0&&y.size===0&&!L){let g=window.getSelection();if(g&&(g.anchorNode==null||g.focusNode==null))return}s.current=I}c.current=!1;let b=u();b!==null&&a(b)}),[e,u,n,m]),Kt(()=>n?e.registerUpdateListener(()=>{let y=e.getRootElement();y!==null&&i(y?.innerHTML)}):void 0,[e,n]);let f=se(T=>{n||(T.update(()=>{let y=ms();y.clear();let h=ps();y.append(us().append(h)),h.select()}),o([])),r(y=>!y)},[n]),C=se(()=>{if(!n)return;let T=window.getSelection();if(T===null||T.anchorNode==null||T.focusNode==null)return;let{anchorNode:y,anchorOffset:h,focusNode:w,focusOffset:I}=bs(T),v=p().getRootElement(),L;y!==null&&(L=pn(y,v));let b;w!==null&&(b=pn(w,v)),m("snapshot",{anchorNode:y,anchorOffset:h,anchorPath:L,focusNode:w,focusOffset:I,focusPath:b})},[m,n,p]),E=se(()=>{fs(u())},[u]),x=se(()=>{gs("test.js",u())},[u]);return[ae("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:T=>{f(p()),T.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?Xt("div",{className:"test-recorder-output",children:[Xt("div",{className:"test-recorder-toolbar",children:[ae("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:T=>{C(),T.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ae("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:T=>{E(),T.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ae("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:T=>{x(),T.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ae("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var gn=()=>{let[e]=ds(),[t,o]=xs(e);return Xt(fn.Fragment,{children:[ae("p",{children:"HI"}),t,o,ae("p",{children:"DONE"})]})};var Ts=k({plugins:[{Component:gn,position:"bottom"}]});import{useLexicalComposerContext as Es}from"@lexical/react/LexicalComposerContext.js";import{TreeView as ys}from"@lexical/react/LexicalTreeView.js";import{jsx as Ns}from"react/jsx-runtime";var Cn=()=>{let[e]=Es();return Ns(ys,{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"})};var Ls=k({plugins:[{Component:Cn,position:"bottom"}]});import{$isRangeSelection as ks,FORMAT_TEXT_COMMAND as ws}from"lexical";import{jsx as hn}from"react/jsx-runtime";var bn=()=>hn("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:hn("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 U=e=>({type:"buttons",items:e,key:"format",order:40});var xn={type:"text-format",format:["bold","italic"],tag:"***"},Tn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},En={type:"text-format",format:["bold"],tag:"**"},yn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Nn=[U([{ChildComponent:bn,isActive:({selection:e})=>ks(e)?e.hasFormat("bold"):!1,key:"bold",onSelect:({editor:e})=>{e.dispatchCommand(ws,"bold")},order:1}])],Rs=k(({featureProviderMap:e})=>{let t=[En,yn];return e.get("italic")&&t.push(Tn,xn),{markdownTransformers:t,toolbarFixed:{groups:Nn},toolbarInline:{groups:Nn}}});import{$isRangeSelection as Ss,FORMAT_TEXT_COMMAND as vs}from"lexical";import{jsx as Ln,jsxs as _s}from"react/jsx-runtime";var kn=()=>_s("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:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Ln("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var wn={type:"text-format",format:["code"],tag:"`"};var Rn=[U([{ChildComponent:kn,isActive:({selection:e})=>Ss(e)?e.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:e})=>{e.dispatchCommand(vs,"code")},order:7}])],Is=k({markdownTransformers:[wn],toolbarFixed:{groups:Rn},toolbarInline:{groups:Rn}});import{$isRangeSelection as Fs,FORMAT_TEXT_COMMAND as Ms}from"lexical";import{jsx as _n}from"react/jsx-runtime";var Sn=()=>_n("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_n("path",{d:"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 vn={type:"text-format",format:["italic"],tag:"*"},In={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Fn=[U([{ChildComponent:Sn,isActive:({selection:e})=>Fs(e)?e.hasFormat("italic"):!1,key:"italic",onSelect:({editor:e})=>{e.dispatchCommand(Ms,"italic")},order:2}])],Ps=k({markdownTransformers:[vn,In],toolbarFixed:{groups:Fn},toolbarInline:{groups:Fn}});import{$isRangeSelection as As,FORMAT_TEXT_COMMAND as Os}from"lexical";import{jsx as Mn,jsxs as Ds}from"react/jsx-runtime";var Pn=()=>Ds("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mn("path",{d:"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"}),Mn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Dn={type:"text-format",format:["strikethrough"],tag:"~~"};var An=[U([{ChildComponent:Pn,isActive:({selection:e})=>As(e)?e.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:e})=>{e.dispatchCommand(Os,"strikethrough")},order:4}])],Hs=k({markdownTransformers:[Dn],toolbarFixed:{groups:An},toolbarInline:{groups:An}});import{$isRangeSelection as Bs,FORMAT_TEXT_COMMAND as $s}from"lexical";import{jsx as On}from"react/jsx-runtime";var Hn=()=>On("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:On("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 Bn=[U([{ChildComponent:Hn,isActive:({selection:e})=>Bs(e)?e.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:e})=>{e.dispatchCommand($s,"subscript")},order:5}])],Gs=k({toolbarFixed:{groups:Bn},toolbarInline:{groups:Bn}});import{$isRangeSelection as Us,FORMAT_TEXT_COMMAND as Ws}from"lexical";import{jsx as $n}from"react/jsx-runtime";var Gn=()=>$n("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$n("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 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 Un=[U([{ChildComponent:Gn,isActive:({selection:e})=>Us(e)?e.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:e})=>{e.dispatchCommand(Ws,"superscript")},order:6}])],Vs=k({toolbarFixed:{groups:Un},toolbarInline:{groups:Un}});import{$isRangeSelection as Ks,FORMAT_TEXT_COMMAND as js}from"lexical";import{jsx as Wn,jsxs as zs}from"react/jsx-runtime";var Vn=()=>zs("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:[Wn("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"}),Wn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var zn=[U([{ChildComponent:Vn,isActive:({selection:e})=>Ks(e)?e.hasFormat("underline"):!1,key:"underline",onSelect:({editor:e})=>{e.dispatchCommand(js,"underline")},order:3}])],Xs=k({toolbarFixed:{groups:zn},toolbarInline:{groups:zn}});import{$createHeadingNode as qs,$isHeadingNode as ir,HeadingNode as Qs}from"@lexical/rich-text";import{$setBlocksType as ea}from"@lexical/selection";import{$getSelection as ta,$isRangeSelection as oa}from"lexical";import{jsx as Kn}from"react/jsx-runtime";var jn=()=>Kn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Kn("path",{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 Xn}from"react/jsx-runtime";var Zn=()=>Xn("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:Xn("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 Jn}from"react/jsx-runtime";var Yn=()=>Jn("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:Jn("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 qn}from"react/jsx-runtime";var Qn=()=>qn("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:qn("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 er}from"react/jsx-runtime";var tr=()=>er("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:er("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 or}from"react/jsx-runtime";var nr=()=>or("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:or("path",{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 Zs,$isHeadingNode as Js,HeadingNode as Ys}from"@lexical/rich-text";var Zt=e=>(t,o,n)=>{let r=e(n);r&&(r.append(...o),t.replace(r),r.select(0,0))};var rr=e=>{let o=`^(${e.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[Ys],export:(r,i)=>{if(!Js(r))return null;let l=Number(r.getTag().slice(1));return"#".repeat(l)+" "+i(r)},regExp:n,replace:Zt(r=>{let i="h"+r[1].length;return Zs(i)})}};var lr=e=>{let t=ta();ea(t,()=>qs(e))},sr={h1:jn,h2:Zn,h3:Yn,h4:Qn,h5:tr,h6:nr},na=k(({props:e})=>{let{enabledHeadingSizes:t=["h1","h2","h3","h4","h5","h6"]}=e,o=[V(t.map((n,r)=>({ChildComponent:sr[n],isActive:({selection:i})=>{if(!oa(i))return!1;for(let l of i.getNodes()){if(ir(l)&&l.getTag()===n)continue;let a=l.getParent();if(!(ir(a)&&a.getTag()===n))return!1}return!0},key:n,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{lr(n)})},order:r+2})))];return{markdownTransformers:[rr(t)],nodes:[Qs],sanitizedClientFeatureProps:e,slashMenu:{groups:t?.length?[G(t.map(n=>({Icon:sr[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{lr(n)})}})))]:[]},toolbarFixed:{groups:t?.length?o:[]},toolbarInline:{groups:t?.length?o:[]}}});import{$isNodeSelection as ua}from"lexical";import{jsx as ar}from"react/jsx-runtime";var Jt=()=>ar("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:ar("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as cr,jsxs as ra}from"react/jsx-runtime";var dr=()=>ra("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[cr("path",{d:"M5 10h10",stroke:"currentColor"}),cr("path",{d:"M10 15V5",stroke:"currentColor"})]});var Y=e=>({type:"dropdown",ChildComponent:dr,items:e,key:"add",order:10});var ur={type:"element",dependencies:[Xe],export:(e,t)=>Je(e)?"---":null,regExp:/^---\s*$/,replace:e=>{let t=Ze();t&&e.replace(t)}};import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as la}from"@lexical/utils";import{$getSelection as sa,$isRangeSelection as aa,COMMAND_PRIORITY_EDITOR as ca}from"lexical";import{useEffect as da}from"react";var pr=()=>{let[e]=ia();return da(()=>e.registerCommand(ke,t=>{let o=sa();if(!aa(o))return!1;if(o.focus.getNode()!==null){let r=Ze();la(r)}return!0},ca),[e]),null};var pa=k({markdownTransformers:[ur],nodes:[Xe],plugins:[{Component:pr,position:"normal"}],slashMenu:{groups:[G([{Icon:Jt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(ke,void 0)}}])]},toolbarFixed:{groups:[Y([{ChildComponent:Jt,isActive:({selection:e})=>{if(!ua(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Je(t)},key:"horizontalRule",label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(ke,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as ga,OUTDENT_CONTENT_COMMAND as Ca}from"lexical";import{jsx as st,jsxs as ma}from"react/jsx-runtime";var mr=()=>ma("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:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as at,jsxs as fa}from"react/jsx-runtime";var fr=()=>fa("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:[at("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var gr=e=>({type:"buttons",items:e,key:"indent",order:35});var Cr=[gr([{ChildComponent:mr,isActive:()=>!1,isEnabled:({selection:e})=>{if(!e||!e?.getNodes()?.length)return!1;for(let t of e.getNodes())if("__indent"in t&&t.__indent>0||t.getParent()&&"__indent"in t.getParent()&&t.getParent().__indent>0)return!0;return!1},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ca,void 0)},order:1},{ChildComponent:fr,isActive:()=>!1,key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ga,void 0)},order:2}])],ha=k({toolbarFixed:{groups:Cr},toolbarInline:{groups:Cr}});import{$findMatchingParent as Nc}from"@lexical/utils";import{$getSelection as ro,$isRangeSelection as Kr}from"lexical";import{jsx as hr}from"react/jsx-runtime";var br=()=>hr("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:hr("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 xr}from"@lexical/selection";function pe(e){let{anchor:t}=e,{focus:o}=e,n=e.anchor.getNode(),r=e.focus.getNode();return n===r?n:e.isBackward()?xr(o)?n:r:xr(t)?n:r}var Yt=e=>({type:"buttons",items:e,key:"features",order:50});import{$createTextNode as _a,$isTextNode as Sa}from"lexical";import{addClassNamesToElement as ba,isHTMLAnchorElement as xa}from"@lexical/utils";import eo from"bson-objectid";import{$applyNodeReplacement as Ta,$createTextNode as Tr,$getSelection as Ea,$isElementNode as Er,$isRangeSelection as Qt,ElementNode as ya,createCommand as Na}from"lexical";var La=new Set(["http:","https:","mailto:","sms:","tel:"]),z=class e extends ya{__fields;__id;constructor({id:t,fields:o={doc:null,linkType:"custom",newTab:!1,url:void 0},key:n}){super(n),this.__fields=o,this.__id=t}static clone(t){return new e({id:t.__id,fields:t.__fields,key:t.__key})}static getType(){return"link"}static importDOM(){return{a:t=>({conversion:ka,priority:1})}}static importJSON(t){t.version===1&&typeof t.fields?.doc?.value=="object"&&t.fields?.doc?.value?.id&&(t.fields.doc.value=t.fields.doc.value.id,t.version=2),t.version===2&&!t.id&&(t.id=new eo.default().toHexString(),t.version=3);let o=q({id:t.id,fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(t){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=qt(o.rel,"add","noopener")),ba(o,t.theme.link),o}exportJSON(){let t={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(t.id=o),t}extractWithChild(t,o,n){if(!Qt(o))return!1;let r=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(t,o=!0){let n=this.getParentOrThrow().insertNewAfter(t,o);if(Er(n)){let r=q({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(t){try{let o=new URL(t);if(!La.has(o.protocol))return"about:blank"}catch{return"https://"}return t}setFields(t){let o=this.getWritable();o.__fields=t}updateDOM(t,o,n){let r=this.__fields?.url,i=this.__fields?.newTab;return r!=null&&r!==t.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&t.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==t.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=qt(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=qt(o.rel,"remove","noopener"))),!1}};function ka(e){let t=null;if(xa(e)){let o=e.textContent;o!==null&&o!==""&&(t=q({id:new eo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:e.getAttribute("target")==="_blank",url:e.getAttribute("href")??""}}))}return{node:t}}function q({id:e,fields:t}){return Ta(new z({id:e??new eo.default().toHexString(),fields:t}))}function $(e){return e instanceof z}var Z=Na("TOGGLE_LINK_COMMAND");function yr(e){let t=Ea();if(!Qt(t)&&!e.selectedNodes.length)return;let o=Qt(t)?t.extract():e.selectedNodes;if(e===null)o.forEach(n=>{let r=n.getParent();if($(r)){let i=r.getChildren();for(let l=0;l<i.length;l+=1)r.insertBefore(i[l]);r.remove()}});else{if(o.length===1){let i=o[0],l=$(i)?i:wa(i);if(l!==null){l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(Tr(e.text)),l.getChildren().forEach(a=>{a!==l.getLastChild()&&a.remove()}));return}}let n=null,r=null;o.forEach(i=>{let l=i.getParent();if(!(l===r||l===null||Er(i)&&!i.isInline())){if($(l)){r=l,l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(Tr(e.text)),l.getChildren().forEach(a=>{a!==l.getLastChild()&&a.remove()}));return}if(l.is(n)||(n=l,r=q({fields:e.fields}),$(l)?i.getPreviousSibling()===null?l.insertBefore(r):l.insertAfter(r):i.insertBefore(r)),$(i)){if(i.is(r))return;if(r!==null){let a=i.getChildren();for(let s=0;s<a.length;s+=1)r.append(a[s])}i.remove();return}r!==null&&r.append(i)}})}}function wa(e){return Ra(e,t=>$(t))}function Ra(e,t){let o=e;for(;o!==null&&(o=o.getParent())!==null&&!t(o););return o}function qt(e,t,o){let n,r=`${e}`;if(t==="add"){if(r.includes(o)){let i=new RegExp(o,"g");r=r.replace(i,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let i=new RegExp(o,"g");n=r.replace(i,"").trim()}return n}var Nr={type:"text-match",dependencies:[z],export:(e,t,o)=>{if(!$(e))return null;let n=e,{url:r}=n.getFields(),i=`[${n.getTextContent()}](${r})`,l=n.getFirstChild();return n.getChildrenSize()===1&&Sa(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(e,t)=>{let[,o,n]=t,r=q({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),i=_a(o);i.setFormat(e.getFormat()),r.append(i),e.replace(r)},trigger:")"};import{$applyNodeReplacement as va,$isElementNode as Ia}from"lexical";var Q=class e extends z{static clone(t){return new e({id:void 0,fields:t.__fields,key:t.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(t){t.version===1&&typeof t.fields?.doc?.value=="object"&&t.fields?.doc?.value?.id&&(t.fields.doc.value=t.fields.doc.value.id,t.version=2);let o=Ae({fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}exportJSON(){let t=super.exportJSON();return{type:"autolink",children:t.children,direction:t.direction,fields:t.fields,format:t.format,indent:t.indent,version:2}}insertNewAfter(t,o=!0){let n=this.getParentOrThrow().insertNewAfter(t,o);if(Ia(n)){let r=Ae({fields:this.__fields});return n.append(r),r}return null}};function Ae({fields:e}){return va(new Q({id:void 0,fields:e}))}function ee(e){return e instanceof Q}import{useLexicalComposerContext as Fa}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ma}from"@lexical/utils";import{$createTextNode as Lr,$getSelection as Pa,$isElementNode as wr,$isLineBreakNode as Rr,$isNodeSelection as Da,$isRangeSelection as Aa,$isTextNode as Oe,TextNode as Oa}from"lexical";import{useEffect as Ha}from"react";function kr(e,t=o=>o){return o=>{let n=e.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:t(n[0])}}}function _r(e,t){for(let o=0;o<t.length;o++){let n=t[o](e);if(n!=null)return n}return null}var Ba=/[.,;\s]/;function dt(e){return Ba.test(e)}function Sr(e){return dt(e[e.length-1])}function oo(e){return dt(e[0])}function $a(e,t){return t?/^\.[a-z]{2,}/i.test(e):/^\.[a-z0-9]+/i.test(e)}function vr(e){let t=e.getPreviousSibling();return wr(t)&&(t=t.getLastDescendant()),t===null||Rr(t)||Oe(t)&&Sr(t.getTextContent())}function Ir(e){let t=e.getNextSibling();return wr(t)&&(t=t.getFirstDescendant()),t===null||Rr(t)||Oe(t)&&oo(t.getTextContent())}function Ga(e,t,o,n){return(e>0?dt(o[e-1]):vr(n[0]))?t<o.length?dt(o[t]):Ir(n[n.length-1]):!1}function Ua(e,t,o){let n=[],r=[],i=[],l=0,a=0,s=[...e];for(;s.length>0;){let c=s[0],p=c.getTextContent().length,u=a;a+p<=t?(n.push(c),l+=p):u>=o?i.push(c):r.push(c),a+=p,s.shift()}return[l,n,r,i]}function Wa(e,t,o,n){let r={linkType:"custom",url:n.url,...n.fields},i=Ae({fields:r});if(e.length===1){let l=e[0],a;t===0?[a,l]=l.splitText(o):[,a,l]=l.splitText(t,o);let s=Lr(n.text);return s.setFormat(a.getFormat()),s.setDetail(a.getDetail()),s.setStyle(a.getStyle()),i.append(s),a.replace(i),l}else if(e.length>1){let l=e[0],a=l.getTextContent().length,s;t===0?s=l:[,s]=l.splitText(t);let c=[],d;for(let f=1;f<e.length;f++){let C=e[f],x=C.getTextContent().length,F=a,M=a+x;if(F<o)if(M<=o)c.push(C);else{let[T,y]=C.splitText(o-F);c.push(T),d=y}a+=x}let p=Pa(),u=p?p.getNodes().find(Oe):void 0,m=Lr(s.getTextContent());return m.setFormat(s.getFormat()),m.setDetail(s.getDetail()),m.setStyle(s.getStyle()),i.append(m,...c),u&&u===s&&(Aa(p)?m.select(p.anchor.offset,p.focus.offset):Da(p)&&m.select(0,m.getTextContent().length)),s.replace(i),d}}function Va(e,t,o){let n=[...e],r=n.map(s=>s.getTextContent()).join(""),i=r,l,a=0;for(;(l=_r(i,t))!=null&&l!==null;){let s=l.index,c=l.length,d=s+c;if(Ga(a+s,a+d,r,n)){let[u,,m,f]=Ua(n,a+s,a+d),C=a+s-u,E=a+d-u,x=Wa(m,C,E,l);n=x?[x,...f]:f,o(l.url,null),a=0}else a+=d;i=i.substring(d)}}function to(e,t,o){let n=e.getChildren(),r=n.length;for(let s=0;s<r;s++){let c=n[s];if(!Oe(c)||!c.isSimpleText()){ct(e),o(null,e.getFields()?.url??null);return}}let i=e.getTextContent(),l=_r(i,t);if(l===null||l.text!==i){ct(e),o(null,e.getFields()?.url??null);return}if(!vr(e)||!Ir(e)){ct(e),o(null,e.getFields()?.url??null);return}let a=e.getFields()?.url;if(a!==l?.url){let s=e.getFields();s.url=l?.url,e.setFields(s),o(l.url,a??null)}}function za(e,t,o){let n=e.getPreviousSibling(),r=e.getNextSibling(),i=e.getTextContent();if(ee(n)){let l=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:"):!1;(!oo(i)||$a(i,l))&&(n.append(e),to(n,t,o),o(null,n.getFields()?.url??null))}ee(r)&&!Sr(i)&&(ct(r),to(r,t,o),o(null,r.getFields()?.url??null))}function ct(e){let t=e.getChildren(),o=t.length;for(let n=o-1;n>=0;n--)e.insertAfter(t[n]);return e.remove(),t.map(n=>n.getLatest())}function Ka(e){let t=[e],o=e.getNextSibling();for(;o!==null&&Oe(o)&&o.isSimpleText()&&(t.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return t}function ja(e,t,o){Ha(()=>{if(!e.hasNodes([Q]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let n=(r,i)=>{o?.(r,i)};return Ma(e.registerNodeTransform(Oa,r=>{let i=r.getParentOrThrow(),l=r.getPreviousSibling();if(ee(i))to(i,t,n);else if(!$(i)){if(r.isSimpleText()&&(oo(r.getTextContent())||!ee(l))){let a=Ka(r);Va(a,t,n)}za(r,t,n)}}))},[e,t,o])}var Xa=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Za=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ja=[kr(Xa,e=>e.startsWith("http")?e:`https://${e}`),kr(Za,e=>`mailto:${e}`)],Fr=()=>{let[e]=Fa();return ja(e,Ja),null};import{ClickableLinkPlugin as Ya}from"@lexical/react/LexicalClickableLinkPlugin.js";import{jsx as qa}from"react/jsx-runtime";var Mr=()=>qa(Ya,{});import{createCommand as Qa}from"lexical";var ut=Qa("TOGGLE_LINK_WITH_MODAL_COMMAND");import{createPortal as pc}from"react-dom";import{useLexicalComposerContext as ec}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Pr,mergeRegister as Dr}from"@lexical/utils";import{getTranslation as tc}from"@payloadcms/translations";import{formatDrawerSlug as oc,useConfig as nc,useEditDepth as rc,useModal as ic,useTranslation as lc}from"@payloadcms/ui";import{$getSelection as Ar,$isLineBreakNode as sc,$isRangeSelection as Or,COMMAND_PRIORITY_HIGH as ac,COMMAND_PRIORITY_LOW as Hr,KEY_ESCAPE_COMMAND as cc,SELECTION_CHANGE_COMMAND as dc}from"lexical";import Br,{useCallback as $r,useEffect as mt,useRef as uc,useState as me}from"react";function pt(e,t,o,n=10,r=5){let i=o.parentElement;if(e===null||i==null){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let l=t.getBoundingClientRect(),a=o.getBoundingClientRect(),s=i.getBoundingClientRect(),c=e.top-n,d=e.left-r;c<s.top&&(c+=l.height+e.height+n*2),d+l.width>s.right&&(d=s.right-l.width-r),c-=a.top,d-=a.left,t.style.opacity="1",t.style.transform=`translate(${d}px, ${c}px)`}import{jsx as fe,jsxs as no}from"react/jsx-runtime";function Gr({anchorElem:e}){let[t]=ec(),o=uc(null),[n,r]=me(null),[i,l]=me(null),{uuid:a}=A(),{config:s}=nc(),{i18n:c,t:d}=lc(),[p,u]=me(null),{closeModal:m,toggleModal:f}=ic(),C=rc(),[E,x]=me(!1),[F,M]=me([]),[T,y]=me(!1),h=oc({slug:"lexical-rich-text-link-"+a,depth:C}),w=$r(()=>{x(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),y(!1),r(null),l(null),M([]),u(null)},[x,r,l,M]),I=$r(()=>{let v=Ar(),L=null;if(!Or(v)||!v){w();return}let b=pe(v);L=t.getElementByKey(b.getKey())?.getBoundingClientRect();let g=Pr(b,$),_=v.getNodes().filter(B=>!sc(B)).find(B=>{let W=Pr(B,$);return g&&!g.is(W)||W&&!W.is(g)});if(g==null||_){w();return}let R={doc:void 0,linkType:void 0,newTab:void 0,url:"",...g.getFields(),id:g.getID(),text:g.getTextContent()};if(g.getFields()?.linkType==="custom")r(g.getFields()?.url??null),l(null);else{r(`/admin/collections/${g.getFields()?.doc?.relationTo}/${g.getFields()?.doc?.value}`);let B=s.collections.find(W=>W.slug===g.getFields()?.doc?.relationTo);if(!B)l(g.getFields()?.label?String(g.getFields()?.label):null),r(g.getFields()?.url?String(g.getFields()?.url):null);else{let W=d("fields:linkedTo",{label:tc(B.labels.singular,c)}).replace(/<[^>]*>?/g,"");l(W)}}u(R),x(!0),M(v?v?.getNodes():[]),ee(g)?y(!0):y(!1);let N=o.current,S=window.getSelection(),{activeElement:D}=document;if(N===null)return;let H=t.getRootElement();return S!==null&&H!==null&&H.contains(S.anchorNode)?(L||(L=S.getRangeAt(0).getBoundingClientRect()),L!=null&&(L.y+=40,pt(L,N,e))):(D==null||D.className!=="link-input")&&(H!==null&&pt(null,N,e),r(null),l(null)),!0},[t,w,s.collections,d,c,e]);return mt(()=>Dr(t.registerCommand(ut,v=>(t.dispatchCommand(Z,v),I(),f(h),!0),Hr)),[t,I,f,h]),mt(()=>{let v=e.parentElement,L=()=>{t.getEditorState().read(()=>{I()})};return window.addEventListener("resize",L),v?.addEventListener("scroll",L),()=>{window.removeEventListener("resize",L),v?.removeEventListener("scroll",L)}},[e.parentElement,t,I]),mt(()=>Dr(t.registerUpdateListener(({editorState:v})=>{v.read(()=>{I()})}),t.registerCommand(dc,()=>(I(),!0),Hr),t.registerCommand(cc,()=>E?(w(),!0):!1,ac)),[t,I,E,w]),mt(()=>{t.getEditorState().read(()=>{I()})},[t,I]),no(Br.Fragment,{children:[fe("div",{className:"link-editor",ref:o,children:no("div",{className:"link-input",children:[n&&n.length>0?fe("a",{href:n,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:n}):i!=null&&i.length>0?fe("span",{className:"link-input__label-pure",children:i}):null,t.isEditable()&&no(Br.Fragment,{children:[fe("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{f(h)},onMouseDown:v=>{v.preventDefault()},tabIndex:0,type:"button"}),!T&&fe("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{t.dispatchCommand(Z,null)},onMouseDown:v=>{v.preventDefault()},tabIndex:0,type:"button"})]})]})}),fe(le,{className:"lexical-link-edit-drawer",data:p,drawerSlug:h,drawerTitle:d("fields:editLink"),featureKey:"link",handleDrawerSubmit:(v,L)=>{m(h);let b=L,g={...b};delete g.text,t.update(()=>{let _=Ar(),R=null;if(Or(_)?R=pe(_).getParent():F.length&&(R=F[0].getParent()),R&&ee(R)){let N=q({fields:g});R.replace(N,!0)}}),t.dispatchCommand(Z,{fields:g,selectedNodes:F,text:b.text})},schemaPathSuffix:"fields"})]})}import{jsx as mc}from"react/jsx-runtime";var Ur=e=>{let{anchorElem:t=document.body}=e;return pc(mc(Gr,{anchorElem:t}),t)};import{useLexicalComposerContext as Cc}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as hc}from"@lexical/utils";import{$getSelection as bc,$isElementNode as xc,$isRangeSelection as Tc,COMMAND_PRIORITY_LOW as Vr,PASTE_COMMAND as Ec}from"lexical";import{useEffect as yc}from"react";var fc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,gc=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Wr(e){if(!e)return!1;if(e==="https://"||fc.test(e)||gc.test(e))return!0;try{return new URL(e),!0}catch{}return!1}var zr=()=>{let[e]=Cc();return yc(()=>{if(!e.hasNodes([z]))throw new Error("LinkPlugin: LinkNode not registered on editor");return hc(e.registerCommand(Z,t=>(yr(t),!0),Vr),e.registerCommand(Ec,t=>{let o=bc();if(!Tc(o)||o.isCollapsed()||!(t instanceof ClipboardEvent)||t.clipboardData==null)return!1;let n=t.clipboardData.getData("text");if(!Wr(n))return!1;if(!o.getNodes().some(r=>xc(r))){let r={doc:null,linkType:"custom",newTab:!1,url:n};return e.dispatchCommand(Z,{fields:r,text:null}),t.preventDefault(),!0}return!1},Vr))},[e]),null};var jr=[Yt([{ChildComponent:br,isActive:({selection:e})=>{if(Kr(e)){let t=pe(e);return Nc(t,$)!=null}return!1},isEnabled:({selection:e})=>!!(Kr(e)&&ro()?.getTextContent()?.length),key:"link",label:({i18n:e})=>e.t("lexical:link:label"),onSelect:({editor:e,isActive:t})=>{if(t)e.dispatchCommand(Z,null);else{let o=null,n=[];if(e.getEditorState().read(()=>{o=ro()?.getTextContent(),n=ro()?.getNodes()??[]}),!o?.length)return;let r={doc:null,linkType:"custom",newTab:!1,url:"https://"};e.dispatchCommand(ut,{fields:r,selectedNodes:n,text:o})}},order:1}])],Lc=k({markdownTransformers:[Nr],nodes:[z,Q],plugins:[{Component:zr,position:"normal"},{Component:Fr,position:"normal"},{Component:Mr,position:"normal"},{Component:Ur,position:"floatingAnchorElem"}],toolbarFixed:{groups:jr},toolbarInline:{groups:jr}});import{$isListNode as so,INSERT_CHECK_LIST_COMMAND as Qr,ListItemNode as Ac,ListNode as Oc}from"@lexical/list";import{$isRangeSelection as Hc}from"lexical";import{jsx as Xr,jsxs as kc}from"react/jsx-runtime";var io=()=>kc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Xr("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Xr("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{ListPlugin as wc}from"@lexical/react/LexicalListPlugin.js";import{jsx as Rc}from"react/jsx-runtime";var ge=()=>Rc(wc,{});function Ce(e){return{items:e,key:"lists",label:({i18n:t})=>t.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Ic,ListItemNode as Fc,ListNode as Mc}from"@lexical/list";import{$createListItemNode as _c,$createListNode as Sc,$isListItemNode as vc,$isListNode as lo}from"@lexical/list";var Zr=4,he=e=>(t,o,n)=>{let r=t.getPreviousSibling(),i=t.getNextSibling(),l=_c(e==="check"?n[3]==="x":void 0);if(lo(i)&&i.getListType()===e){let s=i.getFirstChild();s!==null?s.insertBefore(l):i.append(l),t.remove()}else if(lo(r)&&r.getListType()===e)r.append(l),t.remove();else{let s=Sc(e,e==="number"?Number(n[2]):void 0);s.append(l),t.replace(s)}l.append(...o),l.select(0,0);let a=Math.floor(n[1].length/Zr);a&&l.setIndent(a)},ce=(e,t,o)=>{let n=[],r=e.getChildren(),i=0;for(let l of r)if(vc(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(lo(d)){n.push(ce(d,t,o+1));continue}}let a=" ".repeat(o*Zr),s=e.getListType(),c=s==="number"?`${e.getStart()+i}. `:s==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";n.push(a+c+t(l)),i++}return n.join(`
35
- `)};var Jr={type:"element",dependencies:[Mc,Fc],export:(e,t)=>Ic(e)?ce(e,t,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:he("check")};import{CheckListPlugin as Pc}from"@lexical/react/LexicalCheckListPlugin.js";import{jsx as Dc}from"react/jsx-runtime";var Yr=()=>Dc(Pc,{});var qr=[V([{ChildComponent:io,isActive:({selection:e})=>{if(!Hc(e))return!1;for(let t of e.getNodes()){if(so(t)&&t.getListType()==="check")continue;let o=t.getParent();if(so(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(so(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:e})=>e.t("lexical:checklist:label"),onSelect:({editor:e})=>{e.dispatchCommand(Qr,void 0)},order:12}])],Bc=k(({featureProviderMap:e})=>{let t=[{Component:Yr,position:"normal"}];return!e.has("unorderedList")&&!e.has("orderedList")&&t.push({Component:ge,position:"normal"}),{markdownTransformers:[Jr],nodes:e.has("unorderedList")||e.has("orderedList")?[]:[Oc,Ac],plugins:t,slashMenu:{groups:[Ce([{Icon:io,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Qr,void 0)}}])]},toolbarFixed:{groups:qr},toolbarInline:{groups:qr}}});import{$isListNode as co,INSERT_ORDERED_LIST_COMMAND as oi,ListItemNode as Vc,ListNode as zc}from"@lexical/list";import{$isRangeSelection as Kc}from"lexical";import{jsx as He,jsxs as $c}from"react/jsx-runtime";var ao=()=>$c("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[He("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"}),He("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"}),He("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Gc,ListItemNode as Uc,ListNode as Wc}from"@lexical/list";var ei={type:"element",dependencies:[Wc,Uc],export:(e,t)=>Gc(e)?ce(e,t,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:he("number")};var ti=[V([{ChildComponent:ao,isActive:({selection:e})=>{if(!Kc(e))return!1;for(let t of e.getNodes()){if(co(t)&&t.getListType()==="number")continue;let o=t.getParent();if(co(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(co(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(oi,void 0)},order:10}])],jc=k(({featureProviderMap:e})=>({markdownTransformers:[ei],nodes:e.has("orderedList")?[]:[zc,Vc],plugins:e.has("orderedList")?[]:[{Component:ge,position:"normal"}],slashMenu:{groups:[Ce([{Icon:ao,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(oi,void 0)}}])]},toolbarFixed:{groups:ti},toolbarInline:{groups:ti}}));import{$isListNode as po,INSERT_UNORDERED_LIST_COMMAND as ii,ListItemNode as qc,ListNode as Qc}from"@lexical/list";import{$isRangeSelection as ed}from"lexical";import{jsx as be,jsxs as Xc}from"react/jsx-runtime";var uo=()=>Xc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[be("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Zc,ListItemNode as Jc,ListNode as Yc}from"@lexical/list";var ni={type:"element",dependencies:[Yc,Jc],export:(e,t)=>Zc(e)?ce(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:he("bullet")};var ri=[V([{ChildComponent:uo,isActive:({selection:e})=>{if(!ed(e))return!1;for(let t of e.getNodes()){if(po(t)&&t.getListType()==="bullet")continue;let o=t.getParent();if(po(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(po(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:e})=>e.t("lexical:unorderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ii,void 0)},order:11}])],td=k({markdownTransformers:[ni],nodes:[Qc,qc],plugins:[{Component:ge,position:"normal"}],slashMenu:{groups:[Ce([{Icon:uo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:e})=>e.t("lexical:unorderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ii,void 0)}}])]},toolbarFixed:{groups:ri},toolbarInline:{groups:ri}});import{addClassNamesToElement as od}from"@lexical/utils";import{DecoratorNode as nd}from"lexical";import*as li from"react";import{jsx as ld}from"react/jsx-runtime";var rd=li.lazy(()=>import("./Component-7HS6FEJS.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),Be=class e extends nd{__data;constructor({data:t,key:o}){super(o),this.__data=t}static clone(t){return new e({data:t.__data,key:t.__key})}static getType(){return"unknownConverted"}static importJSON(t){return id({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return od(o,"unknownConverted"),o}decorate(){return ld(rd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function id({data:e}){return new Be({data:e})}var sd=k(()=>({nodes:[Be]}));import{addClassNamesToElement as ad}from"@lexical/utils";import{DecoratorNode as cd}from"lexical";import*as si from"react";import{jsx as pd}from"react/jsx-runtime";var dd=si.lazy(()=>import("./Component-LAKSCIDX.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),$e=class e extends cd{__data;constructor({data:t,key:o}){super(o),this.__data=t}static clone(t){return new e({data:t.__data,key:t.__key})}static getType(){return"unknownConverted"}static importJSON(t){return ud({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return ad(o,"unknownConverted"),o}decorate(){return pd(dd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function ud({data:e}){return new $e({data:e})}var md=k(({clientFunctions:e})=>({nodes:[$e]}));import{$setBlocksType as di}from"@lexical/selection";import{$createParagraphNode as ui,$getSelection as pi,$isParagraphNode as ai,$isRangeSelection as fd}from"lexical";var ci=[V([{ChildComponent:Pe,isActive:({selection:e})=>{if(!fd(e))return!1;for(let t of e.getNodes())if(!ai(t)&&!ai(t.getParent()))return!1;return!0},key:"paragraph",label:({i18n:e})=>e.t("lexical:paragraph:label2"),onSelect:({editor:e})=>{e.update(()=>{let t=pi();di(t,()=>ui())})},order:1}])],gd=k({slashMenu:{groups:[G([{Icon:Pe,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:e})=>e.t("lexical:paragraph:label"),onSelect:({editor:e})=>{e.update(()=>{let t=pi();di(t,()=>ui())})}}])]},toolbarFixed:{groups:ci},toolbarInline:{groups:ci}});import{$isNodeSelection as Md}from"lexical";import{jsx as Ge,jsxs as Cd}from"react/jsx-runtime";var mo=()=>Cd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ge("g",{clipPath:"url(#clip0_4397_10817)",children:Ge("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"})}),Ge("defs",{children:Ge("clipPath",{id:"clip0_4397_10817",children:Ge("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{useLexicalComposerContext as Nd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ld}from"@lexical/utils";import{useConfig as kd}from"@payloadcms/ui";import{$getPreviousSelection as wd,$getSelection as Rd,$isParagraphNode as hi,$isRangeSelection as _d,COMMAND_PRIORITY_EDITOR as Sd,createCommand as vd}from"lexical";import{useEffect as Id}from"react";import{useLexicalComposerContext as hd}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as bd}from"@payloadcms/ui";import{$getNodeByKey as xd,COMMAND_PRIORITY_EDITOR as Td}from"lexical";import{useCallback as Ed,useEffect as mi,useState as fi}from"react";import{jsx as ft}from"react/jsx-runtime";var yd=({editor:e,relationTo:t,replaceNodeKey:o,value:n})=>{o?e.update(()=>{let r=xd(o);r&&r.replace(_e({relationTo:t,value:n}))}):e.dispatchCommand(fo,{relationTo:t,value:n})},gi=({enabledCollectionSlugs:e})=>{let[t]=hd(),[o,n]=fi(()=>e[0]),[r,i]=fi(null),[l,a,{closeDrawer:s,isDrawerOpen:c,openDrawer:d}]=bd({collectionSlugs:e,selectedCollection:o});mi(()=>t.registerCommand(we,u=>(i(u?.replace?u?.replace.nodeKey:null),d(),!0),Td),[t,d]);let p=Ed(({collectionSlug:u,docID:m})=>{yd({editor:t,relationTo:u,replaceNodeKey:r,value:m}),s()},[t,s,r]);return mi(()=>{n(e[0])},[c,e]),ft(l,{onSelect:p})},Ci=e=>e?.enabledCollectionSlugs?.length>0?ft(gi,{...e}):ft(Ye,{...e,children:ft(gi,{...e})});import{jsx as Fd}from"react/jsx-runtime";var fo=vd("INSERT_RELATIONSHIP_COMMAND"),bi=({clientProps:e})=>{let[t]=Nd(),{config:{collections:o}}=kd(),n=null;return e?.enabledCollections?n=e?.enabledCollections:e?.disabledCollections&&(n=o.filter(({slug:r})=>!e?.disabledCollections?.includes(r)).map(({slug:r})=>r)),Id(()=>{if(!t.hasNodes([Re]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return t.registerCommand(fo,r=>{let i=Rd()||wd();if(_d(i)){let l=_e(r);Ld(l);let{focus:a}=i,s=a.getNode();hi(s)&&s.getTextContentSize()===0&&s.getParent().getChildren().filter(c=>hi(c)).length>1&&s.remove()}return!0},Sd)},[t]),Fd(Ci,{enabledCollectionSlugs:n})};var Pd=k({nodes:[Re],plugins:[{Component:bi,position:"normal"}],slashMenu:{groups:[G([{Icon:mo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(we,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:mo,isActive:({selection:e})=>{if(!Md(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Mt(t)},key:"relationship",label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(we,{replace:!1})}}])]}});import{useLexicalComposerContext as Zd}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Jd,useThrottledEffect as Yd,useTranslation as qd}from"@payloadcms/ui";import*as te from"react";import{useMemo as Qd}from"react";import{mergeRegister as Dd}from"@lexical/utils";import{$getSelection as Ad}from"lexical";import{useCallback as Od,useEffect as gt,useState as go}from"react";import{jsx as Hd}from"react/jsx-runtime";var Co="toolbar-popup__button",Ue=({children:e,editor:t,item:o})=>{let[n,r]=go(!0),[i,l]=go(!1),[a,s]=go(Co),c=A(),d=Od(()=>{t.getEditorState().read(()=>{let p=Ad();if(o.isActive){let u=o.isActive({editor:t,editorConfigContext:c,selection:p});i!==u&&l(u)}if(o.isEnabled){let u=o.isEnabled({editor:t,editorConfigContext:c,selection:p});n!==u&&r(u)}})},[i,t,c,n,o]);return gt(()=>{d()},[d]),gt(()=>(document.addEventListener("mouseup",d),()=>{document.removeEventListener("mouseup",d)}),[d]),gt(()=>Dd(t.registerUpdateListener(()=>{d()})),[t,d]),gt(()=>{s([Co,n===!1?"disabled":"",i?"active":"",o?.key?`${Co}-`+o.key:""].filter(Boolean).join(" "))},[n,i,a,o.key]),Hd("button",{className:a,onClick:()=>{if(n!==!1)return t._updateTags=new Set([...t._updateTags,"toolbar"]),t.focus(()=>{o.onSelect({editor:t,isActive:i})}),!0},onMouseDown:p=>{p.preventDefault()},type:"button",children:e})};import Ni,{useCallback as Wd,useEffect as xo}from"react";import{mergeRegister as Vd}from"@lexical/utils";import{useTranslation as zd}from"@payloadcms/ui";import{$getSelection as Kd}from"lexical";import Ct,{useCallback as Bd,useEffect as We,useMemo as $d,useRef as bo,useState as ht}from"react";import{createPortal as Gd}from"react-dom";import{jsx as ie,jsxs as xi}from"react/jsx-runtime";var ho="toolbar-popup__dropdown-item",Ti=Ct.createContext(null);function Ei({active:e,children:t,editor:o,enabled:n,item:r,title:i}){let[l,a]=ht(ho);We(()=>{a([ho,n===!1?"disabled":"",e?"active":"",r?.key?`${ho}-${r.key}`:""].filter(Boolean).join(" "))},[n,e,l,r.key]);let s=bo(null),c=Ct.useContext(Ti);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=c;return We(()=>{s?.current!=null&&d(s)},[s,d]),ie("button",{className:l,onClick:()=>{n!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{r.onSelect({editor:o,isActive:e})}))},onMouseDown:p=>{p.preventDefault()},ref:s,title:i,type:"button",children:t})}function Ud({children:e,dropDownRef:t,itemsContainerClassNames:o,onClose:n}){let[r,i]=ht(),[l,a]=ht(),s=Bd(p=>{i(u=>u!=null?[...u,p]:[p])},[i]),c=p=>{if(r==null)return;let{key:u}=p;["ArrowDown","ArrowUp","Escape","Tab"].includes(u)&&p.preventDefault(),u==="Escape"||u==="Tab"?n():u==="ArrowUp"?a(m=>{if(m==null)return r[0];let f=r.indexOf(m)-1;return r[f===-1?r.length-1:f]}):u==="ArrowDown"&&a(m=>m==null?r[0]:r[r.indexOf(m)+1])},d=$d(()=>({registerItem:s}),[s]);return We(()=>{r!=null&&l==null&&a(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),ie(Ti.Provider,{value:d,children:ie("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:t,children:e})})}function yi({Icon:e,buttonAriaLabel:t,buttonClassName:o,children:n,disabled:r=!1,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:a}){let s=bo(null),c=bo(null),[d,p]=ht(!1),u=()=>{p(!1),c?.current!=null&&c.current.focus()};We(()=>{let f=c.current,C=s.current;if(d&&f!==null&&C!==null){let{left:E,top:x}=f.getBoundingClientRect(),F=window.scrollY||document.documentElement.scrollTop;C.style.top=`${x+F+f.offsetHeight+5}px`,C.style.left=`${Math.min(E-5,window.innerWidth-C.offsetWidth-20)}px`}},[s,c,d]),We(()=>{let f=c.current;if(f!==null&&d){let C=E=>{let{target:x}=E;a!=null&&s.current!=null&&s.current.contains(x)||f.contains(x)||p(!1)};return document.addEventListener("click",C),()=>{document.removeEventListener("click",C)}}},[s,c,d,a]);let m=Gd(ie(Ud,{dropDownRef:s,itemsContainerClassNames:i,onClose:u,children:n}),document.body);return xi(Ct.Fragment,{children:[xi("button",{"aria-label":t,className:o+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),p(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[e&&ie(e,{}),l&&ie("span",{className:"toolbar-popup__dropdown-label",children:l}),ie("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ie(Ct.Fragment,{children:m})]})}import{jsx as Ve,jsxs as Xd}from"react/jsx-runtime";var To="toolbar-popup__dropdown",jd=({active:e,anchorElem:t,editor:o,enabled:n,item:r})=>{let{i18n:i}=zd(),{field:{richTextComponentMap:l}}=A();if(r.Component)return r?.Component&&Ve(r.Component,{active:e,anchorElem:t,editor:o,enabled:n,item:r},r.key);let a=r.key;return r.label&&(a=typeof r.label=="function"?r.label({i18n:i,richTextComponentMap:l}):r.label),a.length>25&&(a=a.substring(0,25)+"..."),Xd(Ei,{active:e,editor:o,enabled:n,item:r,children:[r?.ChildComponent&&Ve(r.ChildComponent,{}),Ve("span",{className:"text",children:a})]},r.key)},de=({Icon:e,anchorElem:t,classNames:o,editor:n,groupKey:r,items:i,itemsContainerClassNames:l,label:a,maxActiveItems:s,onActiveChange:c})=>{let[d,p]=Ni.useState([]),[u,m]=Ni.useState([]),f=A(),C=Wd(()=>{n.getEditorState().read(()=>{let E=Kd(),x=[],F=[],M=[];for(let T of i)T.isActive&&(!s||x.length<s)&&T.isActive({editor:n,editorConfigContext:f,selection:E})&&(x.push(T.key),F.push(T)),T.isEnabled?T.isEnabled({editor:n,editorConfigContext:f,selection:E})&&M.push(T.key):M.push(T.key);p(x),m(M),c&&c({activeItems:F})})},[n,f,i,s,c]);return xo(()=>{C()},[C]),xo(()=>(document.addEventListener("mouseup",C),()=>{document.removeEventListener("mouseup",C)}),[C]),xo(()=>Vd(n.registerUpdateListener(()=>{C()})),[n,C]),Ve(yi,{Icon:e,buttonAriaLabel:`${r} dropdown`,buttonClassName:[To,`${To}-${r}`,...o||[]].filter(Boolean).join(" "),itemsContainerClassNames:[`${To}-items`,...l||[]],label:a,children:i.length&&i.map(E=>Ve(jd,{active:d.includes(E.key),anchorElem:t,editor:n,enabled:u.includes(E.key),item:E},E.key))},r)};import{jsx as j,jsxs as nu}from"react/jsx-runtime";function eu({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&j(o.Component,{anchorElem:e,editor:t,item:o},o.key):j(Ue,{editor:t,item:o,children:o?.ChildComponent&&j(o.ChildComponent,{})},o.key)}function tu({anchorElem:e,editor:t,editorConfig:o,group:n,index:r}){let{i18n:i}=qd(),{field:{richTextComponentMap:l}}=A(),[a,s]=te.useState(null),[c,d]=te.useState(null);te.useEffect(()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(null)},[n]);let p=({activeItems:u})=>{if(!u.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?(d(()=>n.ChildComponent),s(null)):(d(null),s(null));return}let m=u[0],f=m.key;m.label&&(f=typeof m.label=="function"?m.label({i18n:i,richTextComponentMap:l}):m.label),f.length>25&&(f=f.substring(0,25)+"..."),s(f),d(()=>m.ChildComponent)};return nu("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,children:[n.type==="dropdown"&&n.items.length&&(c?j(de,{Icon:c,anchorElem:e,editor:t,groupKey:n.key,items:n.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:1,onActiveChange:p}):j(de,{anchorElem:e,editor:t,groupKey:n.key,items:n.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:1,onActiveChange:p})),n.type==="buttons"&&n.items.length&&n.items.map(u=>j(eu,{anchorElem:e,editor:t,item:u},u.key)),r<o.features.toolbarFixed?.groups.length-1&&j("div",{className:"divider"})]},n.key)}function ou({anchorElem:e,clientProps:t,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=te.useRef(null),{y:l}=Jd(),a=Qd(()=>{if(!r||t?.disableIfParentHasFixedToolbar)return null;let c=r.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[t?.disableIfParentHasFixedToolbar,r]);return Yd(()=>{if(!a)return;let s=i.current;if(!s)return;let c=s.getBoundingClientRect(),d=a.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",a.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",a.className="fixed-toolbar"}},50,[i,a,l]),j("div",{className:"fixed-toolbar",onFocus:s=>{s.stopPropagation()},ref:i,children:o.isEditable()&&j(te.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((s,c)=>j(tu,{anchorElem:e,editor:o,editorConfig:n,group:s,index:c},s.key))})})}var Li=e=>{if(e.parentEditor?.editorConfig){if(e.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return e.parentEditor;if(e.parentEditor)return Li(e.parentEditor)}return!1},ki=({anchorElem:e,clientProps:t})=>{let[o]=Zd(),n=A(),{editorConfig:r}=n,i=t.applyToFocusedEditor&&n.focusedEditor?.editor||o,l=t.applyToFocusedEditor&&n.focusedEditor?.editorConfig||r,a=Li(n);return t?.disableIfParentHasFixedToolbar&&a||!l?.features?.toolbarFixed?.groups?.length?null:j(ou,{anchorElem:e,editor:i,editorConfig:l,parentWithFixedToolbar:a})};var ru=k({plugins:[{Component:ki,position:"aboveContainer"}]});import{useLexicalComposerContext as iu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as _i}from"@lexical/utils";import{$getSelection as Si,$isRangeSelection as wi,$isTextNode as lu,COMMAND_PRIORITY_LOW as su,SELECTION_CHANGE_COMMAND as au}from"lexical";import{useCallback as ze,useEffect as Ke,useRef as Ri,useState as cu}from"react";import*as xe from"react";import{createPortal as du}from"react-dom";function Eo(e,t){let o=e.getRangeAt(0),n;if(e.anchorNode===t){let r=t;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function bt(e){let{alwaysDisplayOnTop:t=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:i=5,horizontalPosition:l="left",specialHandlingForCaret:a=!1,targetRect:s,verticalGap:c=10}=e,d=o.parentElement;if(s===null||d==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let p=r.getBoundingClientRect(),u=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=s.top-p.height-c,C=s.left-i;l==="center"&&(C=s.left+s.width/2-p.width/2);let E=0;return!t&&f<m.top&&!a&&(E=p.height+s.height+c*2,f+=E),l==="center"?C+p.width>m.right?C=m.right-p.width-i:C<m.left&&(C=m.left+i):C+p.width>m.right&&(C=m.right-p.width-i),C-=u.left,r.style.opacity="1",a&&n!==0?(f-=u.bottom-n+p.height-3,r.style.transform=`translate(${C}px, ${f}px) rotate(180deg)`):(f-=u.top,r.style.transform=`translate(${C}px, ${f}px)`),E}import{jsx as X,jsxs as Ii}from"react/jsx-runtime";function uu({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&X(o.Component,{anchorElem:e,editor:t,item:o},o.key):X(Ue,{editor:t,item:o,children:o?.ChildComponent&&X(o.ChildComponent,{})},o.key)}function pu({anchorElem:e,editor:t,group:o,index:n}){let{editorConfig:r}=A(),[i,l]=xe.useState(null);xe.useEffect(()=>{o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null)},[o]);let a=({activeItems:s})=>{if(!s.length){o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null);return}let c=s[0];l(()=>c.ChildComponent)};return Ii("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,children:[o.type==="dropdown"&&o.items.length&&(i?X(de,{Icon:i,anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:a}):X(de,{anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:a})),o.type==="buttons"&&o.items.length&&o.items.map(s=>X(uu,{anchorElem:e,editor:t,item:s},s.key)),n<r.features.toolbarInline?.groups.length-1&&X("div",{className:"divider"})]},o.key)}function mu({anchorElem:e,editor:t}){let o=Ri(null),n=Ri(null),{editorConfig:r}=A(),i=ze(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=ze(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",p=o.current.style.pointerEvents==="none";if(!d||!p){let u=c.clientX,m=c.clientY,f=document.elementFromPoint(u,m);o.current.contains(f)||i()}}},[i]),a=ze(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ke(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}),[o,l,a]);let s=ze(()=>{let c=Si(),d=window.getSelection();if(o.current===null)return;let p=e.querySelector(":scope > .link-editor"),u=p!==null&&"style"in p&&p?.style?.opacity==="1",m=t.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=Eo(d,m),C=bt({alwaysDisplayOnTop:u,anchorElem:e,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&bt({anchorElem:o.current,anchorFlippedOffset:C,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:10})}else i()},[t,i,e]);return Ke(()=>{let c=e.parentElement,d=()=>{t.getEditorState().read(()=>{s()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[t,s,e]),Ke(()=>(t.getEditorState().read(()=>{s()}),_i(t.registerUpdateListener(({editorState:c})=>{c.read(()=>{s()})}),t.registerCommand(au,()=>(s(),!1),su))),[t,s]),Ii("div",{className:"inline-toolbar-popup",ref:o,children:[X("div",{className:"caret",ref:n}),t.isEditable()&&X(xe.Fragment,{children:r?.features&&r.features?.toolbarInline?.groups.map((c,d)=>X(pu,{anchorElem:e,editor:t,group:c,index:d},c.key))})]})}function fu(e,t){let[o,n]=cu(!1),r=ze(()=>{e.getEditorState().read(()=>{if(e.isComposing())return;let i=Si(),l=window.getSelection(),a=e.getRootElement();if(l!==null&&(!wi(i)||a===null||!a.contains(l.anchorNode))){n(!1);return}if(!wi(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),d=!1;for(let p of c)if(lu(p)){n(!0),d=!0;break}d||n(!1)}else n(!1);let s=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&s===""){n(!1);return}})},[e]);return Ke(()=>(document.addEventListener("selectionchange",r),document.addEventListener("mouseup",r),()=>{document.removeEventListener("selectionchange",r),document.removeEventListener("mouseup",r)}),[r]),Ke(()=>_i(e.registerUpdateListener(()=>{r()}),e.registerRootListener(()=>{e.getRootElement()===null&&n(!1)})),[e,r]),o?du(X(mu,{anchorElem:t,editor:e}),t):null}var vi=({anchorElem:e})=>{let[t]=iu();return fu(t,e)};var gu=k({plugins:[{Component:vi,position:"floatingAnchorElem"}]});import{TableCellNode as Ap,TableNode as Op,TableRowNode as Hp}from"@lexical/table";import{jsx as Fi}from"react/jsx-runtime";var yo=()=>Fi("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Fi("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{useLexicalComposerContext as Di}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as hu}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as bu,$deleteTableRow__EXPERIMENTAL as xu,$getNodeTriplet as Tu,$getTableCellNodeFromLexicalNode as Eu,$getTableColumnIndexFromTableCellNode as yu,$getTableNodeFromLexicalNodeOrThrow as xt,$getTableRowIndexFromTableCellNode as Nu,$insertTableColumn__EXPERIMENTAL as Lu,$insertTableRow__EXPERIMENTAL as ku,$isTableCellNode as je,$isTableRowNode as ko,$isTableSelection as Et,$unmergeCell as wu,TableCellHeaderStates as Te,TableCellNode as Ru,getTableObserverFromTableElement as _u}from"@lexical/table";import{useScrollInfo as Su}from"@payloadcms/ui";import{$createParagraphNode as vu,$getRoot as Iu,$getSelection as yt,$isElementNode as Fu,$isParagraphNode as Ai,$isRangeSelection as wo,$isTextNode as Mu}from"lexical";import*as Ro from"react";import{useCallback as oe,useEffect as ue,useRef as Tt,useState as Ee}from"react";import{createPortal as Oi}from"react-dom";import{jsx as No,jsxs as Cu}from"react/jsx-runtime";var Mi=()=>Cu("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[No("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"}),No("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"}),No("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});import{jsx as O,jsxs as ne}from"react/jsx-runtime";function Lo(e){let t=e.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function Pu(e){let t=e.getNodes(),o=[],n=null,r=null,i=0;for(let l=0;l<t.length;l++){let a=t[l];if(je(a)){let s=a.getParentOrThrow();if(ko(s))throw new Error("Expected CellNode to have a RowNode parent");if(n!==s){if(r!==null&&i!==r)return!1;n!==null&&(r=i),n=s,i=0}let c=a.__colSpan;for(let d=0;d<c;d++)o[i+d]===void 0&&(o[i+d]=0),o[i+d]+=a.__rowSpan;i+=c}}return(r===null||i===r)&&o.every(l=>l===o[0])}function Du(){let e=yt();if(wo(e)&&!e.isCollapsed()||Et(e)&&!e.anchor.is(e.focus)||!wo(e)&&!Et(e))return!1;let[t]=Tu(e.anchor);return t.__colSpan>1||t.__rowSpan>1}function Pi(e){if(e.getChildrenSize()!==1)return!1;let t=e.getFirstChildOrThrow();return!(!Ai(t)||!t.isEmpty())}function Au(e){let t=e.getLastDescendant();Mu(t)?t.select():Fu(t)?t.selectEnd():t!==null&&t.selectNext()}function Ou({cellMerge:e,contextRef:t,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Di(),l=Tt(null),[a,s]=Ee(r),[c,d]=Ee({columns:1,rows:1}),[p,u]=Ee(!1),[m,f]=Ee(!1),{y:C}=Su();ue(()=>i.registerMutationListener(Ru,b=>{b.get(a.getKey())==="updated"&&i.getEditorState().read(()=>{s(a.getLatest())})},{skipInitialization:!0}),[i,a]),ue(()=>{i.getEditorState().read(()=>{let b=yt();if(Et(b)){let g=Lo(b);d(Lo(b)),u(Pu(b)&&(g.columns>1||g.rows>1))}f(Du())})},[i]),ue(()=>{let b=t.current,g=l.current,_=i.getRootElement();if(b!=null&&g!=null&&_!=null){let R=_.getBoundingClientRect(),N=b.getBoundingClientRect();g.style.opacity="1";let S=g.getBoundingClientRect(),D=5,H=N.right+D;if(H+S.width>window.innerWidth||H+S.width>R.right){let W=N.left-S.width-D;H=(W<0?D:W)+window.pageXOffset}g.style.left=`${H+window.pageXOffset}px`;let B=N.top;if(B+S.height>window.innerHeight){let W=N.bottom-S.height;B=(W<0?D:W)+window.pageYOffset}g.style.top=`${B}px`}},[t,l,i,C]),ue(()=>{function b(g){l.current!=null&&t.current!=null&&!l.current.contains(g.target)&&!t.current.contains(g.target)&&n(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[n,t]);let E=oe(()=>{i.update(()=>{if(a.isAttached()){let g=xt(a),_=i.getElementByKey(g.getKey());if(!_)throw new Error("Expected to find tableElement in DOM");let R=_u(_);R!==null&&R.clearHighlight(),g.markDirty(),s(a.getLatest())}Iu().selectStart()})},[i,a]),x=()=>{i.update(()=>{let b=yt();if(Et(b)){let{columns:g,rows:_}=Lo(b),R=b.getNodes(),N=null;for(let S=0;S<R.length;S++){let D=R[S];if(je(D))if(N===null){D.setColSpan(g).setRowSpan(_),N=D;let H=Pi(D),B;H&&Ai(B=D.getFirstChild())&&B.remove()}else je(N)&&(Pi(D)||N.append(...D.getChildren()),D.remove())}N!==null&&(N.getChildrenSize()===0&&N.append(vu()),Au(N)),o()}})},F=()=>{i.update(()=>{wu()})},M=oe(b=>{i.update(()=>{ku(b),o()})},[i,o]),T=oe(b=>{i.update(()=>{for(let g=0;g<c.columns;g++)Lu(b);o()})},[i,o,c.columns]),y=oe(()=>{i.update(()=>{xu(),o()})},[i,o]),h=oe(()=>{i.update(()=>{xt(a).remove(),E(),o()})},[i,a,E,o]),w=oe(()=>{i.update(()=>{bu(),o()})},[i,o]),I=oe(()=>{i.update(()=>{let b=xt(a),g=Nu(a),_=b.getChildren();if(g>=_.length||g<0)throw new Error("Expected table cell to be inside of table row.");let R=_[g];if(!ko(R))throw new Error("Expected table row");R.getChildren().forEach(N=>{if(!je(N))throw new Error("Expected table cell");N.toggleHeaderStyle(Te.ROW)}),E(),o()})},[i,a,E,o]),v=oe(()=>{i.update(()=>{let b=xt(a),g=yu(a),_=b.getChildren(),R=Math.max(..._.map(N=>N.getChildren().length));if(g>=R||g<0)throw new Error("Expected table cell to be inside of table row.");for(let N=0;N<_.length;N++){let S=_[N];if(!ko(S))throw new Error("Expected table row");let D=S.getChildren();if(g>=D.length)continue;let H=D[g];if(!je(H))throw new Error("Expected table cell");H.toggleHeaderStyle(Te.COLUMN)}E(),o()})},[i,a,E,o]),L=null;return e&&(p?L=O("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>x(),type:"button",children:"Merge cells"}):m&&(L=O("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>F(),type:"button",children:"Unmerge cells"}))),Oi(ne("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[L?ne(Ro.Fragment,{children:[L,O("hr",{})]}):null,O("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>M(!1),type:"button",children:ne("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),O("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>M(!0),type:"button",children:ne("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),O("hr",{}),O("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>T(!1),type:"button",children:ne("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),O("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>T(!0),type:"button",children:ne("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),O("hr",{}),O("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:O("span",{className:"text",children:"Delete column"})}),O("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>y(),type:"button",children:O("span",{className:"text",children:"Delete row"})}),O("button",{className:"item","data-test-id":"table-delete",onClick:()=>h(),type:"button",children:O("span",{className:"text",children:"Delete table"})}),O("hr",{}),O("button",{className:"item",onClick:()=>I(),type:"button",children:ne("span",{className:"text",children:[(a.__headerState&Te.ROW)===Te.ROW?"Remove":"Add"," ","row header"]})}),O("button",{className:"item","data-test-id":"table-column-header",onClick:()=>v(),type:"button",children:ne("span",{className:"text",children:[(a.__headerState&Te.COLUMN)===Te.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Hu({anchorElem:e,cellMerge:t}){let[o]=Di(),n=Tt(null),r=Tt(null),[i,l]=Ee(!1),[a,s]=Ee(null),c=oe(()=>{let p=n.current,u=yt(),m=window.getSelection(),f=document.activeElement;if(u==null||p==null){s(null);return}let C=o.getRootElement();if(wo(u)&&C!==null&&m!==null&&C.contains(m.anchorNode)){let E=Eu(u.anchor.getNode());if(E==null){s(null);return}if(o.getElementByKey(E.getKey())==null){s(null);return}s(E)}else f||s(null)},[o]);ue(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),ue(()=>{let p=n.current;if(p!=null&&a!=null){let u=o.getElementByKey(a.getKey());if(u!=null){let m=u.getBoundingClientRect(),f=p.getBoundingClientRect(),C=e.getBoundingClientRect(),E=m.top-C.top+4,x=m.right-f.width-10-C.left;p.style.opacity="1",p.style.transform=`translate(${x}px, ${E}px)`}else p.style.opacity="0",p.style.transform="translate(-10000px, -10000px)"}},[n,a,o,e]);let d=Tt(a);return ue(()=>{d.current!==a&&l(!1),d.current=a},[d,a]),O("div",{className:"table-cell-action-button-container",ref:n,children:a!=null&&ne(Ro.Fragment,{children:[O("button",{className:"table-cell-action-button",onClick:p=>{p.stopPropagation(),l(!i)},ref:r,type:"button",children:O(Mi,{})}),i&&O(Ou,{cellMerge:t,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:a})]})})}var Hi=({anchorElem:e})=>{let t=hu();return Oi(t?O(Hu,{anchorElem:e??document.body,cellMerge:!0}):null,e??document.body)};import{useLexicalComposerContext as Bu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as $u}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Gu,$getTableNodeFromLexicalNodeOrThrow as _o,$getTableRowIndexFromTableCellNode as Uu,$isTableCellNode as Bi,$isTableRowNode as Wu,getDOMCellFromTarget as Vu}from"@lexical/table";import{calculateZoomLevel as $i}from"@lexical/utils";import{$getNearestNodeFromDOMNode as So}from"lexical";import*as Gi from"react";import{useCallback as ye,useEffect as zu,useMemo as Ku,useRef as Nt,useState as Lt}from"react";import{createPortal as ju}from"react-dom";import{jsx as kt,jsxs as Yu}from"react/jsx-runtime";var Xu=33,Zu=50;function Ju({editor:e}){let t=Nt(null),o=Nt(null),n=Nt(null),r=A(),i=Nt(null),[l,a]=Lt(null),[s,c]=Lt(null),[d,p]=Lt(!1),[u,m]=Lt(null),f=ye(()=>{c(null),t.current=null,m(null),i.current=null,n.current=null},[]),C=L=>(L.buttons&1)===1;zu(()=>{let L=R=>{setTimeout(()=>{let N=R.target;if(u){a({x:R.clientX,y:R.clientY});return}if(p(C(R)),!(o.current&&o.current.contains(N))&&t.current!==N){t.current=N;let S=Vu(N);S&&s!==S?e.update(()=>{let D=So(S.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let H=_o(D),B=e.getElementByKey(H.getKey());if(!B)throw new Error("TableCellResizer: Table element not found.");t.current=N,n.current=B.getBoundingClientRect(),c(S)}):S==null&&f()}},0)},b=R=>{setTimeout(()=>{p(!0)},0)},g=R=>{setTimeout(()=>{p(!1)},0)},_=e.registerRootListener((R,N)=>{R?.addEventListener("mousemove",L),R?.addEventListener("mousedown",b),R?.addEventListener("mouseup",g),N?.removeEventListener("mousemove",L),N?.removeEventListener("mousedown",b),N?.removeEventListener("mouseup",g)});return()=>{_()}},[s,u,e,f]);let E=L=>L==="bottom",x=ye(L=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let b=So(s.elem);if(!Bi(b))throw new Error("TableCellResizer: Table cell node not found.");let g=_o(b),_=Uu(b),R=g.getChildren();if(_>=R.length||_<0)throw new Error("Expected table cell to be inside of table row.");let N=R[_];if(!Wu(N))throw new Error("Expected table row");let S=N.getHeight();if(S===void 0){let H=N.getChildren();S=Math.min(...H.map(B=>M(B,e)??1/0))}let D=Math.max(S+L,Xu);N.setHeight(D)},{tag:"skip-scroll-into-view"})},[s,e]),F=(L,b)=>{let g=L.getWidth();if(g!==void 0)return g;let _=b.getElementByKey(L.getKey());if(_==null)return;let R=getComputedStyle(_);return _.clientWidth-parseFloat(R.paddingLeft)-parseFloat(R.paddingRight)},M=(L,b)=>b.getElementByKey(L.getKey())?.clientHeight,T=(L,b)=>{for(let g=0;g<b.length;g++)for(let _=0;_<b[g].length;_++)if(b[g][_].cell===L)return _},y=ye(L=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let b=So(s.elem);if(!Bi(b))throw new Error("TableCellResizer: Table cell node not found.");let g=_o(b),[_]=Gu(g,null,null),R=T(b,_);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");for(let N=0;N<_.length;N++){let S=_[N][R];if(S.startRow===N&&(R===_[N].length-1||_[N][R].cell!==_[N][R+1].cell)){let D=F(S.cell,e);if(D===void 0)continue;let H=Math.max(D+L,Zu);S.cell.setWidth(H)}}},{tag:"skip-scroll-into-view"})},[s,e]),h=ye(L=>{let b=g=>{if(g.preventDefault(),g.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:_,y:R}=i.current;if(s===null)return;let N=$i(g.target);if(E(L)){let S=(g.clientY-R)/N;x(S)}else{let S=(g.clientX-_)/N;y(S)}f(),document.removeEventListener("mouseup",b)}};return b},[s,f,y,x]),w=ye(L=>b=>{if(b.preventDefault(),b.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");i.current={x:b.clientX,y:b.clientY},a(i.current),m(L),document.addEventListener("mouseup",h(L))},[s,h]),v=ye(()=>{if(s){let{height:L,left:b,top:g,width:_}=s.elem.getBoundingClientRect(),R=$i(s.elem),N=10,S={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${N}px`,left:`${window.pageXOffset+b}px`,top:`${window.pageYOffset+g+L-N/2}px`,width:`${_}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${L}px`,left:`${window.pageXOffset+b+_-N/2}px`,top:`${window.pageYOffset+g}px`,width:`${N}px`}},D=n.current;return u&&l&&D&&(E(u)?(S[u].left=`${window.pageXOffset+D.left}px`,S[u].top=`${window.pageYOffset+l.y/R}px`,S[u].height="3px",S[u].width=`${D.width}px`):(S[u].top=`${window.pageYOffset+D.top}px`,S[u].left=`${window.pageXOffset+l.x/R}px`,S[u].width="3px",S[u].height=`${D.height}px`),S[u].backgroundColor="#adf"),S}return{bottom:null,left:null,right:null,top:null}},[s,u,l])();return kt("div",{ref:o,children:s!=null&&!d&&Yu(Gi.Fragment,{children:[kt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:w("right"),style:v.right||void 0}),kt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:w("bottom"),style:v.bottom||void 0})]})})}var Ui=()=>{let[e]=Bu(),t=$u();return Ku(()=>t?ju(kt(Ju,{editor:e}),document.body):null,[e,t])};import{useLexicalComposerContext as rp}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as ip,$getTableRowIndexFromTableCellNode as lp,$insertTableColumn__EXPERIMENTAL as sp,$insertTableRow__EXPERIMENTAL as ap,$isTableCellNode as cp,$isTableNode as zi,TableNode as dp}from"@lexical/table";import{$findMatchingParent as up,mergeRegister as pp}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ki}from"lexical";import{useEffect as ji,useRef as Xi,useState as wt}from"react";import{createPortal as mp}from"react-dom";import{useMemo as op,useRef as np}from"react";var qu="Expected a function",Qu=Math.max,ep=Math.min;function tp(e,t,o){let n,r,i,l,a,s,c=0,d=!1,p=!1,u=!0;if(typeof e!="function")throw new TypeError(qu);t=t||0,typeof o=="object"&&(d=!!o.leading,p="maxWait"in o,i=p?Qu(o.maxWait||0,t):i,u="trailing"in o?!!o.trailing:u);function m(h){let w=n,I=r;return n=r=void 0,c=h,l=e.apply(I,w),l}function f(h){return c=h,a=setTimeout(x,t),d?m(h):l}function C(h){let w=h-s,I=h-c,v=t-w;return p?ep(v,i-I):v}function E(h){let w=h-s,I=h-c;return s===void 0||w>=t||w<0||p&&I>=i}function x(){let h=Date.now();if(E(h))return F(h);a=setTimeout(x,C(h))}function F(h){return a=void 0,u&&n?m(h):(n=r=void 0,l)}function M(){a!==void 0&&clearTimeout(a),c=0,n=s=r=a=void 0}function T(){return a===void 0?l:F(Date.now())}function y(){let h=Date.now(),w=E(h);if(n=arguments,r=this,s=h,w){if(a===void 0)return f(s);if(p)return clearTimeout(a),a=setTimeout(x,t),m(s)}return a===void 0&&(a=setTimeout(x,t)),l}return y.cancel=M,y.flush=T,y}var Wi=tp;function Vi(e,t,o){let n=np(null);return n.current=e,op(()=>Wi((...r)=>{n.current&&n.current(...r)},t,{maxWait:o}),[t,o])}import{Fragment as Cp,jsx as vo,jsxs as hp}from"react/jsx-runtime";var Zi=20;function fp({anchorElem:e}){let[t]=rp(),o=A(),[n,r]=wt(!1),[i,l]=wt(!1),[a,s]=wt(!1),[c,d]=wt({}),p=Xi(new Set),u=Xi(null),m=Vi(C=>{let{isOutside:E,tableDOMNode:x}=gp(C,o.editorConfig?.lexical);if(E){r(!1),l(!1);return}if(!x)return;u.current=x;let F=null,M=null,T=null;if(t.update(()=>{let y=Ki(x);if(cp(y)){let h=up(y,w=>zi(w));if(!zi(h))return;if(T=t.getElementByKey(h?.getKey()),T){let w=h.getChildrenSize(),I=h.getChildAtIndex(0)?.getChildrenSize(),v=lp(y),L=ip(y);v===w-1?F=y:L===I-1&&(M=y)}}}),T){let{bottom:y,height:h,right:w,width:I,x:v,y:L}=T.getBoundingClientRect(),{left:b,y:g}=e.getBoundingClientRect();F?(l(!1),r(!0),d({height:Zi,left:v-b,top:y-g+5,width:I})):M&&(l(!0),r(!1),d({height:h,left:w-b+5,top:L-g,width:Zi}))}},50,250);ji(()=>{if(a)return document.addEventListener("mousemove",m),()=>{r(!1),l(!1),document.removeEventListener("mousemove",m)}},[a,m]),ji(()=>pp(t.registerMutationListener(dp,C=>{t.getEditorState().read(()=>{for(let[E,x]of C)switch(x){case"created":p.current.add(E),s(p.current.size>0);break;case"destroyed":p.current.delete(E),s(p.current.size>0);break;default:break}})},{skipInitialization:!1})),[t]);let f=C=>{t.update(()=>{u.current&&(Ki(u.current)?.selectEnd(),C?(ap(),r(!1)):(sp(),l(!1)))})};return hp(Cp,{children:[n&&vo("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>f(!0),style:{...c}}),i&&vo("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>f(!1),style:{...c}})]})}function gp(e,t){let o=e.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${t.theme.tableCell}, th.${t.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${t.theme.tableAddRows}`)||o.closest(`button.${t.theme.tableAddColumns}`)||o.closest(`div.${t.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function Ji({anchorElem:e=document.body}){return mp(vo(fp,{anchorElem:e}),e)}import{useLexicalComposerContext as bp}from"@lexical/react/LexicalComposerContext";import{TablePlugin as xp}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Tp,TableNode as Ep}from"@lexical/table";import{mergeRegister as yp}from"@lexical/utils";import{formatDrawerSlug as Np,useEditDepth as Lp,useModal as kp}from"@payloadcms/ui";import{$getSelection as wp,$isRangeSelection as Rp,COMMAND_PRIORITY_EDITOR as _p,createCommand as Sp}from"lexical";import{createContext as vp,useContext as Ip,useEffect as Fp,useMemo as Mp,useState as Pp}from"react";import*as Yi from"react";import{jsx as Io,jsxs as Dp}from"react/jsx-runtime";var Rt=Sp("OPEN_EMBED_DRAWER_COMMAND"),qi=vp({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Qi({children:e}){let[t,o]=Pp({cellEditorConfig:null,cellEditorPlugins:null});return Io(qi.Provider,{value:Mp(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:e})}var el=()=>{let[e]=bp(),t=Ip(qi),{closeModal:o,toggleModal:n}=kp(),r=Lp(),{uuid:i}=A(),l=Np({slug:"lexical-table-create-"+i,depth:r});return Fp(()=>{if(!e.hasNodes([Ep]))throw new Error("TablePlugin: TableNode is not registered on editor");return yp(e.registerCommand(Rt,()=>{let a=null;return e.getEditorState().read(()=>{let s=wp();Rp(s)&&(a=s)}),a&&n(l),!0},_p))},[t,e,n]),Dp(Yi.Fragment,{children:[Io(le,{drawerSlug:l,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:(a,s)=>{o(l),!(!s.columns||!s.rows)&&e.dispatchCommand(Tp,{columns:String(s.columns),rows:String(s.rows)})},schemaPathSuffix:"fields"}),Io(xp,{hasCellBackgroundColor:!1,hasCellMerge:!0})]})};var Bp=k({nodes:[Op,Ap,Hp],plugins:[{Component:el,position:"normal"},{Component:Ui,position:"normal"},{Component:Hi,position:"floatingAnchorElem"},{Component:Ji,position:"floatingAnchorElem"}],providers:[Qi],slashMenu:{groups:[G([{Icon:yo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(Rt,{})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:yo,key:"table",label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(Rt,{})}}])]}});import{$isNodeSelection as sm}from"lexical";import{jsx as Fo,jsxs as $p}from"react/jsx-runtime";var Mo=()=>$p("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Fo("path",{d:"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"}),Fo("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"}),Fo("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{useLexicalComposerContext as Jp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Yp,mergeRegister as qp}from"@lexical/utils";import{useConfig as Qp}from"@payloadcms/ui";import{$getPreviousSelection as em,$getSelection as tm,$isParagraphNode as ol,$isRangeSelection as om,COMMAND_PRIORITY_EDITOR as nm,createCommand as rm}from"lexical";import{useEffect as im}from"react";import{useLexicalComposerContext as Gp}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Up}from"@payloadcms/ui";import{$getNodeByKey as Wp,COMMAND_PRIORITY_EDITOR as Vp}from"lexical";import{useCallback as zp,useEffect as Kp,useState as jp}from"react";import{jsx as Po}from"react/jsx-runtime";var Xp=({editor:e,relationTo:t,replaceNodeKey:o,value:n})=>{o?e.update(()=>{let r=Wp(o);r&&r.replace(Ie({data:{fields:null,relationTo:t,value:n}}))}):e.dispatchCommand(Do,{fields:null,relationTo:t,value:n})},Zp=({enabledCollectionSlugs:e})=>{let[t]=Gp(),[o,n]=jp(null),[r,i,{closeDrawer:l,openDrawer:a}]=Up({collectionSlugs:e,uploads:!0});Kp(()=>t.registerCommand(Se,c=>(n(c?.replace?c?.replace.nodeKey:null),a(),!0),Vp),[t,a]);let s=zp(({collectionSlug:c,docID:d})=>{Xp({editor:t,relationTo:c,replaceNodeKey:o,value:d}),l()},[t,l,o]);return Po(r,{onSelect:s})},tl=e=>Po(Ye,{...e,uploads:!0,children:Po(Zp,{...e})});import{jsx as lm}from"react/jsx-runtime";var Do=rm("INSERT_UPLOAD_COMMAND"),nl=({clientProps:e})=>{let[t]=Jp(),{config:{collections:o}}=Qp();return im(()=>{if(!t.hasNodes([ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return qp(t.registerCommand(Do,n=>(t.update(()=>{let r=tm()||em();if(om(r)){let i=Ie({data:{id:n.id,fields:n.fields,relationTo:n.relationTo,value:n.value}});Yp(i);let{focus:l}=r,a=l.getNode();ol(a)&&a.getTextContentSize()===0&&a.getParent().getChildren().filter(s=>ol(s)).length>1&&a.remove()}}),!0),nm))},[t]),lm(tl,{enabledCollectionSlugs:o.map(({slug:n})=>n)})};var am=k({nodes:[ve],plugins:[{Component:nl,position:"normal"}],slashMenu:{groups:[G([{Icon:Mo,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(Se,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:Mo,isActive:({selection:e})=>{if(!sm(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Pt(t)},key:"upload",label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(Se,{replace:!1})}}])]}});import{ShimmerEffect as cm,useClientFunctions as dm,useFieldProps as um}from"@payloadcms/ui";import rl,{Suspense as pm,lazy as mm,useEffect as fm,useState as Ao}from"react";import{jsx as _t,jsxs as hm}from"react/jsx-runtime";var gm=mm(()=>import("./Field-QK4IB5HD.js").then(e=>({default:e.RichText}))),Cm=e=>{let{admin:t,field:{richTextComponentMap:o},lexicalEditorConfig:n}=e,{schemaPath:r}=um(),i=dm(),[l,a]=Ao(!1),[s,c]=Ao([]),[d,p]=Ao(null),u=o.get("features");u=u.sort((f,C)=>f.order-C.order);let m=0;for(let f of u){let C=Array.from(o.keys()).filter(E=>E.startsWith(`lexical_internal_feature.${f.key}.lexical_internal_components.`));m+=1,m+=C.length}return fm(()=>{if(!l){let f=[],C=0;if(Object.entries(i).forEach(([E,x])=>{E.startsWith(`lexicalFeature.${r}.`)&&(E.includes(".lexical_internal_components.")||f.push(x),C++)}),C===m){c(f),a(!0);let E=qe({clientFunctions:i,schemaPath:r,unSanitizedEditorConfig:{features:f,lexical:n}});p(Me(n||Fe,E,t))}}},[t,l,i,r,u.length,s,d,n,m]),l?_t(pm,{fallback:_t(cm,{height:"35vh"}),children:d&&_t(gm,{...e,editorConfig:d})}):_t(rl.Fragment,{children:Array.isArray(u)&&u.map(f=>{let E=Array.from(o.keys()).filter(x=>x.startsWith(`lexical_internal_feature.${f.key}.lexical_internal_components.`)).map(x=>o.get(x));return hm(rl.Fragment,{children:[E?.length?E.map(x=>x):null,f.ClientFeature]},f.key)})})};function bm(...e){return e.filter(Boolean).join(" ")}var St=new WeakMap;function il(e){let t=e.changedTouches[0];return t===void 0?null:[t.clientX,t.clientY]}function vt(e,t){let o=St.get(e);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=il(l))},i=l=>{if(o===void 0)return;let{start:a}=o;if(a===null)return;let s=il(l);for(let c of n)s!==null&&c([s[0]-a[0],s[1]-a[1]],l)};e.addEventListener("touchstart",r),e.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},St.set(e,o)}return o.listeners.add(t),()=>{xm(e,t)}}function xm(e,t){let o=St.get(e);if(o===void 0)return;let{listeners:n}=o;n.delete(t),n.size===0&&(St.delete(e),e.removeEventListener("touchstart",o.handleTouchstart),e.removeEventListener("touchend",o.handleTouchend))}function Tm(e,t){return vt(e,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&t(r,n)})}function Em(e,t){return vt(e,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&t(r,n)})}function ym(e,t){return vt(e,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&t(r,n)})}function Nm(e,t){return vt(e,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&t(r,n)})}var P={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},Lm=P.IS_BOLD|P.IS_ITALIC|P.IS_STRIKETHROUGH|P.IS_UNDERLINE|P.IS_CODE|P.IS_SUBSCRIPT|P.IS_SUPERSCRIPT|P.IS_HIGHLIGHT,km="\xA0",wm=`
35
+ `)};var Jr={type:"element",dependencies:[Mc,Fc],export:(e,t)=>Ic(e)?ce(e,t,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:he("check")};import{CheckListPlugin as Pc}from"@lexical/react/LexicalCheckListPlugin.js";import{jsx as Dc}from"react/jsx-runtime";var Yr=()=>Dc(Pc,{});var qr=[V([{ChildComponent:io,isActive:({selection:e})=>{if(!Hc(e))return!1;for(let t of e.getNodes()){if(so(t)&&t.getListType()==="check")continue;let o=t.getParent();if(so(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(so(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:e})=>e.t("lexical:checklist:label"),onSelect:({editor:e})=>{e.dispatchCommand(Qr,void 0)},order:12}])],Bc=k(({featureProviderMap:e})=>{let t=[{Component:Yr,position:"normal"}];return!e.has("unorderedList")&&!e.has("orderedList")&&t.push({Component:ge,position:"normal"}),{markdownTransformers:[Jr],nodes:e.has("unorderedList")||e.has("orderedList")?[]:[Oc,Ac],plugins:t,slashMenu:{groups:[Ce([{Icon:io,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Qr,void 0)}}])]},toolbarFixed:{groups:qr},toolbarInline:{groups:qr}}});import{$isListNode as co,INSERT_ORDERED_LIST_COMMAND as oi,ListItemNode as Vc,ListNode as zc}from"@lexical/list";import{$isRangeSelection as Kc}from"lexical";import{jsx as He,jsxs as $c}from"react/jsx-runtime";var ao=()=>$c("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[He("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"}),He("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"}),He("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Gc,ListItemNode as Uc,ListNode as Wc}from"@lexical/list";var ei={type:"element",dependencies:[Wc,Uc],export:(e,t)=>Gc(e)?ce(e,t,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:he("number")};var ti=[V([{ChildComponent:ao,isActive:({selection:e})=>{if(!Kc(e))return!1;for(let t of e.getNodes()){if(co(t)&&t.getListType()==="number")continue;let o=t.getParent();if(co(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(co(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(oi,void 0)},order:10}])],jc=k(({featureProviderMap:e})=>({markdownTransformers:[ei],nodes:e.has("orderedList")?[]:[zc,Vc],plugins:e.has("orderedList")?[]:[{Component:ge,position:"normal"}],slashMenu:{groups:[Ce([{Icon:ao,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(oi,void 0)}}])]},toolbarFixed:{groups:ti},toolbarInline:{groups:ti}}));import{$isListNode as po,INSERT_UNORDERED_LIST_COMMAND as ii,ListItemNode as qc,ListNode as Qc}from"@lexical/list";import{$isRangeSelection as ed}from"lexical";import{jsx as be,jsxs as Xc}from"react/jsx-runtime";var uo=()=>Xc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[be("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Zc,ListItemNode as Jc,ListNode as Yc}from"@lexical/list";var ni={type:"element",dependencies:[Yc,Jc],export:(e,t)=>Zc(e)?ce(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:he("bullet")};var ri=[V([{ChildComponent:uo,isActive:({selection:e})=>{if(!ed(e))return!1;for(let t of e.getNodes()){if(po(t)&&t.getListType()==="bullet")continue;let o=t.getParent();if(po(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(po(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:e})=>e.t("lexical:unorderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ii,void 0)},order:11}])],td=k({markdownTransformers:[ni],nodes:[Qc,qc],plugins:[{Component:ge,position:"normal"}],slashMenu:{groups:[Ce([{Icon:uo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:e})=>e.t("lexical:unorderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ii,void 0)}}])]},toolbarFixed:{groups:ri},toolbarInline:{groups:ri}});import{addClassNamesToElement as od}from"@lexical/utils";import{DecoratorNode as nd}from"lexical";import*as li from"react";import{jsx as ld}from"react/jsx-runtime";var rd=li.lazy(()=>import("./Component-7HS6FEJS.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),Be=class e extends nd{__data;constructor({data:t,key:o}){super(o),this.__data=t}static clone(t){return new e({data:t.__data,key:t.__key})}static getType(){return"unknownConverted"}static importJSON(t){return id({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return od(o,"unknownConverted"),o}decorate(){return ld(rd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function id({data:e}){return new Be({data:e})}var sd=k(()=>({nodes:[Be]}));import{addClassNamesToElement as ad}from"@lexical/utils";import{DecoratorNode as cd}from"lexical";import*as si from"react";import{jsx as pd}from"react/jsx-runtime";var dd=si.lazy(()=>import("./Component-LAKSCIDX.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),$e=class e extends cd{__data;constructor({data:t,key:o}){super(o),this.__data=t}static clone(t){return new e({data:t.__data,key:t.__key})}static getType(){return"unknownConverted"}static importJSON(t){return ud({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return ad(o,"unknownConverted"),o}decorate(){return pd(dd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function ud({data:e}){return new $e({data:e})}var md=k(({clientFunctions:e})=>({nodes:[$e]}));import{$setBlocksType as di}from"@lexical/selection";import{$createParagraphNode as ui,$getSelection as pi,$isParagraphNode as ai,$isRangeSelection as fd}from"lexical";var ci=[V([{ChildComponent:Pe,isActive:({selection:e})=>{if(!fd(e))return!1;for(let t of e.getNodes())if(!ai(t)&&!ai(t.getParent()))return!1;return!0},key:"paragraph",label:({i18n:e})=>e.t("lexical:paragraph:label2"),onSelect:({editor:e})=>{e.update(()=>{let t=pi();di(t,()=>ui())})},order:1}])],gd=k({slashMenu:{groups:[G([{Icon:Pe,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:e})=>e.t("lexical:paragraph:label"),onSelect:({editor:e})=>{e.update(()=>{let t=pi();di(t,()=>ui())})}}])]},toolbarFixed:{groups:ci},toolbarInline:{groups:ci}});import{$isNodeSelection as Md}from"lexical";import{jsx as Ge,jsxs as Cd}from"react/jsx-runtime";var mo=()=>Cd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ge("g",{clipPath:"url(#clip0_4397_10817)",children:Ge("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"})}),Ge("defs",{children:Ge("clipPath",{id:"clip0_4397_10817",children:Ge("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{useLexicalComposerContext as Nd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ld}from"@lexical/utils";import{useConfig as kd}from"@payloadcms/ui";import{$getPreviousSelection as wd,$getSelection as Rd,$isParagraphNode as hi,$isRangeSelection as _d,COMMAND_PRIORITY_EDITOR as Sd,createCommand as vd}from"lexical";import{useEffect as Id}from"react";import{useLexicalComposerContext as hd}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as bd}from"@payloadcms/ui";import{$getNodeByKey as xd,COMMAND_PRIORITY_EDITOR as Td}from"lexical";import{useCallback as Ed,useEffect as mi,useState as fi}from"react";import{jsx as ft}from"react/jsx-runtime";var yd=({editor:e,relationTo:t,replaceNodeKey:o,value:n})=>{o?e.update(()=>{let r=xd(o);r&&r.replace(_e({relationTo:t,value:n}))}):e.dispatchCommand(fo,{relationTo:t,value:n})},gi=({enabledCollectionSlugs:e})=>{let[t]=hd(),[o,n]=fi(()=>e[0]),[r,i]=fi(null),[l,a,{closeDrawer:s,isDrawerOpen:c,openDrawer:d}]=bd({collectionSlugs:e,selectedCollection:o});mi(()=>t.registerCommand(we,u=>(i(u?.replace?u?.replace.nodeKey:null),d(),!0),Td),[t,d]);let p=Ed(({collectionSlug:u,docID:m})=>{yd({editor:t,relationTo:u,replaceNodeKey:r,value:m}),s()},[t,s,r]);return mi(()=>{n(e[0])},[c,e]),ft(l,{onSelect:p})},Ci=e=>e?.enabledCollectionSlugs?.length>0?ft(gi,{...e}):ft(Ye,{...e,children:ft(gi,{...e})});import{jsx as Fd}from"react/jsx-runtime";var fo=vd("INSERT_RELATIONSHIP_COMMAND"),bi=({clientProps:e})=>{let[t]=Nd(),{config:{collections:o}}=kd(),n=null;return e?.enabledCollections?n=e?.enabledCollections:e?.disabledCollections&&(n=o.filter(({slug:r})=>!e?.disabledCollections?.includes(r)).map(({slug:r})=>r)),Id(()=>{if(!t.hasNodes([Re]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return t.registerCommand(fo,r=>{let i=Rd()||wd();if(_d(i)){let l=_e(r);Ld(l);let{focus:a}=i,s=a.getNode();hi(s)&&s.getTextContentSize()===0&&s.getParent().getChildren().filter(c=>hi(c)).length>1&&s.remove()}return!0},Sd)},[t]),Fd(Ci,{enabledCollectionSlugs:n})};var Pd=k({nodes:[Re],plugins:[{Component:bi,position:"normal"}],slashMenu:{groups:[G([{Icon:mo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(we,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:mo,isActive:({selection:e})=>{if(!Md(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Mt(t)},key:"relationship",label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(we,{replace:!1})}}])]}});import{useLexicalComposerContext as Zd}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Jd,useThrottledEffect as Yd,useTranslation as qd}from"@payloadcms/ui";import*as te from"react";import{useMemo as Qd}from"react";import{mergeRegister as Dd}from"@lexical/utils";import{$getSelection as Ad}from"lexical";import{useCallback as Od,useEffect as gt,useState as go}from"react";import{jsx as Hd}from"react/jsx-runtime";var Co="toolbar-popup__button",Ue=({children:e,editor:t,item:o})=>{let[n,r]=go(!0),[i,l]=go(!1),[a,s]=go(Co),c=A(),d=Od(()=>{t.getEditorState().read(()=>{let p=Ad();if(o.isActive){let u=o.isActive({editor:t,editorConfigContext:c,selection:p});i!==u&&l(u)}if(o.isEnabled){let u=o.isEnabled({editor:t,editorConfigContext:c,selection:p});n!==u&&r(u)}})},[i,t,c,n,o]);return gt(()=>{d()},[d]),gt(()=>(document.addEventListener("mouseup",d),()=>{document.removeEventListener("mouseup",d)}),[d]),gt(()=>Dd(t.registerUpdateListener(()=>{d()})),[t,d]),gt(()=>{s([Co,n===!1?"disabled":"",i?"active":"",o?.key?`${Co}-`+o.key:""].filter(Boolean).join(" "))},[n,i,a,o.key]),Hd("button",{className:a,onClick:()=>{if(n!==!1)return t._updateTags=new Set([...t._updateTags,"toolbar"]),t.focus(()=>{o.onSelect({editor:t,isActive:i})}),!0},onMouseDown:p=>{p.preventDefault()},type:"button",children:e})};import Ni,{useCallback as Wd,useEffect as xo}from"react";import{mergeRegister as Vd}from"@lexical/utils";import{useTranslation as zd}from"@payloadcms/ui";import{$getSelection as Kd}from"lexical";import Ct,{useCallback as Bd,useEffect as We,useMemo as $d,useRef as bo,useState as ht}from"react";import{createPortal as Gd}from"react-dom";import{jsx as ie,jsxs as xi}from"react/jsx-runtime";var ho="toolbar-popup__dropdown-item",Ti=Ct.createContext(null);function Ei({active:e,children:t,editor:o,enabled:n,item:r,title:i}){let[l,a]=ht(ho);We(()=>{a([ho,n===!1?"disabled":"",e?"active":"",r?.key?`${ho}-${r.key}`:""].filter(Boolean).join(" "))},[n,e,l,r.key]);let s=bo(null),c=Ct.useContext(Ti);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=c;return We(()=>{s?.current!=null&&d(s)},[s,d]),ie("button",{className:l,onClick:()=>{n!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{r.onSelect({editor:o,isActive:e})}))},onMouseDown:p=>{p.preventDefault()},ref:s,title:i,type:"button",children:t})}function Ud({children:e,dropDownRef:t,itemsContainerClassNames:o,onClose:n}){let[r,i]=ht(),[l,a]=ht(),s=Bd(p=>{i(u=>u!=null?[...u,p]:[p])},[i]),c=p=>{if(r==null)return;let{key:u}=p;["ArrowDown","ArrowUp","Escape","Tab"].includes(u)&&p.preventDefault(),u==="Escape"||u==="Tab"?n():u==="ArrowUp"?a(m=>{if(m==null)return r[0];let f=r.indexOf(m)-1;return r[f===-1?r.length-1:f]}):u==="ArrowDown"&&a(m=>m==null?r[0]:r[r.indexOf(m)+1])},d=$d(()=>({registerItem:s}),[s]);return We(()=>{r!=null&&l==null&&a(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),ie(Ti.Provider,{value:d,children:ie("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:t,children:e})})}function yi({Icon:e,buttonAriaLabel:t,buttonClassName:o,children:n,disabled:r=!1,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:a}){let s=bo(null),c=bo(null),[d,p]=ht(!1),u=()=>{p(!1),c?.current!=null&&c.current.focus()};We(()=>{let f=c.current,C=s.current;if(d&&f!==null&&C!==null){let{left:E,top:x}=f.getBoundingClientRect(),F=window.scrollY||document.documentElement.scrollTop;C.style.top=`${x+F+f.offsetHeight+5}px`,C.style.left=`${Math.min(E-5,window.innerWidth-C.offsetWidth-20)}px`}},[s,c,d]),We(()=>{let f=c.current;if(f!==null&&d){let C=E=>{let{target:x}=E;a!=null&&s.current!=null&&s.current.contains(x)||f.contains(x)||p(!1)};return document.addEventListener("click",C),()=>{document.removeEventListener("click",C)}}},[s,c,d,a]);let m=Gd(ie(Ud,{dropDownRef:s,itemsContainerClassNames:i,onClose:u,children:n}),document.body);return xi(Ct.Fragment,{children:[xi("button",{"aria-label":t,className:o+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),p(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[e&&ie(e,{}),l&&ie("span",{className:"toolbar-popup__dropdown-label",children:l}),ie("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ie(Ct.Fragment,{children:m})]})}import{jsx as Ve,jsxs as Xd}from"react/jsx-runtime";var To="toolbar-popup__dropdown",jd=({active:e,anchorElem:t,editor:o,enabled:n,item:r})=>{let{i18n:i}=zd(),{field:{richTextComponentMap:l}}=A();if(r.Component)return r?.Component&&Ve(r.Component,{active:e,anchorElem:t,editor:o,enabled:n,item:r},r.key);let a=r.key;return r.label&&(a=typeof r.label=="function"?r.label({i18n:i,richTextComponentMap:l}):r.label),a.length>25&&(a=a.substring(0,25)+"..."),Xd(Ei,{active:e,editor:o,enabled:n,item:r,children:[r?.ChildComponent&&Ve(r.ChildComponent,{}),Ve("span",{className:"text",children:a})]},r.key)},de=({Icon:e,anchorElem:t,classNames:o,editor:n,groupKey:r,items:i,itemsContainerClassNames:l,label:a,maxActiveItems:s,onActiveChange:c})=>{let[d,p]=Ni.useState([]),[u,m]=Ni.useState([]),f=A(),C=Wd(()=>{n.getEditorState().read(()=>{let E=Kd(),x=[],F=[],M=[];for(let T of i)T.isActive&&(!s||x.length<s)&&T.isActive({editor:n,editorConfigContext:f,selection:E})&&(x.push(T.key),F.push(T)),T.isEnabled?T.isEnabled({editor:n,editorConfigContext:f,selection:E})&&M.push(T.key):M.push(T.key);p(x),m(M),c&&c({activeItems:F})})},[n,f,i,s,c]);return xo(()=>{C()},[C]),xo(()=>(document.addEventListener("mouseup",C),()=>{document.removeEventListener("mouseup",C)}),[C]),xo(()=>Vd(n.registerUpdateListener(()=>{C()})),[n,C]),Ve(yi,{Icon:e,buttonAriaLabel:`${r} dropdown`,buttonClassName:[To,`${To}-${r}`,...o||[]].filter(Boolean).join(" "),itemsContainerClassNames:[`${To}-items`,...l||[]],label:a,children:i.length&&i.map(E=>Ve(jd,{active:d.includes(E.key),anchorElem:t,editor:n,enabled:u.includes(E.key),item:E},E.key))},r)};import{jsx as j,jsxs as nu}from"react/jsx-runtime";function eu({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&j(o.Component,{anchorElem:e,editor:t,item:o},o.key):j(Ue,{editor:t,item:o,children:o?.ChildComponent&&j(o.ChildComponent,{})},o.key)}function tu({anchorElem:e,editor:t,editorConfig:o,group:n,index:r}){let{i18n:i}=qd(),{field:{richTextComponentMap:l}}=A(),[a,s]=te.useState(null),[c,d]=te.useState(null);te.useEffect(()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(null)},[n]);let p=({activeItems:u})=>{if(!u.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?(d(()=>n.ChildComponent),s(null)):(d(null),s(null));return}let m=u[0],f=m.key;m.label&&(f=typeof m.label=="function"?m.label({i18n:i,richTextComponentMap:l}):m.label),f.length>25&&(f=f.substring(0,25)+"..."),s(f),d(()=>m.ChildComponent)};return nu("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,children:[n.type==="dropdown"&&n.items.length&&(c?j(de,{Icon:c,anchorElem:e,editor:t,groupKey:n.key,items:n.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:1,onActiveChange:p}):j(de,{anchorElem:e,editor:t,groupKey:n.key,items:n.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:1,onActiveChange:p})),n.type==="buttons"&&n.items.length&&n.items.map(u=>j(eu,{anchorElem:e,editor:t,item:u},u.key)),r<o.features.toolbarFixed?.groups.length-1&&j("div",{className:"divider"})]},n.key)}function ou({anchorElem:e,clientProps:t,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=te.useRef(null),{y:l}=Jd(),a=Qd(()=>{if(!r||t?.disableIfParentHasFixedToolbar)return null;let c=r.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[t?.disableIfParentHasFixedToolbar,r]);return Yd(()=>{if(!a)return;let s=i.current;if(!s)return;let c=s.getBoundingClientRect(),d=a.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",a.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",a.className="fixed-toolbar"}},50,[i,a,l]),j("div",{className:"fixed-toolbar",onFocus:s=>{s.stopPropagation()},ref:i,children:o.isEditable()&&j(te.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((s,c)=>j(tu,{anchorElem:e,editor:o,editorConfig:n,group:s,index:c},s.key))})})}var Li=e=>{if(e.parentEditor?.editorConfig){if(e.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return e.parentEditor;if(e.parentEditor)return Li(e.parentEditor)}return!1},ki=({anchorElem:e,clientProps:t})=>{let[o]=Zd(),n=A(),{editorConfig:r}=n,i=t.applyToFocusedEditor&&n.focusedEditor?.editor||o,l=t.applyToFocusedEditor&&n.focusedEditor?.editorConfig||r,a=Li(n);return t?.disableIfParentHasFixedToolbar&&a||!l?.features?.toolbarFixed?.groups?.length?null:j(ou,{anchorElem:e,editor:i,editorConfig:l,parentWithFixedToolbar:a})};var ru=k({plugins:[{Component:ki,position:"aboveContainer"}]});import{useLexicalComposerContext as iu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as _i}from"@lexical/utils";import{$getSelection as Si,$isRangeSelection as wi,$isTextNode as lu,COMMAND_PRIORITY_LOW as su,SELECTION_CHANGE_COMMAND as au}from"lexical";import{useCallback as ze,useEffect as Ke,useRef as Ri,useState as cu}from"react";import*as xe from"react";import{createPortal as du}from"react-dom";function Eo(e,t){let o=e.getRangeAt(0),n;if(e.anchorNode===t){let r=t;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function bt(e){let{alwaysDisplayOnTop:t=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:i=5,horizontalPosition:l="left",specialHandlingForCaret:a=!1,targetRect:s,verticalGap:c=10}=e,d=o.parentElement;if(s===null||d==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let p=r.getBoundingClientRect(),u=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=s.top-p.height-c,C=s.left-i;l==="center"&&(C=s.left+s.width/2-p.width/2);let E=0;return!t&&f<m.top&&!a&&(E=p.height+s.height+c*2,f+=E),l==="center"?C+p.width>m.right?C=m.right-p.width-i:C<m.left&&(C=m.left+i):C+p.width>m.right&&(C=m.right-p.width-i),C-=u.left,r.style.opacity="1",a&&n!==0?(f-=u.bottom-n+p.height-3,r.style.transform=`translate(${C}px, ${f}px) rotate(180deg)`):(f-=u.top,r.style.transform=`translate(${C}px, ${f}px)`),E}import{jsx as X,jsxs as Ii}from"react/jsx-runtime";function uu({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&X(o.Component,{anchorElem:e,editor:t,item:o},o.key):X(Ue,{editor:t,item:o,children:o?.ChildComponent&&X(o.ChildComponent,{})},o.key)}function pu({anchorElem:e,editor:t,group:o,index:n}){let{editorConfig:r}=A(),[i,l]=xe.useState(null);xe.useEffect(()=>{o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null)},[o]);let a=({activeItems:s})=>{if(!s.length){o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null);return}let c=s[0];l(()=>c.ChildComponent)};return Ii("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,children:[o.type==="dropdown"&&o.items.length&&(i?X(de,{Icon:i,anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:a}):X(de,{anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:a})),o.type==="buttons"&&o.items.length&&o.items.map(s=>X(uu,{anchorElem:e,editor:t,item:s},s.key)),n<r.features.toolbarInline?.groups.length-1&&X("div",{className:"divider"})]},o.key)}function mu({anchorElem:e,editor:t}){let o=Ri(null),n=Ri(null),{editorConfig:r}=A(),i=ze(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=ze(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",p=o.current.style.pointerEvents==="none";if(!d||!p){let u=c.clientX,m=c.clientY,f=document.elementFromPoint(u,m);o.current.contains(f)||i()}}},[i]),a=ze(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ke(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}),[o,l,a]);let s=ze(()=>{let c=Si(),d=window.getSelection();if(o.current===null)return;let p=e.querySelector(":scope > .link-editor"),u=p!==null&&"style"in p&&p?.style?.opacity==="1",m=t.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=Eo(d,m),C=bt({alwaysDisplayOnTop:u,anchorElem:e,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&bt({anchorElem:o.current,anchorFlippedOffset:C,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:10})}else i()},[t,i,e]);return Ke(()=>{let c=e.parentElement,d=()=>{t.getEditorState().read(()=>{s()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[t,s,e]),Ke(()=>(t.getEditorState().read(()=>{s()}),_i(t.registerUpdateListener(({editorState:c})=>{c.read(()=>{s()})}),t.registerCommand(au,()=>(s(),!1),su))),[t,s]),Ii("div",{className:"inline-toolbar-popup",ref:o,children:[X("div",{className:"caret",ref:n}),t.isEditable()&&X(xe.Fragment,{children:r?.features&&r.features?.toolbarInline?.groups.map((c,d)=>X(pu,{anchorElem:e,editor:t,group:c,index:d},c.key))})]})}function fu(e,t){let[o,n]=cu(!1),r=ze(()=>{e.getEditorState().read(()=>{if(e.isComposing())return;let i=Si(),l=window.getSelection(),a=e.getRootElement();if(l!==null&&(!wi(i)||a===null||!a.contains(l.anchorNode))){n(!1);return}if(!wi(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),d=!1;for(let p of c)if(lu(p)){n(!0),d=!0;break}d||n(!1)}else n(!1);let s=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&s===""){n(!1);return}})},[e]);return Ke(()=>(document.addEventListener("selectionchange",r),document.addEventListener("mouseup",r),()=>{document.removeEventListener("selectionchange",r),document.removeEventListener("mouseup",r)}),[r]),Ke(()=>_i(e.registerUpdateListener(()=>{r()}),e.registerRootListener(()=>{e.getRootElement()===null&&n(!1)})),[e,r]),o?du(X(mu,{anchorElem:t,editor:e}),t):null}var vi=({anchorElem:e})=>{let[t]=iu();return fu(t,e)};var gu=k({plugins:[{Component:vi,position:"floatingAnchorElem"}]});import{TableCellNode as Ap,TableNode as Op,TableRowNode as Hp}from"@lexical/table";import{jsx as Fi}from"react/jsx-runtime";var yo=()=>Fi("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Fi("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{useLexicalComposerContext as Di}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as hu}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as bu,$deleteTableRow__EXPERIMENTAL as xu,$getNodeTriplet as Tu,$getTableCellNodeFromLexicalNode as Eu,$getTableColumnIndexFromTableCellNode as yu,$getTableNodeFromLexicalNodeOrThrow as xt,$getTableRowIndexFromTableCellNode as Nu,$insertTableColumn__EXPERIMENTAL as Lu,$insertTableRow__EXPERIMENTAL as ku,$isTableCellNode as je,$isTableRowNode as ko,$isTableSelection as Et,$unmergeCell as wu,TableCellHeaderStates as Te,TableCellNode as Ru,getTableObserverFromTableElement as _u}from"@lexical/table";import{useScrollInfo as Su}from"@payloadcms/ui";import{$createParagraphNode as vu,$getRoot as Iu,$getSelection as yt,$isElementNode as Fu,$isParagraphNode as Ai,$isRangeSelection as wo,$isTextNode as Mu}from"lexical";import*as Ro from"react";import{useCallback as oe,useEffect as ue,useRef as Tt,useState as Ee}from"react";import{createPortal as Oi}from"react-dom";import{jsx as No,jsxs as Cu}from"react/jsx-runtime";var Mi=()=>Cu("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[No("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"}),No("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"}),No("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});import{jsx as O,jsxs as ne}from"react/jsx-runtime";function Lo(e){let t=e.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function Pu(e){let t=e.getNodes(),o=[],n=null,r=null,i=0;for(let l=0;l<t.length;l++){let a=t[l];if(je(a)){let s=a.getParentOrThrow();if(ko(s))throw new Error("Expected CellNode to have a RowNode parent");if(n!==s){if(r!==null&&i!==r)return!1;n!==null&&(r=i),n=s,i=0}let c=a.__colSpan;for(let d=0;d<c;d++)o[i+d]===void 0&&(o[i+d]=0),o[i+d]+=a.__rowSpan;i+=c}}return(r===null||i===r)&&o.every(l=>l===o[0])}function Du(){let e=yt();if(wo(e)&&!e.isCollapsed()||Et(e)&&!e.anchor.is(e.focus)||!wo(e)&&!Et(e))return!1;let[t]=Tu(e.anchor);return t.__colSpan>1||t.__rowSpan>1}function Pi(e){if(e.getChildrenSize()!==1)return!1;let t=e.getFirstChildOrThrow();return!(!Ai(t)||!t.isEmpty())}function Au(e){let t=e.getLastDescendant();Mu(t)?t.select():Fu(t)?t.selectEnd():t!==null&&t.selectNext()}function Ou({cellMerge:e,contextRef:t,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Di(),l=Tt(null),[a,s]=Ee(r),[c,d]=Ee({columns:1,rows:1}),[p,u]=Ee(!1),[m,f]=Ee(!1),{y:C}=Su();ue(()=>i.registerMutationListener(Ru,b=>{b.get(a.getKey())==="updated"&&i.getEditorState().read(()=>{s(a.getLatest())})},{skipInitialization:!0}),[i,a]),ue(()=>{i.getEditorState().read(()=>{let b=yt();if(Et(b)){let g=Lo(b);d(Lo(b)),u(Pu(b)&&(g.columns>1||g.rows>1))}f(Du())})},[i]),ue(()=>{let b=t.current,g=l.current,_=i.getRootElement();if(b!=null&&g!=null&&_!=null){let R=_.getBoundingClientRect(),N=b.getBoundingClientRect();g.style.opacity="1";let S=g.getBoundingClientRect(),D=5,H=N.right+D;if(H+S.width>window.innerWidth||H+S.width>R.right){let W=N.left-S.width-D;H=(W<0?D:W)+window.pageXOffset}g.style.left=`${H+window.pageXOffset}px`;let B=N.top;if(B+S.height>window.innerHeight){let W=N.bottom-S.height;B=(W<0?D:W)+window.pageYOffset}g.style.top=`${B}px`}},[t,l,i,C]),ue(()=>{function b(g){l.current!=null&&t.current!=null&&!l.current.contains(g.target)&&!t.current.contains(g.target)&&n(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[n,t]);let E=oe(()=>{i.update(()=>{if(a.isAttached()){let g=xt(a),_=i.getElementByKey(g.getKey());if(!_)throw new Error("Expected to find tableElement in DOM");let R=_u(_);R!==null&&R.clearHighlight(),g.markDirty(),s(a.getLatest())}Iu().selectStart()})},[i,a]),x=()=>{i.update(()=>{let b=yt();if(Et(b)){let{columns:g,rows:_}=Lo(b),R=b.getNodes(),N=null;for(let S=0;S<R.length;S++){let D=R[S];if(je(D))if(N===null){D.setColSpan(g).setRowSpan(_),N=D;let H=Pi(D),B;H&&Ai(B=D.getFirstChild())&&B.remove()}else je(N)&&(Pi(D)||N.append(...D.getChildren()),D.remove())}N!==null&&(N.getChildrenSize()===0&&N.append(vu()),Au(N)),o()}})},F=()=>{i.update(()=>{wu()})},M=oe(b=>{i.update(()=>{ku(b),o()})},[i,o]),T=oe(b=>{i.update(()=>{for(let g=0;g<c.columns;g++)Lu(b);o()})},[i,o,c.columns]),y=oe(()=>{i.update(()=>{xu(),o()})},[i,o]),h=oe(()=>{i.update(()=>{xt(a).remove(),E(),o()})},[i,a,E,o]),w=oe(()=>{i.update(()=>{bu(),o()})},[i,o]),I=oe(()=>{i.update(()=>{let b=xt(a),g=Nu(a),_=b.getChildren();if(g>=_.length||g<0)throw new Error("Expected table cell to be inside of table row.");let R=_[g];if(!ko(R))throw new Error("Expected table row");R.getChildren().forEach(N=>{if(!je(N))throw new Error("Expected table cell");N.toggleHeaderStyle(Te.ROW)}),E(),o()})},[i,a,E,o]),v=oe(()=>{i.update(()=>{let b=xt(a),g=yu(a),_=b.getChildren(),R=Math.max(..._.map(N=>N.getChildren().length));if(g>=R||g<0)throw new Error("Expected table cell to be inside of table row.");for(let N=0;N<_.length;N++){let S=_[N];if(!ko(S))throw new Error("Expected table row");let D=S.getChildren();if(g>=D.length)continue;let H=D[g];if(!je(H))throw new Error("Expected table cell");H.toggleHeaderStyle(Te.COLUMN)}E(),o()})},[i,a,E,o]),L=null;return e&&(p?L=O("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>x(),type:"button",children:"Merge cells"}):m&&(L=O("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>F(),type:"button",children:"Unmerge cells"}))),Oi(ne("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[L?ne(Ro.Fragment,{children:[L,O("hr",{})]}):null,O("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>M(!1),type:"button",children:ne("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),O("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>M(!0),type:"button",children:ne("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),O("hr",{}),O("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>T(!1),type:"button",children:ne("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),O("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>T(!0),type:"button",children:ne("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),O("hr",{}),O("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:O("span",{className:"text",children:"Delete column"})}),O("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>y(),type:"button",children:O("span",{className:"text",children:"Delete row"})}),O("button",{className:"item","data-test-id":"table-delete",onClick:()=>h(),type:"button",children:O("span",{className:"text",children:"Delete table"})}),O("hr",{}),O("button",{className:"item",onClick:()=>I(),type:"button",children:ne("span",{className:"text",children:[(a.__headerState&Te.ROW)===Te.ROW?"Remove":"Add"," ","row header"]})}),O("button",{className:"item","data-test-id":"table-column-header",onClick:()=>v(),type:"button",children:ne("span",{className:"text",children:[(a.__headerState&Te.COLUMN)===Te.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Hu({anchorElem:e,cellMerge:t}){let[o]=Di(),n=Tt(null),r=Tt(null),[i,l]=Ee(!1),[a,s]=Ee(null),c=oe(()=>{let p=n.current,u=yt(),m=window.getSelection(),f=document.activeElement;if(u==null||p==null){s(null);return}let C=o.getRootElement();if(wo(u)&&C!==null&&m!==null&&C.contains(m.anchorNode)){let E=Eu(u.anchor.getNode());if(E==null){s(null);return}if(o.getElementByKey(E.getKey())==null){s(null);return}s(E)}else f||s(null)},[o]);ue(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),ue(()=>{let p=n.current;if(p!=null&&a!=null){let u=o.getElementByKey(a.getKey());if(u!=null){let m=u.getBoundingClientRect(),f=p.getBoundingClientRect(),C=e.getBoundingClientRect(),E=m.top-C.top+4,x=m.right-f.width-10-C.left;p.style.opacity="1",p.style.transform=`translate(${x}px, ${E}px)`}else p.style.opacity="0",p.style.transform="translate(-10000px, -10000px)"}},[n,a,o,e]);let d=Tt(a);return ue(()=>{d.current!==a&&l(!1),d.current=a},[d,a]),O("div",{className:"table-cell-action-button-container",ref:n,children:a!=null&&ne(Ro.Fragment,{children:[O("button",{className:"table-cell-action-button",onClick:p=>{p.stopPropagation(),l(!i)},ref:r,type:"button",children:O(Mi,{})}),i&&O(Ou,{cellMerge:t,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:a})]})})}var Hi=({anchorElem:e})=>{let t=hu();return Oi(t?O(Hu,{anchorElem:e??document.body,cellMerge:!0}):null,e??document.body)};import{useLexicalComposerContext as Bu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as $u}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Gu,$getTableNodeFromLexicalNodeOrThrow as _o,$getTableRowIndexFromTableCellNode as Uu,$isTableCellNode as Bi,$isTableRowNode as Wu,getDOMCellFromTarget as Vu}from"@lexical/table";import{calculateZoomLevel as $i}from"@lexical/utils";import{$getNearestNodeFromDOMNode as So}from"lexical";import*as Gi from"react";import{useCallback as ye,useEffect as zu,useMemo as Ku,useRef as Nt,useState as Lt}from"react";import{createPortal as ju}from"react-dom";import{jsx as kt,jsxs as Yu}from"react/jsx-runtime";var Xu=33,Zu=50;function Ju({editor:e}){let t=Nt(null),o=Nt(null),n=Nt(null),r=A(),i=Nt(null),[l,a]=Lt(null),[s,c]=Lt(null),[d,p]=Lt(!1),[u,m]=Lt(null),f=ye(()=>{c(null),t.current=null,m(null),i.current=null,n.current=null},[]),C=L=>(L.buttons&1)===1;zu(()=>{let L=R=>{setTimeout(()=>{let N=R.target;if(u){a({x:R.clientX,y:R.clientY});return}if(p(C(R)),!(o.current&&o.current.contains(N))&&t.current!==N){t.current=N;let S=Vu(N);S&&s!==S?e.update(()=>{let D=So(S.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let H=_o(D),B=e.getElementByKey(H.getKey());if(!B)throw new Error("TableCellResizer: Table element not found.");t.current=N,n.current=B.getBoundingClientRect(),c(S)}):S==null&&f()}},0)},b=R=>{setTimeout(()=>{p(!0)},0)},g=R=>{setTimeout(()=>{p(!1)},0)},_=e.registerRootListener((R,N)=>{R?.addEventListener("mousemove",L),R?.addEventListener("mousedown",b),R?.addEventListener("mouseup",g),N?.removeEventListener("mousemove",L),N?.removeEventListener("mousedown",b),N?.removeEventListener("mouseup",g)});return()=>{_()}},[s,u,e,f]);let E=L=>L==="bottom",x=ye(L=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let b=So(s.elem);if(!Bi(b))throw new Error("TableCellResizer: Table cell node not found.");let g=_o(b),_=Uu(b),R=g.getChildren();if(_>=R.length||_<0)throw new Error("Expected table cell to be inside of table row.");let N=R[_];if(!Wu(N))throw new Error("Expected table row");let S=N.getHeight();if(S===void 0){let H=N.getChildren();S=Math.min(...H.map(B=>M(B,e)??1/0))}let D=Math.max(S+L,Xu);N.setHeight(D)},{tag:"skip-scroll-into-view"})},[s,e]),F=(L,b)=>{let g=L.getWidth();if(g!==void 0)return g;let _=b.getElementByKey(L.getKey());if(_==null)return;let R=getComputedStyle(_);return _.clientWidth-parseFloat(R.paddingLeft)-parseFloat(R.paddingRight)},M=(L,b)=>b.getElementByKey(L.getKey())?.clientHeight,T=(L,b)=>{for(let g=0;g<b.length;g++)for(let _=0;_<b[g].length;_++)if(b[g][_].cell===L)return _},y=ye(L=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let b=So(s.elem);if(!Bi(b))throw new Error("TableCellResizer: Table cell node not found.");let g=_o(b),[_]=Gu(g,null,null),R=T(b,_);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");for(let N=0;N<_.length;N++){let S=_[N][R];if(S.startRow===N&&(R===_[N].length-1||_[N][R].cell!==_[N][R+1].cell)){let D=F(S.cell,e);if(D===void 0)continue;let H=Math.max(D+L,Zu);S.cell.setWidth(H)}}},{tag:"skip-scroll-into-view"})},[s,e]),h=ye(L=>{let b=g=>{if(g.preventDefault(),g.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:_,y:R}=i.current;if(s===null)return;let N=$i(g.target);if(E(L)){let S=(g.clientY-R)/N;x(S)}else{let S=(g.clientX-_)/N;y(S)}f(),document.removeEventListener("mouseup",b)}};return b},[s,f,y,x]),w=ye(L=>b=>{if(b.preventDefault(),b.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");i.current={x:b.clientX,y:b.clientY},a(i.current),m(L),document.addEventListener("mouseup",h(L))},[s,h]),v=ye(()=>{if(s){let{height:L,left:b,top:g,width:_}=s.elem.getBoundingClientRect(),R=$i(s.elem),N=10,S={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${N}px`,left:`${window.pageXOffset+b}px`,top:`${window.pageYOffset+g+L-N/2}px`,width:`${_}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${L}px`,left:`${window.pageXOffset+b+_-N/2}px`,top:`${window.pageYOffset+g}px`,width:`${N}px`}},D=n.current;return u&&l&&D&&(E(u)?(S[u].left=`${window.pageXOffset+D.left}px`,S[u].top=`${window.pageYOffset+l.y/R}px`,S[u].height="3px",S[u].width=`${D.width}px`):(S[u].top=`${window.pageYOffset+D.top}px`,S[u].left=`${window.pageXOffset+l.x/R}px`,S[u].width="3px",S[u].height=`${D.height}px`),S[u].backgroundColor="#adf"),S}return{bottom:null,left:null,right:null,top:null}},[s,u,l])();return kt("div",{ref:o,children:s!=null&&!d&&Yu(Gi.Fragment,{children:[kt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:w("right"),style:v.right||void 0}),kt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:w("bottom"),style:v.bottom||void 0})]})})}var Ui=()=>{let[e]=Bu(),t=$u();return Ku(()=>t?ju(kt(Ju,{editor:e}),document.body):null,[e,t])};import{useLexicalComposerContext as rp}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as ip,$getTableRowIndexFromTableCellNode as lp,$insertTableColumn__EXPERIMENTAL as sp,$insertTableRow__EXPERIMENTAL as ap,$isTableCellNode as cp,$isTableNode as zi,TableNode as dp}from"@lexical/table";import{$findMatchingParent as up,mergeRegister as pp}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ki}from"lexical";import{useEffect as ji,useRef as Xi,useState as wt}from"react";import{createPortal as mp}from"react-dom";import{useMemo as op,useRef as np}from"react";var qu="Expected a function",Qu=Math.max,ep=Math.min;function tp(e,t,o){let n,r,i,l,a,s,c=0,d=!1,p=!1,u=!0;if(typeof e!="function")throw new TypeError(qu);t=t||0,typeof o=="object"&&(d=!!o.leading,p="maxWait"in o,i=p?Qu(o.maxWait||0,t):i,u="trailing"in o?!!o.trailing:u);function m(h){let w=n,I=r;return n=r=void 0,c=h,l=e.apply(I,w),l}function f(h){return c=h,a=setTimeout(x,t),d?m(h):l}function C(h){let w=h-s,I=h-c,v=t-w;return p?ep(v,i-I):v}function E(h){let w=h-s,I=h-c;return s===void 0||w>=t||w<0||p&&I>=i}function x(){let h=Date.now();if(E(h))return F(h);a=setTimeout(x,C(h))}function F(h){return a=void 0,u&&n?m(h):(n=r=void 0,l)}function M(){a!==void 0&&clearTimeout(a),c=0,n=s=r=a=void 0}function T(){return a===void 0?l:F(Date.now())}function y(){let h=Date.now(),w=E(h);if(n=arguments,r=this,s=h,w){if(a===void 0)return f(s);if(p)return clearTimeout(a),a=setTimeout(x,t),m(s)}return a===void 0&&(a=setTimeout(x,t)),l}return y.cancel=M,y.flush=T,y}var Wi=tp;function Vi(e,t,o){let n=np(null);return n.current=e,op(()=>Wi((...r)=>{n.current&&n.current(...r)},t,{maxWait:o}),[t,o])}import{Fragment as Cp,jsx as vo,jsxs as hp}from"react/jsx-runtime";var Zi=20;function fp({anchorElem:e}){let[t]=rp(),o=A(),[n,r]=wt(!1),[i,l]=wt(!1),[a,s]=wt(!1),[c,d]=wt({}),p=Xi(new Set),u=Xi(null),m=Vi(C=>{let{isOutside:E,tableDOMNode:x}=gp(C,o.editorConfig?.lexical);if(E){r(!1),l(!1);return}if(!x)return;u.current=x;let F=null,M=null,T=null;if(t.update(()=>{let y=Ki(x);if(cp(y)){let h=up(y,w=>zi(w));if(!zi(h))return;if(T=t.getElementByKey(h?.getKey()),T){let w=h.getChildrenSize(),I=h.getChildAtIndex(0)?.getChildrenSize(),v=lp(y),L=ip(y);v===w-1?F=y:L===I-1&&(M=y)}}}),T){let{bottom:y,height:h,right:w,width:I,x:v,y:L}=T.getBoundingClientRect(),{left:b,y:g}=e.getBoundingClientRect();F?(l(!1),r(!0),d({height:Zi,left:v-b,top:y-g+5,width:I})):M&&(l(!0),r(!1),d({height:h,left:w-b+5,top:L-g,width:Zi}))}},50,250);ji(()=>{if(a)return document.addEventListener("mousemove",m),()=>{r(!1),l(!1),document.removeEventListener("mousemove",m)}},[a,m]),ji(()=>pp(t.registerMutationListener(dp,C=>{t.getEditorState().read(()=>{for(let[E,x]of C)switch(x){case"created":p.current.add(E),s(p.current.size>0);break;case"destroyed":p.current.delete(E),s(p.current.size>0);break;default:break}})},{skipInitialization:!1})),[t]);let f=C=>{t.update(()=>{u.current&&(Ki(u.current)?.selectEnd(),C?(ap(),r(!1)):(sp(),l(!1)))})};return hp(Cp,{children:[n&&vo("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>f(!0),style:{...c}}),i&&vo("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>f(!1),style:{...c}})]})}function gp(e,t){let o=e.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${t.theme.tableCell}, th.${t.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${t.theme.tableAddRows}`)||o.closest(`button.${t.theme.tableAddColumns}`)||o.closest(`div.${t.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function Ji({anchorElem:e=document.body}){return mp(vo(fp,{anchorElem:e}),e)}import{useLexicalComposerContext as bp}from"@lexical/react/LexicalComposerContext";import{TablePlugin as xp}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Tp,TableNode as Ep}from"@lexical/table";import{mergeRegister as yp}from"@lexical/utils";import{formatDrawerSlug as Np,useEditDepth as Lp,useModal as kp}from"@payloadcms/ui";import{$getSelection as wp,$isRangeSelection as Rp,COMMAND_PRIORITY_EDITOR as _p,createCommand as Sp}from"lexical";import{createContext as vp,useContext as Ip,useEffect as Fp,useMemo as Mp,useState as Pp}from"react";import*as Yi from"react";import{jsx as Io,jsxs as Dp}from"react/jsx-runtime";var Rt=Sp("OPEN_EMBED_DRAWER_COMMAND"),qi=vp({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Qi({children:e}){let[t,o]=Pp({cellEditorConfig:null,cellEditorPlugins:null});return Io(qi.Provider,{value:Mp(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:e})}var el=()=>{let[e]=bp(),t=Ip(qi),{closeModal:o,toggleModal:n}=kp(),r=Lp(),{uuid:i}=A(),l=Np({slug:"lexical-table-create-"+i,depth:r});return Fp(()=>{if(!e.hasNodes([Ep]))throw new Error("TablePlugin: TableNode is not registered on editor");return yp(e.registerCommand(Rt,()=>{let a=null;return e.getEditorState().read(()=>{let s=wp();Rp(s)&&(a=s)}),a&&n(l),!0},_p))},[t,e,n]),Dp(Yi.Fragment,{children:[Io(le,{drawerSlug:l,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:(a,s)=>{o(l),!(!s.columns||!s.rows)&&e.dispatchCommand(Tp,{columns:String(s.columns),rows:String(s.rows)})},schemaPathSuffix:"fields"}),Io(xp,{hasCellBackgroundColor:!1,hasCellMerge:!0})]})};var Bp=k({nodes:[Op,Ap,Hp],plugins:[{Component:el,position:"normal"},{Component:Ui,position:"normal"},{Component:Hi,position:"floatingAnchorElem"},{Component:Ji,position:"floatingAnchorElem"}],providers:[Qi],slashMenu:{groups:[G([{Icon:yo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(Rt,{})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:yo,key:"table",label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(Rt,{})}}])]}});import{$isNodeSelection as sm}from"lexical";import{jsx as Fo,jsxs as $p}from"react/jsx-runtime";var Mo=()=>$p("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Fo("path",{d:"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"}),Fo("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"}),Fo("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{useLexicalComposerContext as Jp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Yp,mergeRegister as qp}from"@lexical/utils";import{useConfig as Qp}from"@payloadcms/ui";import{$getPreviousSelection as em,$getSelection as tm,$isParagraphNode as ol,$isRangeSelection as om,COMMAND_PRIORITY_EDITOR as nm,createCommand as rm}from"lexical";import{useEffect as im}from"react";import{useLexicalComposerContext as Gp}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Up}from"@payloadcms/ui";import{$getNodeByKey as Wp,COMMAND_PRIORITY_EDITOR as Vp}from"lexical";import{useCallback as zp,useEffect as Kp,useState as jp}from"react";import{jsx as Po}from"react/jsx-runtime";var Xp=({editor:e,relationTo:t,replaceNodeKey:o,value:n})=>{o?e.update(()=>{let r=Wp(o);r&&r.replace(Ie({data:{fields:null,relationTo:t,value:n}}))}):e.dispatchCommand(Do,{fields:null,relationTo:t,value:n})},Zp=({enabledCollectionSlugs:e})=>{let[t]=Gp(),[o,n]=jp(null),[r,i,{closeDrawer:l,openDrawer:a}]=Up({collectionSlugs:e,uploads:!0});Kp(()=>t.registerCommand(Se,c=>(n(c?.replace?c?.replace.nodeKey:null),a(),!0),Vp),[t,a]);let s=zp(({collectionSlug:c,docID:d})=>{Xp({editor:t,relationTo:c,replaceNodeKey:o,value:d}),l()},[t,l,o]);return Po(r,{onSelect:s})},tl=e=>Po(Ye,{...e,uploads:!0,children:Po(Zp,{...e})});import{jsx as lm}from"react/jsx-runtime";var Do=rm("INSERT_UPLOAD_COMMAND"),nl=({clientProps:e})=>{let[t]=Jp(),{config:{collections:o}}=Qp();return im(()=>{if(!t.hasNodes([ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return qp(t.registerCommand(Do,n=>(t.update(()=>{let r=tm()||em();if(om(r)){let i=Ie({data:{id:n.id,fields:n.fields,relationTo:n.relationTo,value:n.value}});Yp(i);let{focus:l}=r,a=l.getNode();ol(a)&&a.getTextContentSize()===0&&a.getParent().getChildren().filter(s=>ol(s)).length>1&&a.remove()}}),!0),nm))},[t]),lm(tl,{enabledCollectionSlugs:o.map(({slug:n})=>n)})};var am=k({nodes:[ve],plugins:[{Component:nl,position:"normal"}],slashMenu:{groups:[G([{Icon:Mo,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(Se,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:Mo,isActive:({selection:e})=>{if(!sm(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Pt(t)},key:"upload",label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(Se,{replace:!1})}}])]}});import{ShimmerEffect as cm,useClientFunctions as dm,useFieldProps as um}from"@payloadcms/ui";import rl,{Suspense as pm,lazy as mm,useEffect as fm,useState as Ao}from"react";import{jsx as _t,jsxs as hm}from"react/jsx-runtime";var gm=mm(()=>import("./Field-BYB3WX7J.js").then(e=>({default:e.RichText}))),Cm=e=>{let{admin:t={},field:{richTextComponentMap:o},lexicalEditorConfig:n}=e,{schemaPath:r}=um(),i=dm(),[l,a]=Ao(!1),[s,c]=Ao([]),[d,p]=Ao(null),u=o.get("features");u=u.sort((f,C)=>f.order-C.order);let m=0;for(let f of u){let C=Array.from(o.keys()).filter(E=>E.startsWith(`lexical_internal_feature.${f.key}.lexical_internal_components.`));m+=1,m+=C.length}return fm(()=>{if(!l){let f=[],C=0;if(Object.entries(i).forEach(([E,x])=>{E.startsWith(`lexicalFeature.${r}.`)&&(E.includes(".lexical_internal_components.")||f.push(x),C++)}),C===m){c(f),a(!0);let E=qe({clientFunctions:i,schemaPath:r,unSanitizedEditorConfig:{features:f,lexical:n}});p(Me(n||Fe,E,t))}}},[t,l,i,r,u.length,s,d,n,m]),l?_t(pm,{fallback:_t(cm,{height:"35vh"}),children:d&&_t(gm,{...e,editorConfig:d})}):_t(rl.Fragment,{children:Array.isArray(u)&&u.map(f=>{let E=Array.from(o.keys()).filter(x=>x.startsWith(`lexical_internal_feature.${f.key}.lexical_internal_components.`)).map(x=>o.get(x));return hm(rl.Fragment,{children:[E?.length?E.map(x=>x):null,f.ClientFeature]},f.key)})})};function bm(...e){return e.filter(Boolean).join(" ")}var St=new WeakMap;function il(e){let t=e.changedTouches[0];return t===void 0?null:[t.clientX,t.clientY]}function vt(e,t){let o=St.get(e);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=il(l))},i=l=>{if(o===void 0)return;let{start:a}=o;if(a===null)return;let s=il(l);for(let c of n)s!==null&&c([s[0]-a[0],s[1]-a[1]],l)};e.addEventListener("touchstart",r),e.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},St.set(e,o)}return o.listeners.add(t),()=>{xm(e,t)}}function xm(e,t){let o=St.get(e);if(o===void 0)return;let{listeners:n}=o;n.delete(t),n.size===0&&(St.delete(e),e.removeEventListener("touchstart",o.handleTouchstart),e.removeEventListener("touchend",o.handleTouchend))}function Tm(e,t){return vt(e,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&t(r,n)})}function Em(e,t){return vt(e,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&t(r,n)})}function ym(e,t){return vt(e,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&t(r,n)})}function Nm(e,t){return vt(e,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&t(r,n)})}var P={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},Lm=P.IS_BOLD|P.IS_ITALIC|P.IS_STRIKETHROUGH|P.IS_UNDERLINE|P.IS_CODE|P.IS_SUBSCRIPT|P.IS_SUPERSCRIPT|P.IS_HIGHLIGHT,km="\xA0",wm=`
36
36
 
37
37
  `,ll="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",sl="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Rm=new RegExp("^[^"+sl+"]*["+ll+"]"),_m=new RegExp("^[^"+ll+"]*["+sl+"]"),Sm={bold:P.IS_BOLD,code:P.IS_CODE,highlight:P.IS_HIGHLIGHT,italic:P.IS_ITALIC,strikethrough:P.IS_STRIKETHROUGH,subscript:P.IS_SUBSCRIPT,superscript:P.IS_SUPERSCRIPT,underline:P.IS_UNDERLINE},vm={directionless:P.IS_DIRECTIONLESS,unmergeable:P.IS_UNMERGEABLE},Im={center:P.IS_ALIGN_CENTER,end:P.IS_ALIGN_END,justify:P.IS_ALIGN_JUSTIFY,left:P.IS_ALIGN_LEFT,right:P.IS_ALIGN_RIGHT,start:P.IS_ALIGN_START},Fm={[P.IS_ALIGN_CENTER]:"center",[P.IS_ALIGN_END]:"end",[P.IS_ALIGN_JUSTIFY]:"justify",[P.IS_ALIGN_LEFT]:"left",[P.IS_ALIGN_RIGHT]:"right",[P.IS_ALIGN_START]:"start"},Mm={normal:P.IS_NORMAL,segmented:P.IS_SEGMENTED,token:P.IS_TOKEN},Pm={[P.IS_NORMAL]:"normal",[P.IS_SEGMENTED]:"segmented",[P.IS_TOKEN]:"token"};export{Ae as $createAutoLinkNode,rt as $createBlockNode,q as $createLinkNode,_e as $createRelationshipNode,Ie as $createUploadNode,ee as $isAutoLinkNode,Ul as $isBlockNode,$ as $isLinkNode,Mt as $isRelationshipNode,Pt as $isUploadNode,Rl as AlignFeatureClient,Q as AutoLinkNode,J as BlockNode,Ml as BlockquoteFeatureClient,ss as BlocksFeatureClient,Rs as BoldFeatureClient,K as CAN_USE_DOM,Bc as ChecklistFeatureClient,vm as DETAIL_TYPE_TO_DETAIL,wm as DOUBLE_LINE_BREAK,Fm as ELEMENT_FORMAT_TO_TYPE,Im as ELEMENT_TYPE_TO_FORMAT,cl as ENABLE_SLASH_MENU_COMMAND,al as EditorConfigProvider,le as FieldsDrawer,ru as FixedToolbarFeatureClient,na as HeadingFeatureClient,pa as HorizontalRuleFeatureClient,Lm as IS_ALL_FORMATTING,ha as IndentFeatureClient,Is as InlineCodeFeatureClient,gu as InlineToolbarFeatureClient,Ps as ItalicFeatureClient,_m as LTR_REGEX,sd as LexicalPluginToLexicalFeatureClient,Lc as LinkFeatureClient,z as LinkNode,km as NON_BREAKING_SPACE,P as NodeFormat,jc as OrderedListFeatureClient,gd as ParagraphFeatureClient,ul as Point,Rm as RTL_REGEX,ml as Rect,Pd as RelationshipFeatureClient,Re as RelationshipNode,bl as RichTextCell,Cm as RichTextField,md as SlateToLexicalFeatureClient,Hs as StrikethroughFeatureClient,Gs as SubscriptFeatureClient,Vs as SuperscriptFeatureClient,Mm as TEXT_MODE_TO_TYPE,Sm as TEXT_TYPE_TO_FORMAT,Pm as TEXT_TYPE_TO_MODE,Z as TOGGLE_LINK_COMMAND,Bp as TableFeatureClient,Ts as TestRecorderFeatureClient,Ue as ToolbarButton,de as ToolbarDropdown,Ls as TreeViewFeatureClient,Xs as UnderlineFeatureClient,td as UnorderedListFeatureClient,am as UploadFeatureClient,ve as UploadNode,Nm as addSwipeDownListener,Tm as addSwipeLeftListener,Em as addSwipeRightListener,ym as addSwipeUpListener,Zt as createBlockNode,Gt as createClientComponent,k as createClientFeature,Fe as defaultEditorLexicalConfig,Eo as getDOMRangeRect,It as getEnabledNodes,pe as getSelectedNode,dl as isHTMLElement,pl as isPoint,bm as joinClasses,Me as sanitizeClientEditorConfig,$o as sanitizeClientFeatures,bt as setFloatingElemPosition,pt as setFloatingElemPositionForLinkEditor,G as slashMenuBasicGroupWithItems,Y as toolbarAddDropdownGroupWithItems,Yt as toolbarFeatureButtonsGroupWithItems,U as toolbarFormatGroupWithItems,V as toolbarTextDropdownGroupWithItems,A as useEditorConfigContext};
38
38
  //# sourceMappingURL=index.js.map