@payloadcms/richtext-lexical 3.64.0-internal.deef021 → 3.64.0

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.
@@ -52,7 +52,7 @@ ${e.map(Zu).join(`
52
52
  });
53
53
  });
54
54
  `},[t,e]),p=$e((_,C)=>{o(g=>{let b=e.length-1,k=e[b];if(k&&k.name===_){if(_==="type")return[...e.slice(0,b),{...k,value:k.value+C}];if(k.value===C)return[...e.slice(0,b),{...k,count:k.count+1}]}return[...g,{name:_,count:1,value:C}]})},[e,o]);On(()=>{let _=g=>{if(!r)return;let b=g.key;Yu(g)?p("selectAll",""):Pn.has(b)?p("press",g.key):[...b].length>1?p("keydown",g.key):p("type",g.key)},C=g=>{if(!r)return;let b=g.key;!Pn.has(b)&&[...b].length>1&&p("keyup",g.key)};return t.registerRootListener((g,b)=>{b!==null&&(b.removeEventListener("keydown",_),b.removeEventListener("keyup",C)),g!==null&&(g.addEventListener("keydown",_),g.addEventListener("keyup",C))})},[t,r,p]),On(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),Xo(()=>{if(e){let _=m();_!==null&&s(_),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),Xo(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:g,editorState:b})=>{if(!r)return;let k=b._selection,y=d.current,R=c.current;if(y!==k){if(g.size===0&&C.size===0&&!R){let L=zo(t._window);if(L&&(L.anchorNode==null||L.focusNode==null))return}d.current=k}c.current=!1;let M=m();M!==null&&s(M)}),[t,m,r,p]),Xo(()=>r?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,r]);let f=$e(_=>{r||(_.update(()=>{let C=Ju();C.clear();let g=Ku();C.append(Vu().append(g)),g.select()}),o([])),n(C=>!C)},[r]),h=$e(()=>{if(!r)return;let _=zo(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:C,anchorOffset:g,focusNode:b,focusOffset:k}=qu(_),y=a().getRootElement(),R;C!==null&&(R=Fn(C,y));let M;b!==null&&(M=Fn(b,y)),p("snapshot",{anchorNode:C,anchorOffset:g,anchorPath:R,focusNode:b,focusOffset:k,focusPath:M})},[p,r,a]),x=$e(()=>{zu(m())},[m]),w=$e(()=>{Xu("test.js",m())},[m]);return[Ae("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{f(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Yo("div",{className:"test-recorder-output",children:[Yo("div",{className:"test-recorder-toolbar",children:[Ae("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Ae("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{x(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Ae("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{w(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Ae("pre",{id:"test-recorder",ref:u,children:i})]}):null]}var jn=()=>{let t=Wu(3),[e]=Gu(),[o,r]=Qu(e),n;return t[0]!==o||t[1]!==r?(n=Yo(Bn.Fragment,{children:[Ae("p",{children:"HI"}),o,r,Ae("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var ed=$({plugins:[{Component:jn,position:"bottom"}]});import{c as td}from"react/compiler-runtime";import{jsx as od}from"react/jsx-runtime";import{useLexicalComposerContext as rd}from"@lexical/react/LexicalComposerContext.js";import{TreeView as nd}from"@lexical/react/LexicalTreeView.js";import"react";var Hn=()=>{let t=td(2),[e]=rd(),o;return t[0]!==e?(o=od(nd,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var ld=$({plugins:[{Component:Hn,position:"bottom"}]});import{$isTableSelection as id}from"@lexical/table";import{$isRangeSelection as sd,FORMAT_TEXT_COMMAND as ad}from"lexical";import{jsx as Un}from"react/jsx-runtime";import"react";var Wn=()=>Un("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Un("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var q=t=>({type:"buttons",items:t,key:"format",order:40});var Gn={type:"text-format",format:["bold","italic"],tag:"***"},Vn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Kn={type:"text-format",format:["bold"],tag:"**"},Jn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var zn=[q([{ChildComponent:Wn,isActive:({selection:t})=>sd(t)||id(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(ad,"bold")},order:1}])],cd=$(({featureProviderMap:t})=>{let e=[Kn,Jn];return t.get("italic")&&e.push(Vn,Gn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:zn},toolbarInline:{groups:zn}}});import{$isTableSelection as dd}from"@lexical/table";import{$isRangeSelection as md,FORMAT_TEXT_COMMAND as pd}from"lexical";import{jsx as Xn,jsxs as ud}from"react/jsx-runtime";import"react";var Zn=()=>ud("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:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Xn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Yn={type:"text-format",format:["code"],tag:"`"};var qn=[q([{ChildComponent:Zn,isActive:({selection:t})=>md(t)||dd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(pd,"code")},order:7}])],fd=$({enableFormats:["code"],markdownTransformers:[Yn],toolbarFixed:{groups:qn},toolbarInline:{groups:qn}});import{$isTableSelection as hd}from"@lexical/table";import{$isRangeSelection as gd,FORMAT_TEXT_COMMAND as xd}from"lexical";import{jsx as Qn}from"react/jsx-runtime";import"react";var el=()=>Qn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var tl={type:"text-format",format:["italic"],tag:"*"},ol={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var rl=[q([{ChildComponent:el,isActive:({selection:t})=>gd(t)||hd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(xd,"italic")},order:2}])],Cd=$({enableFormats:["italic"],markdownTransformers:[tl,ol],toolbarFixed:{groups:rl},toolbarInline:{groups:rl}});import{$isTableSelection as kd}from"@lexical/table";import{$isRangeSelection as _d,FORMAT_TEXT_COMMAND as Td}from"lexical";import{jsx as nl,jsxs as bd}from"react/jsx-runtime";import"react";var ll=()=>bd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[nl("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),nl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var il={type:"text-format",format:["strikethrough"],tag:"~~"};var sl=[q([{ChildComponent:ll,isActive:({selection:t})=>_d(t)||kd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Td,"strikethrough")},order:4}])],wd=$({enableFormats:["strikethrough"],markdownTransformers:[il],toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{$isTableSelection as Ed}from"@lexical/table";import{$isRangeSelection as Sd,FORMAT_TEXT_COMMAND as Nd}from"lexical";import{jsx as al}from"react/jsx-runtime";import"react";var cl=()=>al("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:al("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var ul=[q([{ChildComponent:cl,isActive:({selection:t})=>Sd(t)||Ed(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Nd,"subscript")},order:5}])],Ld=$({enableFormats:["subscript"],toolbarFixed:{groups:ul},toolbarInline:{groups:ul}});import{$isTableSelection as yd}from"@lexical/table";import{$isRangeSelection as Rd,FORMAT_TEXT_COMMAND as Id}from"lexical";import{jsx as dl}from"react/jsx-runtime";import"react";var ml=()=>dl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var pl=[q([{ChildComponent:ml,isActive:({selection:t})=>Rd(t)||yd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Id,"superscript")},order:6}])],vd=$({enableFormats:["superscript"],toolbarFixed:{groups:pl},toolbarInline:{groups:pl}});import{$isTableSelection as Dd}from"@lexical/table";import{$isRangeSelection as $d,FORMAT_TEXT_COMMAND as Ad}from"lexical";import{jsx as fl,jsxs as Md}from"react/jsx-runtime";import"react";var hl=()=>Md("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[fl("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),fl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var gl=[q([{ChildComponent:hl,isActive:({selection:t})=>$d(t)||Dd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Ad,"underline")},order:3}])],Od=$({enableFormats:["underline"],toolbarFixed:{groups:gl},toolbarInline:{groups:gl}});import{jsx as Qo}from"react/jsx-runtime";import{jsx as Fd}from"react/jsx-runtime";function Pd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var io=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Pd(o),r])):{};return Fd("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Bd}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as jd}from"@lexical/selection";import{$getNodeByKey as Hd,$getState as Ud,$setState as Wd,createState as Gd,TextNode as Vd}from"lexical";import{useEffect as Kd}from"react";function xl(t){let e=new Map;for(let o in t){let r=t[o],n=Gd(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function qo(t,e,o,r){t.update(()=>{jd(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);Wd(n,l.stateConfig,r)})})}function Cl({stateMap:t}){let[e]=Bd();return Kd(()=>e.registerMutationListener(Vd,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=Hd(r),i=e.getElementByKey(r);if(!l||!i)continue;let s=Object.create(null);t.forEach((d,c)=>{let u=Ud(l,d.stateConfig);if(!u){delete i.dataset[c];return}i.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(s,a)}),i.style.cssText="",Object.assign(i.style,s)}})}),[e]),null}var bl=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let i in l){let s=l[i];o.push({ChildComponent:()=>Qo(io,{css:s.css}),key:i,label:s.label,onSelect:({editor:d})=>{qo(d,e,n,i)}})}}return[{type:"dropdown",ChildComponent:()=>Qo(io,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Qo(io,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)qo(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},Jd=$(({props:t})=>{let e=xl(t.state);return{plugins:[{Component:()=>Cl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:bl(t,e)},toolbarInline:{groups:bl(t,e)}}});import{c as Yd}from"react/compiler-runtime";import{useLexicalComposerContext as qd}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Qd,$isHeadingNode as Dl,HeadingNode as Ol}from"@lexical/rich-text";import{$setBlocksType as em}from"@lexical/selection";import{$getSelection as tm,$isRangeSelection as om}from"lexical";import{useEffect as rm}from"react";import{jsx as kl}from"react/jsx-runtime";import"react";var _l=()=>kl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:kl("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Tl}from"react/jsx-runtime";import"react";var wl=()=>Tl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as El}from"react/jsx-runtime";import"react";var Sl=()=>El("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as Nl}from"react/jsx-runtime";import"react";var Ll=()=>Nl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Nl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as yl}from"react/jsx-runtime";import"react";var Rl=()=>yl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as Il}from"react/jsx-runtime";import"react";var vl=()=>Il("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Il("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as zd,$isHeadingNode as Xd,HeadingNode as Zd}from"@lexical/rich-text";var er=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Ml=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Zd],export:(n,l)=>{if(!Xd(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:er(n=>{let l="h"+n[1]?.length;return zd(l)})}};var $l=t=>{let e=tm();em(e,()=>Qd(t))},Al={h1:_l,h2:wl,h3:Sl,h4:Ll,h5:Rl,h6:vl},nm=$(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((r,n)=>({ChildComponent:Al[r],isActive:({selection:l})=>{if(!om(l))return!1;for(let i of l.getNodes()){if(Dl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(Dl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{$l(r)})},order:n+2})))];return{markdownTransformers:[Ml(e)],nodes:[Ol],plugins:[{Component:lm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Y(e.map(r=>({Icon:Al[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{$l(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),lm=t=>{let e=Yd(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[d]=qd(),c,u;return e[4]!==d||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return d.registerNodeTransform(Ol,a=>{l.includes(a.getTag())||a.setTag(s)})},u=[d,l,s],e[4]=d,e[5]=l,e[6]=s,e[7]=c,e[8]=u):(c=e[7],u=e[8]),rm(c,u),null};import{$isNodeSelection as _m}from"lexical";import{jsx as Fl}from"react/jsx-runtime";import"react";var tr=()=>Fl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Fl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Pl,jsxs as im}from"react/jsx-runtime";import"react";var Bl=()=>im("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pl("path",{d:"M5 10h10",stroke:"currentColor"}),Pl("path",{d:"M10 15V5",stroke:"currentColor"})]});var xe=t=>({type:"dropdown",ChildComponent:Bl,items:t,key:"add",order:10});import{addClassNamesToElement as sm}from"@lexical/utils";import{$applyNodeReplacement as am,createCommand as cm,DecoratorNode as um}from"lexical";var kt=cm("INSERT_HORIZONTAL_RULE_COMMAND"),bt=class extends um{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:dm,priority:0})}}static importJSON(e){return jl()}createDOM(e){let o=document.createElement("hr");return sm(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
- `}isInline(){return!1}updateDOM(){return!1}};function dm(){return{node:jl()}}function jl(){return am(new bt)}import{$applyNodeReplacement as mm}from"lexical";import"react";var Ce=class extends bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Xe()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Xe(){return mm(new Ce)}function _t(t){return t instanceof Ce}var Hl={type:"element",dependencies:[Ce],export:(t,e)=>_t(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Xe();e&&t.replace(e)}};import{c as pm}from"react/compiler-runtime";import{useLexicalComposerContext as fm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as hm}from"@lexical/utils";import{$getSelection as gm,$isRangeSelection as xm,COMMAND_PRIORITY_EDITOR as Cm}from"lexical";import{useEffect as bm}from"react";var Ul=()=>{let t=pm(3),[e]=fm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(kt,km,Cm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),bm(o,r),null};function km(t){let e=gm();if(!xm(e))return!1;if(e.focus.getNode()!==null){let r=Xe();hm(r)}return!0}var Tm=$({markdownTransformers:[Hl],nodes:[Ce],plugins:[{Component:Ul,position:"normal"}],slashMenu:{groups:[Y([{Icon:tr,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:tr,isActive:({selection:t})=>{if(!_m(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return _t(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]}});import{$findMatchingParent as ql}from"@lexical/utils";import{$isElementNode as Am,INDENT_CONTENT_COMMAND as Om,OUTDENT_CONTENT_COMMAND as Fm}from"lexical";import{jsx as so,jsxs as wm}from"react/jsx-runtime";import"react";var Wl=()=>wm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[so("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ao,jsxs as Em}from"react/jsx-runtime";import"react";var Gl=()=>Em("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ao("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Sm}from"react/jsx-runtime";import{useLexicalComposerContext as Nm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Lm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as ym,mergeRegister as Vl}from"@lexical/utils";import{$getSelection as Rm,$isElementNode as Xl,$isRangeSelection as Im,COMMAND_PRIORITY_LOW as Kl,INDENT_CONTENT_COMMAND as Jl,KEY_TAB_COMMAND as vm,OUTDENT_CONTENT_COMMAND as Mm,TabNode as Dm}from"lexical";import{useEffect as zl}from"react";var Zl=({clientProps:t})=>{let[e]=Nm(),{disabledNodes:o,disableTabNode:r}=t;return zl(()=>{if(!(!e||!o?.length))return Vl(e.registerCommand(Jl,()=>$m(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Kl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Xl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),zl(()=>{if(!(!e||!r))return Vl(e.registerCommand(vm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Mm:Jl,void 0)),Kl),e.registerNodeTransform(Dm,n=>{n.remove()}))},[e,r]),Sm(Lm,{})};function $m(t){let e=Rm();if(!Im(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=ym(l,c=>Xl(c)&&!c.isInline());if(s===null)continue;let d=s.getKey();s.canIndent()&&!o.has(d)&&(o.add(d),t(s))}return o.size>0}var Yl=t=>({type:"buttons",items:t,key:"indent",order:35});var Ql=({disabledNodes:t})=>[Yl([{ChildComponent:Wl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ei(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ql(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Fm,void 0)},order:1},{ChildComponent:Gl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ei(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ql(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Om,void 0)},order:2}])],Pm=$(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Zl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ql({disabledNodes:e})},toolbarInline:{groups:Ql({disabledNodes:e})}}}),ei=t=>Am(t)&&t.canIndent();import{$findMatchingParent as Yp}from"@lexical/utils";import{$getSelection as ur,$isRangeSelection as vi}from"lexical";import{jsx as ti}from"react/jsx-runtime";import"react";var oi=()=>ti("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ti("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as ri}from"@lexical/selection";function Ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?ri(o)?r:n:ri(e)?r:n}var or=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Xm}from"lexical";import{addClassNamesToElement as Bm,isHTMLAnchorElement as jm}from"@lexical/utils";import lr from"bson-objectid";import{$applyNodeReplacement as Hm,$createTextNode as ni,$getSelection as Um,$isElementNode as li,$isRangeSelection as nr,createCommand as Wm,ElementNode as Gm}from"lexical";var Vm=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends Gm{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Km,priority:1})}}static importJSON(e){let o=be({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new lr.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=rr(o.rel,"add","noopener")),Bm(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!nr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(li(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Vm.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=rr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=rr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Km(t){let e=null;if(jm(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new lr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return Hm(new oe({id:t??new lr.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var ce=Wm("TOGGLE_LINK_COMMAND");function ir(t){let e=Um();if(!nr(e)&&(t===null||!t.selectedNodes?.length))return;let o=nr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();K(i)&&(i.getChildren().forEach(d=>{i.insertBefore(d)}),i.remove())});return}if(o?.length===1){let l=o[0],i=K(l)?l:Jm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ni(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||li(l)&&!l.isInline())){if(K(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ni(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=be({fields:t.fields}),K(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Jm(t){return zm(t,e=>K(e))}function zm(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function rr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var ii={type:"text-match",dependencies:[oe],export:(t,e)=>{if(!K(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Xm(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Zm,$isElementNode as Ym}from"lexical";var ke=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Tt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Ym(r)){let n=Tt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Tt({fields:t}){return Zm(new ke({id:"",fields:t}))}function _e(t){return t instanceof ke}import{c as qm}from"react/compiler-runtime";import{useLexicalComposerContext as Qm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ep}from"@lexical/utils";import{$createTextNode as si,$getSelection as tp,$isElementNode as ci,$isLineBreakNode as ui,$isNodeSelection as op,$isRangeSelection as rp,$isTextNode as wt,TextNode as np}from"lexical";import{useEffect as lp}from"react";function ai(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function di(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var ip=/[.,;\s]/;function uo(t){return t!==void 0&&ip.test(t)}function mi(t){return uo(t[t.length-1])}function ar(t){return uo(t[0])}function sp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function pi(t){let e=t.getPreviousSibling();return ci(e)&&(e=e.getLastDescendant()),e===null||ui(e)||wt(e)&&mi(e.getTextContent())}function fi(t){let e=t.getNextSibling();return ci(e)&&(e=e.getFirstDescendant()),e===null||ui(e)||wt(e)&&ar(e.getTextContent())}function ap(t,e,o,r){return(t>0?uo(o[t-1]):pi(r[0]))?e<o.length?uo(o[e]):fi(r[r.length-1]):!1}function cp(t,e,o){let r=[],n=[],l=[],i=0,s=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,d.shift()}return[i,r,n,l]}function up(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Tt({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let d=si(r.text);d.setFormat(s.getFormat()),d.setDetail(s.getDetail()),d.setStyle(s.getStyle()),l.append(d),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,d;e===0?d=i:[,d]=i.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[x,w]=a.splitText(o-f);x&&c.push(x),u=w}s+=p}),d){let a=tp(),m=a?a.getNodes().find(wt):void 0,p=si(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(rp(a)?p.select(a.anchor.offset,a.focus.offset):op(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function dp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,i,s=0;for(;(i=di(l,e))!=null&&i!==null;){let d=i.index,c=i.length,u=d+c;if(ap(s+d,s+u,n,r)){let[m,,p,f]=cp(r,s+d,s+u),h=s+d-m,x=s+u-m,w=up(p,h,x,i);r=w?[w,...f]:f,o(i.url,null),s=0}else s+=u;l=l.substring(u)}}function sr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!wt(c)||!c.isSimpleText()){co(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=di(l,e);if(i===null||i.text!==l){co(t),o(null,t.getFields()?.url??null);return}if(!pi(t)||!fi(t)){co(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let d=t.getFields();d.url=i?.url,t.setFields(d),o(i.url,s??null)}}function mp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(_e(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!ar(l)||sp(l,i))&&(r.append(t),sr(r,e,o),o(null,r.getFields()?.url??null))}_e(n)&&!mi(l)&&(co(n),sr(n,e,o),o(null,n.getFields()?.url??null))}function co(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function pp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&wt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function fp(t,e,o){let r=qm(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,d)=>{o?.(s,d)};return ep(t.registerNodeTransform(np,s=>{let d=s.getParentOrThrow(),c=s.getPreviousSibling();if(_e(d))sr(d,e,i);else if(!K(d)){if(s.isSimpleText()&&(ar(s.getTextContent())||!_e(c))){let u=pp(s);dp(u,e,i)}mp(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),lp(n,l)}var hp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,gp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,xp=[ai(hp,t=>t.startsWith("http")?t:`https://${t}`),ai(gp,t=>`mailto:${t}`)],hi=()=>{let[t]=Qm();return fp(t,xp),null};import{jsx as Cp}from"react/jsx-runtime";import{ClickableLinkPlugin as bp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var gi=()=>Cp(bp,{});import{jsx as Pp}from"react/jsx-runtime";import"react";import{createPortal as Bp}from"react-dom";import{jsx as Te,jsxs as Et,Fragment as _p}from"react/jsx-runtime";import{useLexicalComposerContext as Tp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as wp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as xi,mergeRegister as Ci}from"@lexical/utils";import{getTranslation as cr}from"@payloadcms/translations";import{CloseMenuIcon as Ep,EditIcon as Sp,ExternalLinkIcon as bi,formatDrawerSlug as Np,useConfig as Lp,useEditDepth as yp,useLocale as Rp,useTranslation as Ip}from"@payloadcms/ui";import{requests as vp}from"@payloadcms/ui/shared";import{$getSelection as ki,$isLineBreakNode as Mp,$isRangeSelection as _i,COMMAND_PRIORITY_HIGH as Dp,COMMAND_PRIORITY_LOW as Ti,getDOMSelection as $p,KEY_ESCAPE_COMMAND as Ap,SELECTION_CHANGE_COMMAND as Op}from"lexical";import wi,{useCallback as Ei,useEffect as fo,useRef as Fp,useState as Oe}from"react";function mo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),d=l.getBoundingClientRect(),c=t.top-r,u=t.left-n;c<d.top&&(c+=i.height+t.height+r*2),u+i.width>d.right&&(u=d.right-i.width-n),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as kp}from"lexical";var po=kp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Si(t){t.preventDefault()}function Ni({anchorElem:t}){let[e]=Tp(),[o,r]=Oe(),n=Fp(null),[l,i]=Oe(null),[s,d]=Oe(null),{fieldProps:{schemaPath:c},uuid:u}=H(),a=wp(),{config:m,getEntityConfig:p}=Lp(),{i18n:f,t:h}=Ip(),[x,w]=Oe(),E=yp(),[N,_]=Oe(!1),[C,g]=Oe([]),b=Rp(),[k,y]=Oe(!1),R=Np({slug:"lexical-rich-text-link-"+u,depth:E}),{toggleDrawer:M}=fe(R),L=Ei(()=>{_(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),y(!1),i(null),d(null),g([]),w(void 0)},[_,i,d,g]),T=Ei(()=>{let S=ki(),I;if(!_i(S)||!S){L();return}let A=Ze(S);I=e.getElementByKey(A.getKey())?.getBoundingClientRect();let v=xi(A,K),O=S.getNodes().filter(z=>!Mp(z)).find(z=>{let U=xi(z,K);return v&&!v.is(U)||U&&!U.is(v)});if(v==null||O){L();return}r(v);let D=v.getFields(),G={...D,id:v.getID(),text:v.getTextContent()};if(D?.linkType==="custom")i(D?.url??null),d(null);else{i(`${m.routes.admin==="/"?"":m.routes.admin}/collections/${D?.doc?.relationTo}/${D?.doc?.value}`);let z=D?.doc?.relationTo?p({collectionSlug:D?.doc?.relationTo}):void 0;if(!z)d(D?.label?String(D?.label):null),i(D?.url?String(D?.url):null);else{let U=typeof D.doc?.value=="object"?D.doc.value.id:D.doc?.value,Ue=D.doc?.relationTo;if(!U||!Ue)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Ne=h("fields:linkedTo",{label:`${cr(z.labels.singular,f)} - ${h("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(Ne),vp.get(`${m.serverURL}${m.routes.api}/${Ue}/${U}`,{headers:{"Accept-Language":f.language},params:{depth:0,locale:b?.code}}).then(async pe=>{if(!pe.ok)throw new Error(`HTTP error! Status: ${pe.status}`);let jt=await pe.json(),Le=z?.admin?.useAsTitle||"id",Ht=jt[Le],We=h("fields:linkedTo",{label:`${cr(z.labels.singular,f)} - ${Ht}`}).replace(/<[^>]*>?/g,"");d(We)}).catch(()=>{let pe=h("fields:linkedTo",{label:`${cr(z.labels.singular,f)} - ${h("general:untitled",f)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");d(pe)})}}w(G),_(!0),g(S?S?.getNodes():[]),_e(v)?y(!0):y(!1);let Q=n.current,J=$p(e._window),{activeElement:Pt}=document;if(Q===null)return;let Bt=e.getRootElement();return J!==null&&Bt!==null&&Bt.contains(J.anchorNode)?(I||(I=J.getRangeAt(0).getBoundingClientRect()),I!=null&&(I.y+=40,mo(I,Q,t))):(Pt==null||Pt.className!=="link-input")&&(Bt!==null&&mo(null,Q,t),i(null),d(null)),!0},[e,L,m.routes.admin,m.routes.api,m.serverURL,p,h,f,b?.code,t]);return fo(()=>Ci(e.registerCommand(po,S=>(e.dispatchCommand(ce,S),T(),M(),!0),Ti)),[e,T,M,R]),fo(()=>{let S=t.parentElement,I=()=>{e.getEditorState().read(()=>{T()})};return window.addEventListener("resize",I),S?.addEventListener("scroll",I),()=>{window.removeEventListener("resize",I),S?.removeEventListener("scroll",I)}},[t.parentElement,e,T]),fo(()=>Ci(e.registerUpdateListener(({editorState:S})=>{S.read(()=>{T()})}),e.registerCommand(Op,()=>(T(),!0),Ti),e.registerCommand(Ap,()=>N?(L(),!0):!1,Dp)),[e,T,N,L]),fo(()=>{e.getEditorState().read(()=>{T()})},[e,T]),Et(wi.Fragment,{children:[Te("div",{className:"link-editor",ref:n,children:Et("div",{className:"link-input",children:[l&&l.length>0?Et("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Te(bi,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Et(_p,{children:[o?.__fields.newTab?Te(bi,{}):null,Te("span",{className:"link-input__label-pure",children:s})]}):null,a&&Et(wi.Fragment,{children:[Te("button",{"aria-label":"Edit link",className:"link-edit",onClick:S=>{S.preventDefault(),M()},onMouseDown:Si,tabIndex:0,type:"button",children:Te(Sp,{})}),!k&&Te("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ce,null)},onMouseDown:Si,tabIndex:0,type:"button",children:Te(Ep,{})})]})]})}),Te(mt,{className:"lexical-link-edit-drawer",data:x,drawerSlug:R,drawerTitle:h("fields:editLink"),featureKey:"link",handleDrawerSubmit:(S,I)=>{let A=I,v={...A};delete v.text,e.update(()=>{let O=ki(),D=null;if(_i(O)?D=Ze(O).getParent():C.length&&(D=C[0]?.getParent()??null),D&&_e(D)){let G=be({fields:v});D.replace(G,!0)}}),e.dispatchCommand(ce,{fields:v,selectedNodes:C,text:A.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Li=t=>{let{anchorElem:e=document.body}=t;return Bp(Pp(Ni,{anchorElem:e}),e)};import{c as Up}from"react/compiler-runtime";import{useLexicalComposerContext as Wp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Gp}from"@lexical/utils";import{$getSelection as Vp,$isElementNode as Kp,$isRangeSelection as Jp,COMMAND_PRIORITY_LOW as Ri,PASTE_COMMAND as zp}from"lexical";import{useEffect as Xp}from"react";var jp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Hp=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function yi(t){if(!t)return!1;if(t==="https://"||jp.test(t)||Hp.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ii=t=>{let e=Up(5),{clientProps:o}=t,[r]=Wp(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Gp(r.registerCommand(ce,i=>i===null?(ir(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),ir(i),!0),Ri),r.registerCommand(zp,i=>{let s=Vp();if(!Jp(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let d=i.clipboardData.getData("text");if(!yi(d))return!1;if(!s.getNodes().some(Zp)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ce,{fields:c,text:null}),i.preventDefault(),!0}return!1},Ri))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Xp(n,l),null};function Zp(t){return Kp(t)}var Mi=[or([{ChildComponent:oi,isActive:({selection:t})=>{if(vi(t)){let e=Ze(t);return Yp(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(vi(t)&&ur()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ce,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=ur()?.getTextContent(),r=ur()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(po,{fields:n,selectedNodes:r,text:o})}},order:1}])],qp=$(({props:t})=>({markdownTransformers:[ii],nodes:[oe,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:Ii,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:hi,position:"normal"},{Component:gi,position:"normal"},{Component:Li,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Mi},toolbarInline:{groups:Mi}}));import{$isListNode as pr,INSERT_CHECK_LIST_COMMAND as Pi,ListItemNode as df,ListNode as mf}from"@lexical/list";import{$isRangeSelection as pf}from"lexical";import{jsx as Di,jsxs as Qp}from"react/jsx-runtime";import"react";var dr=()=>Qp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Di("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Di("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as ef}from"react/jsx-runtime";import{ListPlugin as tf}from"@lexical/react/LexicalListPlugin.js";import"react";var Ye=()=>ef(tf,{});function ho(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function qe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as lf,ListItemNode as sf,ListNode as af}from"@lexical/list";import{$createListItemNode as of,$createListNode as rf,$isListItemNode as nf,$isListNode as mr}from"@lexical/list";var $i=4,Qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=of(t==="check"?r[3]==="x":void 0);if(mr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(i):l.append(i),e.remove()}else if(mr(n)&&n.getListType()===t)n.append(i),e.remove();else{let d=rf(t,t==="number"?Number(r[2]):void 0);d.append(i),e.replace(d)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/$i);s&&i.setIndent(s)},Fe=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(nf(i)){if(i.getChildrenSize()===1){let u=i.getFirstChild();if(mr(u)){r.push(Fe(u,e,o+1));continue}}let s=" ".repeat(o*$i),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function dm(){return{node:jl()}}function jl(){return am(new bt)}import{$applyNodeReplacement as mm}from"lexical";import"react";var Ce=class extends bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Xe()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Xe(){return mm(new Ce)}function _t(t){return t instanceof Ce}var Hl={type:"element",dependencies:[Ce],export:(t,e)=>_t(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Xe();e&&t.replace(e)}};import{c as pm}from"react/compiler-runtime";import{useLexicalComposerContext as fm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as hm}from"@lexical/utils";import{$getSelection as gm,$isRangeSelection as xm,COMMAND_PRIORITY_EDITOR as Cm}from"lexical";import{useEffect as bm}from"react";var Ul=()=>{let t=pm(3),[e]=fm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(kt,km,Cm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),bm(o,r),null};function km(t){let e=gm();if(!xm(e))return!1;if(e.focus.getNode()!==null){let r=Xe();hm(r)}return!0}var Tm=$({markdownTransformers:[Hl],nodes:[Ce],plugins:[{Component:Ul,position:"normal"}],slashMenu:{groups:[Y([{Icon:tr,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:tr,isActive:({selection:t})=>{if(!_m(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return _t(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]}});import{$findMatchingParent as ql}from"@lexical/utils";import{$isElementNode as Am,INDENT_CONTENT_COMMAND as Om,OUTDENT_CONTENT_COMMAND as Fm}from"lexical";import{jsx as so,jsxs as wm}from"react/jsx-runtime";import"react";var Wl=()=>wm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[so("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ao,jsxs as Em}from"react/jsx-runtime";import"react";var Gl=()=>Em("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ao("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Sm}from"react/jsx-runtime";import{useLexicalComposerContext as Nm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Lm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as ym,mergeRegister as Vl}from"@lexical/utils";import{$getSelection as Rm,$isElementNode as Xl,$isRangeSelection as Im,COMMAND_PRIORITY_LOW as Kl,INDENT_CONTENT_COMMAND as Jl,KEY_TAB_COMMAND as vm,OUTDENT_CONTENT_COMMAND as Mm,TabNode as Dm}from"lexical";import{useEffect as zl}from"react";var Zl=({clientProps:t})=>{let[e]=Nm(),{disabledNodes:o,disableTabNode:r}=t;return zl(()=>{if(!(!e||!o?.length))return Vl(e.registerCommand(Jl,()=>$m(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Kl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Xl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),zl(()=>{if(!(!e||!r))return Vl(e.registerCommand(vm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Mm:Jl,void 0)),Kl),e.registerNodeTransform(Dm,n=>{n.remove()}))},[e,r]),Sm(Lm,{})};function $m(t){let e=Rm();if(!Im(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=ym(l,c=>Xl(c)&&!c.isInline());if(s===null)continue;let d=s.getKey();s.canIndent()&&!o.has(d)&&(o.add(d),t(s))}return o.size>0}var Yl=t=>({type:"buttons",items:t,key:"indent",order:35});var Ql=({disabledNodes:t})=>[Yl([{ChildComponent:Wl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ei(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ql(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Fm,void 0)},order:1},{ChildComponent:Gl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ei(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ql(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Om,void 0)},order:2}])],Pm=$(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Zl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ql({disabledNodes:e})},toolbarInline:{groups:Ql({disabledNodes:e})}}}),ei=t=>Am(t)&&t.canIndent();import{$findMatchingParent as Yp}from"@lexical/utils";import{$getSelection as ur,$isRangeSelection as vi}from"lexical";import{jsx as ti}from"react/jsx-runtime";import"react";var oi=()=>ti("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ti("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as ri}from"@lexical/selection";function Ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?ri(o)?r:n:ri(e)?r:n}var or=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Xm}from"lexical";import{addClassNamesToElement as Bm,isHTMLAnchorElement as jm}from"@lexical/utils";import lr from"bson-objectid";import{$applyNodeReplacement as Hm,$createTextNode as ni,$getSelection as Um,$isElementNode as li,$isRangeSelection as nr,createCommand as Wm,ElementNode as Gm}from"lexical";var Vm=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends Gm{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Km,priority:1})}}static importJSON(e){let o=be({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new lr.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=rr(o.rel,"add","noopener")),Bm(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!nr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(li(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Vm.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=rr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=rr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Km(t){let e=null;if(jm(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new lr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return Hm(new oe({id:t??new lr.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var ce=Wm("TOGGLE_LINK_COMMAND");function ir(t){let e=Um();if(!nr(e)&&(t===null||!t.selectedNodes?.length))return;let o=nr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();K(i)&&(i.getChildren().forEach(d=>{i.insertBefore(d)}),i.remove())});return}if(o?.length===1){let l=o[0],i=K(l)?l:Jm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ni(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||li(l)&&!l.isInline())){if(K(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ni(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=be({fields:t.fields}),K(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Jm(t){return zm(t,e=>K(e))}function zm(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function rr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var ii={type:"text-match",dependencies:[oe],export:(t,e)=>{if(!K(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Xm(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Zm,$isElementNode as Ym}from"lexical";var ke=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Tt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Ym(r)){let n=Tt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Tt({fields:t}){return Zm(new ke({id:"",fields:t}))}function _e(t){return t instanceof ke}import{c as qm}from"react/compiler-runtime";import{useLexicalComposerContext as Qm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ep}from"@lexical/utils";import{$createTextNode as si,$getSelection as tp,$isElementNode as ci,$isLineBreakNode as ui,$isNodeSelection as op,$isRangeSelection as rp,$isTextNode as wt,TextNode as np}from"lexical";import{useEffect as lp}from"react";function ai(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function di(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var ip=/[.,;\s]/;function uo(t){return t!==void 0&&ip.test(t)}function mi(t){return uo(t[t.length-1])}function ar(t){return uo(t[0])}function sp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function pi(t){let e=t.getPreviousSibling();return ci(e)&&(e=e.getLastDescendant()),e===null||ui(e)||wt(e)&&mi(e.getTextContent())}function fi(t){let e=t.getNextSibling();return ci(e)&&(e=e.getFirstDescendant()),e===null||ui(e)||wt(e)&&ar(e.getTextContent())}function ap(t,e,o,r){return(t>0?uo(o[t-1]):pi(r[0]))?e<o.length?uo(o[e]):fi(r[r.length-1]):!1}function cp(t,e,o){let r=[],n=[],l=[],i=0,s=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,d.shift()}return[i,r,n,l]}function up(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Tt({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let d=si(r.text);d.setFormat(s.getFormat()),d.setDetail(s.getDetail()),d.setStyle(s.getStyle()),l.append(d),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,d;e===0?d=i:[,d]=i.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[x,w]=a.splitText(o-f);x&&c.push(x),u=w}s+=p}),d){let a=tp(),m=a?a.getNodes().find(wt):void 0,p=si(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(rp(a)?p.select(a.anchor.offset,a.focus.offset):op(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function dp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,i,s=0;for(;(i=di(l,e))!=null&&i!==null;){let d=i.index,c=i.length,u=d+c;if(ap(s+d,s+u,n,r)){let[m,,p,f]=cp(r,s+d,s+u),h=s+d-m,x=s+u-m,w=up(p,h,x,i);r=w?[w,...f]:f,o(i.url,null),s=0}else s+=u;l=l.substring(u)}}function sr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!wt(c)||!c.isSimpleText()){co(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=di(l,e);if(i===null||i.text!==l){co(t),o(null,t.getFields()?.url??null);return}if(!pi(t)||!fi(t)){co(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let d=t.getFields();d.url=i?.url,t.setFields(d),o(i.url,s??null)}}function mp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(_e(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!ar(l)||sp(l,i))&&(r.append(t),sr(r,e,o),o(null,r.getFields()?.url??null))}_e(n)&&!mi(l)&&(co(n),sr(n,e,o),o(null,n.getFields()?.url??null))}function co(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function pp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&wt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function fp(t,e,o){let r=qm(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,d)=>{o?.(s,d)};return ep(t.registerNodeTransform(np,s=>{let d=s.getParentOrThrow(),c=s.getPreviousSibling();if(_e(d))sr(d,e,i);else if(!K(d)){if(s.isSimpleText()&&(ar(s.getTextContent())||!_e(c))){let u=pp(s);dp(u,e,i)}mp(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),lp(n,l)}var hp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,gp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,xp=[ai(hp,t=>t.startsWith("http")?t:`https://${t}`),ai(gp,t=>`mailto:${t}`)],hi=()=>{let[t]=Qm();return fp(t,xp),null};import{jsx as Cp}from"react/jsx-runtime";import{ClickableLinkPlugin as bp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var gi=()=>Cp(bp,{});import{jsx as Pp}from"react/jsx-runtime";import"react";import{createPortal as Bp}from"react-dom";import{jsx as Te,jsxs as Et,Fragment as _p}from"react/jsx-runtime";import{useLexicalComposerContext as Tp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as wp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as xi,mergeRegister as Ci}from"@lexical/utils";import{getTranslation as cr}from"@payloadcms/translations";import{CloseMenuIcon as Ep,EditIcon as Sp,ExternalLinkIcon as bi,formatDrawerSlug as Np,useConfig as Lp,useEditDepth as yp,useLocale as Rp,useTranslation as Ip}from"@payloadcms/ui";import{requests as vp}from"@payloadcms/ui/shared";import{$getSelection as ki,$isLineBreakNode as Mp,$isRangeSelection as _i,COMMAND_PRIORITY_HIGH as Dp,COMMAND_PRIORITY_LOW as Ti,getDOMSelection as $p,KEY_ESCAPE_COMMAND as Ap,SELECTION_CHANGE_COMMAND as Op}from"lexical";import wi,{useCallback as Ei,useEffect as fo,useRef as Fp,useState as Oe}from"react";function mo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),d=l.getBoundingClientRect(),c=t.top-r,u=t.left-n;c<d.top&&(c+=i.height+t.height+r*2),u+i.width>d.right&&(u=d.right-i.width-n),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as kp}from"lexical";var po=kp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Si(t){t.preventDefault()}function Ni({anchorElem:t}){let[e]=Tp(),[o,r]=Oe(),n=Fp(null),[l,i]=Oe(null),[s,d]=Oe(null),{fieldProps:{schemaPath:c},uuid:u}=H(),a=wp(),{config:m,getEntityConfig:p}=Lp(),{i18n:f,t:h}=Ip(),[x,w]=Oe(),E=yp(),[N,_]=Oe(!1),[C,g]=Oe([]),b=Rp(),[k,y]=Oe(!1),R=Np({slug:"lexical-rich-text-link-"+u,depth:E}),{toggleDrawer:M}=fe(R),L=Ei(()=>{_(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),y(!1),i(null),d(null),g([]),w(void 0)},[_,i,d,g]),T=Ei(()=>{let S=ki(),I;if(!_i(S)||!S){L();return}let A=Ze(S);I=e.getElementByKey(A.getKey())?.getBoundingClientRect();let v=xi(A,K),O=S.getNodes().filter(z=>!Mp(z)).find(z=>{let U=xi(z,K);return v&&!v.is(U)||U&&!U.is(v)});if(v==null||O){L();return}r(v);let D=v.getFields(),G={...D,id:v.getID(),text:v.getTextContent()};if(D?.linkType==="custom")i(D?.url??null),d(null);else{i(`${m.routes.admin==="/"?"":m.routes.admin}/collections/${D?.doc?.relationTo}/${D?.doc?.value}`);let z=D?.doc?.relationTo?p({collectionSlug:D?.doc?.relationTo}):void 0;if(!z)d(D?.label?String(D?.label):null),i(D?.url?String(D?.url):null);else{let U=typeof D.doc?.value=="object"?D.doc.value.id:D.doc?.value,Ue=D.doc?.relationTo;if(!U||!Ue)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Ne=h("fields:linkedTo",{label:`${cr(z.labels.singular,f)} - ${h("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(Ne),vp.get(`${m.serverURL}${m.routes.api}/${Ue}/${U}`,{headers:{"Accept-Language":f.language},params:{depth:0,locale:b?.code}}).then(async pe=>{if(!pe.ok)throw new Error(`HTTP error! Status: ${pe.status}`);let jt=await pe.json(),Le=z?.admin?.useAsTitle||"id",Ht=jt[Le],We=h("fields:linkedTo",{label:`${cr(z.labels.singular,f)} - ${Ht}`}).replace(/<[^>]*>?/g,"");d(We)}).catch(()=>{let pe=h("fields:linkedTo",{label:`${cr(z.labels.singular,f)} - ${h("general:untitled",f)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");d(pe)})}}w(G),_(!0),g(S?S?.getNodes():[]),_e(v)?y(!0):y(!1);let Q=n.current,J=$p(e._window),{activeElement:Pt}=document;if(Q===null)return;let Bt=e.getRootElement();return J!==null&&Bt!==null&&Bt.contains(J.anchorNode)?(I||(I=J.getRangeAt(0).getBoundingClientRect()),I!=null&&(I.y+=40,mo(I,Q,t))):(Pt==null||Pt.className!=="link-input")&&(Bt!==null&&mo(null,Q,t),i(null),d(null)),!0},[e,L,m.routes.admin,m.routes.api,m.serverURL,p,h,f,b?.code,t]);return fo(()=>Ci(e.registerCommand(po,S=>(e.dispatchCommand(ce,S),T(),M(),!0),Ti)),[e,T,M,R]),fo(()=>{let S=t.parentElement,I=()=>{e.getEditorState().read(()=>{T()})};return window.addEventListener("resize",I),S?.addEventListener("scroll",I),()=>{window.removeEventListener("resize",I),S?.removeEventListener("scroll",I)}},[t.parentElement,e,T]),fo(()=>Ci(e.registerUpdateListener(({editorState:S})=>{S.read(()=>{T()})}),e.registerCommand(Op,()=>(T(),!0),Ti),e.registerCommand(Ap,()=>N?(L(),!0):!1,Dp)),[e,T,N,L]),fo(()=>{e.getEditorState().read(()=>{T()})},[e,T]),Et(wi.Fragment,{children:[Te("div",{className:"link-editor",ref:n,children:Et("div",{className:"link-input",children:[l&&l.length>0?Et("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Te(bi,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Et(_p,{children:[o?.__fields.newTab?Te(bi,{}):null,Te("span",{className:"link-input__label-pure",children:s})]}):null,a&&Et(wi.Fragment,{children:[Te("button",{"aria-label":"Edit link",className:"link-edit",onClick:S=>{S.preventDefault(),M()},onMouseDown:Si,tabIndex:0,type:"button",children:Te(Sp,{})}),!k&&Te("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ce,null)},onMouseDown:Si,tabIndex:0,type:"button",children:Te(Ep,{})})]})]})}),Te(mt,{className:"lexical-link-edit-drawer",data:x,drawerSlug:R,drawerTitle:h("fields:editLink"),featureKey:"link",handleDrawerSubmit:(S,I)=>{let A=I,v={...A};delete v.text,e.update(()=>{let O=ki(),D=null;if(_i(O)?D=Ze(O).getParent():C.length&&(D=C[0]?.getParent()??null),D&&_e(D)){let G=be({fields:v});D.replace(G,!0)}}),e.dispatchCommand(ce,{fields:v,selectedNodes:C,text:A.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Li=t=>{let{anchorElem:e=document.body}=t;return Bp(Pp(Ni,{anchorElem:e}),e)};import{c as Up}from"react/compiler-runtime";import{useLexicalComposerContext as Wp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Gp}from"@lexical/utils";import{$getSelection as Vp,$isElementNode as Kp,$isRangeSelection as Jp,COMMAND_PRIORITY_LOW as Ri,PASTE_COMMAND as zp}from"lexical";import{useEffect as Xp}from"react";var jp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Hp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function yi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||jp.test(t)||Hp.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}var Ii=t=>{let e=Up(5),{clientProps:o}=t,[r]=Wp(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Gp(r.registerCommand(ce,i=>i===null?(ir(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),ir(i),!0),Ri),r.registerCommand(zp,i=>{let s=Vp();if(!Jp(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let d=i.clipboardData.getData("text");if(!yi(d))return!1;if(!s.getNodes().some(Zp)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ce,{fields:c,text:null}),i.preventDefault(),!0}return!1},Ri))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Xp(n,l),null};function Zp(t){return Kp(t)}var Mi=[or([{ChildComponent:oi,isActive:({selection:t})=>{if(vi(t)){let e=Ze(t);return Yp(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(vi(t)&&ur()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ce,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=ur()?.getTextContent(),r=ur()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(po,{fields:n,selectedNodes:r,text:o})}},order:1}])],qp=$(({props:t})=>({markdownTransformers:[ii],nodes:[oe,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:Ii,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:hi,position:"normal"},{Component:gi,position:"normal"},{Component:Li,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Mi},toolbarInline:{groups:Mi}}));import{$isListNode as pr,INSERT_CHECK_LIST_COMMAND as Pi,ListItemNode as df,ListNode as mf}from"@lexical/list";import{$isRangeSelection as pf}from"lexical";import{jsx as Di,jsxs as Qp}from"react/jsx-runtime";import"react";var dr=()=>Qp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Di("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Di("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as ef}from"react/jsx-runtime";import{ListPlugin as tf}from"@lexical/react/LexicalListPlugin.js";import"react";var Ye=()=>ef(tf,{});function ho(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function qe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as lf,ListItemNode as sf,ListNode as af}from"@lexical/list";import{$createListItemNode as of,$createListNode as rf,$isListItemNode as nf,$isListNode as mr}from"@lexical/list";var $i=4,Qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=of(t==="check"?r[3]==="x":void 0);if(mr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(i):l.append(i),e.remove()}else if(mr(n)&&n.getListType()===t)n.append(i),e.remove();else{let d=rf(t,t==="number"?Number(r[2]):void 0);d.append(i),e.replace(d)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/$i);s&&i.setIndent(s)},Fe=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(nf(i)){if(i.getChildrenSize()===1){let u=i.getFirstChild();if(mr(u)){r.push(Fe(u,e,o+1));continue}}let s=" ".repeat(o*$i),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
56
56
  `)};var Ai={type:"element",dependencies:[af,sf],export:(t,e)=>lf(t)?Fe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Qe("check")};import{jsx as cf}from"react/jsx-runtime";import{CheckListPlugin as uf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Oi=()=>cf(uf,{});var Fi=[te([{ChildComponent:dr,isActive:({selection:t})=>{if(!pf(t))return!1;for(let e of t.getNodes()){if(pr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(pr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(pr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Pi,void 0)},order:12}])],ff=$(({featureProviderMap:t})=>{let e=[{Component:Oi,position:"normal"}],o=ho("checklist",t);return o&&e.push({Component:Ye,position:"normal"}),{markdownTransformers:[Ai],nodes:o?[mf,df]:[],plugins:e,slashMenu:{groups:[qe([{Icon:dr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(Pi,void 0)}}])]},toolbarFixed:{groups:Fi},toolbarInline:{groups:Fi}}});import{$isListNode as hr,INSERT_ORDERED_LIST_COMMAND as Hi,ListItemNode as bf,ListNode as kf}from"@lexical/list";import{$isRangeSelection as _f}from"lexical";import{jsx as St,jsxs as hf}from"react/jsx-runtime";import"react";var fr=()=>hf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[St("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),St("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),St("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as gf,ListItemNode as xf,ListNode as Cf}from"@lexical/list";var Bi={type:"element",dependencies:[Cf,xf],export:(t,e)=>gf(t)?Fe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Qe("number")};var ji=[te([{ChildComponent:fr,isActive:({selection:t})=>{if(!_f(t))return!1;for(let e of t.getNodes()){if(hr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(hr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(hr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Hi,void 0)},order:10}])],Tf=$(({featureProviderMap:t})=>{let e=ho("ordered",t);return{markdownTransformers:[Bi],nodes:e?[kf,bf]:[],plugins:e?[{Component:Ye,position:"normal"}]:[],slashMenu:{groups:[qe([{Icon:fr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Hi,void 0)}}])]},toolbarFixed:{groups:ji},toolbarInline:{groups:ji}}});import{$isListNode as xr,INSERT_UNORDERED_LIST_COMMAND as Gi,ListItemNode as Lf,ListNode as yf}from"@lexical/list";import{$isRangeSelection as Rf}from"lexical";import{jsx as et,jsxs as wf}from"react/jsx-runtime";import"react";var gr=()=>wf("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:[et("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),et("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),et("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Ef,ListItemNode as Sf,ListNode as Nf}from"@lexical/list";var Ui={type:"element",dependencies:[Nf,Sf],export:(t,e)=>Ef(t)?Fe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Qe("bullet")};var Wi=[te([{ChildComponent:gr,isActive:({selection:t})=>{if(!Rf(t))return!1;for(let e of t.getNodes()){if(xr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(xr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(xr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)},order:11}])],If=$({markdownTransformers:[Ui],nodes:[yf,Lf],plugins:[{Component:Ye,position:"normal"}],slashMenu:{groups:[qe([{Icon:gr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)}}])]},toolbarFixed:{groups:Wi},toolbarInline:{groups:Wi}});import{jsx as vf}from"react/jsx-runtime";import{addClassNamesToElement as Mf}from"@lexical/utils";import{$applyNodeReplacement as Df,DecoratorNode as $f}from"lexical";import*as Vi from"react";var Af=Vi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Nt=class extends $f{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Of({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Mf(o,"unknownConverted"),o}decorate(){return vf(Af,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Of({data:t}){return Df(new Nt({data:t}))}var Ff=$(()=>({nodes:[Nt]}));import{jsx as Pf}from"react/jsx-runtime";import{addClassNamesToElement as Bf}from"@lexical/utils";import{$applyNodeReplacement as jf,DecoratorNode as Hf}from"lexical";import*as Ki from"react";var Uf=Ki.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Lt=class extends Hf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Wf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Bf(o,"unknownConverted"),o}decorate(){return Pf(Uf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Wf({data:t}){return jf(new Lt({data:t}))}var Gf=$(()=>({nodes:[Lt]}));import{$setBlocksType as Xi}from"@lexical/selection";import{$createParagraphNode as Zi,$getSelection as Yi,$isParagraphNode as Ji,$isRangeSelection as Vf}from"lexical";var zi=[te([{ChildComponent:pt,isActive:({selection:t})=>{if(!Vf(t))return!1;for(let e of t.getNodes())if(!Ji(e)&&!Ji(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Yi();Xi(e,()=>Zi())})},order:1}])],Kf=$({slashMenu:{groups:[Y([{Icon:pt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Yi();Xi(e,()=>Zi())})}}])]},toolbarFixed:{groups:zi},toolbarInline:{groups:zi}});import{c as p0}from"react/compiler-runtime";import{jsx as xs}from"react/jsx-runtime";import{useLexicalComposerContext as f0}from"@lexical/react/LexicalComposerContext";import{useEffect as h0,useState as g0}from"react";import{jsx as gs,Fragment as m0}from"react/jsx-runtime";import"react";import{jsx as Jf}from"react/jsx-runtime";var qi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Jf("blockquote",{children:o})}};import{jsx as zf}from"react/jsx-runtime";var Qi={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return zf(r,{children:o})}};import{jsx as Xf}from"react/jsx-runtime";var es={horizontalrule:Xf("hr",{})};import{jsx as Zf}from"react/jsx-runtime";var ts={linebreak:Zf("br",{})};import{jsx as os}from"react/jsx-runtime";var rs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return os("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),os("a",{href:i,rel:n,target:l,children:r})}});import{jsx as tt,jsxs as Yf,Fragment as qf}from"react/jsx-runtime";import{v4 as Qf}from"uuid";var ns={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return tt(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Qf();return tt("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Yf(qf,{children:[tt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),tt("label",{htmlFor:l,children:n}),tt("br",{})]})})}else return tt("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as Cr}from"react/jsx-runtime";var ls={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Cr("p",{children:o}):Cr("p",{children:Cr("br",{})})}};var is={tab:" "};import{jsx as yt}from"react/jsx-runtime";var ss={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yt("div",{className:"lexical-table-container",children:yt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:yt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return yt(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Pe}from"react/jsx-runtime";import"react";var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},e0=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,t0="\xA0",o0=`
57
57
 
58
58
  `,as="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",cs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",r0=new RegExp("^[^"+cs+"]*["+as+"]"),n0=new RegExp("^[^"+as+"]*["+cs+"]"),l0={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},i0={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},s0={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},a0={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},c0={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},u0={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};var us={text:({node:t})=>{let e=t.text;return t.format&F.IS_BOLD&&(e=Pe("strong",{children:e})),t.format&F.IS_ITALIC&&(e=Pe("em",{children:e})),t.format&F.IS_STRIKETHROUGH&&(e=Pe("span",{style:{textDecoration:"line-through"},children:e})),t.format&F.IS_UNDERLINE&&(e=Pe("span",{style:{textDecoration:"underline"},children:e})),t.format&F.IS_CODE&&(e=Pe("code",{children:e})),t.format&F.IS_SUBSCRIPT&&(e=Pe("sub",{children:e})),t.format&F.IS_SUPERSCRIPT&&(e=Pe("sup",{children:e})),e}};import{jsx as Rt}from"react/jsx-runtime";var ds={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Rt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Rt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Rt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Rt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Rt("picture",{children:n})}};var ot={...ls,...us,...ts,...qi,...ss,...Qi,...es,...ns,...rs({}),...ds,...is};import{jsx as ps,Fragment as d0}from"react/jsx-runtime";import br from"react";function ms(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function fs({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return ms(e)?hs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):ps(d0,{})}function hs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,d)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:s,nodesToJSX:p=>hs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:u=ps("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),br.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return br.cloneElement(u,{key:d,style:m})}return br.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",s),null}}).filter(Boolean)}var kr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:ot}):i=e:i=ot;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&fs({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?gs(m0,{children:s}):gs("div",{className:t??"payload-richtext",children:s})};function Cs(){let t=p0(7),[e]=f0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=g0(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),h0(l,i);let s;return t[5]!==r?(s=xs("div",{className:"debug-jsx-converter",children:xs(kr,{converters:ot,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var x0=$({plugins:[{Component:Cs,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},C0={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as i1}from"lexical";import{jsx as It,jsxs as b0}from"react/jsx-runtime";import"react";var _r=()=>b0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[It("g",{clipPath:"url(#clip0_4397_10817)",children:It("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"})}),It("defs",{children:It("clipPath",{id:"clip0_4397_10817",children:It("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as E0}from"react/jsx-runtime";import{$applyNodeReplacement as S0}from"lexical";import*as ks from"react";import{DecoratorBlockNode as k0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as _0}from"@lexical/utils";import{$applyNodeReplacement as T0}from"lexical";function w0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:bs({relationTo:o,value:e})}:null}var vt=class extends k0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:w0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=bs(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return _0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function bs(t){return T0(new vt({data:t}))}var N0=ks.lazy(()=>import("./RelationshipComponent-UCIWIEVD.js").then(t=>({default:t.RelationshipComponent})));function L0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Be({relationTo:o,value:e})}:null}var we=class extends vt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:L0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Be(o);return r.setFormat(e.format),r}decorate(e,o){return E0(N0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return S0(new we({data:t}))}function Tr(t){return t instanceof we}import{c as z0}from"react/compiler-runtime";import{jsx as X0}from"react/jsx-runtime";import{useLexicalComposerContext as Z0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Y0}from"@lexical/utils";import{$getPreviousSelection as q0,$getSelection as Q0,$isParagraphNode as e1,$isRangeSelection as t1,COMMAND_PRIORITY_EDITOR as o1,createCommand as r1}from"lexical";import{useEffect as n1}from"react";import{c as ws}from"react/compiler-runtime";import{jsx as wr}from"react/jsx-runtime";import{useLexicalComposerContext as Es}from"@lexical/react/LexicalComposerContext.js";import{toast as B0}from"@payloadcms/ui";import{$getNodeByKey as j0,COMMAND_PRIORITY_EDITOR as Ss}from"lexical";import{useEffect as Ns,useState as H0}from"react";import{c as y0}from"react/compiler-runtime";import{jsx as R0}from"react/jsx-runtime";import{useLexicalComposerContext as I0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as v0,useModal as M0}from"@payloadcms/ui";import{$getNodeByKey as _s,$getPreviousSelection as D0,$getRoot as $0,$getSelection as A0,$isRangeSelection as O0,$setSelection as F0}from"lexical";import{useEffect as P0,useState as Ts}from"react";var Mt=t=>{let e=y0(23),[o]=I0(),[r,n]=Ts(null),[l,i]=Ts(!1),[s,d,c]=v0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=M0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let R=A0()??D0();n(R)},e[0]=h):h=e[0];let x=h,w;e[1]!==o||e[2]!==r?(w=()=>{r&&o.update(()=>{if(O0(r)){let{anchor:R,focus:M}=r;_s(R.key)&&_s(M.key)&&F0(r.clone())}else $0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=w):w=e[3];let E=w,N;e[4]!==u?(N=()=>{u()},e[4]=u,e[5]=N):N=e[5];let _=N,C,g;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(C=()=>{if(!l)return;let R=f[a];R&&!R?.isOpen&&(i(!1),setTimeout(()=>{E()},1))},g=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=C,e[11]=g):(C=e[10],g=e[11]),P0(C,g);let b;e[12]!==d?(b=R=>R0(d,{...R,onClick:()=>{x()}}),e[12]=d,e[13]=b):b=e[13];let k;e[14]!==p?(k=()=>{x(),p(),i(!0)},e[14]=p,e[15]=k):k=e[15];let y;return e[16]!==s||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==b||e[21]!==k?(y={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:b,openListDrawer:k},e[16]=s,e[17]=_,e[18]=m,e[19]=a,e[20]=b,e[21]=k,e[22]=y):y=e[22],y};var U0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=j0(o);n&&n.replace(Be({relationTo:e,value:r}))}):t.dispatchCommand(Er,{relationTo:e,value:r})},W0=t=>{let e=ws(14),{enabledCollectionSlugs:o}=t,[r]=Es(),[n,l]=H0(null),i=o?.[0],s;e[0]!==o||e[1]!==i?(s={collectionSlugs:o,selectedCollection:i},e[0]=o,e[1]=i,e[2]=s):s=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Mt(s),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Ve,x=>(l(x?.replace?x?.replace.nodeKey:null),u(),!0),Ss),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Ns(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=x=>{let{collectionSlug:w,doc:E}=x;U0({editor:r,relationTo:w,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let f=p,h;return e[11]!==c||e[12]!==f?(h=wr(c,{onSelect:f}),e[11]=c,e[12]=f,e[13]=h):h=e[13],h},G0=()=>{let t=ws(3),[e]=Es(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ve,V0,Ss),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ns(o,r),null},Ls=({enabledCollectionSlugs:t})=>t?.length?wr(W0,{enabledCollectionSlugs:t}):wr(G0,{});function V0(){return B0.error("No relationship collections enabled"),!0}import{useConfig as K0,useEntityVisibility as J0}from"@payloadcms/ui";import*as ys from"react";var go=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=K0(),{visibleEntities:l}=J0();return ys.useMemo(()=>{let s=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:f}=a;if(l?.collections.includes(m)){if(r){if(!p||!f)continue}else if(f||!p)continue;c&&!c.has(m)||u&&u.has(m)||(s.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:s}},[n,l,r,o,e])};var Er=r1("INSERT_RELATIONSHIP_COMMAND"),Rs=t=>{let e=z0(8),{clientProps:o}=t,[r]=Z0(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=go(i),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Er,l1,o1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),n1(d,c);let u;return e[6]!==s?(u=X0(Ls,{enabledCollectionSlugs:s}),e[6]=s,e[7]=u):u=e[7],u};function l1(t){let e=Q0()||q0();if(t1(e)){let o=Be(t),{focus:r}=e,n=r.getNode();Y0(o),e1(n)&&!n.__first&&n.remove()}return!0}var s1=$({nodes:[we],plugins:[{Component:Rs,position:"normal"}],slashMenu:{groups:[Y([{Icon:_r,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:_r,isActive:({selection:t})=>{if(!i1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Tr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]}});import{c as Ps}from"react/compiler-runtime";import{jsx as se,jsxs as $1}from"react/jsx-runtime";import{useLexicalComposerContext as A1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Bs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as O1,useThrottledEffect as F1,useTranslation as P1}from"@payloadcms/ui";import*as Ee from"react";import{useMemo as B1}from"react";import{c as a1}from"react/compiler-runtime";import{jsx as c1}from"react/jsx-runtime";import{mergeRegister as u1}from"@lexical/utils";import{$addUpdateTag as d1,$getSelection as m1}from"lexical";import{useDeferredValue as p1,useEffect as f1,useState as h1}from"react";var Is="toolbar-popup__button",Dt=t=>{let e=a1(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=h1(l),d=p1(i),c=H(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Is}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Is,u,a,m].filter(Boolean),e[1]=u,e[2]=a,e[3]=m,e[4]=p):p=e[4];let f=p.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let k=m1();if(!k)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:k}):!1,R=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:k}):!0;s(M=>M.active===y&&M.enabled===R?M:{active:y,enabled:R})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,w=Vt(),E,N;e[9]!==r||e[10]!==w||e[11]!==x?(E=()=>{w(x);let k=()=>w(x),y=u1(r.registerUpdateListener(k));return document.addEventListener("mouseup",k),()=>{y(),document.removeEventListener("mouseup",k)}},N=[r,w,x],e[9]=r,e[10]=w,e[11]=x,e[12]=E,e[13]=N):(E=e[12],N=e[13]),f1(E,N);let _;e[14]!==i||e[15]!==r||e[16]!==n?(_=()=>{i.enabled&&r.focus(()=>{r.update(g1),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=_):_=e[17];let C=_,g=x1,b;return e[18]!==o||e[19]!==f||e[20]!==C||e[21]!==n.key?(b=c1("button",{className:f,"data-button-key":n.key,onClick:C,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=C,e[21]=n.key,e[22]=b):b=e[22],b};function g1(){d1("toolbar")}function x1(t){t.preventDefault()}import{c as E1}from"react/compiler-runtime";import{jsx as rt}from"react/jsx-runtime";import Fs,{useCallback as S1,useDeferredValue as N1,useEffect as L1,useMemo as y1}from"react";import{mergeRegister as R1}from"@lexical/utils";import{useTranslation as I1}from"@payloadcms/ui";import{$getSelection as v1}from"lexical";import{jsx as Re,jsxs as vs}from"react/jsx-runtime";import{Button as C1}from"@payloadcms/ui";import{$addUpdateTag as b1,isDOMNode as k1}from"lexical";import xo,{useCallback as _1,useEffect as Co,useMemo as Ds,useRef as Sr,useState as Nr}from"react";import{createPortal as T1}from"react-dom";var Ms="toolbar-popup__dropdown-item",$s=xo.createContext(null);function As({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let d=Ds(()=>[Ms,r===!1?"disabled":"",t?"active":"",l?.key?`${Ms}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Sr(null),u=xo.use($s);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return Co(()=>{c?.current!=null&&a(c)},[c,a]),Re(C1,{"aria-label":s,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{b1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function w1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Nr(),[i,s]=Nr(),d=_1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=Ds(()=>({registerItem:d}),[d]);return Co(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Re($s,{value:u,children:Re("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Os({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:d}){let c=Sr(null),u=Sr(null),[a,m]=Nr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};Co(()=>{let h=u.current,x=c.current;if(a&&h!==null&&x!==null){let{left:w,top:E}=h.getBoundingClientRect(),N=window.scrollY||document.documentElement.scrollTop;x.style.top=`${E+N+h.offsetHeight+5}px`,x.style.left=`${Math.min(w-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),Co(()=>{let h=u.current;if(h!==null&&a){let x=w=>{let E=w.target;k1(E)&&(d&&c.current&&c.current.contains(E)||h.contains(E)||m(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,u,a,d]);let f=T1(Re(w1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return vs(xo.Fragment,{children:[vs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:u,type:"button",children:[l&&Re(l,{}),s&&Re("span",{className:"toolbar-popup__dropdown-label",children:s}),Re("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Re(xo.Fragment,{children:f})]})}var Lr="toolbar-popup__dropdown",M1=t=>{let e=E1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=I1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&rt(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==u){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=rt(As,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?rt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:rt("span",{className:"text",children:p})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=u,e[13]=a}else a=e[13];return a},D1=Fs.memo(M1),je=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:d})=>{let[c,u]=Fs.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=N1(c),m=H(),{items:p,key:f}=r,h=Vt(),x=S1(()=>{o.getEditorState().read(()=>{let E=v1();if(!E)return;let N=[],_=[],C=[];for(let g of p)g.isActive&&(!s||N.length<s)&&g.isActive({editor:o,editorConfigContext:m,selection:E})&&(N.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:E})&&C.push(g.key):C.push(g.key);u({activeItemKeys:N,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:E}):!0,enabledItemKeys:C}),d&&d({activeItems:_})})},[o,m,r,p,s,d]);L1(()=>(h(x),R1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let w=y1(()=>p?.length?p.map(E=>rt(D1,{active:a.activeItemKeys.includes(E.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(E.key),item:E},E.key)):null,[p,a,t,o]);return rt(Os,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[Lr,`${Lr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${Lr}-items`,...l||[]],label:i,children:w},f)};function j1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(Dt,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function H1(t){let e=Ps(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=P1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Ee.useState(void 0),[p,f]=Ee.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Ee.useEffect(h,x);let w;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==u?(w=C=>{let{activeItems:g}=C;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let b=g[0],k=b.key;b.label&&(k=typeof b.label=="function"?b.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):b.label),k.length>25&&(k=k.substring(0,25)+"..."),g.length===1?(m(k),f(()=>b.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=u,e[12]=w):w=e[12];let E=w,N=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==E||e[21]!==N?(_=$1("div",{className:N,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?se(je,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):se(je,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):null,l.type==="buttons"&&l.items.length?l.items.map(C=>se(j1,{anchorElem:o,editor:r,item:C},C.key)):null,i<n.features.toolbarFixed?.groups.length-1&&se("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=E,e[21]=N,e[22]=_):_=e[22],_}function U1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ee.useRef(null),i=Bs(),{y:s}=O1(),d=B1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return F1(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,s]),se("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:i&&se(Ee.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>se(H1,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var js=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return js(t.parentEditor)}return!1},Hs=t=>{let e=Ps(6),{clientProps:o}=t,[r]=A1(),n=H();if(!Bs())return null;let{editorConfig:i}=n,s=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==s||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=js(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=se(U1,{anchorElem:document.body,editor:s,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=s,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var W1=$({plugins:[{Component:Hs,position:"aboveContainer"}]});import{c as Gs}from"react/compiler-runtime";import{jsx as ue,jsxs as Vs}from"react/jsx-runtime";import{useLexicalComposerContext as G1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as V1}from"@lexical/react/useLexicalEditable";import{mergeRegister as Ks}from"@lexical/utils";import{$getSelection as Js,$isRangeSelection as Us,$isTextNode as K1,COMMAND_PRIORITY_LOW as J1,getDOMSelection as zs,SELECTION_CHANGE_COMMAND as z1}from"lexical";import{useCallback as ko,useEffect as $t,useRef as Ws,useState as X1}from"react";import*as _o from"react";import{createPortal as Z1}from"react-dom";function yr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function bo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=d.top-a.height-c,h=d.left-l;i==="center"&&(h=d.left+d.width/2-a.width/2);let x=0;return!e&&f<p.top&&!s&&(x=a.height+d.height+c*2,f+=x),i==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function Y1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ue(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ue(Dt,{editor:e,item:o,children:ue(o.ChildComponent,{})},o.key):null}function q1(t){let e=Gs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=H(),[s,d]=_o.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],_o.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let w=x[0];d(()=>w?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(f=Vs("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ue(je,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):ue(je,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ue(Y1,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ue("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function Q1({anchorElem:t,editor:e}){let o=Ws(null),r=Ws(null),{editorConfig:n}=H(),l=ko(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),i=ko(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),s=ko(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);$t(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let d=ko(()=>{let c=Js(),u=zs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let f=yr(u,p),h=bo({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&bo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return $t(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),$t(()=>(e.getEditorState().read(()=>{d()}),Ks(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(z1,()=>(d(),!1),J1))),[e,d]),Vs("div",{className:"inline-toolbar-popup",ref:o,children:[ue("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>ue(q1,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function eh(t,e){let o=Gs(12),[r,n]=X1(!1),l=V1(),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Js(),f=zs(t._window),h=t.getRootElement();if(f!==null&&(!Us(p)||h===null||!h.contains(f.anchorNode))){n(!1);return}if(!Us(p))return;if(p.getTextContent()!==""){let w=p.getNodes(),E=!1;for(let N of w)if(K1(N)){n(!0),E=!0;break}E||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let s=i,d,c;o[2]!==s?(d=()=>(document.addEventListener("selectionchange",s),document.addEventListener("mouseup",s),()=>{document.removeEventListener("selectionchange",s),document.removeEventListener("mouseup",s)}),c=[s],o[2]=s,o[3]=d,o[4]=c):(d=o[3],c=o[4]),$t(d,c);let u,a;if(o[5]!==t||o[6]!==s?(u=()=>Ks(t.registerUpdateListener(()=>{s()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,s],o[5]=t,o[6]=s,o[7]=u,o[8]=a):(u=o[7],a=o[8]),$t(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=Z1(ue(Q1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Xs=t=>{let{anchorElem:e}=t,[o]=G1();return eh(o,e)};var th=$({plugins:[{Component:Xs,position:"floatingAnchorElem"}]});import{TableCellNode as Gg,TableNode as Vg,TableRowNode as Kg}from"@lexical/table";import{jsx as Zs}from"react/jsx-runtime";import"react";var Rr=()=>Zs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Zs("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as oh,$createTableNode as rh,$createTableRowNode as nh,$isTableCellNode as Ys,$isTableNode as Ir,$isTableRowNode as vr,TableCellHeaderStates as To,TableCellNode as lh,TableNode as ih,TableRowNode as sh}from"@lexical/table";import{$isParagraphNode as ah,$isTextNode as ch}from"lexical";var Qs=/^\|(.+)\|\s?$/,uh=/^(\| ?:?-*:? ?)+\|\s?$/,ea=({allTransformers:t})=>({type:"element",dependencies:[ih,sh,lh],export:e=>{if(!Ir(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!vr(r))continue;let l=!1;for(let i of r.getChildren())Ys(i)&&(n.push(Gt(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===To.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`