@payloadcms/richtext-lexical 3.55.0-internal.d44d1d3 → 3.55.0-internal.f8c92b5

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.
@@ -37,5 +37,5 @@ ${e.map(jc).join(`
37
37
 
38
38
  `,Bi="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Hi="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",jp=new RegExp("^[^"+Hi+"]*["+Bi+"]"),Up=new RegExp("^[^"+Bi+"]*["+Hi+"]"),Gp={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},Wp={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},Vp={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},Kp={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},Jp={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},Xp={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var ji={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=He("strong",{children:e})),t.format&O.IS_ITALIC&&(e=He("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=He("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=He("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=He("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=He("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=He("sup",{children:e})),e}};import{jsx as St}from"react/jsx-runtime";var Ui={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 St("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return St("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(St("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(St("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),St("picture",{children:n})}};var tt={...$i,...ji,...Mi,...Ii,...Pi,...Ri,...vi,...Oi,...Ai({}),...Ui,...Fi};import{jsx as Wi,Fragment as zp}from"react/jsx-runtime";import ir from"react";function Gi(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 Vi({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Gi(e)?Ki({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Wi(zp,{})}function Ki({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,u)=>{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 d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:m=>Ki({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...s,parent:n}}),parent:n}):c:d=Wi("span",{children:"unknown node"},u);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`),ir.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return ir.cloneElement(d,{key:u,style:p})}return ir.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var sr=({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:tt}):i=e:i=tt;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Vi({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?Ji(Zp,{children:s}):Ji("div",{className:t??"payload-richtext",children:s})};function zi(){let t=Yp(7),[e]=qp(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=ef(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),Qp(l,i);let s;return t[5]!==r?(s=Xi("div",{className:"debug-jsx-converter",children:Xi(sr,{converters:tt,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var tf=y({plugins:[{Component:zi,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)"}},of={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 jf}from"lexical";import{jsx as Nt,jsxs as rf}from"react/jsx-runtime";import"react";var ar=()=>rf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Nt("g",{clipPath:"url(#clip0_4397_10817)",children:Nt("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"})}),Nt("defs",{children:Nt("clipPath",{id:"clip0_4397_10817",children:Nt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as sf}from"react/jsx-runtime";import*as Yi from"react";import{DecoratorBlockNode as nf}from"@lexical/react/LexicalDecoratorBlockNode.js";function lf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Zi({relationTo:o,value:e})}:null}var Lt=class extends nf{__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:lf,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=Zi(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Zi(t){return new Lt({data:t})}var af=Yi.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function cf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:je({relationTo:o,value:e})}:null}var Se=class extends Lt{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:cf,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=je(o);return r.setFormat(e.format),r}decorate(e,o){return sf(af,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return new Se({data:t})}function cr(t){return t instanceof Se}import{c as Lf}from"react/compiler-runtime";import{jsx as yf}from"react/jsx-runtime";import{useLexicalComposerContext as If}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Rf}from"@lexical/utils";import{useConfig as vf}from"@payloadcms/ui";import{$getPreviousSelection as Mf,$getSelection as Df,$isParagraphNode as Af,$isRangeSelection as Of,COMMAND_PRIORITY_EDITOR as $f,createCommand as Ff}from"lexical";import{useEffect as Pf}from"react";import{c as _f}from"react/compiler-runtime";import{jsx as no}from"react/jsx-runtime";import{useLexicalComposerContext as Tf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as wf,COMMAND_PRIORITY_EDITOR as Ef}from"lexical";import{useEffect as Sf,useState as es}from"react";import{c as uf}from"react/compiler-runtime";import{jsx as df}from"react/jsx-runtime";import{useLexicalComposerContext as mf}from"@lexical/react/LexicalComposerContext";import{useListDrawer as pf,useModal as ff}from"@payloadcms/ui";import{$getNodeByKey as qi,$getPreviousSelection as hf,$getRoot as gf,$getSelection as xf,$isRangeSelection as Cf,$setSelection as bf}from"lexical";import{useEffect as kf,useState as Qi}from"react";var yt=t=>{let e=uf(23),[o]=mf(),[r,n]=Qi(null),[l,i]=Qi(!1),[s,u,c]=pf(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=ff(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let F=xf()??hf();n(F)},e[0]=h):h=e[0];let g=h,_;e[1]!==o||e[2]!==r?(_=()=>{r&&o.update(()=>{if(Cf(r)){let{anchor:F,focus:I}=r;qi(F.key)&&qi(I.key)&&bf(r.clone())}else gf().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=_):_=e[3];let T=_,v;e[4]!==d?(v=()=>{d()},e[4]=d,e[5]=v):v=e[5];let b=v,k,x;e[6]!==a||e[7]!==f||e[8]!==T||e[9]!==l?(k=()=>{if(!l)return;let F=f[a];F&&!F?.isOpen&&(i(!1),setTimeout(()=>{T()},1))},x=[f,a,T,l],e[6]=a,e[7]=f,e[8]=T,e[9]=l,e[10]=k,e[11]=x):(k=e[10],x=e[11]),kf(k,x);let w;e[12]!==u?(w=F=>df(u,{...F,onClick:()=>{g()}}),e[12]=u,e[13]=w):w=e[13];let R;e[14]!==m?(R=()=>{g(),m(),i(!0)},e[14]=m,e[15]=R):R=e[15];let A;return e[16]!==s||e[17]!==b||e[18]!==p||e[19]!==a||e[20]!==w||e[21]!==R?(A={closeListDrawer:b,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:R},e[16]=s,e[17]=b,e[18]=p,e[19]=a,e[20]=w,e[21]=R,e[22]=A):A=e[22],A};var Nf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=wf(o);n&&n.replace(je({relationTo:e,value:r}))}):t.dispatchCommand(ur,{relationTo:e,value:r})},ts=t=>{let e=_f(16),{enabledCollectionSlugs:o}=t,[r]=Tf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=es(n),[i,s]=es(null),u=o||void 0,c;e[2]!==l||e[3]!==u?(c={collectionSlugs:u,selectedCollection:l},e[2]=l,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=yt(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(at,T=>(s(T?.replace?T?.replace.nodeKey:null),p(),!0),Ef),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Sf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=T=>{let{collectionSlug:v,doc:b}=T;Nf({editor:r,relationTo:v,replaceNodeKey:i,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let g=h,_;return e[13]!==a||e[14]!==g?(_=no(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=_):_=e[15],_},os=t=>(t?.enabledCollectionSlugs?.length??-1)>0?no(ts,{...t}):no(Ot,{...t,children:no(ts,{...t})});var ur=Ff("INSERT_RELATIONSHIP_COMMAND"),rs=t=>{let e=Lf(5),{clientProps:o}=t,[r]=If(),{config:n}=vf(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let c;e[0]!==o?.disabledCollections?(c=d=>{let{slug:a}=d;return!o?.disabledCollections?.includes(a)},e[0]=o?.disabledCollections,e[1]=c):c=e[1],i=l.filter(c).map(Bf)}let s,u;return e[2]!==r?(s=()=>{if(!r.hasNodes([Se]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(ur,Hf,$f)},u=[r],e[2]=r,e[3]=s,e[4]=u):(s=e[3],u=e[4]),Pf(s,u),yf(os,{enabledCollectionSlugs:i})};function Bf(t){let{slug:e}=t;return e}function Hf(t){let e=Df()||Mf();if(Of(e)){let o=je(t),{focus:r}=e,n=r.getNode();Rf(o),Af(n)&&!n.__first&&n.remove()}return!0}var Uf=y({nodes:[Se],plugins:[{Component:rs,position:"normal"}],slashMenu:{groups:[ee([{Icon:ar,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(at,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:ar,isActive:({selection:t})=>{if(!jf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return cr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(at,{replace:!1})}}])]}});import{c as ms}from"react/compiler-runtime";import{jsx as me,jsxs as h0}from"react/jsx-runtime";import{useLexicalComposerContext as g0}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as x0,useThrottledEffect as C0,useTranslation as b0}from"@payloadcms/ui";import*as Ne from"react";import{useMemo as k0}from"react";import{c as Gf}from"react/compiler-runtime";import{jsx as Wf}from"react/jsx-runtime";import{mergeRegister as Vf}from"@lexical/utils";import{$addUpdateTag as Kf,$getSelection as Jf}from"lexical";import{useDeferredValue as Xf,useEffect as zf,useState as Zf}from"react";var ns="toolbar-popup__button",It=t=>{let e=Gf(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]=Zf(l),u=Xf(i),c=j(),d=u.enabled?"":"disabled",a=u.active?"active":"",p=n.key?`${ns}-${n.key}`:"",m;e[1]!==d||e[2]!==a||e[3]!==p?(m=[ns,d,a,p].filter(Boolean),e[1]=d,e[2]=a,e[3]=p,e[4]=m):m=e[4];let f=m.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let R=Jf();if(!R)return;let A=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:R}):!1,F=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:R}):!0;s(I=>I.active===A&&I.enabled===F?I:{active:A,enabled:F})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let g=h,_=$t(),T,v;e[9]!==r||e[10]!==_||e[11]!==g?(T=()=>{_(g);let R=()=>_(g),A=Vf(r.registerUpdateListener(R));return document.addEventListener("mouseup",R),()=>{A(),document.removeEventListener("mouseup",R)}},v=[r,_,g],e[9]=r,e[10]=_,e[11]=g,e[12]=T,e[13]=v):(T=e[12],v=e[13]),zf(T,v);let b;e[14]!==i||e[15]!==r||e[16]!==n?(b=()=>{i.enabled&&r.focus(()=>{r.update(Yf),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=b):b=e[17];let k=b,x=qf,w;return e[18]!==o||e[19]!==f||e[20]!==k||e[21]!==n.key?(w=Wf("button",{className:f,"data-button-key":n.key,onClick:k,onMouseDown:x,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=k,e[21]=n.key,e[22]=w):w=e[22],w};function Yf(){Kf("toolbar")}function qf(t){t.preventDefault()}import{c as l0}from"react/compiler-runtime";import{jsx as ot}from"react/jsx-runtime";import ds,{useCallback as i0,useDeferredValue as s0,useEffect as a0,useMemo as c0}from"react";import{mergeRegister as u0}from"@lexical/utils";import{useTranslation as d0}from"@payloadcms/ui";import{$getSelection as m0}from"lexical";import{jsx as Me,jsxs as ls}from"react/jsx-runtime";import{Button as Qf}from"@payloadcms/ui";import{$addUpdateTag as e0,isDOMNode as t0}from"lexical";import lo,{useCallback as o0,useEffect as io,useMemo as ss,useRef as dr,useState as mr}from"react";import{createPortal as r0}from"react-dom";var is="toolbar-popup__dropdown-item",as=lo.createContext(null);function cs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let u=ss(()=>[is,r===!1?"disabled":"",t?"active":"",l?.key?`${is}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=dr(null),d=lo.use(as);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return io(()=>{c?.current!=null&&a(c)},[c,a]),Me(Qf,{"aria-label":s,buttonStyle:"none",className:u,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{e0("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function n0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=mr(),[i,s]=mr(),u=o0(a=>{l(p=>p!=null?[...p,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=ss(()=>({registerItem:u}),[u]);return io(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Me(as,{value:d,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function us({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:u}){let c=dr(null),d=dr(null),[a,p]=mr(!1),m=()=>{p(!1),d?.current!=null&&d.current.focus()};io(()=>{let h=d.current,g=c.current;if(a&&h!==null&&g!==null){let{left:_,top:T}=h.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;g.style.top=`${T+v+h.offsetHeight+5}px`,g.style.left=`${Math.min(_-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,d,a]),io(()=>{let h=d.current;if(h!==null&&a){let g=_=>{let T=_.target;t0(T)&&(u&&c.current&&c.current.contains(T)||h.contains(T)||p(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,d,a,u]);let f=r0(Me(n0,{dropDownRef:c,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return ls(lo.Fragment,{children:[ls("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),p(!a)},onMouseDown:h=>{h.preventDefault()},ref:d,type:"button",children:[l&&Me(l,{}),s&&Me("span",{className:"toolbar-popup__dropdown-label",children:s}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Me(lo.Fragment,{children:f})]})}var pr="toolbar-popup__dropdown",p0=t=>{let e=l0(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=d0(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let p;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(p=i?.Component&&ot(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]=p):p=e[5],p}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==d){let p=i.key,m;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label),p.length>25?m=p.substring(0,25)+"...":m=p,a=ot(cs,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?ot(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:p,children:ot("span",{className:"text",children:m})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=d,e[13]=a}else a=e[13];return a},f0=ds.memo(p0),Ue=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=ds.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=s0(c),p=j(),{items:m,key:f}=r,h=$t(),g=i0(()=>{o.getEditorState().read(()=>{let T=m0();if(!T)return;let v=[],b=[],k=[];for(let x of m)x.isActive&&(!s||v.length<s)&&x.isActive({editor:o,editorConfigContext:p,selection:T})&&(v.push(x.key),b.push(x)),x.isEnabled?x.isEnabled({editor:o,editorConfigContext:p,selection:T})&&k.push(x.key):k.push(x.key);d({activeItemKeys:v,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:p,selection:T}):!0,enabledItemKeys:k}),u&&u({activeItems:b})})},[o,p,r,m,s,u]);a0(()=>(h(g),u0(o.registerUpdateListener(async()=>{await h(g)}))),[o,h,g]);let _=c0(()=>m?.length?m.map(T=>ot(f0,{active:a.activeItemKeys.includes(T.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(T.key),item:T},T.key)):null,[m,a,t,o]);return ot(us,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[pr,`${pr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${pr}-items`,...l||[]],label:i,children:_},f)};function _0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&me(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?me(It,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function T0(t){let e=ms(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=b0(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=Ne.useState(void 0),[m,f]=Ne.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 g;e[4]!==l?(g=[l],e[4]=l,e[5]=g):g=e[5],Ne.useEffect(h,g);let _;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(_=k=>{let{activeItems:x}=k;if(!x.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let w=x[0],R=w.key;w.label&&(R=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),R.length>25&&(R=R.substring(0,25)+"..."),x.length===1?(p(R),f(()=>w.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:x.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]=d,e[12]=_):_=e[12];let T=_,v=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,b;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==T||e[21]!==v?(b=h0("div",{className:v,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?m?me(Ue,{anchorElem:o,editor:r,group:l,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):me(Ue,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):null,l.type==="buttons"&&l.items.length?l.items.map(k=>me(_0,{anchorElem:o,editor:r,item:k},k.key)):null,i<n.features.toolbarFixed?.groups.length-1&&me("div",{className:"divider"})]},l.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=T,e[21]=v,e[22]=b):b=e[22],b}function w0({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ne.useRef(null),{y:i}=x0(),s=k0(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return C0(()=>{if(!s)return;let u=l.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[l,s,i]),me("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:o.isEditable()&&me(Ne.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>me(T0,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var ps=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ps(t.parentEditor)}return!1},fs=t=>{let e=ms(6),{clientProps:o}=t,[r]=g0(),n=j(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=ps(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=me(w0,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var E0=y({plugins:[{Component:fs,position:"aboveContainer"}]});import{c as xs}from"react/compiler-runtime";import{jsx as ge,jsxs as Cs}from"react/jsx-runtime";import{useLexicalComposerContext as S0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as bs}from"@lexical/utils";import{$getSelection as ks,$isRangeSelection as hs,$isTextNode as N0,COMMAND_PRIORITY_LOW as L0,getDOMSelection as _s,SELECTION_CHANGE_COMMAND as y0}from"lexical";import{useCallback as ao,useEffect as Rt,useRef as gs,useState as I0}from"react";import*as co from"react";import{createPortal as R0}from"react-dom";function fr(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 so(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-l;i==="center"&&(h=u.left+u.width/2-a.width/2);let g=0;return!e&&f<m.top&&!s&&(g=a.height+u.height+c*2,f+=g),i==="center"?h+a.width>m.right?h=m.right-a.width-l:h<m.left&&(h=m.left+l):h+a.width>m.right&&(h=m.right-a.width-l),h-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function v0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ge(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ge(It,{editor:e,item:o,children:ge(o.ChildComponent,{})},o.key):null}function M0(t){let e=xs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=j(),[s,u]=co.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],co.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let _=g[0];u(()=>_?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`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]!==p||e[17]!==m?(f=Cs("div",{className:m,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ge(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ge(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ge(v0,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ge("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]=p,e[17]=m,e[18]=f):f=e[18],f}function D0({anchorElem:t,editor:e}){let o=gs(null),r=gs(null),{editorConfig:n}=j(),l=ao(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),i=ao(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||l()}}},[l]),s=ao(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Rt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=ao(()=>{let c=ks(),d=_s(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=fr(d,m),h=so({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&so({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Rt(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,u,t]),Rt(()=>(e.getEditorState().read(()=>{u()}),bs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(y0,()=>(u(),!1),L0))),[e,u]),Cs("div",{className:"inline-toolbar-popup",ref:o,children:[ge("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>ge(M0,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function A0(t,e){let o=xs(12),[r,n]=I0(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=ks(),m=_s(t._window),f=t.getRootElement();if(m!==null&&(!hs(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!hs(p))return;if(p.getTextContent()!==""){let g=p.getNodes(),_=!1;for(let T of g)if(N0(T)){n(!0),_=!0;break}_||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,u;o[2]!==i?(s=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=s,o[4]=u):(s=o[3],u=o[4]),Rt(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>bs(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=d):(c=o[7],d=o[8]),Rt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=R0(ge(D0,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Ts=t=>{let{anchorElem:e}=t,[o]=S0();return A0(o,e)};var O0=y({plugins:[{Component:Ts,position:"floatingAnchorElem"}]});import{TableCellNode as Sh,TableNode as Nh,TableRowNode as Lh}from"@lexical/table";import{jsx as ws}from"react/jsx-runtime";import"react";var hr=()=>ws("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ws("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 $0,$createTableNode as F0,$createTableRowNode as P0,$isTableCellNode as Es,$isTableNode as gr,$isTableRowNode as xr,TableCellHeaderStates as uo,TableCellNode as B0,TableNode as H0,TableRowNode as j0}from"@lexical/table";import{$isParagraphNode as U0,$isTextNode as G0}from"lexical";var Ns=/^\|(.+)\|\s?$/,W0=/^(\| ?:?-*:? ?)+\|\s?$/,Ls=({allTransformers:t})=>({type:"element",dependencies:[H0,j0,B0],export:e=>{if(!gr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!xr(r))continue;let l=!1;for(let i of r.getChildren())Es(i)&&(n.push(Hr(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===uo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
39
39
  `)},regExp:Ns,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(W0.test(n)){let a=e.getPreviousSibling();if(!a||!gr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!xr(m))return;m.getChildren().forEach(f=>{Es(f)&&f.setHeaderStyles(uo.ROW,uo.ROW)}),e.remove();return}let l=Ss(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),u=l.length;for(;s&&!(!U0(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!G0(a))break;let p=Ss(a.getTextContent(),t);if(p==null)break;u=Math.max(u,p.length),i.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let c=F0();for(let a of i){let p=P0();c.append(p);for(let m=0;m<u;m++)p.append(m<a.length?a[m]:ys("",t))}let d=e.getPreviousSibling();gr(d)&&V0(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function V0(t){let e=t.getFirstChild();return xr(e)?e.getChildrenSize():0}var ys=(t,e)=>{t=t.replace(/\\n/g,`
40
- `);let o=$0(uo.NO_STATUS);return Br(t,e,o),o},Ss=(t,e)=>{let o=t.match(Ns);return!o||!o[1]?null:o[1].split("|").map(r=>ys(r,e))};import{c as J0}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as Ms}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as X0}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as br,$deleteTableColumn__EXPERIMENTAL as z0,$deleteTableRow__EXPERIMENTAL as Z0,$getNodeTriplet as Y0,$getTableCellNodeFromLexicalNode as Rs,$getTableColumnIndexFromTableCellNode as q0,$getTableNodeFromLexicalNodeOrThrow as ye,$getTableRowIndexFromTableCellNode as Q0,$insertTableColumn__EXPERIMENTAL as e1,$insertTableRow__EXPERIMENTAL as t1,$isTableCellNode as Ds,$isTableSelection as vt,$unmergeCell as o1,getTableElement as kr,getTableObserverFromTableElement as _r,TableCellHeaderStates as De,TableCellNode as r1}from"@lexical/table";import{mergeRegister as n1}from"@lexical/utils";import{useScrollInfo as l1}from"@payloadcms/ui";import{$createParagraphNode as i1,$getSelection as po,$isElementNode as s1,$isParagraphNode as a1,$isRangeSelection as Tr,$isTextNode as c1,$setSelection as u1,COMMAND_PRIORITY_CRITICAL as d1,getDOMSelection as m1,isDOMNode as p1,SELECTION_CHANGE_COMMAND as f1}from"lexical";import*as wr from"react";import{useCallback as pe,useEffect as rt,useRef as mo,useState as nt}from"react";import{createPortal as As}from"react-dom";import{jsx as Cr,jsxs as K0}from"react/jsx-runtime";import"react";var Is=()=>K0("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Cr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Cr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Cr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function vs(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function h1(){let t=po();if(Tr(t)&&!t.isCollapsed()||vt(t)&&!t.anchor.is(t.focus)||!Tr(t)&&!vt(t))return!1;let[e]=Y0(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function g1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!a1(e)||!e.isEmpty())}function x1(t){let e=t.getLastDescendant();c1(e)?e.select():s1(e)?e.selectEnd():e!==null&&e.selectNext()}function C1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Ms(),i=mo(null),[s,u]=nt(n),[c,d]=nt({columns:1,rows:1}),[a,p]=nt(!1),[m,f]=nt(!1),{y:h}=l1();rt(()=>l.registerMutationListener(r1,C=>{C.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),rt(()=>{l.getEditorState().read(()=>{let C=po();if(vt(C)){let N=vs(C);d(vs(C)),p(N.columns>1||N.rows>1)}f(h1())})},[l]),rt(()=>{let C=e.current,N=i.current,M=l.getRootElement();if(C!=null&&N!=null&&M!=null){let L=M.getBoundingClientRect(),D=C.getBoundingClientRect();N.style.opacity="1";let E=N.getBoundingClientRect(),$=5,H=D.right+$;if(H+E.width>window.innerWidth||H+E.width>L.right){let Y=D.left-E.width-$;H=(Y<0?$:Y)+window.pageXOffset}N.style.left=`${H+window.pageXOffset}px`;let W=D.top;if(W+E.height>window.innerHeight){let Y=D.bottom-E.height;W=Y<0?$:Y}N.style.top=`${W}px`}},[e,i,l,h]),rt(()=>{function C(N){i.current!=null&&e.current!=null&&p1(N.target)&&!i.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let g=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s),N=kr(C,l.getElementByKey(C.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let M=_r(N);M!==null&&M.$clearHighlight(),C.markDirty(),u(s.getLatest())}u1(null)})},[l,s]),_=()=>{l.update(()=>{let C=po();if(vt(C)){let M=C.getNodes().filter(Ds);if(M.length===0)return;let L=ye(M[0]),[D]=br(L,null,null),E=1/0,$=-1/0,H=1/0,W=-1/0,Y=new Set;for(let q of D)for(let K of q){if(!K||!K.cell)continue;let re=K.cell.getKey();if(!Y.has(re)&&M.some(ne=>ne.is(K.cell))){Y.add(re);let ne=K.startRow,se=K.startColumn,Ae=K.cell.__rowSpan||1,it=K.cell.__colSpan||1;E=Math.min(E,ne),$=Math.max($,ne+Ae-1),H=Math.min(H,se),W=Math.max(W,se+it-1)}}if(E===1/0||H===1/0)return;let We=$-E+1,V=W-H+1,U=D?.[E]?.[H];if(!U?.cell)return;let oe=U.cell;oe.setColSpan(V),oe.setRowSpan(We);let ue=new Set([oe.getKey()]);for(let q=E;q<=$;q++)for(let K=H;K<=W;K++){let re=D?.[q]?.[K];if(!re?.cell)continue;let ne=re.cell,se=ne.getKey();ue.has(se)||(ue.add(se),g1(ne)||oe.append(...ne.getChildren()),ne.remove())}oe.getChildrenSize()===0&&oe.append(i1()),x1(oe),o()}})},T=()=>{l.update(()=>{o1()})},v=pe(C=>{l.update(()=>{for(let N=0;N<c.rows;N++)t1(C);o()})},[l,o,c.rows]),b=pe(C=>{l.update(()=>{for(let N=0;N<c.columns;N++)e1(C);o()})},[l,o,c.columns]),k=pe(()=>{l.update(()=>{Z0(),o()})},[l,o]),x=pe(()=>{l.update(()=>{ye(s).remove(),g(),o()})},[l,s,g,o]),w=pe(()=>{l.update(()=>{z0(),o()})},[l,o]),R=pe(()=>{l.update(()=>{let C=ye(s),N=Q0(s),[M]=br(C,null,null),L=new Set,D=s.getHeaderStyles()^De.ROW;if(M[N])for(let E=0;E<M[N].length;E++){let $=M[N][E];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(D,De.ROW)))}g(),o()})},[l,s,g,o]),A=pe(()=>{l.update(()=>{let C=ye(s),N=q0(s),[M]=br(C,null,null),L=new Set,D=s.getHeaderStyles()^De.COLUMN;if(M)for(let E=0;E<M.length;E++){let $=M?.[E]?.[N];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(D,De.COLUMN)))}g(),o()})},[l,s,g,o]),F=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setRowStriping(!C.getRowStriping())}g(),o()})},[l,s,g,o]),I=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}g(),o()})},[l,s,g,o]),S=null;return t&&(a?S=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(S=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),As(Le("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:i,children:[S?Le(wr.Fragment,{children:[S,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>F(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>I(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>v(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>v(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>R(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>A(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function b1({anchorElem:t,cellMerge:e}){let[o]=Ms(),r=mo(null),n=mo(null),[l,i]=nt(!1),[s,u]=nt(null),c=pe(()=>{let a=r.current,p=po(),m=m1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(p==null||a==null)return h();let g=o.getRootElement(),_=null,T=null;if(Tr(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let b=Rs(p.anchor.getNode());if(b==null||(T=o.getElementByKey(b.getKey()),T==null||!b.isAttached()))return h();let k=ye(b),x=kr(k,o.getElementByKey(k.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=_r(x),u(b)}else if(vt(p)){let b=Rs(p.anchor.getNode());if(!Ds(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=ye(b),x=kr(k,o.getElementByKey(k.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=_r(x),T=o.getElementByKey(b.getKey())}else if(!f)return h();if(_===null||T===null)return h();let v=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",v),a.classList.toggle("table-cell-action-button-container--inactive",!v),v){let b=T.getBoundingClientRect(),k=t.getBoundingClientRect(),x=b.top-k.top,w=b.right-k.left;a.style.transform=`translate(${w}px, ${x}px)`}},[o,t]);rt(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return n1(o.registerUpdateListener(m),o.registerCommand(f1,m,d1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=mo(s);return rt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Le(wr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(Is,{})}),l&&P(C1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Os=t=>{let e=J0(3),{anchorElem:o}=t,r=X0(),n;return e[0]!==o||e[1]!==r?(n=As(r?P(b1,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as k1}from"react/compiler-runtime";import{jsx as ho,jsxs as _1}from"react/jsx-runtime";import{useLexicalComposerContext as T1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as w1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as E1,$getTableNodeFromLexicalNodeOrThrow as Er,$getTableRowIndexFromTableCellNode as S1,$isTableCellNode as $s,$isTableRowNode as N1,getDOMCellFromTarget as L1,getTableElement as y1,TableNode as Fs}from"@lexical/table";import{calculateZoomLevel as Ps,mergeRegister as I1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Sr,isHTMLElement as R1}from"lexical";import*as Hs from"react";import{useCallback as Mt,useEffect as Nr,useRef as fo,useState as lt}from"react";import{createPortal as v1}from"react-dom";var M1=33,Bs=92;function D1({editor:t}){let e=fo(null),o=fo(null),r=fo(null),[n,l]=lt(!1),i=j(),s=fo(null),[u,c]=lt(null),[d,a]=lt(null),[p,m]=lt(!1),[f,h]=lt(null),g=Mt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),_=I=>(I.buttons&1)===1;Nr(()=>{let I=new Set;return I1(t.registerMutationListener(Fs,S=>{for(let[C,N]of S)N==="destroyed"?I.delete(C):I.add(C);l(I.size>0)}),t.registerNodeTransform(Fs,S=>{if(S.getColWidths())return S;let C=S.getColumnCount(),N=Bs;return S.setColWidths(Array(C).fill(N)),S}))},[t]),Nr(()=>{if(!n)return;let I=M=>{let L=M.target;if(R1(L)){if(f){c({x:M.clientX,y:M.clientY});return}if(m(_(M)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let D=L1(L);D&&d!==D?t.getEditorState().read(()=>{let E=Sr(D.elem);if(!E)throw new Error("TableCellResizer: Table cell node not found.");let $=Er(E),H=y1($,t.getElementByKey($.getKey()));if(!H)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=H.getBoundingClientRect(),a(D)},{editor:t}):D==null&&g()}}},S=M=>{m(!0)},C=M=>{m(!1)},N=t.registerRootListener((M,L)=>{L?.removeEventListener("mousemove",I),L?.removeEventListener("mousedown",S),L?.removeEventListener("mouseup",C),M?.addEventListener("mousemove",I),M?.addEventListener("mousedown",S),M?.addEventListener("mouseup",C)});return()=>{N()}},[d,f,t,n,g]);let T=I=>I==="bottom",v=Mt(I=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Sr(d.elem);if(!$s(S))throw new Error("TableCellResizer: Table cell node not found.");let C=Er(S),N=S1(S),M=C.getChildren(),D=S.getColSpan()===C.getColumnCount()?N:N+S.getRowSpan()-1;if(D>=M.length||D<0)throw new Error("Expected table cell to be inside of table row.");let E=M[D];if(!N1(E))throw new Error("Expected table row");let $=E.getHeight();if($===void 0){let W=E.getChildren();$=Math.min(...W.map(Y=>b(Y,t)??1/0))}let H=Math.max($+I,M1);E.setHeight(H)},{tag:"skip-scroll-into-view"})},[d,t]),b=(I,S)=>S.getElementByKey(I.getKey())?.clientHeight,k=(I,S)=>{let C;return S.forEach(N=>{N.forEach((M,L)=>{M.cell===I&&(C=L)})}),C},x=Mt(I=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Sr(d.elem);if(!$s(S))throw new Error("TableCellResizer: Table cell node not found.");let C=Er(S),[N]=E1(C,null,null),M=k(S,N);if(M===void 0)throw new Error("TableCellResizer: Table column not found.");let L=C.getColWidths();if(!L)return;let D=L[M];if(D===void 0)return;let E=[...L],$=Math.max(D+I,Bs);E[M]=$,C.setColWidths(E)},{tag:"skip-scroll-into-view"})},[d,t]),w=Mt(I=>{let S=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y:M}=s.current;if(d===null)return;let L=Ps(C.target);if(T(I)){let D=(C.clientY-M)/L;v(D)}else{let D=(C.clientX-N)/L;x(D)}g(),document.removeEventListener("mouseup",S)}};return S},[d,g,x,v]),R=Mt(I=>S=>{if(S.preventDefault(),S.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:S.clientX,y:S.clientY},c(s.current),h(I),document.addEventListener("mouseup",w(I))},[d,w]),[A,F]=lt({bottom:null,left:null,right:null,top:null});return Nr(()=>{if(d){let{height:I,left:S,top:C,width:N}=d.elem.getBoundingClientRect(),M=Ps(d.elem),L=10,D={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+C+I-L/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${I}px`,left:`${window.scrollX+S+N-L/2}px`,top:`${window.scrollY+C}px`,width:`${L}px`}},E=r.current;f&&u&&E&&(T(f)?(D[f].left=`${window.scrollX+E.left}px`,D[f].top=`${window.scrollY+u.y/M}px`,D[f].height="3px",D[f].width=`${E.width}px`):(D[f].top=`${window.scrollY+E.top}px`,D[f].left=`${window.scrollX+u.x/M}px`,D[f].width="3px",D[f].height=`${E.height}px`),D[f].backgroundColor="#adf"),F(D)}else F({bottom:null,left:null,right:null,top:null})},[d,f,u]),ho("div",{ref:o,children:d!=null&&!p&&_1(Hs.Fragment,{children:[ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:R("right"),style:A.right||void 0}),ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:R("bottom"),style:A.bottom||void 0})]})})}var js=()=>{let t=k1(3),[e]=T1(),o=w1(),r;return t[0]!==e||t[1]!==o?(r=o?v1(ho(D1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as j1}from"react/compiler-runtime";import{jsx as Lr,jsxs as U1,Fragment as G1}from"react/jsx-runtime";import{useLexicalComposerContext as zs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as W1,$getTableColumnIndexFromTableCellNode as V1,$getTableRowIndexFromTableCellNode as K1,$insertTableColumn__EXPERIMENTAL as J1,$insertTableRow__EXPERIMENTAL as X1,$isTableCellNode as z1,$isTableNode as Ws,getTableElement as Z1,TableNode as Y1}from"@lexical/table";import{$findMatchingParent as q1,mergeRegister as Q1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Vs,isHTMLElement as eh}from"lexical";import{useEffect as Ks,useMemo as th,useRef as Js,useState as go}from"react";import"react";import{createPortal as oh}from"react-dom";import{c as P1}from"react/compiler-runtime";import{useEffect as B1,useRef as H1}from"react";var A1="Expected a function",O1=Math.max,$1=Math.min;function F1(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(A1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?O1(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(x){let w=r,R=i;return r=i=void 0,l=x,d=t.apply(R,w),d}function f(x){return l=x,a=setTimeout(_,e),s?m(x):d}function h(x){let w=x-n,R=x-l,A=e-w;return u?$1(A,c-R):A}function g(x){let w=x-n,R=x-l;return n===void 0||w>=e||w<0||u&&R>=c}function _(){let x=Date.now();if(g(x))return T(x);a=setTimeout(_,h(x))}function T(x){return a=void 0,p&&r?m(x):(r=i=void 0,d)}function v(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function b(){return a===void 0?d:T(Date.now())}function k(){let x=Date.now(),w=g(x);if(r=arguments,i=this,n=x,w){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(_,e),m(n)}return a===void 0&&(a=setTimeout(_,e)),d}return k.cancel=v,k.flush=b,k}var Us=F1;function Gs(t,e,o){let r=P1(6),n=H1(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Us(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),B1(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Xs=20;function rh({anchorElem:t}){let[e]=zs(),o=j(),[r,n]=go(!1),[l,i]=go(!1),[s,u]=go(!1),[c,d]=go({}),a=Js(new Set),p=Js(null),m=Gs(g=>{let{isOutside:_,tableDOMNode:T}=nh(g,o.editorConfig?.lexical);if(_){n(!1),i(!1);return}if(!T)return;p.current=T;let v=null,b=null,k=null;if(e.getEditorState().read(()=>{let L=Vs(T);if(z1(L)){let D=q1(L,E=>Ws(E));if(!Ws(D))return;if(k=Z1(D,e.getElementByKey(D.getKey())),k){let E=D.getChildrenSize(),$=D.getChildAtIndex(0)?.getChildrenSize(),H=K1(L),W=V1(L);H===E-1?v=L:W===$-1&&(b=L)}}},{editor:e}),!k)return;let x=k.parentElement;if(!x)return;let{bottom:w,height:R,left:A,right:F,width:I,y:S}=k.getBoundingClientRect(),C=!1;x&&x.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=x.scrollWidth>x.clientWidth);let{left:N,y:M}=t.getBoundingClientRect();v?(i(!1),n(!0),d({height:Xs,left:C&&x?x.offsetLeft:A-N,top:w-M+5,width:C&&x?x.offsetWidth:I})):b&&(i(!0),n(!1),d({height:R,left:F-N+5,top:S-M,width:Xs}))},50,250),f=th(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);Ks(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),Ks(()=>Q1(e.registerMutationListener(Y1,g=>{e.getEditorState().read(()=>{let _=!1;for(let[T,v]of g)switch(v){case"created":{a.current.add(T),_=!0;break}case"destroyed":{a.current.delete(T),_=!0;break}default:break}if(_){f.disconnect();for(let T of a.current){let{tableElement:v}=W1(T);f.observe(v)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{p.current&&(Vs(p.current)?.selectEnd(),g?(X1(),n(!1)):(J1(),i(!1)))})};return e?.isEditable()?U1(G1,{children:[r&&Lr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&Lr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function nh(t,e){let o=t.target;if(eh(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Zs(t){let e=j1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=zs();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=oh(Lr(rh,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as lh}from"react/compiler-runtime";import{jsx as yr,jsxs as ih}from"react/jsx-runtime";import{useLexicalComposerContext as sh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as ah}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ch,TableCellNode as uh,TableNode as dh,TableRowNode as mh}from"@lexical/table";import{mergeRegister as ph}from"@lexical/utils";import{formatDrawerSlug as fh,useEditDepth as hh}from"@payloadcms/ui";import{$getSelection as gh,$isRangeSelection as xh,COMMAND_PRIORITY_EDITOR as Ch,createCommand as bh}from"lexical";import{createContext as kh,use as _h,useEffect as Th,useMemo as wh,useState as Eh}from"react";import*as Ys from"react";var xo=bh("OPEN_EMBED_DRAWER_COMMAND"),qs=kh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Qs({children:t}){let[e,o]=Eh({cellEditorConfig:null,cellEditorPlugins:null});return yr(qs,{value:wh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ea=()=>{let t=lh(16),[e]=sh(),o=_h(qs),r=hh(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=fh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=xe(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([dh,mh,uh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return ph(e.registerCommand(xo,()=>{let h=null;return e.getEditorState().read(()=>{let g=gh();xh(g)&&(h=g)}),h&&d(),!0},Ch))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],Th(a,p);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(ch,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=ih(Ys.Fragment,{children:[yr(st,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),yr(ah,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var yh=y({markdownTransformers:[Ls],nodes:[Nh,Sh,Lh],plugins:[{Component:ea,position:"normal"},{Component:js,position:"normal"},{Component:Os,position:"floatingAnchorElem"},{Component:Zs,position:"floatingAnchorElem"}],providers:[Qs],slashMenu:{groups:[ee([{Icon:hr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:hr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]}});import{$isNodeSelection as lg}from"lexical";import{jsx as Ir,jsxs as Ih}from"react/jsx-runtime";import"react";var Rr=()=>Ih("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ir("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ir("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ah}from"react/jsx-runtime";import ra from"bson-objectid";import{$applyNodeReplacement as Oh}from"lexical";import*as na from"react";import{jsx as Rh}from"react/jsx-runtime";import{DecoratorBlockNode as vh}from"@lexical/react/LexicalDecoratorBlockNode.js";import ta from"bson-objectid";import{$applyNodeReplacement as Mh}from"lexical";import"react";function vr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function Dh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:oa({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||vr(e),null}var Dt=class extends vh{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:Dh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ta.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=oa({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return Rh(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function oa({data:t}){return t?.id||(t.id=new ta.default().toHexString()),Mh(new Dt({data:t}))}var $h=na.lazy(()=>import("./component-3PENNOM3.js").then(t=>({default:t.UploadComponent})));function Fh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Ge({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||vr(e),null}var Ie=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:Fh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ra.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ge({data:o});return r.setFormat(e.format),r}decorate(){return Ah($h,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge({data:t}){return t?.id||(t.id=new ra.default().toHexString()),Oh(new Ie({data:t}))}function Mr(t){return t instanceof Ie}import{c as Vh}from"react/compiler-runtime";import{jsx as Kh}from"react/jsx-runtime";import{useLexicalComposerContext as Jh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Xh,mergeRegister as zh}from"@lexical/utils";import{useConfig as Zh}from"@payloadcms/ui";import{$getPreviousSelection as Yh,$getSelection as qh,$isParagraphNode as Qh,$isRangeSelection as eg,COMMAND_PRIORITY_EDITOR as tg,createCommand as og}from"lexical";import{useEffect as rg}from"react";import{c as la}from"react/compiler-runtime";import{jsx as Dr}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{toast as Ph}from"@payloadcms/ui";import{$getNodeByKey as Bh,COMMAND_PRIORITY_EDITOR as sa}from"lexical";import{useEffect as aa,useState as Hh}from"react";var jh=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Bh(o);n&&n.replace(Ge({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Ar,{fields:null,relationTo:e,value:r})},Uh=t=>{let e=la(13),{enabledCollectionSlugs:o}=t,[r]=ia(),[n,l]=Hh(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=yt(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),sa),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),aa(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:g,doc:_}=h;s(),jh({editor:r,relationTo:g,replaceNodeKey:n,value:_.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=Dr(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},Gh=()=>{let t=la(3),[e]=ia(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,Wh,sa),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),aa(o,r),null},ca=t=>Dr(Ot,{...t,FallbackComponent:Gh,uploads:!0,children:Dr(Uh,{...t})});function Wh(){return Ph.error("No upload collections enabled"),!0}var Ar=og("INSERT_UPLOAD_COMMAND"),ua=t=>{let e=Vh(5),[o]=Jh(),{config:r}=Zh(),{collections:n}=r,l,i;e[0]!==o?(l=()=>{if(!o.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return zh(o.registerCommand(Ar,u=>(o.update(()=>{let c=qh()||Yh();if(eg(c)){let d=Ge({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}}),{focus:a}=c,p=a.getNode();Xh(d),Qh(p)&&!p.__first&&p.remove()}}),!0),tg))},i=[o],e[0]=o,e[1]=l,e[2]=i):(l=e[1],i=e[2]),rg(l,i);let s;return e[3]!==n?(s=Kh(ca,{enabledCollectionSlugs:n.map(ng)}),e[3]=n,e[4]=s):s=e[4],s};function ng(t){let{slug:e}=t;return e}var ig=y({nodes:[Ie],plugins:[{Component:ua,position:"normal"}],slashMenu:{groups:[ee([{Icon:Rr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Rr,isActive:({selection:t})=>{if(!lg(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Mr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as ag}from"react/compiler-runtime";import{jsx as $r}from"react/jsx-runtime";import{ShimmerEffect as cg,useConfig as ug}from"@payloadcms/ui";import{lazy as dg,Suspense as mg,useEffect as pg,useState as fg}from"react";var da={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Co={namespace:"lexical",theme:da};function ma({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let c of l.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}import{deepMerge as sg}from"payload/shared";var pa=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?sg(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Or(t,e,o){return{admin:o,features:pa(t),lexical:e,resolvedFeatureMap:t}}var hg=dg(()=>import("./Field-4DDJ7TQY.js").then(t=>({default:t.RichText}))),gg=t=>{let e=ag(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?Co:s,{config:p}=ug(),[m,f]=fg(null),h,g;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let T=[];for(let[k,x]of Object.entries(r))x.clientFeatureProvider&&T.push(x.clientFeatureProvider(x.clientFeatureProps));let v=a||Co,b=ma({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:T,lexical:v}});f(Or(b,v,d))},g=[a,d,m,r,n,l,i,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=g):(h=e[11],g=e[12]),pg(h,g);let _;return e[13]!==m||e[14]!==t?(_=$r(mg,{fallback:$r(cg,{height:"35vh"}),children:m&&$r(hg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=_):_=e[15],_};function xg(t){return t instanceof HTMLElement}function Cg(...t){return t.filter(Boolean).join(" ")}var bo=new WeakMap;function fa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function ko(t,e){let o=bo.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=fa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=fa(i);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},bo.set(t,o)}return o.listeners.add(e),()=>{bg(t,e)}}function bg(t,e){let o=bo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(bo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function kg(t,e){return ko(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function _g(t,e){return ko(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Tg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function wg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Eg}from"react/compiler-runtime";import{jsx as Sg}from"react/jsx-runtime";import"react";var Ng=()=>{let t=Eg(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?Sg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Lg}from"react/compiler-runtime";import{jsx as yg}from"react/jsx-runtime";import"react";var Ig=()=>{let t=Lg(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?yg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Rg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=()=>{let t=Rg(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?vg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Dg}from"react/compiler-runtime";import{jsx as Ag}from"react/jsx-runtime";import"react";var Og=t=>{let e=Dg(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?Ag(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as $g}from"react/compiler-runtime";import{jsx as Fg}from"react/jsx-runtime";import"react";var Pg=t=>{let e=$g(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=Oe(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?Fg(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as Bg}from"react/compiler-runtime";import{jsx as Hg}from"react/jsx-runtime";import"react";var jg=()=>{let t=Bg(2),{EditButton:e}=Oe(),o;return t[0]!==e?(o=e?Hg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Ug}from"react/compiler-runtime";import{jsx as Gg}from"react/jsx-runtime";import"react";var Wg=()=>{let t=Ug(2),{RemoveButton:e}=Oe(),o;return t[0]!==e?(o=e?Gg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Vg}from"qs-esm";var Kg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=Vg({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};import{c as Jg}from"react/compiler-runtime";import{jsx as At}from"react/jsx-runtime";import{FieldContext as Xg,FieldPathContext as ha,ServerFunctionsContext as ga,useServerFunctions as zg}from"@payloadcms/ui";import Zg from"react";var Yg=t=>{let e=Jg(24),{name:o,admin:r,editorTarget:n,path:l}=t,[i,s]=Zg.useState(null),u=zg(),{serverFunction:c}=u,d;e[0]!==n?(d=n.split("."),e[0]=n,e[1]=d):d=e[1];let a,p,m;e[2]!==d?([p,a,...m]=d,e[2]=d,e[3]=a,e[4]=p,e[5]=m):(a=e[3],p=e[4],m=e[5]);let f;e[6]!==r||e[7]!==n||e[8]!==a||e[9]!==m||e[10]!==o||e[11]!==l||e[12]!==c?(f=b=>{(async function(){let{Component:w}=await c({name:"render-lexical",args:{name:o,admin:r,editorTarget:n,initialValue:b?.initialValue??void 0,path:l,schemaPath:`${a}.${m.join(".")}`}});s(w)})()},e[6]=r,e[7]=n,e[8]=a,e[9]=m,e[10]=o,e[11]=l,e[12]=c,e[13]=f):f=e[13];let h=f,g;e[14]!==i||e[15]!==a||e[16]!==p||e[17]!==o||e[18]!==l||e[19]!==u?(g=function(k){let{setValue:x,value:w}=k;if(!i)return null;let R={...u,getFormState:async I=>u.getFormState({...I,collectionSlug:p==="collection"?a:void 0,globalSlug:p==="global"?a:void 0})},A=l??o;if(typeof w>"u"&&!x)return At(ga,{value:{...R},children:At(ha,{value:A,children:i},A)});let F={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:w,path:A,setValue:x??qg,showError:!1,value:w};return At(ga,{value:{...R},children:At(ha,{value:A,children:At(Xg,{value:F,children:i})},A)})},e[14]=i,e[15]=a,e[16]=p,e[17]=o,e[18]=l,e[19]=u,e[20]=g):g=e[20];let T=g,v;return e[21]!==T||e[22]!==h?(v={Component:T,renderLexical:h},e[21]=T,e[22]=h,e[23]=v):v=e[23],v};function qg(){}function Qg({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{Ct as $createAutoLinkNode,Kt as $createBlockNode,To as $createInlineBlockNode,_e as $createLinkNode,je as $createRelationshipNode,Ge as $createUploadNode,we as $isAutoLinkNode,ft as $isBlockNode,wo as $isInlineBlockNode,Z as $isLinkNode,cr as $isRelationshipNode,Mr as $isUploadNode,Ia as AlignFeatureClient,Te as AutoLinkNode,Pg as BlockCollapsible,jg as BlockEditButton,be as BlockNode,Wg as BlockRemoveButton,Aa as BlockquoteFeatureClient,vc as BlocksFeatureClient,eu as BoldFeatureClient,ce as CAN_USE_DOM,ep as ChecklistFeatureClient,Wp as DETAIL_TYPE_TO_DETAIL,Hp as DOUBLE_LINE_BREAK,tf as DebugJsxConverterFeatureClient,Kp as ELEMENT_FORMAT_TO_TYPE,Vp as ELEMENT_TYPE_TO_FORMAT,Ta as ENABLE_SLASH_MENU_COMMAND,Ca as EditorConfigProvider,st as FieldsDrawer,E0 as FixedToolbarFeatureClient,Ju as HeadingFeatureClient,ud as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,Pp as IS_ALL_FORMATTING,Nd as IndentFeatureClient,Og as InlineBlockContainer,Ng as InlineBlockEditButton,Mg as InlineBlockLabel,_o as InlineBlockNode,Ig as InlineBlockRemoveButton,lu as InlineCodeFeatureClient,O0 as InlineToolbarFeatureClient,cu as ItalicFeatureClient,Up as LTR_REGEX,Tp as LexicalPluginToLexicalFeatureClient,Bm as LinkFeatureClient,ie as LinkNode,Bp as NON_BREAKING_SPACE,O as NodeFormat,ap as OrderedListFeatureClient,Rp as ParagraphFeatureClient,ka as Point,jp as RTL_REGEX,wa as Rect,Uf as RelationshipFeatureClient,Se as RelationshipNode,gg as RichTextField,yp as SlateToLexicalFeatureClient,fu as StrikethroughFeatureClient,Cu as SubscriptFeatureClient,Tu as SuperscriptFeatureClient,Jp as TEXT_MODE_TO_TYPE,Gp as TEXT_TYPE_TO_FORMAT,Xp as TEXT_TYPE_TO_MODE,he as TOGGLE_LINK_COMMAND,yh as TableFeatureClient,Vc as TestRecorderFeatureClient,Pu as TextStateFeatureClient,It as ToolbarButton,Ue as ToolbarDropdown,Zc as TreeViewFeatureClient,Lu as UnderlineFeatureClient,gp as UnorderedListFeatureClient,ig as UploadFeatureClient,Ie as UploadNode,wg as addSwipeDownListener,kg as addSwipeLeftListener,_g as addSwipeRightListener,Tg as addSwipeUpListener,Qg as buildEditorState,jo as createBlockNode,y as createClientFeature,of as defaultColors,Co as defaultEditorLexicalConfig,fr as getDOMRangeRect,Ea as getEnabledNodes,Kg as getRestPopulateFn,ze as getSelectedNode,xg as isHTMLElement,_a as isPoint,Cg as joinClasses,Or as sanitizeClientEditorConfig,pa as sanitizeClientFeatures,so as setFloatingElemPosition,to as setFloatingElemPositionForLinkEditor,ee as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,Go as toolbarFeatureButtonsGroupWithItems,te as toolbarFormatGroupWithItems,le as toolbarTextDropdownGroupWithItems,Oe as useBlockComponentContext,j as useEditorConfigContext,Ce as useInlineBlockComponentContext,ba as useLexicalDocumentDrawer,xe as useLexicalDrawer,yt as useLexicalListDrawer,Yg as useRenderEditor_internal_};
40
+ `);let o=$0(uo.NO_STATUS);return Br(t,e,o),o},Ss=(t,e)=>{let o=t.match(Ns);return!o||!o[1]?null:o[1].split("|").map(r=>ys(r,e))};import{c as J0}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as Ms}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as X0}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as br,$deleteTableColumn__EXPERIMENTAL as z0,$deleteTableRow__EXPERIMENTAL as Z0,$getNodeTriplet as Y0,$getTableCellNodeFromLexicalNode as Rs,$getTableColumnIndexFromTableCellNode as q0,$getTableNodeFromLexicalNodeOrThrow as ye,$getTableRowIndexFromTableCellNode as Q0,$insertTableColumn__EXPERIMENTAL as e1,$insertTableRow__EXPERIMENTAL as t1,$isTableCellNode as Ds,$isTableSelection as vt,$unmergeCell as o1,getTableElement as kr,getTableObserverFromTableElement as _r,TableCellHeaderStates as De,TableCellNode as r1}from"@lexical/table";import{mergeRegister as n1}from"@lexical/utils";import{useScrollInfo as l1}from"@payloadcms/ui";import{$createParagraphNode as i1,$getSelection as po,$isElementNode as s1,$isParagraphNode as a1,$isRangeSelection as Tr,$isTextNode as c1,$setSelection as u1,COMMAND_PRIORITY_CRITICAL as d1,getDOMSelection as m1,isDOMNode as p1,SELECTION_CHANGE_COMMAND as f1}from"lexical";import*as wr from"react";import{useCallback as pe,useEffect as rt,useRef as mo,useState as nt}from"react";import{createPortal as As}from"react-dom";import{jsx as Cr,jsxs as K0}from"react/jsx-runtime";import"react";var Is=()=>K0("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Cr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Cr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Cr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function vs(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function h1(){let t=po();if(Tr(t)&&!t.isCollapsed()||vt(t)&&!t.anchor.is(t.focus)||!Tr(t)&&!vt(t))return!1;let[e]=Y0(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function g1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!a1(e)||!e.isEmpty())}function x1(t){let e=t.getLastDescendant();c1(e)?e.select():s1(e)?e.selectEnd():e!==null&&e.selectNext()}function C1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Ms(),i=mo(null),[s,u]=nt(n),[c,d]=nt({columns:1,rows:1}),[a,p]=nt(!1),[m,f]=nt(!1),{y:h}=l1();rt(()=>l.registerMutationListener(r1,C=>{C.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),rt(()=>{l.getEditorState().read(()=>{let C=po();if(vt(C)){let N=vs(C);d(vs(C)),p(N.columns>1||N.rows>1)}f(h1())})},[l]),rt(()=>{let C=e.current,N=i.current,M=l.getRootElement();if(C!=null&&N!=null&&M!=null){let L=M.getBoundingClientRect(),D=C.getBoundingClientRect();N.style.opacity="1";let E=N.getBoundingClientRect(),$=5,H=D.right+$;if(H+E.width>window.innerWidth||H+E.width>L.right){let Y=D.left-E.width-$;H=(Y<0?$:Y)+window.pageXOffset}N.style.left=`${H+window.pageXOffset}px`;let W=D.top;if(W+E.height>window.innerHeight){let Y=D.bottom-E.height;W=Y<0?$:Y}N.style.top=`${W}px`}},[e,i,l,h]),rt(()=>{function C(N){i.current!=null&&e.current!=null&&p1(N.target)&&!i.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let g=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s),N=kr(C,l.getElementByKey(C.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let M=_r(N);M!==null&&M.$clearHighlight(),C.markDirty(),u(s.getLatest())}u1(null)})},[l,s]),_=()=>{l.update(()=>{let C=po();if(vt(C)){let M=C.getNodes().filter(Ds);if(M.length===0)return;let L=ye(M[0]),[D]=br(L,null,null),E=1/0,$=-1/0,H=1/0,W=-1/0,Y=new Set;for(let q of D)for(let K of q){if(!K||!K.cell)continue;let re=K.cell.getKey();if(!Y.has(re)&&M.some(ne=>ne.is(K.cell))){Y.add(re);let ne=K.startRow,se=K.startColumn,Ae=K.cell.__rowSpan||1,it=K.cell.__colSpan||1;E=Math.min(E,ne),$=Math.max($,ne+Ae-1),H=Math.min(H,se),W=Math.max(W,se+it-1)}}if(E===1/0||H===1/0)return;let We=$-E+1,V=W-H+1,U=D?.[E]?.[H];if(!U?.cell)return;let oe=U.cell;oe.setColSpan(V),oe.setRowSpan(We);let ue=new Set([oe.getKey()]);for(let q=E;q<=$;q++)for(let K=H;K<=W;K++){let re=D?.[q]?.[K];if(!re?.cell)continue;let ne=re.cell,se=ne.getKey();ue.has(se)||(ue.add(se),g1(ne)||oe.append(...ne.getChildren()),ne.remove())}oe.getChildrenSize()===0&&oe.append(i1()),x1(oe),o()}})},T=()=>{l.update(()=>{o1()})},v=pe(C=>{l.update(()=>{for(let N=0;N<c.rows;N++)t1(C);o()})},[l,o,c.rows]),b=pe(C=>{l.update(()=>{for(let N=0;N<c.columns;N++)e1(C);o()})},[l,o,c.columns]),k=pe(()=>{l.update(()=>{Z0(),o()})},[l,o]),x=pe(()=>{l.update(()=>{ye(s).remove(),g(),o()})},[l,s,g,o]),w=pe(()=>{l.update(()=>{z0(),o()})},[l,o]),R=pe(()=>{l.update(()=>{let C=ye(s),N=Q0(s),[M]=br(C,null,null),L=new Set,D=s.getHeaderStyles()^De.ROW;if(M[N])for(let E=0;E<M[N].length;E++){let $=M[N][E];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(D,De.ROW)))}g(),o()})},[l,s,g,o]),A=pe(()=>{l.update(()=>{let C=ye(s),N=q0(s),[M]=br(C,null,null),L=new Set,D=s.getHeaderStyles()^De.COLUMN;if(M)for(let E=0;E<M.length;E++){let $=M?.[E]?.[N];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(D,De.COLUMN)))}g(),o()})},[l,s,g,o]),F=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setRowStriping(!C.getRowStriping())}g(),o()})},[l,s,g,o]),I=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}g(),o()})},[l,s,g,o]),S=null;return t&&(a?S=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(S=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),As(Le("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:i,children:[S?Le(wr.Fragment,{children:[S,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>F(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>I(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>v(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>v(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>R(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>A(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function b1({anchorElem:t,cellMerge:e}){let[o]=Ms(),r=mo(null),n=mo(null),[l,i]=nt(!1),[s,u]=nt(null),c=pe(()=>{let a=r.current,p=po(),m=m1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(p==null||a==null)return h();let g=o.getRootElement(),_=null,T=null;if(Tr(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let b=Rs(p.anchor.getNode());if(b==null||(T=o.getElementByKey(b.getKey()),T==null||!b.isAttached()))return h();let k=ye(b),x=kr(k,o.getElementByKey(k.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=_r(x),u(b)}else if(vt(p)){let b=Rs(p.anchor.getNode());if(!Ds(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=ye(b),x=kr(k,o.getElementByKey(k.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=_r(x),T=o.getElementByKey(b.getKey())}else if(!f)return h();if(_===null||T===null)return h();let v=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",v),a.classList.toggle("table-cell-action-button-container--inactive",!v),v){let b=T.getBoundingClientRect(),k=t.getBoundingClientRect(),x=b.top-k.top,w=b.right-k.left;a.style.transform=`translate(${w}px, ${x}px)`}},[o,t]);rt(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return n1(o.registerUpdateListener(m),o.registerCommand(f1,m,d1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=mo(s);return rt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Le(wr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(Is,{})}),l&&P(C1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Os=t=>{let e=J0(3),{anchorElem:o}=t,r=X0(),n;return e[0]!==o||e[1]!==r?(n=As(r?P(b1,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as k1}from"react/compiler-runtime";import{jsx as ho,jsxs as _1}from"react/jsx-runtime";import{useLexicalComposerContext as T1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as w1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as E1,$getTableNodeFromLexicalNodeOrThrow as Er,$getTableRowIndexFromTableCellNode as S1,$isTableCellNode as $s,$isTableRowNode as N1,getDOMCellFromTarget as L1,getTableElement as y1,TableNode as Fs}from"@lexical/table";import{calculateZoomLevel as Ps,mergeRegister as I1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Sr,isHTMLElement as R1}from"lexical";import*as Hs from"react";import{useCallback as Mt,useEffect as Nr,useRef as fo,useState as lt}from"react";import{createPortal as v1}from"react-dom";var M1=33,Bs=92;function D1({editor:t}){let e=fo(null),o=fo(null),r=fo(null),[n,l]=lt(!1),i=j(),s=fo(null),[u,c]=lt(null),[d,a]=lt(null),[p,m]=lt(!1),[f,h]=lt(null),g=Mt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),_=I=>(I.buttons&1)===1;Nr(()=>{let I=new Set;return I1(t.registerMutationListener(Fs,S=>{for(let[C,N]of S)N==="destroyed"?I.delete(C):I.add(C);l(I.size>0)}),t.registerNodeTransform(Fs,S=>{if(S.getColWidths())return S;let C=S.getColumnCount(),N=Bs;return S.setColWidths(Array(C).fill(N)),S}))},[t]),Nr(()=>{if(!n)return;let I=M=>{let L=M.target;if(R1(L)){if(f){c({x:M.clientX,y:M.clientY});return}if(m(_(M)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let D=L1(L);D&&d!==D?t.getEditorState().read(()=>{let E=Sr(D.elem);if(!E)throw new Error("TableCellResizer: Table cell node not found.");let $=Er(E),H=y1($,t.getElementByKey($.getKey()));if(!H)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=H.getBoundingClientRect(),a(D)},{editor:t}):D==null&&g()}}},S=M=>{m(!0)},C=M=>{m(!1)},N=t.registerRootListener((M,L)=>{L?.removeEventListener("mousemove",I),L?.removeEventListener("mousedown",S),L?.removeEventListener("mouseup",C),M?.addEventListener("mousemove",I),M?.addEventListener("mousedown",S),M?.addEventListener("mouseup",C)});return()=>{N()}},[d,f,t,n,g]);let T=I=>I==="bottom",v=Mt(I=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Sr(d.elem);if(!$s(S))throw new Error("TableCellResizer: Table cell node not found.");let C=Er(S),N=S1(S),M=C.getChildren(),D=S.getColSpan()===C.getColumnCount()?N:N+S.getRowSpan()-1;if(D>=M.length||D<0)throw new Error("Expected table cell to be inside of table row.");let E=M[D];if(!N1(E))throw new Error("Expected table row");let $=E.getHeight();if($===void 0){let W=E.getChildren();$=Math.min(...W.map(Y=>b(Y,t)??1/0))}let H=Math.max($+I,M1);E.setHeight(H)},{tag:"skip-scroll-into-view"})},[d,t]),b=(I,S)=>S.getElementByKey(I.getKey())?.clientHeight,k=(I,S)=>{let C;return S.forEach(N=>{N.forEach((M,L)=>{M.cell===I&&(C=L)})}),C},x=Mt(I=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Sr(d.elem);if(!$s(S))throw new Error("TableCellResizer: Table cell node not found.");let C=Er(S),[N]=E1(C,null,null),M=k(S,N);if(M===void 0)throw new Error("TableCellResizer: Table column not found.");let L=C.getColWidths();if(!L)return;let D=L[M];if(D===void 0)return;let E=[...L],$=Math.max(D+I,Bs);E[M]=$,C.setColWidths(E)},{tag:"skip-scroll-into-view"})},[d,t]),w=Mt(I=>{let S=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y:M}=s.current;if(d===null)return;let L=Ps(C.target);if(T(I)){let D=(C.clientY-M)/L;v(D)}else{let D=(C.clientX-N)/L;x(D)}g(),document.removeEventListener("mouseup",S)}};return S},[d,g,x,v]),R=Mt(I=>S=>{if(S.preventDefault(),S.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:S.clientX,y:S.clientY},c(s.current),h(I),document.addEventListener("mouseup",w(I))},[d,w]),[A,F]=lt({bottom:null,left:null,right:null,top:null});return Nr(()=>{if(d){let{height:I,left:S,top:C,width:N}=d.elem.getBoundingClientRect(),M=Ps(d.elem),L=10,D={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+C+I-L/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${I}px`,left:`${window.scrollX+S+N-L/2}px`,top:`${window.scrollY+C}px`,width:`${L}px`}},E=r.current;f&&u&&E&&(T(f)?(D[f].left=`${window.scrollX+E.left}px`,D[f].top=`${window.scrollY+u.y/M}px`,D[f].height="3px",D[f].width=`${E.width}px`):(D[f].top=`${window.scrollY+E.top}px`,D[f].left=`${window.scrollX+u.x/M}px`,D[f].width="3px",D[f].height=`${E.height}px`),D[f].backgroundColor="#adf"),F(D)}else F({bottom:null,left:null,right:null,top:null})},[d,f,u]),ho("div",{ref:o,children:d!=null&&!p&&_1(Hs.Fragment,{children:[ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:R("right"),style:A.right||void 0}),ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:R("bottom"),style:A.bottom||void 0})]})})}var js=()=>{let t=k1(3),[e]=T1(),o=w1(),r;return t[0]!==e||t[1]!==o?(r=o?v1(ho(D1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as j1}from"react/compiler-runtime";import{jsx as Lr,jsxs as U1,Fragment as G1}from"react/jsx-runtime";import{useLexicalComposerContext as zs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as W1,$getTableColumnIndexFromTableCellNode as V1,$getTableRowIndexFromTableCellNode as K1,$insertTableColumn__EXPERIMENTAL as J1,$insertTableRow__EXPERIMENTAL as X1,$isTableCellNode as z1,$isTableNode as Ws,getTableElement as Z1,TableNode as Y1}from"@lexical/table";import{$findMatchingParent as q1,mergeRegister as Q1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Vs,isHTMLElement as eh}from"lexical";import{useEffect as Ks,useMemo as th,useRef as Js,useState as go}from"react";import"react";import{createPortal as oh}from"react-dom";import{c as P1}from"react/compiler-runtime";import{useEffect as B1,useRef as H1}from"react";var A1="Expected a function",O1=Math.max,$1=Math.min;function F1(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(A1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?O1(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(x){let w=r,R=i;return r=i=void 0,l=x,d=t.apply(R,w),d}function f(x){return l=x,a=setTimeout(_,e),s?m(x):d}function h(x){let w=x-n,R=x-l,A=e-w;return u?$1(A,c-R):A}function g(x){let w=x-n,R=x-l;return n===void 0||w>=e||w<0||u&&R>=c}function _(){let x=Date.now();if(g(x))return T(x);a=setTimeout(_,h(x))}function T(x){return a=void 0,p&&r?m(x):(r=i=void 0,d)}function v(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function b(){return a===void 0?d:T(Date.now())}function k(){let x=Date.now(),w=g(x);if(r=arguments,i=this,n=x,w){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(_,e),m(n)}return a===void 0&&(a=setTimeout(_,e)),d}return k.cancel=v,k.flush=b,k}var Us=F1;function Gs(t,e,o){let r=P1(6),n=H1(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Us(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),B1(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Xs=20;function rh({anchorElem:t}){let[e]=zs(),o=j(),[r,n]=go(!1),[l,i]=go(!1),[s,u]=go(!1),[c,d]=go({}),a=Js(new Set),p=Js(null),m=Gs(g=>{let{isOutside:_,tableDOMNode:T}=nh(g,o.editorConfig?.lexical);if(_){n(!1),i(!1);return}if(!T)return;p.current=T;let v=null,b=null,k=null;if(e.getEditorState().read(()=>{let L=Vs(T);if(z1(L)){let D=q1(L,E=>Ws(E));if(!Ws(D))return;if(k=Z1(D,e.getElementByKey(D.getKey())),k){let E=D.getChildrenSize(),$=D.getChildAtIndex(0)?.getChildrenSize(),H=K1(L),W=V1(L);H===E-1?v=L:W===$-1&&(b=L)}}},{editor:e}),!k)return;let x=k.parentElement;if(!x)return;let{bottom:w,height:R,left:A,right:F,width:I,y:S}=k.getBoundingClientRect(),C=!1;x&&x.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=x.scrollWidth>x.clientWidth);let{left:N,y:M}=t.getBoundingClientRect();v?(i(!1),n(!0),d({height:Xs,left:C&&x?x.offsetLeft:A-N,top:w-M+5,width:C&&x?x.offsetWidth:I})):b&&(i(!0),n(!1),d({height:R,left:F-N+5,top:S-M,width:Xs}))},50,250),f=th(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);Ks(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),Ks(()=>Q1(e.registerMutationListener(Y1,g=>{e.getEditorState().read(()=>{let _=!1;for(let[T,v]of g)switch(v){case"created":{a.current.add(T),_=!0;break}case"destroyed":{a.current.delete(T),_=!0;break}default:break}if(_){f.disconnect();for(let T of a.current){let{tableElement:v}=W1(T);f.observe(v)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{p.current&&(Vs(p.current)?.selectEnd(),g?(X1(),n(!1)):(J1(),i(!1)))})};return e?.isEditable()?U1(G1,{children:[r&&Lr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&Lr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function nh(t,e){let o=t.target;if(eh(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Zs(t){let e=j1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=zs();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=oh(Lr(rh,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as lh}from"react/compiler-runtime";import{jsx as yr,jsxs as ih}from"react/jsx-runtime";import{useLexicalComposerContext as sh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as ah}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ch,TableCellNode as uh,TableNode as dh,TableRowNode as mh}from"@lexical/table";import{mergeRegister as ph}from"@lexical/utils";import{formatDrawerSlug as fh,useEditDepth as hh}from"@payloadcms/ui";import{$getSelection as gh,$isRangeSelection as xh,COMMAND_PRIORITY_EDITOR as Ch,createCommand as bh}from"lexical";import{createContext as kh,use as _h,useEffect as Th,useMemo as wh,useState as Eh}from"react";import*as Ys from"react";var xo=bh("OPEN_EMBED_DRAWER_COMMAND"),qs=kh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Qs({children:t}){let[e,o]=Eh({cellEditorConfig:null,cellEditorPlugins:null});return yr(qs,{value:wh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ea=()=>{let t=lh(16),[e]=sh(),o=_h(qs),r=hh(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=fh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=xe(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([dh,mh,uh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return ph(e.registerCommand(xo,()=>{let h=null;return e.getEditorState().read(()=>{let g=gh();xh(g)&&(h=g)}),h&&d(),!0},Ch))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],Th(a,p);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(ch,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=ih(Ys.Fragment,{children:[yr(st,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),yr(ah,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var yh=y({markdownTransformers:[Ls],nodes:[Nh,Sh,Lh],plugins:[{Component:ea,position:"normal"},{Component:js,position:"normal"},{Component:Os,position:"floatingAnchorElem"},{Component:Zs,position:"floatingAnchorElem"}],providers:[Qs],slashMenu:{groups:[ee([{Icon:hr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:hr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]}});import{$isNodeSelection as lg}from"lexical";import{jsx as Ir,jsxs as Ih}from"react/jsx-runtime";import"react";var Rr=()=>Ih("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ir("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ir("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ah}from"react/jsx-runtime";import ra from"bson-objectid";import{$applyNodeReplacement as Oh}from"lexical";import*as na from"react";import{jsx as Rh}from"react/jsx-runtime";import{DecoratorBlockNode as vh}from"@lexical/react/LexicalDecoratorBlockNode.js";import ta from"bson-objectid";import{$applyNodeReplacement as Mh}from"lexical";import"react";function vr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function Dh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:oa({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||vr(e),null}var Dt=class extends vh{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:Dh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ta.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=oa({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return Rh(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function oa({data:t}){return t?.id||(t.id=new ta.default().toHexString()),Mh(new Dt({data:t}))}var $h=na.lazy(()=>import("./component-3PENNOM3.js").then(t=>({default:t.UploadComponent})));function Fh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Ge({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||vr(e),null}var Ie=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:Fh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ra.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ge({data:o});return r.setFormat(e.format),r}decorate(){return Ah($h,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge({data:t}){return t?.id||(t.id=new ra.default().toHexString()),Oh(new Ie({data:t}))}function Mr(t){return t instanceof Ie}import{c as Vh}from"react/compiler-runtime";import{jsx as Kh}from"react/jsx-runtime";import{useLexicalComposerContext as Jh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Xh,mergeRegister as zh}from"@lexical/utils";import{useConfig as Zh}from"@payloadcms/ui";import{$getPreviousSelection as Yh,$getSelection as qh,$isParagraphNode as Qh,$isRangeSelection as eg,COMMAND_PRIORITY_EDITOR as tg,createCommand as og}from"lexical";import{useEffect as rg}from"react";import{c as la}from"react/compiler-runtime";import{jsx as Dr}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{toast as Ph}from"@payloadcms/ui";import{$getNodeByKey as Bh,COMMAND_PRIORITY_EDITOR as sa}from"lexical";import{useEffect as aa,useState as Hh}from"react";var jh=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Bh(o);n&&n.replace(Ge({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Ar,{fields:null,relationTo:e,value:r})},Uh=t=>{let e=la(13),{enabledCollectionSlugs:o}=t,[r]=ia(),[n,l]=Hh(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=yt(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),sa),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),aa(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:g,doc:_}=h;s(),jh({editor:r,relationTo:g,replaceNodeKey:n,value:_.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=Dr(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},Gh=()=>{let t=la(3),[e]=ia(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,Wh,sa),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),aa(o,r),null},ca=t=>Dr(Ot,{...t,FallbackComponent:Gh,uploads:!0,children:Dr(Uh,{...t})});function Wh(){return Ph.error("No upload collections enabled"),!0}var Ar=og("INSERT_UPLOAD_COMMAND"),ua=t=>{let e=Vh(5),[o]=Jh(),{config:r}=Zh(),{collections:n}=r,l,i;e[0]!==o?(l=()=>{if(!o.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return zh(o.registerCommand(Ar,u=>(o.update(()=>{let c=qh()||Yh();if(eg(c)){let d=Ge({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}}),{focus:a}=c,p=a.getNode();Xh(d),Qh(p)&&!p.__first&&p.remove()}}),!0),tg))},i=[o],e[0]=o,e[1]=l,e[2]=i):(l=e[1],i=e[2]),rg(l,i);let s;return e[3]!==n?(s=Kh(ca,{enabledCollectionSlugs:n.map(ng)}),e[3]=n,e[4]=s):s=e[4],s};function ng(t){let{slug:e}=t;return e}var ig=y({nodes:[Ie],plugins:[{Component:ua,position:"normal"}],slashMenu:{groups:[ee([{Icon:Rr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Rr,isActive:({selection:t})=>{if(!lg(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Mr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as ag}from"react/compiler-runtime";import{jsx as $r}from"react/jsx-runtime";import{ShimmerEffect as cg,useConfig as ug}from"@payloadcms/ui";import{lazy as dg,Suspense as mg,useEffect as pg,useState as fg}from"react";var da={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Co={namespace:"lexical",theme:da};function ma({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let c of l.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}import{deepMerge as sg}from"payload/shared";var pa=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?sg(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Or(t,e,o){return{admin:o,features:pa(t),lexical:e,resolvedFeatureMap:t}}var hg=dg(()=>import("./Field-Q3PTZQ75.js").then(t=>({default:t.RichText}))),gg=t=>{let e=ag(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?Co:s,{config:p}=ug(),[m,f]=fg(null),h,g;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let T=[];for(let[k,x]of Object.entries(r))x.clientFeatureProvider&&T.push(x.clientFeatureProvider(x.clientFeatureProps));let v=a||Co,b=ma({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:T,lexical:v}});f(Or(b,v,d))},g=[a,d,m,r,n,l,i,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=g):(h=e[11],g=e[12]),pg(h,g);let _;return e[13]!==m||e[14]!==t?(_=$r(mg,{fallback:$r(cg,{height:"35vh"}),children:m&&$r(hg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=_):_=e[15],_};function xg(t){return t instanceof HTMLElement}function Cg(...t){return t.filter(Boolean).join(" ")}var bo=new WeakMap;function fa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function ko(t,e){let o=bo.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=fa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=fa(i);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},bo.set(t,o)}return o.listeners.add(e),()=>{bg(t,e)}}function bg(t,e){let o=bo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(bo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function kg(t,e){return ko(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function _g(t,e){return ko(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Tg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function wg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Eg}from"react/compiler-runtime";import{jsx as Sg}from"react/jsx-runtime";import"react";var Ng=()=>{let t=Eg(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?Sg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Lg}from"react/compiler-runtime";import{jsx as yg}from"react/jsx-runtime";import"react";var Ig=()=>{let t=Lg(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?yg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Rg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=()=>{let t=Rg(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?vg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Dg}from"react/compiler-runtime";import{jsx as Ag}from"react/jsx-runtime";import"react";var Og=t=>{let e=Dg(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?Ag(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as $g}from"react/compiler-runtime";import{jsx as Fg}from"react/jsx-runtime";import"react";var Pg=t=>{let e=$g(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=Oe(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?Fg(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as Bg}from"react/compiler-runtime";import{jsx as Hg}from"react/jsx-runtime";import"react";var jg=()=>{let t=Bg(2),{EditButton:e}=Oe(),o;return t[0]!==e?(o=e?Hg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Ug}from"react/compiler-runtime";import{jsx as Gg}from"react/jsx-runtime";import"react";var Wg=()=>{let t=Ug(2),{RemoveButton:e}=Oe(),o;return t[0]!==e?(o=e?Gg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Vg}from"qs-esm";var Kg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=Vg({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};import{c as Jg}from"react/compiler-runtime";import{jsx as At}from"react/jsx-runtime";import{FieldContext as Xg,FieldPathContext as ha,ServerFunctionsContext as ga,useServerFunctions as zg}from"@payloadcms/ui";import Zg from"react";var Yg=t=>{let e=Jg(24),{name:o,admin:r,editorTarget:n,path:l}=t,[i,s]=Zg.useState(null),u=zg(),{serverFunction:c}=u,d;e[0]!==n?(d=n.split("."),e[0]=n,e[1]=d):d=e[1];let a,p,m;e[2]!==d?([p,a,...m]=d,e[2]=d,e[3]=a,e[4]=p,e[5]=m):(a=e[3],p=e[4],m=e[5]);let f;e[6]!==r||e[7]!==n||e[8]!==a||e[9]!==m||e[10]!==o||e[11]!==l||e[12]!==c?(f=b=>{(async function(){let{Component:w}=await c({name:"render-lexical",args:{name:o,admin:r,editorTarget:n,initialValue:b?.initialValue??void 0,path:l,schemaPath:`${a}.${m.join(".")}`}});s(w)})()},e[6]=r,e[7]=n,e[8]=a,e[9]=m,e[10]=o,e[11]=l,e[12]=c,e[13]=f):f=e[13];let h=f,g;e[14]!==i||e[15]!==a||e[16]!==p||e[17]!==o||e[18]!==l||e[19]!==u?(g=function(k){let{setValue:x,value:w}=k;if(!i)return null;let R={...u,getFormState:async I=>u.getFormState({...I,collectionSlug:p==="collection"?a:void 0,globalSlug:p==="global"?a:void 0})},A=l??o;if(typeof w>"u"&&!x)return At(ga,{value:{...R},children:At(ha,{value:A,children:i},A)});let F={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:w,path:A,setValue:x??qg,showError:!1,value:w};return At(ga,{value:{...R},children:At(ha,{value:A,children:At(Xg,{value:F,children:i})},A)})},e[14]=i,e[15]=a,e[16]=p,e[17]=o,e[18]=l,e[19]=u,e[20]=g):g=e[20];let T=g,v;return e[21]!==T||e[22]!==h?(v={Component:T,renderLexical:h},e[21]=T,e[22]=h,e[23]=v):v=e[23],v};function qg(){}function Qg({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{Ct as $createAutoLinkNode,Kt as $createBlockNode,To as $createInlineBlockNode,_e as $createLinkNode,je as $createRelationshipNode,Ge as $createUploadNode,we as $isAutoLinkNode,ft as $isBlockNode,wo as $isInlineBlockNode,Z as $isLinkNode,cr as $isRelationshipNode,Mr as $isUploadNode,Ia as AlignFeatureClient,Te as AutoLinkNode,Pg as BlockCollapsible,jg as BlockEditButton,be as BlockNode,Wg as BlockRemoveButton,Aa as BlockquoteFeatureClient,vc as BlocksFeatureClient,eu as BoldFeatureClient,ce as CAN_USE_DOM,ep as ChecklistFeatureClient,Wp as DETAIL_TYPE_TO_DETAIL,Hp as DOUBLE_LINE_BREAK,tf as DebugJsxConverterFeatureClient,Kp as ELEMENT_FORMAT_TO_TYPE,Vp as ELEMENT_TYPE_TO_FORMAT,Ta as ENABLE_SLASH_MENU_COMMAND,Ca as EditorConfigProvider,st as FieldsDrawer,E0 as FixedToolbarFeatureClient,Ju as HeadingFeatureClient,ud as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,Pp as IS_ALL_FORMATTING,Nd as IndentFeatureClient,Og as InlineBlockContainer,Ng as InlineBlockEditButton,Mg as InlineBlockLabel,_o as InlineBlockNode,Ig as InlineBlockRemoveButton,lu as InlineCodeFeatureClient,O0 as InlineToolbarFeatureClient,cu as ItalicFeatureClient,Up as LTR_REGEX,Tp as LexicalPluginToLexicalFeatureClient,Bm as LinkFeatureClient,ie as LinkNode,Bp as NON_BREAKING_SPACE,O as NodeFormat,ap as OrderedListFeatureClient,Rp as ParagraphFeatureClient,ka as Point,jp as RTL_REGEX,wa as Rect,Uf as RelationshipFeatureClient,Se as RelationshipNode,gg as RichTextField,yp as SlateToLexicalFeatureClient,fu as StrikethroughFeatureClient,Cu as SubscriptFeatureClient,Tu as SuperscriptFeatureClient,Jp as TEXT_MODE_TO_TYPE,Gp as TEXT_TYPE_TO_FORMAT,Xp as TEXT_TYPE_TO_MODE,he as TOGGLE_LINK_COMMAND,yh as TableFeatureClient,Vc as TestRecorderFeatureClient,Pu as TextStateFeatureClient,It as ToolbarButton,Ue as ToolbarDropdown,Zc as TreeViewFeatureClient,Lu as UnderlineFeatureClient,gp as UnorderedListFeatureClient,ig as UploadFeatureClient,Ie as UploadNode,wg as addSwipeDownListener,kg as addSwipeLeftListener,_g as addSwipeRightListener,Tg as addSwipeUpListener,Qg as buildEditorState,jo as createBlockNode,y as createClientFeature,of as defaultColors,Co as defaultEditorLexicalConfig,fr as getDOMRangeRect,Ea as getEnabledNodes,Kg as getRestPopulateFn,ze as getSelectedNode,xg as isHTMLElement,_a as isPoint,Cg as joinClasses,Or as sanitizeClientEditorConfig,pa as sanitizeClientFeatures,so as setFloatingElemPosition,to as setFloatingElemPositionForLinkEditor,ee as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,Go as toolbarFeatureButtonsGroupWithItems,te as toolbarFormatGroupWithItems,le as toolbarTextDropdownGroupWithItems,Oe as useBlockComponentContext,j as useEditorConfigContext,Ce as useInlineBlockComponentContext,ba as useLexicalDocumentDrawer,xe as useLexicalDrawer,yt as useLexicalListDrawer,Yg as useRenderEditor_internal_};
41
41
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rscEntry.d.ts","sourceRoot":"","sources":["../../src/field/rscEntry.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EAGV,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,aAAa,CAAA;AAOpB,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CACzC;IACE,KAAK,EAAE,sBAAsB,CAAA;IAC7B,qBAAqB,EAAE,2BAA2B,CAAA;CACnD,GAAG,oBAAoB,GACtB,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GACxB,oBAAoB,CAkFvB,CAAA"}
1
+ {"version":3,"file":"rscEntry.d.ts","sourceRoot":"","sources":["../../src/field/rscEntry.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EAGV,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,aAAa,CAAA;AAOpB,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CACzC;IACE,KAAK,EAAE,sBAAsB,CAAA;IAC7B,qBAAqB,EAAE,2BAA2B,CAAA;CACnD,GAAG,oBAAoB,GACtB,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GACxB,oBAAoB,CAwFvB,CAAA"}
@@ -58,6 +58,12 @@ export const RscEntryLexicalField = async args => {
58
58
  if (args.admin?.hideInsertParagraphAtEnd) {
59
59
  admin.hideInsertParagraphAtEnd = true;
60
60
  }
61
+ if (args.admin?.hideAddBlockButton) {
62
+ admin.hideAddBlockButton = true;
63
+ }
64
+ if (args.admin?.hideDraggableBlockElement) {
65
+ admin.hideDraggableBlockElement = true;
66
+ }
61
67
  const props = {
62
68
  clientFeatures,
63
69
  featureClientImportMap,
@@ -1 +1 @@
1
- {"version":3,"file":"rscEntry.js","names":["getTranslation","renderField","React","RichTextField","buildInitialState","initLexicalFeatures","RscEntryLexicalField","args","field","path","clientField","name","schemaPath","Error","clientFeatures","featureClientImportMap","featureClientSchemaMap","clientFieldSchemaMap","fieldSchemaMap","i18n","payload","sanitizedEditorConfig","initialLexicalFormState","siblingData","root","children","length","context","id","collectionSlug","documentData","data","lexicalFieldSchemaPath","operation","permissions","preferences","renderFieldFn","req","nodeData","placeholderFromArgs","admin","placeholder","undefined","hideGutter","hideInsertParagraphAtEnd","props","forceRender","lexicalEditorConfig","lexical","readOnly","renderedBlocks","Object","keys","key","_jsx"],"sources":["../../src/field/rscEntry.tsx"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientComponentProps,\n FieldPaths,\n RichTextFieldClient,\n RichTextField as RichTextFieldType,\n ServerComponentProps,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { renderField } from '@payloadcms/ui/forms/renderField'\nimport React from 'react'\n\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type {\n LexicalFieldAdminClientProps,\n LexicalFieldAdminProps,\n LexicalRichTextFieldProps,\n} from '../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { RichTextField } from '../exports/client/index.js'\nimport { buildInitialState } from '../utilities/buildInitialState.js'\nimport { initLexicalFeatures } from '../utilities/initLexicalFeatures.js'\n\nexport const RscEntryLexicalField: React.FC<\n {\n admin: LexicalFieldAdminProps\n sanitizedEditorConfig: SanitizedServerEditorConfig\n } & ClientComponentProps &\n Pick<FieldPaths, 'path'> &\n ServerComponentProps\n> = async (args) => {\n const field: RichTextFieldType = args.field as RichTextFieldType\n const path = args.path ?? (args.clientField as RichTextFieldClient).name\n const schemaPath = args.schemaPath ?? path\n\n if (!(args?.clientField as RichTextFieldClient)?.name) {\n throw new Error('Initialized lexical RSC field without a field name')\n }\n\n const { clientFeatures, featureClientImportMap, featureClientSchemaMap } = initLexicalFeatures({\n clientFieldSchemaMap: args.clientFieldSchemaMap,\n fieldSchemaMap: args.fieldSchemaMap,\n i18n: args.i18n,\n path,\n payload: args.payload,\n sanitizedEditorConfig: args.sanitizedEditorConfig,\n schemaPath,\n })\n\n let initialLexicalFormState = {}\n if (args.siblingData?.[field.name]?.root?.children?.length) {\n initialLexicalFormState = await buildInitialState({\n context: {\n id: args.id,\n clientFieldSchemaMap: args.clientFieldSchemaMap,\n collectionSlug: args.collectionSlug,\n documentData: args.data,\n field,\n fieldSchemaMap: args.fieldSchemaMap,\n lexicalFieldSchemaPath: schemaPath,\n operation: args.operation,\n permissions: args.permissions,\n preferences: args.preferences,\n renderFieldFn: renderField,\n req: args.req,\n },\n nodeData: args.siblingData?.[field.name]?.root?.children as SerializedLexicalNode[],\n })\n }\n\n const placeholderFromArgs = args.admin?.placeholder\n const placeholder = placeholderFromArgs\n ? getTranslation(placeholderFromArgs, args.i18n)\n : undefined\n\n const admin: LexicalFieldAdminClientProps = {}\n if (placeholder) {\n admin.placeholder = placeholder\n }\n if (args.admin?.hideGutter) {\n admin.hideGutter = true\n }\n if (args.admin?.hideInsertParagraphAtEnd) {\n admin.hideInsertParagraphAtEnd = true\n }\n\n const props: LexicalRichTextFieldProps = {\n clientFeatures,\n featureClientImportMap,\n featureClientSchemaMap, // TODO: Does client need this? Why cant this just live in the server\n field: args.clientField as RichTextFieldClient,\n forceRender: args.forceRender,\n initialLexicalFormState,\n lexicalEditorConfig: args.sanitizedEditorConfig.lexical,\n path,\n permissions: args.permissions,\n readOnly: args.readOnly,\n renderedBlocks: args.renderedBlocks,\n schemaPath,\n }\n if (Object.keys(admin).length) {\n props.admin = admin\n }\n\n for (const key in props) {\n if (props[key as keyof LexicalRichTextFieldProps] === undefined) {\n delete props[key as keyof LexicalRichTextFieldProps]\n }\n }\n\n return <RichTextField {...props} />\n}\n"],"mappings":";AASA,SAASA,cAAc,QAAQ;AAC/B,SAASC,WAAW,QAAQ;AAC5B,OAAOC,KAAA,MAAW;AASlB;AACA,SAASC,aAAa,QAAQ;AAC9B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,mBAAmB,QAAQ;AAEpC,OAAO,MAAMC,oBAAA,GAOT,MAAOC,IAAA;EACT,MAAMC,KAAA,GAA2BD,IAAA,CAAKC,KAAK;EAC3C,MAAMC,IAAA,GAAOF,IAAA,CAAKE,IAAI,IAAIF,IAAC,CAAKG,WAAW,CAAyBC,IAAI;EACxE,MAAMC,UAAA,GAAaL,IAAA,CAAKK,UAAU,IAAIH,IAAA;EAEtC,IAAI,CAAEF,IAAA,EAAMG,WAAA,EAAqCC,IAAA,EAAM;IACrD,MAAM,IAAIE,KAAA,CAAM;EAClB;EAEA,MAAM;IAAEC,cAAc;IAAEC,sBAAsB;IAAEC;EAAsB,CAAE,GAAGX,mBAAA,CAAoB;IAC7FY,oBAAA,EAAsBV,IAAA,CAAKU,oBAAoB;IAC/CC,cAAA,EAAgBX,IAAA,CAAKW,cAAc;IACnCC,IAAA,EAAMZ,IAAA,CAAKY,IAAI;IACfV,IAAA;IACAW,OAAA,EAASb,I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AAA,CAAKiC,KAAK,EAAEI,wBAAA,EAA0B;IACxCJ,KAAA,CAAMI,wBAAwB,GAAG;EACnC;EAEA,MAAMC,KAAA,GAAmC;IACvC/B,cAAA;IACAC,sBAAA;IACAC,sBAAA;IACAR,KAAA,EAAOD,IAAA,CAAKG,WAAW;IACvBoC,WAAA,EAAavC,IAAA,CAAKuC,WAAW;IAC7BxB,uBAAA;IACAyB,mBAAA,EAAqBxC,IAAA,CAAKc,qBAAqB,CAAC2B,OAAO;IACvDvC,IAAA;IACAyB,WAAA,EAAa3B,IAAA,CAAK2B,WAAW;IAC7Be,QAAA,EAAU1C,IAAA,CAAK0C,QAAQ;IACvBC,cAAA,EAAgB3C,IAAA,CAAK2C,cAAc;IACnCtC;EACF;EACA,IAAIuC,MAAA,CAAOC,IAAI,CAACZ,KAAA,EAAOd,MAAM,EAAE;IAC7BmB,KAAA,CAAML,KAAK,GAAGA,KAAA;EAChB;EAEA,KAAK,MAAMa,GAAA,IAAOR,KAAA,EAAO;IACvB,IAAIA,KAAK,CAACQ,GAAA,CAAuC,KAAKX,SAAA,EAAW;MAC/D,OAAOG,KAAK,CAACQ,GAAA,CAAuC;IACtD;EACF;EAEA,oBAAOC,IAAA,CAACnD,aAAA;IAAe,GAAG0C;;AAC5B","ignoreList":[]}
1
+ {"version":3,"file":"rscEntry.js","names":["getTranslation","renderField","React","RichTextField","buildInitialState","initLexicalFeatures","RscEntryLexicalField","args","field","path","clientField","name","schemaPath","Error","clientFeatures","featureClientImportMap","featureClientSchemaMap","clientFieldSchemaMap","fieldSchemaMap","i18n","payload","sanitizedEditorConfig","initialLexicalFormState","siblingData","root","children","length","context","id","collectionSlug","documentData","data","lexicalFieldSchemaPath","operation","permissions","preferences","renderFieldFn","req","nodeData","placeholderFromArgs","admin","placeholder","undefined","hideGutter","hideInsertParagraphAtEnd","hideAddBlockButton","hideDraggableBlockElement","props","forceRender","lexicalEditorConfig","lexical","readOnly","renderedBlocks","Object","keys","key","_jsx"],"sources":["../../src/field/rscEntry.tsx"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientComponentProps,\n FieldPaths,\n RichTextFieldClient,\n RichTextField as RichTextFieldType,\n ServerComponentProps,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { renderField } from '@payloadcms/ui/forms/renderField'\nimport React from 'react'\n\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type {\n LexicalFieldAdminClientProps,\n LexicalFieldAdminProps,\n LexicalRichTextFieldProps,\n} from '../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { RichTextField } from '../exports/client/index.js'\nimport { buildInitialState } from '../utilities/buildInitialState.js'\nimport { initLexicalFeatures } from '../utilities/initLexicalFeatures.js'\n\nexport const RscEntryLexicalField: React.FC<\n {\n admin: LexicalFieldAdminProps\n sanitizedEditorConfig: SanitizedServerEditorConfig\n } & ClientComponentProps &\n Pick<FieldPaths, 'path'> &\n ServerComponentProps\n> = async (args) => {\n const field: RichTextFieldType = args.field as RichTextFieldType\n const path = args.path ?? (args.clientField as RichTextFieldClient).name\n const schemaPath = args.schemaPath ?? path\n\n if (!(args?.clientField as RichTextFieldClient)?.name) {\n throw new Error('Initialized lexical RSC field without a field name')\n }\n\n const { clientFeatures, featureClientImportMap, featureClientSchemaMap } = initLexicalFeatures({\n clientFieldSchemaMap: args.clientFieldSchemaMap,\n fieldSchemaMap: args.fieldSchemaMap,\n i18n: args.i18n,\n path,\n payload: args.payload,\n sanitizedEditorConfig: args.sanitizedEditorConfig,\n schemaPath,\n })\n\n let initialLexicalFormState = {}\n if (args.siblingData?.[field.name]?.root?.children?.length) {\n initialLexicalFormState = await buildInitialState({\n context: {\n id: args.id,\n clientFieldSchemaMap: args.clientFieldSchemaMap,\n collectionSlug: args.collectionSlug,\n documentData: args.data,\n field,\n fieldSchemaMap: args.fieldSchemaMap,\n lexicalFieldSchemaPath: schemaPath,\n operation: args.operation,\n permissions: args.permissions,\n preferences: args.preferences,\n renderFieldFn: renderField,\n req: args.req,\n },\n nodeData: args.siblingData?.[field.name]?.root?.children as SerializedLexicalNode[],\n })\n }\n\n const placeholderFromArgs = args.admin?.placeholder\n const placeholder = placeholderFromArgs\n ? getTranslation(placeholderFromArgs, args.i18n)\n : undefined\n\n const admin: LexicalFieldAdminClientProps = {}\n if (placeholder) {\n admin.placeholder = placeholder\n }\n if (args.admin?.hideGutter) {\n admin.hideGutter = true\n }\n if (args.admin?.hideInsertParagraphAtEnd) {\n admin.hideInsertParagraphAtEnd = true\n }\n if (args.admin?.hideAddBlockButton) {\n admin.hideAddBlockButton = true\n }\n if (args.admin?.hideDraggableBlockElement) {\n admin.hideDraggableBlockElement = true\n }\n\n const props: LexicalRichTextFieldProps = {\n clientFeatures,\n featureClientImportMap,\n featureClientSchemaMap, // TODO: Does client need this? Why cant this just live in the server\n field: args.clientField as RichTextFieldClient,\n forceRender: args.forceRender,\n initialLexicalFormState,\n lexicalEditorConfig: args.sanitizedEditorConfig.lexical,\n path,\n permissions: args.permissions,\n readOnly: args.readOnly,\n renderedBlocks: args.renderedBlocks,\n schemaPath,\n }\n if (Object.keys(admin).length) {\n props.admin = admin\n }\n\n for (const key in props) {\n if (props[key as keyof LexicalRichTextFieldProps] === undefined) {\n delete props[key as keyof LexicalRichTextFieldProps]\n }\n }\n\n return <RichTextField {...props} />\n}\n"],"mappings":";AASA,SAASA,cAAc,QAAQ;AAC/B,SAASC,WAAW,QAAQ;AAC5B,OAAOC,KAAA,MAAW;AASlB;AACA,SAASC,aAAa,QAAQ;AAC9B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,mBAAmB,QAAQ;AAEpC,OAAO,MAAMC,oBAAA,GAOT,MAAOC,IAAA;EACT,MAAMC,KAAA,GAA2BD,IAAA,CAAKC,KAAK;EAC3C,MAAMC,IAAA,GAAOF,IAAA,CAAKE,IAAI,IAAIF,IAAC,CAAKG,WAAW,CAAyBC,IAAI;EACxE,MAAMC,UAAA,GAAaL,IA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,SAAA,EAAW;MAC/D,OAAOK,KAAK,CAACQ,GAAA,CAAuC;IACtD;EACF;EAEA,oBAAOC,IAAA,CAACrD,aAAA;IAAe,GAAG4C;;AAC5B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalEditor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAIhE,OAAO,sBAAsB,CAAA;AAY7B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC;IACE,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1D,oBAAoB,EAAE,OAAO,CAAA;CAC9B,GAAG,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,CAAC,CA6J5D,CAAA"}
1
+ {"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalEditor.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAIhE,OAAO,sBAAsB,CAAA;AAY7B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC;IACE,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC1D,oBAAoB,EAAE,OAAO,CAAA;CAC9B,GAAG,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,CAAC,CAiK5D,CAAA"}
@@ -125,9 +125,9 @@ export const LexicalEditor = props => {
125
125
  onChange: t4
126
126
  }), floatingAnchorElem && _jsxs(React.Fragment, {
127
127
  children: [!isSmallWidthViewport && editor.isEditable() && _jsxs(React.Fragment, {
128
- children: [_jsx(DraggableBlockPlugin, {
128
+ children: [editorConfig.admin?.hideDraggableBlockElement ? null : _jsx(DraggableBlockPlugin, {
129
129
  anchorElem: floatingAnchorElem
130
- }), _jsx(AddBlockHandlePlugin, {
130
+ }), editorConfig.admin?.hideAddBlockButton ? null : _jsx(AddBlockHandlePlugin, {
131
131
  anchorElem: floatingAnchorElem
132
132
  })]
133
133
  }), editorConfig.features.plugins?.map(plugin_1 => {
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalEditor.js","names":["c","_c","useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","editorConfigContext","editor","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","t4","editorState","editor_0","tags","has","size","_jsxs","Fragment","children","features","plugins","map","_temp","className","ref","_temp2","_jsx","contentEditable","ignoreSelectionChange","isEditable","anchorElem","plugin_1","plugin","position","desktopOnly","clientProps","key","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n <InsertParagraphAtEndPlugin />\n <DecoratorPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ;AAClE,YAAYC,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,QAAQ,QAAQ;AAIpC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,YAAY,QAAQ;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AAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAjExE,SAAAG,OAAAI,QAAA;EAAA,IAuIUX,QAAA,CAAAC,QAAA,KAAoB;IAAA,OAEpBP,IAAA,CAAA3D,YAAA;MAAAoE,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAzIxE,SAAAI,OAAAI,QAAA;EAAA,IA8IUZ,QAAA,CAAAC,QAAA,KAAoB;IAAA,OAEpBP,IAAA,CAAA3D,YAAA;MAAAoE,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA;AAhJxE,SAAAK,OAAAI,QAAA;EAAA,IAsJQb,QAAA,CAAAC,QAAA,KAAoB;IAAA,OACfP,IAAA,CAAA3D,YAAA;MAAAoE,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"LexicalEditor.js","names":["c","_c","useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","editorConfigContext","editor","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","t4","editorState","editor_0","tags","has","size","_jsxs","Fragment","children","features","plugins","map","_temp","className","ref","_temp2","_jsx","contentEditable","ignoreSelectionChange","isEditable","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","plugin_1","plugin","position","desktopOnly","clientProps","key","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n <InsertParagraphAtEndPlugin />\n <DecoratorPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ;AAClE,YAAYC,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,QAAQ,QAAQ;AAIpC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,YAAY,QAAQ;AAE7B,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,aAAA,GAKTC,KAAA;EAAA,MAAAC,CAAA,GAAA1B,EAAA;EACF;IAAA2B,YAAA;IAAAC,kBAAA;IAAAC,oBAAA;IAAAC;EAAA,IAA6EL,KAAA;EAC7E,MAAAM,mBAAA,GAA4BnB,sBAAA;EAC5B,OAAAoB,MAAA,IAAiB/B,yBAAA;EAEjB,OAAAgC,kBAAA,EAAAC,qBAAA,IAAoDvB,QAAA,KAAgC;EAAA,IAAAwB,EAAA;EAAA,IAAAT,CAAA,QAAAU,MAAA,CAAAC,GAAA;IACtEF,EAAA,GAAAG,mBAAA;MAAA,IACRA,mBAAA,SAAwB;QAC1BJ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H,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA","ignoreList":[]}
package/dist/types.d.ts CHANGED
@@ -5,6 +5,14 @@ import type { FeatureProviderServer } from './features/typesServer.js';
5
5
  import type { SanitizedServerEditorConfig } from './lexical/config/types.js';
6
6
  import type { InitialLexicalFormState } from './utilities/buildInitialState.js';
7
7
  export type LexicalFieldAdminProps = {
8
+ /**
9
+ * Controls if the add block button should be hidden. @default false
10
+ */
11
+ hideAddBlockButton?: boolean;
12
+ /**
13
+ * Controls if the draggable block element should be hidden. @default false
14
+ */
15
+ hideDraggableBlockElement?: boolean;
8
16
  /**
9
17
  * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false
10
18
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACzF,OAAO,KAAK,EACV,WAAW,EACX,+BAA+B,EAC/B,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,WAAW,EACZ,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EACV,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AAC5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAE/E,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC;;OAEG;IACH,WAAW,CAAC,EAAE,aAAa,GAAG,WA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S,CAAA;CACrD,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,GACtC,wBAAwB,CAAC,qBAAqB,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;AAEvE,MAAM,MAAM,wBAAwB,GAAG,+BAA+B,CACpE,mBAAmB,CAAC,qBAAqB,EAAE,YAAY,EAAE,MAAM,CAAC,EAChE,qBAAqB,CACtB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,2BAA2B,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,aAAa,EAAE,6BAA6B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACtD,kBAAkB,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAA;CACnD,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type {\n ClientField,\n DefaultServerCellComponentProps,\n LabelFunction,\n RichTextAdapter,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n StaticLabel,\n} from 'payload'\n\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from './features/typesClient.js'\nimport type { FeatureProviderServer } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\nimport type { InitialLexicalFormState } from './utilities/buildInitialState.js'\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n /**\n * Controls if the insert paragraph at the end button should be hidden. @default false\n */\n hideInsertParagraphAtEnd?: boolean\n /**\n * Changes the placeholder text in the editor if no content is present.\n */\n placeholder?: LabelFunction | StaticLabel\n}\n\nexport type LexicalFieldAdminClientProps = {\n placeholder?: string\n} & Omit<LexicalFieldAdminProps, 'placeholder'>\n\nexport type FeaturesInput =\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?: FeaturesInput\n lexical?: LexicalEditorConfig\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & RichTextAdapter<SerializedEditorState, AdapterProps>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n parentIsLocalized,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type SingleFeatureClientSchemaMap = {\n [key: string]: ClientField[]\n}\nexport type FeatureClientSchemaMap = {\n [featureKey: string]: SingleFeatureClientSchemaMap\n}\n\nexport type LexicalRichTextFieldProps = {\n admin?: LexicalFieldAdminClientProps\n // clientFeatures is added through the rsc field\n clientFeatures: {\n [featureKey: string]: {\n clientFeatureProps?: object\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n }\n featureClientImportMap: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n initialLexicalFormState: InitialLexicalFormState\n lexicalEditorConfig: LexicalEditorConfig | undefined // Undefined if default lexical editor config should be used\n} & Pick<ServerFieldBase, 'permissions'> &\n RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>\n\nexport type LexicalRichTextCellProps = DefaultServerCellComponentProps<\n RichTextFieldClient<SerializedEditorState, AdapterProps, object>,\n SerializedEditorState\n>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n clientFeature: FeatureProviderProviderClient<any, any>\n clientFeatureProps: BaseClientFeatureProps<object>\n}\n"],"mappings":"AAkIA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type {\n ClientField,\n DefaultServerCellComponentProps,\n LabelFunction,\n RichTextAdapter,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n StaticLabel,\n} from 'payload'\n\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from './features/typesClient.js'\nimport type { FeatureProviderServer } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\nimport type { InitialLexicalFormState } from './utilities/buildInitialState.js'\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the add block button should be hidden. @default false\n */\n hideAddBlockButton?: boolean\n /**\n * Controls if the draggable block element should be hidden. @default false\n */\n hideDraggableBlockElement?: boolean\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n /**\n * Controls if the insert paragraph at the end button should be hidden. @default false\n */\n hideInsertParagraphAtEnd?: boolean\n /**\n * Changes the placeholder text in the editor if no content is present.\n */\n placeholder?: LabelFunction | StaticLabel\n}\n\nexport type LexicalFieldAdminClientProps = {\n placeholder?: string\n} & Omit<LexicalFieldAdminProps, 'placeholder'>\n\nexport type FeaturesInput =\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?: FeaturesInput\n lexical?: LexicalEditorConfig\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & RichTextAdapter<SerializedEditorState, AdapterProps>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n parentIsLocalized,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type SingleFeatureClientSchemaMap = {\n [key: string]: ClientField[]\n}\nexport type FeatureClientSchemaMap = {\n [featureKey: string]: SingleFeatureClientSchemaMap\n}\n\nexport type LexicalRichTextFieldProps = {\n admin?: LexicalFieldAdminClientProps\n // clientFeatures is added through the rsc field\n clientFeatures: {\n [featureKey: string]: {\n clientFeatureProps?: object\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n }\n featureClientImportMap: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n initialLexicalFormState: InitialLexicalFormState\n lexicalEditorConfig: LexicalEditorConfig | undefined // Undefined if default lexical editor config should be used\n} & Pick<ServerFieldBase, 'permissions'> &\n RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>\n\nexport type LexicalRichTextCellProps = DefaultServerCellComponentProps<\n RichTextFieldClient<SerializedEditorState, AdapterProps, object>,\n SerializedEditorState\n>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n clientFeature: FeatureProviderProviderClient<any, any>\n clientFeatureProps: BaseClientFeatureProps<object>\n}\n"],"mappings":"AA0IA","ignoreList":[]}