@payloadcms/richtext-lexical 3.73.0-canary.3 → 3.73.0-canary.5
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.
- package/dist/exports/client/{Field-2A2VQXKP.js → Field-HJGV32KA.js} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-AFXLIYGL.js → chunk-EZX4YW7S.js} +1 -1
- package/dist/exports/client/{chunk-AFXLIYGL.js.map → chunk-EZX4YW7S.js.map} +2 -2
- package/dist/exports/client/index.js +3 -3
- package/dist/exports/client/index.js.map +1 -1
- package/dist/exports/server/ast/mdx.d.ts.map +1 -1
- package/dist/exports/server/ast/mdx.js +0 -1
- package/dist/exports/server/ast/mdx.js.map +1 -1
- package/dist/field/Diff/index.d.ts.map +1 -1
- package/dist/field/Diff/index.js +36 -1
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -1
- package/dist/packages/@lexical/markdown/MarkdownImport.js.map +1 -1
- package/package.json +9 -9
- /package/dist/exports/client/{Field-2A2VQXKP.js.map → Field-HJGV32KA.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{a as ge,c as dt,d as mt,e as pt}from"./chunk-2S5Q7QYO.js";import{a as Je}from"./chunk-DBWINSQN.js";import{a as ft,b as ze}from"./chunk-QJ5EETIB.js";import{a as he}from"./chunk-INBEEENE.js";import{a as xc}from"./chunk-F26IQ5RE.js";import{b as Jt,c as zt,d as le,e as Xt,f as Cc,g as bc,i as kc,k as _c,l as Tc}from"./chunk-
|
|
1
|
+
"use client";import{a as ge,c as dt,d as mt,e as pt}from"./chunk-2S5Q7QYO.js";import{a as Je}from"./chunk-DBWINSQN.js";import{a as ft,b as ze}from"./chunk-QJ5EETIB.js";import{a as he}from"./chunk-INBEEENE.js";import{a as xc}from"./chunk-F26IQ5RE.js";import{b as Jt,c as zt,d as le,e as Xt,f as Cc,g as bc,i as kc,k as _c,l as Tc}from"./chunk-EZX4YW7S.js";import{a as gc,b as H}from"./chunk-BZZVLW4U.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Lc}from"react/compiler-runtime";import{useLexicalComposerContext as yc}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as xe}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Rc}from"@lexical/utils";import{$getSelection as Ic,$isElementNode as ce,$isNodeSelection as vc,$isRangeSelection as ht,COMMAND_PRIORITY_LOW as Mc,FORMAT_ELEMENT_COMMAND as gt}from"lexical";import{useEffect as Dc}from"react";import{jsx as Po,jsxs as wc}from"react/jsx-runtime";import"react";var ln=()=>wc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Po("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Po("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Po("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bo,jsxs as Ec}from"react/jsx-runtime";import"react";var sn=()=>Ec("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as jo,jsxs as Sc}from"react/jsx-runtime";import"react";var Zt=()=>Sc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[jo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ho,jsxs as Nc}from"react/jsx-runtime";import"react";var an=()=>Nc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ho("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ho("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ho("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var $=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var cn=t=>({type:"dropdown",ChildComponent:Zt,items:t,key:"align",order:30});var Ie=t=>ce(t)?t.getFormatType():t.__format,un=[cn([{ChildComponent:Zt,isActive:({selection:t})=>{if(!ht(t))return!1;for(let e of t.getNodes()){if((ce(e)||xe(e))&&Ie(e)==="left")continue;let o=e.getParent();if(!((ce(o)||xe(o))&&Ie(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(gt,"left")},order:1},{ChildComponent:ln,isActive:({selection:t})=>{if(!ht(t))return!1;for(let e of t.getNodes()){if((ce(e)||xe(e))&&Ie(e)==="center")continue;let o=e.getParent();if(!((ce(o)||xe(o))&&Ie(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(gt,"center")},order:2},{ChildComponent:an,isActive:({selection:t})=>{if(!ht(t))return!1;for(let e of t.getNodes()){if((ce(e)||xe(e))&&Ie(e)==="right")continue;let o=e.getParent();if(!((ce(o)||xe(o))&&Ie(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(gt,"right")},order:3},{ChildComponent:sn,isActive:({selection:t})=>{if(!ht(t))return!1;for(let e of t.getNodes()){if((ce(e)||xe(e))&&Ie(e)==="justify")continue;let o=e.getParent();if(!((ce(o)||xe(o))&&Ie(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(gt,"justify")},order:4}])],$c=()=>{let t=Lc(3),[e]=yc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(gt,Fc,Mc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Dc(o,r),null},Ac=$({plugins:[{Component:$c,position:"normal"}],toolbarFixed:{groups:un},toolbarInline:{groups:un}});function Oc(t){return(ce(t)||xe(t))&&!t.isInline()}function Fc(t){let e=Ic();if(!ht(e)&&!vc(e))return!1;let o=e.getNodes();for(let r of o){let n=Rc(r,Oc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as xn,$isQuoteNode as hn,QuoteNode as jc}from"@lexical/rich-text";import{$setBlocksType as Cn}from"@lexical/selection";import{$getSelection as bn,$isRangeSelection as Hc}from"lexical";import{jsx as dn}from"react/jsx-runtime";import"react";var Uo=()=>dn("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:dn("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as mn}from"react/jsx-runtime";import"react";var xt=()=>mn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:mn("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var te=t=>({type:"dropdown",ChildComponent:xt,items:t,key:"text",order:25});import{$createQuoteNode as Pc,$isQuoteNode as pn,QuoteNode as Bc}from"@lexical/rich-text";var fn={type:"element",dependencies:[Bc],export:(t,e)=>{if(!pn(t))return null;let o=e(t).split(`
|
|
2
2
|
`),r=[];for(let n of o)r.push("> "+n);return r.join(`
|
|
3
3
|
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(pn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Pc();n.append(...e),t.replace(n),n.select(0,0)}};var gn=[te([{ChildComponent:Uo,isActive:({selection:t})=>{if(!Hc(t))return!1;for(let e of t.getNodes())if(!hn(e)&&!hn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=bn();Cn(e,()=>xn())})},order:20}])],Uc=$({markdownTransformers:[fn],nodes:[jc],slashMenu:{groups:[Z([{Icon:Uo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=bn();Cn(e,()=>xn())})}}])]},toolbarFixed:{groups:gn},toolbarInline:{groups:gn}});import{getTranslation as io}from"@payloadcms/translations";import{jsx as Wo,jsxs as Wc}from"react/jsx-runtime";import"react";var Yt=()=>Wc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as kn}from"react/jsx-runtime";import"react";var qt=()=>kn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:kn("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as Gc}from"react/jsx-runtime";import"react";function Qt(t,e){return t?()=>Gc("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Yt}import{$parseSerializedNode as vn}from"lexical";import{JSOX as Go}from"jsox";function eo({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let s=Vc(t,n);e[o]=s.value,n=s.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Vc(t,e){let o=t[e];return o==='"'?_n(t,e):o==="'"?_n(t,e,!0):o==="{"?Jc(t,e):o==="["?Kc(t,e):Xc(t,e)}function Kc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Go.parse(`[${r}]`)}}function _n(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function Jc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:zc(r)}}function zc(t){return t[0]!=="{"?Go.parse(t):Go.parse(t.replace(/(\w+):/g,'"$1":'))}function Xc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function Ct({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${Zc(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,Tn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,Tn)}}`));return e.join(" ")}function Zc(t){return t.replace(/"/g,""")}function Tn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function to({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let s="",i="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,f=0,h=d[0].slice(0,n.index),x=0,w=r;e:for(let[N,_]of d.entries()){let C=l?_.trim():_,g=0;if(l)for(let k=0;k<_.length&&_[k]===" ";k++)g++;let b=0;for(N===0&&(b=(n.index??0)+n[0].length-g);b<C.length;){let k=C[b],y=C[b+1];if(c){if(k==="`"&&f++,f%2===0)if(k==="<"&&y==="/"){if(u--,u<0){i[i.length-1]===`
|
|
4
4
|
`&&(i=i.slice(0,-1)),w=N;for(let R=b;R<C.length;R++)if(C[R]===">"){x=R+1;break}break e}}else if(k==="/"&&y===">"){if(u--,u<0){i[i.length-1]===`
|
|
@@ -57,10 +57,10 @@ ${e.map(ad).join(`
|
|
|
57
57
|
|
|
58
58
|
`,us="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ds="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",g0=new RegExp("^[^"+ds+"]*["+us+"]"),x0=new RegExp("^[^"+us+"]*["+ds+"]"),C0={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},b0={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},k0={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},_0={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},T0={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},w0={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};var ms={text:({node:t})=>{let e=t.text;return t.format&F.IS_BOLD&&(e=je("strong",{children:e})),t.format&F.IS_ITALIC&&(e=je("em",{children:e})),t.format&F.IS_STRIKETHROUGH&&(e=je("span",{style:{textDecoration:"line-through"},children:e})),t.format&F.IS_UNDERLINE&&(e=je("span",{style:{textDecoration:"underline"},children:e})),t.format&F.IS_CODE&&(e=je("code",{children:e})),t.format&F.IS_SUBSCRIPT&&(e=je("sub",{children:e})),t.format&F.IS_SUPERSCRIPT&&(e=je("sup",{children:e})),e}};import{jsx as Dt}from"react/jsx-runtime";var ps={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=e.fields?.alt||o?.alt||"",n=o.url;if(!o.mimeType.startsWith("image"))return Dt("a",{href:n,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Dt("img",{alt:r,height:o.height,src:n,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let d=i?.url;l.push(Dt("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(Dt("img",{alt:r,height:o?.height,src:n,width:o?.width},"image")),Dt("picture",{children:l})}};var nt={...ss,...ms,...rs,...es,...cs,...ts,...os,...is,...ls({}),...ps,...as};import{jsx as hs,Fragment as E0}from"react/jsx-runtime";import _r from"react";function fs(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 gs({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return fs(e)?xs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):hs(E0,{})}function xs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((i,d)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:i,nodesToJSX:p=>xs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:n}}),parent:n}):c:u=hs("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.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(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),_r.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return _r.cloneElement(u,{key:d,style:m})}return _r.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}var Tr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let s={};e?typeof e=="function"?s=e({defaultConverters:nt}):s=e:s=nt;let i=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&gs({converters:s,data:o,disableIndent:n,disableTextAlign:l});return r?Cs(S0,{children:i}):Cs("div",{className:t??"payload-richtext",children:i})};function ks(){let t=N0(7),[e]=L0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=R0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),y0(l,s);let i;return t[5]!==r?(i=bs("div",{className:"debug-jsx-converter",children:bs(Tr,{converters:nt,data:r})}),t[5]=r,t[6]=i):i=t[6],i}var I0=$({plugins:[{Component:ks,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)"}},v0={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 b1}from"lexical";import{jsx as $t,jsxs as M0}from"react/jsx-runtime";import"react";var wr=()=>M0("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:[$t("g",{clipPath:"url(#clip0_4397_10817)",children:$t("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"})}),$t("defs",{children:$t("clipPath",{id:"clip0_4397_10817",children:$t("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as F0}from"react/jsx-runtime";import{$applyNodeReplacement as P0}from"lexical";import*as Ts from"react";import{DecoratorBlockNode as D0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as $0}from"@lexical/utils";import{$applyNodeReplacement as A0}from"lexical";function O0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:_s({relationTo:o,value:e})}:null}var At=class extends D0{__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:O0,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=_s(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return $0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function _s(t){return A0(new At({data:t}))}var B0=Ts.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function j0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:He({relationTo:o,value:e})}:null}var Se=class extends At{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:j0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=He(o);return r.setFormat(e.format),r}decorate(e,o){return F0(B0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function He(t){return P0(new Se({data:t}))}function Er(t){return t instanceof Se}import{c as s1}from"react/compiler-runtime";import{jsx as a1}from"react/jsx-runtime";import{useLexicalComposerContext as c1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as u1}from"@lexical/utils";import{$getPreviousSelection as d1,$getSelection as m1,$isParagraphNode as p1,$isRangeSelection as f1,COMMAND_PRIORITY_EDITOR as h1,createCommand as g1}from"lexical";import{useEffect as x1}from"react";import{c as Ss}from"react/compiler-runtime";import{jsx as Sr}from"react/jsx-runtime";import{useLexicalComposerContext as Ns}from"@lexical/react/LexicalComposerContext.js";import{toast as q0}from"@payloadcms/ui";import{$getNodeByKey as Q0,COMMAND_PRIORITY_EDITOR as Ls}from"lexical";import{useEffect as ys,useState as e1}from"react";import{c as H0}from"react/compiler-runtime";import{jsx as U0}from"react/jsx-runtime";import{useLexicalComposerContext as W0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as G0,useModal as V0}from"@payloadcms/ui";import{$getNodeByKey as ws,$getPreviousSelection as K0,$getRoot as J0,$getSelection as z0,$isRangeSelection as X0,$setSelection as Z0}from"lexical";import{useEffect as Y0,useState as Es}from"react";var Ot=t=>{let e=H0(23),[o]=W0(),[r,n]=Es(null),[l,s]=Es(!1),[i,d,c]=G0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=V0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let R=z0()??K0();n(R)},e[0]=h):h=e[0];let x=h,w;e[1]!==o||e[2]!==r?(w=()=>{r&&o.update(()=>{if(X0(r)){let{anchor:R,focus:M}=r;ws(R.key)&&ws(M.key)&&Z0(r.clone())}else J0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=w):w=e[3];let E=w,N;e[4]!==u?(N=()=>{u()},e[4]=u,e[5]=N):N=e[5];let _=N,C,g;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(C=()=>{if(!l)return;let R=f[a];R&&!R?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},g=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=C,e[11]=g):(C=e[10],g=e[11]),Y0(C,g);let b;e[12]!==d?(b=R=>U0(d,{...R,onClick:()=>{x()}}),e[12]=d,e[13]=b):b=e[13];let k;e[14]!==p?(k=()=>{x(),p(),s(!0)},e[14]=p,e[15]=k):k=e[15];let y;return e[16]!==i||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==b||e[21]!==k?(y={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:b,openListDrawer:k},e[16]=i,e[17]=_,e[18]=m,e[19]=a,e[20]=b,e[21]=k,e[22]=y):y=e[22],y};var t1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Q0(o);n&&n.replace(He({relationTo:e,value:r}))}):t.dispatchCommand(Nr,{relationTo:e,value:r})},o1=t=>{let e=Ss(14),{enabledCollectionSlugs:o}=t,[r]=Ns(),[n,l]=e1(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Ot(i),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Je,x=>(l(x?.replace?x?.replace.nodeKey:null),u(),!0),Ls),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),ys(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=x=>{let{collectionSlug:w,doc:E}=x;t1({editor:r,relationTo:w,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let f=p,h;return e[11]!==c||e[12]!==f?(h=Sr(c,{onSelect:f}),e[11]=c,e[12]=f,e[13]=h):h=e[13],h},r1=()=>{let t=Ss(3),[e]=Ns(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Je,n1,Ls),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ys(o,r),null},Rs=({enabledCollectionSlugs:t})=>t?.length?Sr(o1,{enabledCollectionSlugs:t}):Sr(r1,{});function n1(){return q0.error("No relationship collections enabled"),!0}import{useConfig as l1,useEntityVisibility as i1}from"@payloadcms/ui";import*as Is from"react";var Co=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=l1(),{visibleEntities:l}=i1();return Is.useMemo(()=>{let i=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:f}=a;if(l?.collections.includes(m)){if(r){if(!p||!f)continue}else if(f||!p)continue;c&&!c.has(m)||u&&u.has(m)||(i.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:i}},[n,l,r,o,e])};var Nr=g1("INSERT_RELATIONSHIP_COMMAND"),vs=t=>{let e=s1(8),{clientProps:o}=t,[r]=c1(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=Co(s),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([Se]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Nr,C1,h1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),x1(d,c);let u;return e[6]!==i?(u=a1(Rs,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function C1(t){let e=m1()||d1();if(f1(e)){let o=He(t),{focus:r}=e,n=r.getNode();u1(o),p1(n)&&!n.__first&&n.remove()}return!0}var k1=$({nodes:[Se],plugins:[{Component:vs,position:"normal"}],slashMenu:{groups:[Z([{Icon:wr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:wr,isActive:({selection:t})=>{if(!b1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Er(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]}});import{c as js}from"react/compiler-runtime";import{jsx as se,jsxs as J1}from"react/jsx-runtime";import{useLexicalComposerContext as z1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Hs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as X1,useThrottledEffect as Z1,useTranslation as Y1}from"@payloadcms/ui";import*as Ne from"react";import{useMemo as q1}from"react";import{c as _1}from"react/compiler-runtime";import{jsx as T1}from"react/jsx-runtime";import{mergeRegister as w1}from"@lexical/utils";import{$addUpdateTag as E1,$getSelection as S1}from"lexical";import{useDeferredValue as N1,useEffect as L1,useState as y1}from"react";var Ms="toolbar-popup__button",Ft=t=>{let e=_1(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[s,i]=y1(l),d=N1(s),c=H(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Ms}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Ms,u,a,m].filter(Boolean),e[1]=u,e[2]=a,e[3]=m,e[4]=p):p=e[4];let f=p.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let k=S1();if(!k)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:k}):!1,R=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:k}):!0;i(M=>M.active===y&&M.enabled===R?M:{active:y,enabled:R})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,w=Xt(),E,N;e[9]!==r||e[10]!==w||e[11]!==x?(E=()=>{w(x);let k=()=>w(x),y=w1(r.registerUpdateListener(k));return document.addEventListener("mouseup",k),()=>{y(),document.removeEventListener("mouseup",k)}},N=[r,w,x],e[9]=r,e[10]=w,e[11]=x,e[12]=E,e[13]=N):(E=e[12],N=e[13]),L1(E,N);let _;e[14]!==s||e[15]!==r||e[16]!==n?(_=()=>{s.enabled&&r.focus(()=>{r.update(R1),n.onSelect?.({editor:r,isActive:s.active})})},e[14]=s,e[15]=r,e[16]=n,e[17]=_):_=e[17];let C=_,g=I1,b;return e[18]!==o||e[19]!==f||e[20]!==C||e[21]!==n.key?(b=T1("button",{className:f,"data-button-key":n.key,onClick:C,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=C,e[21]=n.key,e[22]=b):b=e[22],b};function R1(){E1("toolbar")}function I1(t){t.preventDefault()}import{c as F1}from"react/compiler-runtime";import{jsx as lt}from"react/jsx-runtime";import Bs,{useCallback as P1,useDeferredValue as B1,useEffect as j1,useMemo as H1}from"react";import{mergeRegister as U1}from"@lexical/utils";import{useTranslation as W1}from"@payloadcms/ui";import{$getSelection as G1}from"lexical";import{jsx as ve,jsxs as Ds}from"react/jsx-runtime";import{Button as v1}from"@payloadcms/ui";import{$addUpdateTag as M1,isDOMNode as D1}from"lexical";import bo,{useCallback as $1,useEffect as ko,useMemo as As,useRef as Lr,useState as yr}from"react";import{createPortal as A1}from"react-dom";var $s="toolbar-popup__dropdown-item",Os=bo.createContext(null);function Fs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:s,tooltip:i}){let d=As(()=>[$s,r===!1?"disabled":"",t?"active":"",l?.key?`${$s}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Lr(null),u=bo.use(Os);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return ko(()=>{c?.current!=null&&a(c)},[c,a]),ve(v1,{"aria-label":i,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":s},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{M1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function O1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=yr(),[s,i]=yr(),d=$1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?i(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&i(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=As(()=>({registerItem:d}),[d]);return ko(()=>{n!=null&&s==null&&i(n[0]),s!=null&&s?.current!=null&&s.current.focus()},[n,s]),ve(Os,{value:u,children:ve("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Ps({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=Lr(null),u=Lr(null),[a,m]=yr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};ko(()=>{let h=u.current,x=c.current;if(a&&h!==null&&x!==null){let{left:w,top:E}=h.getBoundingClientRect(),N=window.scrollY||document.documentElement.scrollTop;x.style.top=`${E+N+h.offsetHeight+5}px`,x.style.left=`${Math.min(w-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),ko(()=>{let h=u.current;if(h!==null&&a){let x=w=>{let E=w.target;D1(E)&&(d&&c.current&&c.current.contains(E)||h.contains(E)||m(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,u,a,d]);let f=A1(ve(O1,{dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return Ds(bo.Fragment,{children:[Ds("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:u,type:"button",children:[l&&ve(l,{}),i&&ve("span",{className:"toolbar-popup__dropdown-label",children:i}),ve("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&ve(bo.Fragment,{children:f})]})}var Rr="toolbar-popup__dropdown",V1=t=>{let e=F1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:s}=t,{i18n:i}=W1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d;if(s.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==s?(m=s?.Component&<(s.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:s},s.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==i||e[11]!==s||e[12]!==u){let m=s.key,p;s.label&&(m=typeof s.label=="function"?s.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):s.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=lt(Fs,{active:o,editor:n,enabled:l,Icon:s?.ChildComponent?lt(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:lt("span",{className:"text",children:p})},s.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=i,e[11]=s,e[12]=u,e[13]=a}else a=e[13];return a},K1=Bs.memo(V1),Ue=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:s,maxActiveItems:i,onActiveChange:d})=>{let[c,u]=Bs.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=B1(c),m=H(),{items:p,key:f}=r,h=Xt(),x=P1(()=>{o.getEditorState().read(()=>{let E=G1();if(!E)return;let N=[],_=[],C=[];for(let g of p)g.isActive&&(!i||N.length<i)&&g.isActive({editor:o,editorConfigContext:m,selection:E})&&(N.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:E})&&C.push(g.key):C.push(g.key);u({activeItemKeys:N,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:E}):!0,enabledItemKeys:C}),d&&d({activeItems:_})})},[o,m,r,p,i,d]);j1(()=>(h(x),U1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let w=H1(()=>p?.length?p.map(E=>lt(K1,{active:a.activeItemKeys.includes(E.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(E.key),item:E},E.key)):null,[p,a,t,o]);return lt(Ps,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[Rr,`${Rr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${Rr}-items`,...l||[]],label:s,children:w},f)};function Q1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(Ft,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function eh(t){let e=js(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:s}=t,{i18n:i}=Y1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Ne.useState(void 0),[p,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 x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Ne.useEffect(h,x);let w;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==i||e[11]!==u?(w=C=>{let{activeItems:g}=C;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let b=g[0],k=b.key;b.label&&(k=typeof b.label=="function"?b.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):b.label),k.length>25&&(k=k.substring(0,25)+"..."),g.length===1?(m(k),f(()=>b.ChildComponent)):(m(i.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=i,e[11]=u,e[12]=w):w=e[12];let E=w,N=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==s||e[20]!==E||e[21]!==N?(_=J1("div",{className:N,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?se(Ue,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):se(Ue,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):null,l.type==="buttons"&&l.items.length?l.items.map(C=>se(Q1,{anchorElem:o,editor:r,item:C},C.key)):null,s<n.features.toolbarFixed?.groups.length-1&&se("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=s,e[20]=E,e[21]=N,e[22]=_):_=e[22],_}function th({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ne.useRef(null),s=Hs(),{y:i}=X1(),d=q1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Z1(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,i]),se("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&se(Ne.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>se(eh,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Us=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Us(t.parentEditor)}return!1},Ws=t=>{let e=js(6),{clientProps:o}=t,[r]=z1(),n=H();if(!Hs())return null;let{editorConfig:s}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=Us(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=se(th,{anchorElem:document.body,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var oh=$({plugins:[{Component:Ws,position:"aboveContainer"}]});import{c as Ks}from"react/compiler-runtime";import{jsx as de,jsxs as Js}from"react/jsx-runtime";import{useLexicalComposerContext as rh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as nh}from"@lexical/react/useLexicalEditable";import{mergeRegister as zs}from"@lexical/utils";import{$getSelection as Xs,$isRangeSelection as Gs,$isTextNode as lh,COMMAND_PRIORITY_LOW as ih,getDOMSelection as Zs,SELECTION_CHANGE_COMMAND as sh}from"lexical";import{useCallback as To,useEffect as Pt,useRef as Vs,useState as ah}from"react";import*as wo from"react";import{createPortal as ch}from"react-dom";function Ir(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 _o(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=d.top-a.height-c,h=d.left-l;s==="center"&&(h=d.left+d.width/2-a.width/2);let x=0;return!e&&f<p.top&&!i&&(x=a.height+d.height+c*2,f+=x),s==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,n.style.opacity="1",i&&r!==0?(f-=m.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function uh({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&de(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?de(Ft,{editor:e,item:o,children:de(o.ChildComponent,{})},o.key):null}function dh(t){let e=Ks(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:s}=H(),[i,d]=wo.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],wo.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let w=x[0];d(()=>w?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==i||e[11]!==o||e[12]!==r||e[13]!==s.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(f=Js("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?i?de(Ue,{anchorElem:o,editor:r,group:n,Icon:i,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):de(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>de(uh,{anchorElem:o,editor:r,item:h},h.key)):null,l<s.features.toolbarInline?.groups.length-1&&de("div",{className:"divider"})]},n.key),e[10]=i,e[11]=o,e[12]=r,e[13]=s.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function mh({anchorElem:t,editor:e}){let o=Vs(null),r=Vs(null),{editorConfig:n}=H(),l=To(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),s=To(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),i=To(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Pt(()=>(document.addEventListener("mousemove",s),document.addEventListener("mouseup",i),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",i)}),[o,s,i]);let d=To(()=>{let c=Xs(),u=Zs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let f=Ir(u,p),h=_o({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&_o({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Pt(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),Pt(()=>(e.getEditorState().read(()=>{d()}),zs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(sh,()=>(d(),!1),ih))),[e,d]),Js("div",{className:"inline-toolbar-popup",ref:o,children:[de("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>de(dh,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function ph(t,e){let o=Ks(12),[r,n]=ah(!1),l=nh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Xs(),f=Zs(t._window),h=t.getRootElement();if(f!==null&&(!Gs(p)||h===null||!h.contains(f.anchorNode))){n(!1);return}if(!Gs(p))return;if(p.getTextContent()!==""){let w=p.getNodes(),E=!1;for(let N of w)if(lh(N)){n(!0),E=!0;break}E||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){n(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,d,c;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Pt(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>zs(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Pt(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=ch(de(mh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Ys=t=>{let{anchorElem:e}=t,[o]=rh();return ph(o,e)};var fh=$({plugins:[{Component:Ys,position:"floatingAnchorElem"}]});import{TableCellNode as rx,TableNode as nx,TableRowNode as lx}from"@lexical/table";import{jsx as qs}from"react/jsx-runtime";import"react";var vr=()=>qs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:qs("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 hh,$createTableNode as gh,$createTableRowNode as xh,$isTableCellNode as Qs,$isTableNode as Mr,$isTableRowNode as Dr,TableCellHeaderStates as Eo,TableCellNode as Ch,TableNode as bh,TableRowNode as kh}from"@lexical/table";import{$isParagraphNode as _h,$isTextNode as Th}from"lexical";var ta=/^\|(.+)\|\s?$/,wh=/^(\| ?:?-*:? ?)+\|\s?$/,oa=({allTransformers:t})=>({type:"element",dependencies:[bh,kh,Ch],export:e=>{if(!Mr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Dr(r))continue;let l=!1;for(let s of r.getChildren())Qs(s)&&(n.push(zt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===Eo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(s=>"---").join(" | ")} |`)}return o.join(`
|
|
59
59
|
`)},regExp:ta,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(wh.test(n)){let a=e.getPreviousSibling();if(!a||!Mr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Dr(p))return;p.getChildren().forEach(f=>{Qs(f)&&f.setHeaderStyles(Eo.ROW,Eo.ROW)}),e.remove();return}let l=ea(n,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!_h(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!Th(a))break;let m=ea(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),s.unshift(m);let p=i.getPreviousSibling();i.remove(),i=p}let c=gh();for(let a of s){let m=xh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ra("",t))}let u=e.getPreviousSibling();Mr(u)&&Eh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function Eh(t){let e=t.getFirstChild();return Dr(e)?e.getChildrenSize():0}var ra=(t,e)=>{t=t.replace(/\\n/g,`
|
|
60
|
-
`);let o=hh(Eo.NO_STATUS);return Jt(t,e,o),o},ea=(t,e)=>{let o=t.match(ta);return!o||!o[1]?null:o[1].split("|").map(r=>ra(r,e))};import{c as Nh}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as aa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Lh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as la,$deleteTableColumnAtSelection as yh,$deleteTableRowAtSelection as Rh,$getNodeTriplet as Ih,$getTableCellNodeFromLexicalNode as ia,$getTableColumnIndexFromTableCellNode as vh,$getTableNodeFromLexicalNodeOrThrow as De,$getTableRowIndexFromTableCellNode as Mh,$insertTableColumnAtSelection as Dh,$insertTableRowAtSelection as $h,$isTableCellNode as ca,$isTableSelection as Bt,$mergeCells as Ah,$unmergeCell as Oh,getTableElement as Ar,getTableObserverFromTableElement as Or,TableCellHeaderStates as Me,TableCellNode as Fh}from"@lexical/table";import{mergeRegister as Ph}from"@lexical/utils";import{useScrollInfo as Bh}from"@payloadcms/ui";import{$getSelection as No,$isElementNode as jh,$isRangeSelection as Fr,$isTextNode as Hh,$setSelection as Uh,COMMAND_PRIORITY_CRITICAL as Wh,getDOMSelection as Gh,isDOMNode as Vh,SELECTION_CHANGE_COMMAND as Kh}from"lexical";import*as Pr from"react";import{useCallback as ae,useEffect as it,useRef as So,useState as st}from"react";import{createPortal as ua}from"react-dom";import{jsx as $r,jsxs as Sh}from"react/jsx-runtime";import"react";var na=()=>Sh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[$r("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"}),$r("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"}),$r("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 sa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Jh(){let t=No();if(Fr(t)&&!t.isCollapsed()||Bt(t)&&!t.anchor.is(t.focus)||!Fr(t)&&!Bt(t))return!1;let[e]=Ih(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function zh(t){let e=t.getLastDescendant();Hh(e)?e.select():jh(e)?e.selectEnd():e!==null&&e.selectNext()}function Xh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=aa(),s=So(null),[i,d]=st(n),[c,u]=st({columns:1,rows:1}),[a,m]=st(!1),[p,f]=st(!1),{y:h}=Bh();it(()=>l.registerMutationListener(Fh,T=>{T.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),it(()=>{l.getEditorState().read(()=>{let T=No();if(Bt(T)){let S=sa(T);u(sa(T)),m(S.columns>1||S.rows>1)}f(Jh())})},[l]),it(()=>{let T=e.current,S=s.current,I=l.getRootElement();if(T!=null&&S!=null&&I!=null){let A=I.getBoundingClientRect(),v=T.getBoundingClientRect();S.style.opacity="1";let O=S.getBoundingClientRect(),D=5,G=v.right+D;if(G+O.width>window.innerWidth||G+O.width>A.right){let z=v.left-O.width-D;G=(z<0?D:z)+window.pageXOffset}S.style.left=`${G+window.pageXOffset}px`;let q=v.top;if(q+O.height>window.innerHeight){let z=v.bottom-O.height;q=z<0?D:z}S.style.top=`${q}px`}},[e,s,l,h]),it(()=>{function T(S){s.current!=null&&e.current!=null&&Vh(S.target)&&!s.current.contains(S.target)&&!e.current.contains(S.target)&&r(!1)}return window.addEventListener("click",T),()=>window.removeEventListener("click",T)},[r,e]);let x=ae(()=>{l.update(()=>{if(i.isAttached()){let T=De(i),S=Ar(T,l.getElementByKey(T.getKey()));if(S===null)throw new Error("Expected to find tableElement in DOM");let I=Or(S);I!==null&&I.$clearHighlight(),T.markDirty(),d(i.getLatest())}Uh(null)})},[l,i]),w=()=>{l.update(()=>{let T=No();if(!Bt(T))return;let I=T.getNodes().filter(ca),A=Ah(I);A&&(zh(A),o())})},E=()=>{l.update(()=>{Oh()})},N=ae(T=>{l.update(()=>{for(let S=0;S<c.rows;S++)$h(T);o()})},[l,o,c.rows]),_=ae(T=>{l.update(()=>{for(let S=0;S<c.columns;S++)Dh(T);o()})},[l,o,c.columns]),C=ae(()=>{l.update(()=>{Rh(),o()})},[l,o]),g=ae(()=>{l.update(()=>{De(i).remove(),x(),o()})},[l,i,x,o]),b=ae(()=>{l.update(()=>{yh(),o()})},[l,o]),k=ae(()=>{l.update(()=>{let T=De(i),S=Mh(i),[I]=la(T,null,null),A=new Set,v=i.getHeaderStyles()^Me.ROW;if(I[S])for(let O=0;O<I[S].length;O++){let D=I[S][O];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Me.ROW)))}x(),o()})},[l,i,x,o]),y=ae(()=>{l.update(()=>{let T=De(i),S=vh(i),[I]=la(T,null,null),A=new Set,v=i.getHeaderStyles()^Me.COLUMN;if(I)for(let O=0;O<I.length;O++){let D=I?.[O]?.[S];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Me.COLUMN)))}x(),o()})},[l,i,x,o]),R=ae(()=>{l.update(()=>{if(i.isAttached()){let T=De(i);T&&T.setRowStriping(!T.getRowStriping())}x(),o()})},[l,i,x,o]),M=ae(()=>{l.update(()=>{if(i.isAttached()){let T=De(i);T&&T.setFrozenColumns(T.getFrozenColumns()===0?1:0)}x(),o()})},[l,i,x,o]),L=null;return t&&(a?L=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(L=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),ua(Le("div",{className:"table-action-menu-dropdown",onClick:T=>{T.stopPropagation()},ref:s,children:[L?Le(Pr.Fragment,{children:[L,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>M(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>N(!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:()=>N(!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:()=>_(!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:()=>_(!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:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>k(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&Me.ROW)===Me.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&Me.COLUMN)===Me.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Zh({anchorElem:t,cellMerge:e}){let[o]=aa(),r=So(null),n=So(null),[l,s]=st(!1),[i,d]=st(null),c=ae(()=>{let a=r.current,m=No(),p=Gh(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return h();let x=o.getRootElement(),w=null,E=null;if(Fr(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=ia(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return h();let C=De(_),g=Ar(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=Or(g),d(_)}else if(Bt(m)){let _=ia(m.anchor.getNode());if(!ca(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=De(_),g=Ar(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=Or(g),E=o.getElementByKey(_.getKey())}else if(!f)return h();if(w===null||E===null)return h();let N=!w||!w.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",N),a.classList.toggle("table-cell-action-button-container--inactive",!N),N){let _=E.getBoundingClientRect(),C=t.getBoundingClientRect(),g=_.top-C.top,b=_.right-C.left;a.style.transform=`translate(${b}px, ${g}px)`}},[o,t]);it(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Ph(o.registerUpdateListener(p),o.registerCommand(Kh,p,Wh),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=So(i);return it(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),P("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&Le(Pr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:P(na,{})}),l&&P(Xh,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var da=t=>{let e=Nh(3),{anchorElem:o}=t,r=Lh(),n;return e[0]!==o||e[1]!==r?(n=ua(r?P(Zh,{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 Yh}from"react/compiler-runtime";import{jsx as yo,jsxs as qh}from"react/jsx-runtime";import{useLexicalComposerContext as Qh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as eg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as tg,$getTableNodeFromLexicalNodeOrThrow as Br,$getTableRowIndexFromTableCellNode as og,$isTableCellNode as ma,$isTableRowNode as rg,getDOMCellFromTarget as ng,getTableElement as lg,TableNode as pa}from"@lexical/table";import{calculateZoomLevel as fa,mergeRegister as ig}from"@lexical/utils";import{$getNearestNodeFromDOMNode as jr,isHTMLElement as sg,SKIP_SCROLL_INTO_VIEW_TAG as ha}from"lexical";import*as xa from"react";import{useCallback as jt,useEffect as Hr,useRef as Lo,useState as at}from"react";import{createPortal as ag}from"react-dom";var cg=33,ga=92;function ug({editor:t}){let e=Lo(null),o=Lo(null),r=Lo(null),[n,l]=at(!1),s=H(),i=Lo(null),[d,c]=at(null),[u,a]=at(null),[m,p]=at(!1),[f,h]=at(null),x=jt(()=>{a(null),e.current=null,h(null),i.current=null,r.current=null},[]),w=M=>(M.buttons&1)===1;Hr(()=>{let M=new Set;return ig(t.registerMutationListener(pa,L=>{for(let[T,S]of L)S==="destroyed"?M.delete(T):M.add(T);l(M.size>0)}),t.registerNodeTransform(pa,L=>{if(L.getColWidths())return L;let T=L.getColumnCount(),S=ga;return L.setColWidths(Array(T).fill(S)),L}))},[t]),Hr(()=>{if(!n)return;let M=I=>{let A=I.target;if(sg(A)){if(f){c({x:I.clientX,y:I.clientY});return}if(p(w(I)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let v=ng(A);v&&u!==v?t.getEditorState().read(()=>{let O=jr(v.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let D=Br(O),G=lg(D,t.getElementByKey(D.getKey()));if(!G)throw new Error("TableCellResizer: Table element not found.");e.current=A,r.current=G.getBoundingClientRect(),a(v)},{editor:t}):v==null&&x()}}},L=I=>{p(!0)},T=I=>{p(!1)},S=t.registerRootListener((I,A)=>{A?.removeEventListener("mousemove",M),A?.removeEventListener("mousedown",L),A?.removeEventListener("mouseup",T),I?.addEventListener("mousemove",M),I?.addEventListener("mousedown",L),I?.addEventListener("mouseup",T)});return()=>{S()}},[u,f,t,n,x]);let E=M=>M==="bottom",N=jt(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=jr(u.elem);if(!ma(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Br(L),S=og(L),I=T.getChildren(),v=L.getColSpan()===T.getColumnCount()?S:S+L.getRowSpan()-1;if(v>=I.length||v<0)throw new Error("Expected table cell to be inside of table row.");let O=I[v];if(!rg(O))throw new Error("Expected table row");let D=O.getHeight();if(D===void 0){let q=O.getChildren();D=Math.min(...q.map(z=>_(z,t)??1/0))}let G=Math.max(D+M,cg);O.setHeight(G)},{tag:ha})},[u,t]),_=(M,L)=>L.getElementByKey(M.getKey())?.clientHeight,C=(M,L)=>{let T;return L.forEach(S=>{S.forEach((I,A)=>{I.cell===M&&(T=A)})}),T},g=jt(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=jr(u.elem);if(!ma(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Br(L),[S]=tg(T,null,null),I=C(L,S);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let A=T.getColWidths();if(!A)return;let v=A[I];if(v===void 0)return;let O=[...A],D=Math.max(v+M,ga);O[I]=D,T.setColWidths(O)},{tag:ha})},[u,t]),b=jt(M=>{let L=T=>{if(T.preventDefault(),T.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:S,y:I}=i.current;if(u===null)return;let A=fa(T.target);if(E(M)){let v=(T.clientY-I)/A;N(v)}else{let v=(T.clientX-S)/A;g(v)}x(),document.removeEventListener("mouseup",L)}};return L},[u,x,g,N]),k=jt(M=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:L.clientX,y:L.clientY},c(i.current),h(M),document.addEventListener("mouseup",b(M))},[u,b]),[y,R]=at({bottom:null,left:null,right:null,top:null});return Hr(()=>{if(u){let{height:M,left:L,top:T,width:S}=u.elem.getBoundingClientRect(),I=fa(u.elem),A=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${A}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+T+M-A/2}px`,width:`${S}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${M}px`,left:`${window.scrollX+L+S-A/2}px`,top:`${window.scrollY+T}px`,width:`${A}px`}},O=r.current;f&&d&&O&&(E(f)?(v[f].left=`${window.scrollX+O.left}px`,v[f].top=`${window.scrollY+d.y/I}px`,v[f].height="3px",v[f].width=`${O.width}px`):(v[f].top=`${window.scrollY+O.top}px`,v[f].left=`${window.scrollX+d.x/I}px`,v[f].width="3px",v[f].height=`${O.height}px`),v[f].backgroundColor="#adf"),R(v)}else R({bottom:null,left:null,right:null,top:null})},[u,f,d]),yo("div",{ref:o,children:u!=null&&!m&&qh(xa.Fragment,{children:[yo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("right"),style:y.right||void 0}),yo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("bottom"),style:y.bottom||void 0})]})})}var Ca=()=>{let t=Yh(3),[e]=Qh(),o=eg(),r;return t[0]!==e||t[1]!==o?(r=o?ag(yo(ug,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Cg}from"react/compiler-runtime";import{jsx as Ur,jsxs as bg,Fragment as kg}from"react/jsx-runtime";import{useLexicalComposerContext as _g}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Na}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Tg,$getTableColumnIndexFromTableCellNode as wg,$getTableRowIndexFromTableCellNode as Eg,$insertTableColumnAtSelection as Sg,$insertTableRowAtSelection as Ng,$isTableCellNode as Lg,$isTableNode as _a,getTableElement as yg,TableNode as Rg}from"@lexical/table";import{$findMatchingParent as Ig,mergeRegister as vg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ta,isHTMLElement as Mg}from"lexical";import{useEffect as wa,useMemo as Dg,useRef as Ea,useState as Ro}from"react";import"react";import{createPortal as $g}from"react-dom";import{c as hg}from"react/compiler-runtime";import{useEffect as gg,useRef as xg}from"react";var dg="Expected a function",mg=Math.max,pg=Math.min;function fg(t,e,o){let r,n,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(dg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?mg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let b=r,k=s;return r=s=void 0,l=g,u=t.apply(k,b),u}function f(g){return l=g,a=setTimeout(w,e),i?p(g):u}function h(g){let b=g-n,k=g-l,y=e-b;return d?pg(y,c-k):y}function x(g){let b=g-n,k=g-l;return n===void 0||b>=e||b<0||d&&k>=c}function w(){let g=Date.now();if(x(g))return E(g);a=setTimeout(w,h(g))}function E(g){return a=void 0,m&&r?p(g):(r=s=void 0,u)}function N(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function _(){return a===void 0?u:E(Date.now())}function C(){let g=Date.now(),b=x(g);if(r=arguments,s=this,n=g,b){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(w,e),p(n)}return a===void 0&&(a=setTimeout(w,e)),u}return C.cancel=N,C.flush=_,C}var ba=fg;function ka(t,e,o){let r=hg(6),n=xg(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ba(t,e,{maxWait:o}),()=>{n.current?.cancel()}),s=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=s):(l=r[3],s=r[4]),gg(l,s);let i;return r[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=i):i=r[5],i}var Sa=20;function Ag({anchorElem:t}){let[e]=_g(),o=Na(),r=H(),[n,l]=Ro(!1),[s,i]=Ro(!1),[d,c]=Ro(!1),[u,a]=Ro({}),m=Ea(new Set),p=Ea(null),f=ka(w=>{let{isOutside:E,tableDOMNode:N}=Og(w,r.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!N)return;p.current=N;let _=null,C=null,g=null;if(e.getEditorState().read(()=>{let v=Ta(N);if(Lg(v)){let O=Ig(v,D=>_a(D));if(!_a(O))return;if(g=yg(O,e.getElementByKey(O.getKey())),g){let D=O.getChildrenSize(),G=O.getChildAtIndex(0)?.getChildrenSize(),q=Eg(v),z=wg(v);q===D-1?_=v:z===G-1&&(C=v)}}},{editor:e}),!g)return;let b=g.parentElement;if(!b)return;let{bottom:k,height:y,left:R,right:M,width:L,y:T}=g.getBoundingClientRect(),S=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(S=b.scrollWidth>b.clientWidth);let{left:I,y:A}=t.getBoundingClientRect();_?(i(!1),l(!0),a({height:Sa,left:S&&b?b.offsetLeft:R-I,top:k-A+5,width:S&&b?b.offsetWidth:L})):C&&(i(!0),l(!1),a({height:y,left:M-I+5,top:T-A,width:Sa}))},50,250),h=Dg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);wa(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),i(!1),document.removeEventListener("mousemove",f)}},[d,f]),wa(()=>vg(e.registerMutationListener(Rg,w=>{e.getEditorState().read(()=>{let E=!1;for(let[N,_]of w)switch(_){case"created":{m.current.add(N),E=!0;break}case"destroyed":{m.current.delete(N),E=!0;break}default:break}if(E){h.disconnect();for(let N of m.current){let{tableElement:_}=Tg(N);h.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=w=>{e.update(()=>{p.current&&(Ta(p.current)?.selectEnd(),w?(Ng(),l(!1)):(Sg(),i(!1)))})};return o?bg(kg,{children:[n&&Ur("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),s&&Ur("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function Og(t,e){let o=t.target;if(Mg(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 La(t){let e=Cg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Na())return null;let l;return e[0]!==r?(l=$g(Ur(Ag,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Fg}from"react/compiler-runtime";import{jsx as Wr,jsxs as Pg}from"react/jsx-runtime";import{useLexicalComposerContext as Bg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as jg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Hg,TableCellNode as Ug,TableNode as Wg,TableRowNode as Gg}from"@lexical/table";import{mergeRegister as Vg}from"@lexical/utils";import{formatDrawerSlug as Kg,useEditDepth as Jg}from"@payloadcms/ui";import{$getSelection as zg,$isRangeSelection as Xg,COMMAND_PRIORITY_EDITOR as Zg,createCommand as Yg}from"lexical";import{createContext as qg,use as Qg,useEffect as ex,useMemo as tx,useState as ox}from"react";import*as ya from"react";var Io=Yg("OPEN_EMBED_DRAWER_COMMAND"),Ra=qg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Ia({children:t}){let[e,o]=ox({cellEditorConfig:null,cellEditorPlugins:null});return Wr(Ra,{value:tx(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var va=()=>{let t=Fg(16),[e]=Bg(),o=Qg(Ra),r=Jg(),{fieldProps:n,uuid:l}=H(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=Kg({slug:i,depth:r}),t[0]=r,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=he(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([Wg,Gg,Ug]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Vg(e.registerCommand(Io,()=>{let h=null;return e.getEditorState().read(()=>{let x=zg();Xg(x)&&(h=x)}),h&&u(),!0},Zg))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],ex(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(Hg,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==s||t[14]!==p?(f=Pg(ya.Fragment,{children:[Wr(ft,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),Wr(jg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=f):f=t[15],f};var ix=$({markdownTransformers:[oa],nodes:[nx,rx,lx],plugins:[{Component:va,position:"normal"},{Component:Ca,position:"normal"},{Component:da,position:"floatingAnchorElem"},{Component:La,position:"floatingAnchorElem"}],providers:[Ia],slashMenu:{groups:[Z([{Icon:vr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Io,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:vr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Io,{})}}])]}});import{$isNodeSelection as Ux}from"lexical";import{jsx as Gr,jsxs as sx}from"react/jsx-runtime";import"react";var Vr=()=>sx("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:[Gr("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"}),Gr("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"}),Gr("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 Oa}from"react/jsx-runtime";import Fa from"bson-objectid";import{$applyNodeReplacement as px}from"lexical";import*as Pa from"react";import ax from"bson-objectid";function vo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new ax.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as cx}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as ux}from"@lexical/utils";import Da from"bson-objectid";import{$applyNodeReplacement as dx}from"lexical";var Ht=class extends cx{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>vo(o,Ma),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Da.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ma({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return ux(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function Ma({data:t}){return t?.id||(t.id=new Da.default().toHexString()),dx(new Ht({data:t}))}import{jsx as $a}from"react/jsx-runtime";import{ShimmerEffect as mx}from"@payloadcms/ui";var Aa=()=>$a("div",{className:"lexical-upload",children:$a(mx,{height:"95px",width:"203px"})});var fx=Pa.lazy(()=>import("./component-XIHC3W6W.js").then(t=>({default:t.UploadComponent}))),me=class extends Ht{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>vo(o,pe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Fa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=pe({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?Oa(Aa,{}):Oa(fx,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function pe({data:t}){return t?.id||(t.id=new Fa.default().toHexString()),px(new me({data:t}))}function ct(t){return t instanceof me}import{c as Tx}from"react/compiler-runtime";import{jsx as wx}from"react/jsx-runtime";import{useLexicalComposerContext as Ex}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Xa,$insertNodeToNearestRoot as zr,mergeRegister as Sx}from"@lexical/utils";import{useBulkUpload as Nx,useEffectEvent as Lx,useModal as yx}from"@payloadcms/ui";import Xr from"bson-objectid";import{$createRangeSelection as Rx,$getPreviousSelection as Ga,$getSelection as Va,$isParagraphNode as Zr,$isRangeSelection as Ka,$setSelection as Ix,COMMAND_PRIORITY_EDITOR as vx,COMMAND_PRIORITY_LOW as Ja,createCommand as Mx,DROP_COMMAND as Dx,getDOMSelectionFromTarget as $x,isHTMLElement as za,PASTE_COMMAND as Ax}from"lexical";import{useEffect as Ox}from"react";import{c as Ba}from"react/compiler-runtime";import{jsx as Kr}from"react/jsx-runtime";import{useLexicalComposerContext as ja}from"@lexical/react/LexicalComposerContext.js";import{toast as hx}from"@payloadcms/ui";import{$getNodeByKey as gx,COMMAND_PRIORITY_EDITOR as Ha}from"lexical";import{useEffect as Ua,useState as xx}from"react";var Cx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=gx(o);n&&n.replace(pe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Jr,{fields:null,relationTo:e,value:r})},bx=t=>{let e=Ba(13),{enabledCollectionSlugs:o}=t,[r]=ja(),[n,l]=xx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=Ot(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(ze,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Ha),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Ua(u,a);let m;e[6]!==i||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:w}=h;i(),Cx({editor:r,relationTo:x,replaceNodeKey:n,value:w.id})},e[6]=i,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==d||e[11]!==p?(f=Kr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},kx=()=>{let t=Ba(3),[e]=ja(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ze,_x,Ha),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ua(o,r),null},Wa=({enabledCollectionSlugs:t})=>t?.length?Kr(bx,{enabledCollectionSlugs:t}):Kr(kx,{});function _x(){return hx.error("No upload collections enabled"),!0}function Fx(t){let e=t.target;return!!(za(e)&&!e.closest("code, span.editor-image")&&za(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Px(t){let e,o=$x(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Jr=Mx("INSERT_UPLOAD_COMMAND"),Za=t=>{let e=Tx(21),{clientProps:o}=t,[r]=Ex(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=Co(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=Nx(),{isModalOpen:f,openModal:h}=yx(),x;e[3]!==d||e[4]!==r||e[5]!==i||e[6]!==f||e[7]!==h||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(x=C=>{let{files:g}=C;if(g?.length!==0&&(u(b=>[...b??[],...g.map(Bx)]),!f(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{r.update(jx)}),m(b=>{let k=new Map(b.map(Hx));r.update(()=>{for(let y of Xa()){let R=y.node;if(ct(R)){let M=R.getData();if(M?.pending){let L=k.get(M.pending?.formID);L&&R.replace(pe({data:{id:new Xr.default().toHexString(),fields:{},relationTo:L.collectionSlug,value:L.doc.id}}))}}}})}),h(d)}},e[3]=d,e[4]=r,e[5]=i,e[6]=f,e[7]=h,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=x):x=e[13];let w=Lx(x),E;e[14]!==r||e[15]!==w?(E=()=>{if(!r.hasNodes([me]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Sx(r.registerNodeTransform(me,C=>{let g=C.getData();if(!g?.pending)return;(async function(){let y=null,R=g?.pending?.src,M=g?.pending?.formID;if(R?.startsWith("data:")){let L=R.match(/data:(image\/[a-zA-Z]+);base64,/),T=L?L[1]:"image/png",S=R.replace(/^data:image\/[a-zA-Z]+;base64,/,""),I=atob(S),A=new Array(I.length);for(let D=0;D<I.length;D++)A[D]=I.charCodeAt(D);let v=new Uint8Array(A);y={alt:void 0,file:new File([v],"pasted-image."+T?.split("/",2)[1],{type:T}),formID:M}}else if(R?.startsWith("http")||R?.startsWith("https")){let T=await(await fetch(R)).blob(),S=R.split("/").pop()||"pasted-image"+T.type.split("/",2)[1];y={alt:void 0,file:new File([T],S,{type:T.type}),formID:M}}y&&w({files:[y]})})()}),r.registerCommand(Jr,C=>(r.update(()=>{let g=Va()||Ga();if(Ka(g)){let b=pe({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:k}=g,y=k.getNode();zr(b),Zr(y)&&!y.__first&&y.remove()}}),!0),vx),r.registerCommand(Ax,C=>{if(!(C instanceof ClipboardEvent))return!1;let g=C.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Xr.default().toHexString()})}),b.length?(r.update(()=>{let k=Va()||Ga();if(Ka(k))for(let y of b){let R=pe({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:M}=k,L=M.getNode();zr(R),Zr(L)&&!L.__first&&L.remove()}}),w({files:b}),!0):!1},Ja),r.registerCommand(Dx,C=>{if(!(C instanceof DragEvent))return!1;let g=C.dataTransfer;if(!g?.types?.length)return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Xr.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),r.update(()=>{if(Fx(C)){let k=Px(C),y=Rx();k!=null&&y.applyDOMRange(k),Ix(y);for(let R of b){let M=pe({data:{pending:{formID:R.formID,src:URL.createObjectURL(R.file)}}}),{focus:L}=y,T=L.getNode();zr(M),Zr(T)&&!T.__first&&T.remove()}}}),w({files:b}),!0):!1},Ja))},e[14]=r,e[15]=w,e[16]=E):E=e[16];let N;e[17]!==r?(N=[r],e[17]=r,e[18]=N):N=e[18],Ox(E,N);let _;return e[19]!==i?(_=wx(Wa,{enabledCollectionSlugs:i}),e[19]=i,e[20]=_):_=e[20],_};function Bx(t){return{file:t.file,formID:t.formID}}function jx(){for(let t of Xa()){let e=t.node;ct(e)&&e.getData()?.pending&&e.remove()}}function Hx(t){return[t.formID,t]}var Wx=$({nodes:[me],plugins:[{Component:Za,position:"normal"}],slashMenu:{groups:[Z([{Icon:Vr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Vr,isActive:({selection:t})=>{if(!Ux(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ct(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]}});import{c as Vx}from"react/compiler-runtime";import{jsx as Qr}from"react/jsx-runtime";import{ShimmerEffect as Kx,useConfig as Jx}from"@payloadcms/ui";import{lazy as zx,Suspense as Xx,useEffect as Zx,useState as Yx}from"react";var Ya={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",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",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",placeholder:"LexicalEditorTheme__placeholder",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:"LexicalEditorTheme__upload"};var Yr={namespace:"lexical",theme:Ya};function qa({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let s=new Map;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.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:r,resolvedFeatures:i,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as Gx}from"payload/shared";var Qa=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(s=>s.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.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(s=>s.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.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(s=>s.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.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?Gx(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 qr(t,e,o){return{admin:o,features:Qa(t),lexical:e,resolvedFeatureMap:t}}var qx=zx(()=>import("./Field-2A2VQXKP.js").then(t=>({default:t.RichText}))),Qx=t=>{let e=Vx(18),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let u=c,a;e[2]!==n?(a=n===void 0?{}:n,e[2]=n,e[3]=a):a=e[3];let m=a,p=i===void 0?Yr:i,{config:f}=Jx(),[h,x]=Yx(null),w,E;e[4]!==u||e[5]!==r||e[6]!==f||e[7]!==m||e[8]!==l||e[9]!==s||e[10]!==h||e[11]!==p||e[12]!==d?(w=()=>{if(h)return;let _=[];for(let g of Object.values(r))g.clientFeatureProvider&&_.push(g.clientFeatureProvider(g.clientFeatureProps));let C=qa({config:f,featureClientImportMap:m,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:_,lexical:p}});x(qr(C,p,u))},E=[u,r,f,m,l,s,h,p,d],e[4]=u,e[5]=r,e[6]=f,e[7]=m,e[8]=l,e[9]=s,e[10]=h,e[11]=p,e[12]=d,e[13]=w,e[14]=E):(w=e[13],E=e[14]),Zx(w,E);let N;return e[15]!==h||e[16]!==t?(N=Qr(Xx,{fallback:Qr(Kx,{height:"35vh"}),children:h&&Qr(qx,{...t,editorConfig:h})}),e[15]=h,e[16]=t,e[17]=N):N=e[17],N};function eC(t){return t instanceof HTMLElement}function tC(...t){return t.filter(Boolean).join(" ")}var Mo=new WeakMap;function ec(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Do(t,e){let o=Mo.get(t);if(o===void 0){let r=new Set,n=s=>{o!==void 0&&(o.start=ec(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=ec(s);for(let c of r)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Mo.set(t,o)}return o.listeners.add(e),()=>{oC(t,e)}}function oC(t,e){let o=Mo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Mo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function rC(t,e){return Do(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function nC(t,e){return Do(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function lC(t,e){return Do(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function iC(t,e){return Do(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as sC}from"react/compiler-runtime";import{jsx as aC}from"react/jsx-runtime";import"react";var cC=()=>{let t=sC(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?aC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as uC}from"react/compiler-runtime";import{jsx as dC}from"react/jsx-runtime";import"react";var mC=()=>{let t=uC(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?dC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as pC}from"react/compiler-runtime";import{jsx as fC}from"react/jsx-runtime";import"react";var hC=()=>{let t=pC(2),{Label:e}=ge(),o;return t[0]!==e?(o=e?fC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gC}from"react/compiler-runtime";import{jsx as xC}from"react/jsx-runtime";import"react";var CC=t=>{let e=gC(3),{children:o}=t,{InlineBlockContainer:r}=ge(),n;return e[0]!==r||e[1]!==o?(n=r?xC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as bC}from"react/jsx-runtime";import"react";var kC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=Ce();return r?bC(r,{...o,children:e}):null};import{c as _C}from"react/compiler-runtime";import{jsx as TC}from"react/jsx-runtime";import"react";var wC=()=>{let t=_C(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?TC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as EC}from"react/compiler-runtime";import{jsx as SC}from"react/jsx-runtime";import"react";var NC=()=>{let t=EC(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?SC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as LC}from"qs-esm";var yC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=LC({depth:e??0,draft:o??!1,locale:r,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var tc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
|
|
60
|
+
`);let o=hh(Eo.NO_STATUS);return Jt(t,e,o),o},ea=(t,e)=>{let o=t.match(ta);return!o||!o[1]?null:o[1].split("|").map(r=>ra(r,e))};import{c as Nh}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as aa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Lh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as la,$deleteTableColumnAtSelection as yh,$deleteTableRowAtSelection as Rh,$getNodeTriplet as Ih,$getTableCellNodeFromLexicalNode as ia,$getTableColumnIndexFromTableCellNode as vh,$getTableNodeFromLexicalNodeOrThrow as De,$getTableRowIndexFromTableCellNode as Mh,$insertTableColumnAtSelection as Dh,$insertTableRowAtSelection as $h,$isTableCellNode as ca,$isTableSelection as Bt,$mergeCells as Ah,$unmergeCell as Oh,getTableElement as Ar,getTableObserverFromTableElement as Or,TableCellHeaderStates as Me,TableCellNode as Fh}from"@lexical/table";import{mergeRegister as Ph}from"@lexical/utils";import{useScrollInfo as Bh}from"@payloadcms/ui";import{$getSelection as No,$isElementNode as jh,$isRangeSelection as Fr,$isTextNode as Hh,$setSelection as Uh,COMMAND_PRIORITY_CRITICAL as Wh,getDOMSelection as Gh,isDOMNode as Vh,SELECTION_CHANGE_COMMAND as Kh}from"lexical";import*as Pr from"react";import{useCallback as ae,useEffect as it,useRef as So,useState as st}from"react";import{createPortal as ua}from"react-dom";import{jsx as $r,jsxs as Sh}from"react/jsx-runtime";import"react";var na=()=>Sh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[$r("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"}),$r("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"}),$r("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 sa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Jh(){let t=No();if(Fr(t)&&!t.isCollapsed()||Bt(t)&&!t.anchor.is(t.focus)||!Fr(t)&&!Bt(t))return!1;let[e]=Ih(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function zh(t){let e=t.getLastDescendant();Hh(e)?e.select():jh(e)?e.selectEnd():e!==null&&e.selectNext()}function Xh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=aa(),s=So(null),[i,d]=st(n),[c,u]=st({columns:1,rows:1}),[a,m]=st(!1),[p,f]=st(!1),{y:h}=Bh();it(()=>l.registerMutationListener(Fh,T=>{T.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),it(()=>{l.getEditorState().read(()=>{let T=No();if(Bt(T)){let S=sa(T);u(sa(T)),m(S.columns>1||S.rows>1)}f(Jh())})},[l]),it(()=>{let T=e.current,S=s.current,I=l.getRootElement();if(T!=null&&S!=null&&I!=null){let A=I.getBoundingClientRect(),v=T.getBoundingClientRect();S.style.opacity="1";let O=S.getBoundingClientRect(),D=5,G=v.right+D;if(G+O.width>window.innerWidth||G+O.width>A.right){let z=v.left-O.width-D;G=(z<0?D:z)+window.pageXOffset}S.style.left=`${G+window.pageXOffset}px`;let q=v.top;if(q+O.height>window.innerHeight){let z=v.bottom-O.height;q=z<0?D:z}S.style.top=`${q}px`}},[e,s,l,h]),it(()=>{function T(S){s.current!=null&&e.current!=null&&Vh(S.target)&&!s.current.contains(S.target)&&!e.current.contains(S.target)&&r(!1)}return window.addEventListener("click",T),()=>window.removeEventListener("click",T)},[r,e]);let x=ae(()=>{l.update(()=>{if(i.isAttached()){let T=De(i),S=Ar(T,l.getElementByKey(T.getKey()));if(S===null)throw new Error("Expected to find tableElement in DOM");let I=Or(S);I!==null&&I.$clearHighlight(),T.markDirty(),d(i.getLatest())}Uh(null)})},[l,i]),w=()=>{l.update(()=>{let T=No();if(!Bt(T))return;let I=T.getNodes().filter(ca),A=Ah(I);A&&(zh(A),o())})},E=()=>{l.update(()=>{Oh()})},N=ae(T=>{l.update(()=>{for(let S=0;S<c.rows;S++)$h(T);o()})},[l,o,c.rows]),_=ae(T=>{l.update(()=>{for(let S=0;S<c.columns;S++)Dh(T);o()})},[l,o,c.columns]),C=ae(()=>{l.update(()=>{Rh(),o()})},[l,o]),g=ae(()=>{l.update(()=>{De(i).remove(),x(),o()})},[l,i,x,o]),b=ae(()=>{l.update(()=>{yh(),o()})},[l,o]),k=ae(()=>{l.update(()=>{let T=De(i),S=Mh(i),[I]=la(T,null,null),A=new Set,v=i.getHeaderStyles()^Me.ROW;if(I[S])for(let O=0;O<I[S].length;O++){let D=I[S][O];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Me.ROW)))}x(),o()})},[l,i,x,o]),y=ae(()=>{l.update(()=>{let T=De(i),S=vh(i),[I]=la(T,null,null),A=new Set,v=i.getHeaderStyles()^Me.COLUMN;if(I)for(let O=0;O<I.length;O++){let D=I?.[O]?.[S];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Me.COLUMN)))}x(),o()})},[l,i,x,o]),R=ae(()=>{l.update(()=>{if(i.isAttached()){let T=De(i);T&&T.setRowStriping(!T.getRowStriping())}x(),o()})},[l,i,x,o]),M=ae(()=>{l.update(()=>{if(i.isAttached()){let T=De(i);T&&T.setFrozenColumns(T.getFrozenColumns()===0?1:0)}x(),o()})},[l,i,x,o]),L=null;return t&&(a?L=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(L=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),ua(Le("div",{className:"table-action-menu-dropdown",onClick:T=>{T.stopPropagation()},ref:s,children:[L?Le(Pr.Fragment,{children:[L,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>M(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>N(!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:()=>N(!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:()=>_(!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:()=>_(!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:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>k(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&Me.ROW)===Me.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&Me.COLUMN)===Me.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Zh({anchorElem:t,cellMerge:e}){let[o]=aa(),r=So(null),n=So(null),[l,s]=st(!1),[i,d]=st(null),c=ae(()=>{let a=r.current,m=No(),p=Gh(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return h();let x=o.getRootElement(),w=null,E=null;if(Fr(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=ia(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return h();let C=De(_),g=Ar(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=Or(g),d(_)}else if(Bt(m)){let _=ia(m.anchor.getNode());if(!ca(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=De(_),g=Ar(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=Or(g),E=o.getElementByKey(_.getKey())}else if(!f)return h();if(w===null||E===null)return h();let N=!w||!w.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",N),a.classList.toggle("table-cell-action-button-container--inactive",!N),N){let _=E.getBoundingClientRect(),C=t.getBoundingClientRect(),g=_.top-C.top,b=_.right-C.left;a.style.transform=`translate(${b}px, ${g}px)`}},[o,t]);it(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Ph(o.registerUpdateListener(p),o.registerCommand(Kh,p,Wh),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=So(i);return it(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),P("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&Le(Pr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:P(na,{})}),l&&P(Xh,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var da=t=>{let e=Nh(3),{anchorElem:o}=t,r=Lh(),n;return e[0]!==o||e[1]!==r?(n=ua(r?P(Zh,{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 Yh}from"react/compiler-runtime";import{jsx as yo,jsxs as qh}from"react/jsx-runtime";import{useLexicalComposerContext as Qh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as eg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as tg,$getTableNodeFromLexicalNodeOrThrow as Br,$getTableRowIndexFromTableCellNode as og,$isTableCellNode as ma,$isTableRowNode as rg,getDOMCellFromTarget as ng,getTableElement as lg,TableNode as pa}from"@lexical/table";import{calculateZoomLevel as fa,mergeRegister as ig}from"@lexical/utils";import{$getNearestNodeFromDOMNode as jr,isHTMLElement as sg,SKIP_SCROLL_INTO_VIEW_TAG as ha}from"lexical";import*as xa from"react";import{useCallback as jt,useEffect as Hr,useRef as Lo,useState as at}from"react";import{createPortal as ag}from"react-dom";var cg=33,ga=92;function ug({editor:t}){let e=Lo(null),o=Lo(null),r=Lo(null),[n,l]=at(!1),s=H(),i=Lo(null),[d,c]=at(null),[u,a]=at(null),[m,p]=at(!1),[f,h]=at(null),x=jt(()=>{a(null),e.current=null,h(null),i.current=null,r.current=null},[]),w=M=>(M.buttons&1)===1;Hr(()=>{let M=new Set;return ig(t.registerMutationListener(pa,L=>{for(let[T,S]of L)S==="destroyed"?M.delete(T):M.add(T);l(M.size>0)}),t.registerNodeTransform(pa,L=>{if(L.getColWidths())return L;let T=L.getColumnCount(),S=ga;return L.setColWidths(Array(T).fill(S)),L}))},[t]),Hr(()=>{if(!n)return;let M=I=>{let A=I.target;if(sg(A)){if(f){c({x:I.clientX,y:I.clientY});return}if(p(w(I)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let v=ng(A);v&&u!==v?t.getEditorState().read(()=>{let O=jr(v.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let D=Br(O),G=lg(D,t.getElementByKey(D.getKey()));if(!G)throw new Error("TableCellResizer: Table element not found.");e.current=A,r.current=G.getBoundingClientRect(),a(v)},{editor:t}):v==null&&x()}}},L=I=>{p(!0)},T=I=>{p(!1)},S=t.registerRootListener((I,A)=>{A?.removeEventListener("mousemove",M),A?.removeEventListener("mousedown",L),A?.removeEventListener("mouseup",T),I?.addEventListener("mousemove",M),I?.addEventListener("mousedown",L),I?.addEventListener("mouseup",T)});return()=>{S()}},[u,f,t,n,x]);let E=M=>M==="bottom",N=jt(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=jr(u.elem);if(!ma(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Br(L),S=og(L),I=T.getChildren(),v=L.getColSpan()===T.getColumnCount()?S:S+L.getRowSpan()-1;if(v>=I.length||v<0)throw new Error("Expected table cell to be inside of table row.");let O=I[v];if(!rg(O))throw new Error("Expected table row");let D=O.getHeight();if(D===void 0){let q=O.getChildren();D=Math.min(...q.map(z=>_(z,t)??1/0))}let G=Math.max(D+M,cg);O.setHeight(G)},{tag:ha})},[u,t]),_=(M,L)=>L.getElementByKey(M.getKey())?.clientHeight,C=(M,L)=>{let T;return L.forEach(S=>{S.forEach((I,A)=>{I.cell===M&&(T=A)})}),T},g=jt(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=jr(u.elem);if(!ma(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Br(L),[S]=tg(T,null,null),I=C(L,S);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let A=T.getColWidths();if(!A)return;let v=A[I];if(v===void 0)return;let O=[...A],D=Math.max(v+M,ga);O[I]=D,T.setColWidths(O)},{tag:ha})},[u,t]),b=jt(M=>{let L=T=>{if(T.preventDefault(),T.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:S,y:I}=i.current;if(u===null)return;let A=fa(T.target);if(E(M)){let v=(T.clientY-I)/A;N(v)}else{let v=(T.clientX-S)/A;g(v)}x(),document.removeEventListener("mouseup",L)}};return L},[u,x,g,N]),k=jt(M=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:L.clientX,y:L.clientY},c(i.current),h(M),document.addEventListener("mouseup",b(M))},[u,b]),[y,R]=at({bottom:null,left:null,right:null,top:null});return Hr(()=>{if(u){let{height:M,left:L,top:T,width:S}=u.elem.getBoundingClientRect(),I=fa(u.elem),A=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${A}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+T+M-A/2}px`,width:`${S}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${M}px`,left:`${window.scrollX+L+S-A/2}px`,top:`${window.scrollY+T}px`,width:`${A}px`}},O=r.current;f&&d&&O&&(E(f)?(v[f].left=`${window.scrollX+O.left}px`,v[f].top=`${window.scrollY+d.y/I}px`,v[f].height="3px",v[f].width=`${O.width}px`):(v[f].top=`${window.scrollY+O.top}px`,v[f].left=`${window.scrollX+d.x/I}px`,v[f].width="3px",v[f].height=`${O.height}px`),v[f].backgroundColor="#adf"),R(v)}else R({bottom:null,left:null,right:null,top:null})},[u,f,d]),yo("div",{ref:o,children:u!=null&&!m&&qh(xa.Fragment,{children:[yo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("right"),style:y.right||void 0}),yo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("bottom"),style:y.bottom||void 0})]})})}var Ca=()=>{let t=Yh(3),[e]=Qh(),o=eg(),r;return t[0]!==e||t[1]!==o?(r=o?ag(yo(ug,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Cg}from"react/compiler-runtime";import{jsx as Ur,jsxs as bg,Fragment as kg}from"react/jsx-runtime";import{useLexicalComposerContext as _g}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Na}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Tg,$getTableColumnIndexFromTableCellNode as wg,$getTableRowIndexFromTableCellNode as Eg,$insertTableColumnAtSelection as Sg,$insertTableRowAtSelection as Ng,$isTableCellNode as Lg,$isTableNode as _a,getTableElement as yg,TableNode as Rg}from"@lexical/table";import{$findMatchingParent as Ig,mergeRegister as vg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ta,isHTMLElement as Mg}from"lexical";import{useEffect as wa,useMemo as Dg,useRef as Ea,useState as Ro}from"react";import"react";import{createPortal as $g}from"react-dom";import{c as hg}from"react/compiler-runtime";import{useEffect as gg,useRef as xg}from"react";var dg="Expected a function",mg=Math.max,pg=Math.min;function fg(t,e,o){let r,n,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(dg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?mg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let b=r,k=s;return r=s=void 0,l=g,u=t.apply(k,b),u}function f(g){return l=g,a=setTimeout(w,e),i?p(g):u}function h(g){let b=g-n,k=g-l,y=e-b;return d?pg(y,c-k):y}function x(g){let b=g-n,k=g-l;return n===void 0||b>=e||b<0||d&&k>=c}function w(){let g=Date.now();if(x(g))return E(g);a=setTimeout(w,h(g))}function E(g){return a=void 0,m&&r?p(g):(r=s=void 0,u)}function N(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function _(){return a===void 0?u:E(Date.now())}function C(){let g=Date.now(),b=x(g);if(r=arguments,s=this,n=g,b){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(w,e),p(n)}return a===void 0&&(a=setTimeout(w,e)),u}return C.cancel=N,C.flush=_,C}var ba=fg;function ka(t,e,o){let r=hg(6),n=xg(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ba(t,e,{maxWait:o}),()=>{n.current?.cancel()}),s=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=s):(l=r[3],s=r[4]),gg(l,s);let i;return r[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=i):i=r[5],i}var Sa=20;function Ag({anchorElem:t}){let[e]=_g(),o=Na(),r=H(),[n,l]=Ro(!1),[s,i]=Ro(!1),[d,c]=Ro(!1),[u,a]=Ro({}),m=Ea(new Set),p=Ea(null),f=ka(w=>{let{isOutside:E,tableDOMNode:N}=Og(w,r.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!N)return;p.current=N;let _=null,C=null,g=null;if(e.getEditorState().read(()=>{let v=Ta(N);if(Lg(v)){let O=Ig(v,D=>_a(D));if(!_a(O))return;if(g=yg(O,e.getElementByKey(O.getKey())),g){let D=O.getChildrenSize(),G=O.getChildAtIndex(0)?.getChildrenSize(),q=Eg(v),z=wg(v);q===D-1?_=v:z===G-1&&(C=v)}}},{editor:e}),!g)return;let b=g.parentElement;if(!b)return;let{bottom:k,height:y,left:R,right:M,width:L,y:T}=g.getBoundingClientRect(),S=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(S=b.scrollWidth>b.clientWidth);let{left:I,y:A}=t.getBoundingClientRect();_?(i(!1),l(!0),a({height:Sa,left:S&&b?b.offsetLeft:R-I,top:k-A+5,width:S&&b?b.offsetWidth:L})):C&&(i(!0),l(!1),a({height:y,left:M-I+5,top:T-A,width:Sa}))},50,250),h=Dg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);wa(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),i(!1),document.removeEventListener("mousemove",f)}},[d,f]),wa(()=>vg(e.registerMutationListener(Rg,w=>{e.getEditorState().read(()=>{let E=!1;for(let[N,_]of w)switch(_){case"created":{m.current.add(N),E=!0;break}case"destroyed":{m.current.delete(N),E=!0;break}default:break}if(E){h.disconnect();for(let N of m.current){let{tableElement:_}=Tg(N);h.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=w=>{e.update(()=>{p.current&&(Ta(p.current)?.selectEnd(),w?(Ng(),l(!1)):(Sg(),i(!1)))})};return o?bg(kg,{children:[n&&Ur("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),s&&Ur("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function Og(t,e){let o=t.target;if(Mg(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 La(t){let e=Cg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Na())return null;let l;return e[0]!==r?(l=$g(Ur(Ag,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Fg}from"react/compiler-runtime";import{jsx as Wr,jsxs as Pg}from"react/jsx-runtime";import{useLexicalComposerContext as Bg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as jg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Hg,TableCellNode as Ug,TableNode as Wg,TableRowNode as Gg}from"@lexical/table";import{mergeRegister as Vg}from"@lexical/utils";import{formatDrawerSlug as Kg,useEditDepth as Jg}from"@payloadcms/ui";import{$getSelection as zg,$isRangeSelection as Xg,COMMAND_PRIORITY_EDITOR as Zg,createCommand as Yg}from"lexical";import{createContext as qg,use as Qg,useEffect as ex,useMemo as tx,useState as ox}from"react";import*as ya from"react";var Io=Yg("OPEN_EMBED_DRAWER_COMMAND"),Ra=qg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Ia({children:t}){let[e,o]=ox({cellEditorConfig:null,cellEditorPlugins:null});return Wr(Ra,{value:tx(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var va=()=>{let t=Fg(16),[e]=Bg(),o=Qg(Ra),r=Jg(),{fieldProps:n,uuid:l}=H(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=Kg({slug:i,depth:r}),t[0]=r,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=he(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([Wg,Gg,Ug]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Vg(e.registerCommand(Io,()=>{let h=null;return e.getEditorState().read(()=>{let x=zg();Xg(x)&&(h=x)}),h&&u(),!0},Zg))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],ex(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(Hg,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==s||t[14]!==p?(f=Pg(ya.Fragment,{children:[Wr(ft,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),Wr(jg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=f):f=t[15],f};var ix=$({markdownTransformers:[oa],nodes:[nx,rx,lx],plugins:[{Component:va,position:"normal"},{Component:Ca,position:"normal"},{Component:da,position:"floatingAnchorElem"},{Component:La,position:"floatingAnchorElem"}],providers:[Ia],slashMenu:{groups:[Z([{Icon:vr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Io,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:vr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Io,{})}}])]}});import{$isNodeSelection as Ux}from"lexical";import{jsx as Gr,jsxs as sx}from"react/jsx-runtime";import"react";var Vr=()=>sx("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:[Gr("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"}),Gr("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"}),Gr("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 Oa}from"react/jsx-runtime";import Fa from"bson-objectid";import{$applyNodeReplacement as px}from"lexical";import*as Pa from"react";import ax from"bson-objectid";function vo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new ax.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as cx}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as ux}from"@lexical/utils";import Da from"bson-objectid";import{$applyNodeReplacement as dx}from"lexical";var Ht=class extends cx{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>vo(o,Ma),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Da.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ma({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return ux(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function Ma({data:t}){return t?.id||(t.id=new Da.default().toHexString()),dx(new Ht({data:t}))}import{jsx as $a}from"react/jsx-runtime";import{ShimmerEffect as mx}from"@payloadcms/ui";var Aa=()=>$a("div",{className:"lexical-upload",children:$a(mx,{height:"95px",width:"203px"})});var fx=Pa.lazy(()=>import("./component-XIHC3W6W.js").then(t=>({default:t.UploadComponent}))),me=class extends Ht{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>vo(o,pe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Fa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=pe({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?Oa(Aa,{}):Oa(fx,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function pe({data:t}){return t?.id||(t.id=new Fa.default().toHexString()),px(new me({data:t}))}function ct(t){return t instanceof me}import{c as Tx}from"react/compiler-runtime";import{jsx as wx}from"react/jsx-runtime";import{useLexicalComposerContext as Ex}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Xa,$insertNodeToNearestRoot as zr,mergeRegister as Sx}from"@lexical/utils";import{useBulkUpload as Nx,useEffectEvent as Lx,useModal as yx}from"@payloadcms/ui";import Xr from"bson-objectid";import{$createRangeSelection as Rx,$getPreviousSelection as Ga,$getSelection as Va,$isParagraphNode as Zr,$isRangeSelection as Ka,$setSelection as Ix,COMMAND_PRIORITY_EDITOR as vx,COMMAND_PRIORITY_LOW as Ja,createCommand as Mx,DROP_COMMAND as Dx,getDOMSelectionFromTarget as $x,isHTMLElement as za,PASTE_COMMAND as Ax}from"lexical";import{useEffect as Ox}from"react";import{c as Ba}from"react/compiler-runtime";import{jsx as Kr}from"react/jsx-runtime";import{useLexicalComposerContext as ja}from"@lexical/react/LexicalComposerContext.js";import{toast as hx}from"@payloadcms/ui";import{$getNodeByKey as gx,COMMAND_PRIORITY_EDITOR as Ha}from"lexical";import{useEffect as Ua,useState as xx}from"react";var Cx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=gx(o);n&&n.replace(pe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Jr,{fields:null,relationTo:e,value:r})},bx=t=>{let e=Ba(13),{enabledCollectionSlugs:o}=t,[r]=ja(),[n,l]=xx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=Ot(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(ze,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Ha),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Ua(u,a);let m;e[6]!==i||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:w}=h;i(),Cx({editor:r,relationTo:x,replaceNodeKey:n,value:w.id})},e[6]=i,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==d||e[11]!==p?(f=Kr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},kx=()=>{let t=Ba(3),[e]=ja(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ze,_x,Ha),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ua(o,r),null},Wa=({enabledCollectionSlugs:t})=>t?.length?Kr(bx,{enabledCollectionSlugs:t}):Kr(kx,{});function _x(){return hx.error("No upload collections enabled"),!0}function Fx(t){let e=t.target;return!!(za(e)&&!e.closest("code, span.editor-image")&&za(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Px(t){let e,o=$x(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Jr=Mx("INSERT_UPLOAD_COMMAND"),Za=t=>{let e=Tx(21),{clientProps:o}=t,[r]=Ex(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=Co(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=Nx(),{isModalOpen:f,openModal:h}=yx(),x;e[3]!==d||e[4]!==r||e[5]!==i||e[6]!==f||e[7]!==h||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(x=C=>{let{files:g}=C;if(g?.length!==0&&(u(b=>[...b??[],...g.map(Bx)]),!f(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{r.update(jx)}),m(b=>{let k=new Map(b.map(Hx));r.update(()=>{for(let y of Xa()){let R=y.node;if(ct(R)){let M=R.getData();if(M?.pending){let L=k.get(M.pending?.formID);L&&R.replace(pe({data:{id:new Xr.default().toHexString(),fields:{},relationTo:L.collectionSlug,value:L.doc.id}}))}}}})}),h(d)}},e[3]=d,e[4]=r,e[5]=i,e[6]=f,e[7]=h,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=x):x=e[13];let w=Lx(x),E;e[14]!==r||e[15]!==w?(E=()=>{if(!r.hasNodes([me]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Sx(r.registerNodeTransform(me,C=>{let g=C.getData();if(!g?.pending)return;(async function(){let y=null,R=g?.pending?.src,M=g?.pending?.formID;if(R?.startsWith("data:")){let L=R.match(/data:(image\/[a-zA-Z]+);base64,/),T=L?L[1]:"image/png",S=R.replace(/^data:image\/[a-zA-Z]+;base64,/,""),I=atob(S),A=new Array(I.length);for(let D=0;D<I.length;D++)A[D]=I.charCodeAt(D);let v=new Uint8Array(A);y={alt:void 0,file:new File([v],"pasted-image."+T?.split("/",2)[1],{type:T}),formID:M}}else if(R?.startsWith("http")||R?.startsWith("https")){let T=await(await fetch(R)).blob(),S=R.split("/").pop()||"pasted-image"+T.type.split("/",2)[1];y={alt:void 0,file:new File([T],S,{type:T.type}),formID:M}}y&&w({files:[y]})})()}),r.registerCommand(Jr,C=>(r.update(()=>{let g=Va()||Ga();if(Ka(g)){let b=pe({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:k}=g,y=k.getNode();zr(b),Zr(y)&&!y.__first&&y.remove()}}),!0),vx),r.registerCommand(Ax,C=>{if(!(C instanceof ClipboardEvent))return!1;let g=C.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Xr.default().toHexString()})}),b.length?(r.update(()=>{let k=Va()||Ga();if(Ka(k))for(let y of b){let R=pe({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:M}=k,L=M.getNode();zr(R),Zr(L)&&!L.__first&&L.remove()}}),w({files:b}),!0):!1},Ja),r.registerCommand(Dx,C=>{if(!(C instanceof DragEvent))return!1;let g=C.dataTransfer;if(!g?.types?.length)return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Xr.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),r.update(()=>{if(Fx(C)){let k=Px(C),y=Rx();k!=null&&y.applyDOMRange(k),Ix(y);for(let R of b){let M=pe({data:{pending:{formID:R.formID,src:URL.createObjectURL(R.file)}}}),{focus:L}=y,T=L.getNode();zr(M),Zr(T)&&!T.__first&&T.remove()}}}),w({files:b}),!0):!1},Ja))},e[14]=r,e[15]=w,e[16]=E):E=e[16];let N;e[17]!==r?(N=[r],e[17]=r,e[18]=N):N=e[18],Ox(E,N);let _;return e[19]!==i?(_=wx(Wa,{enabledCollectionSlugs:i}),e[19]=i,e[20]=_):_=e[20],_};function Bx(t){return{file:t.file,formID:t.formID}}function jx(){for(let t of Xa()){let e=t.node;ct(e)&&e.getData()?.pending&&e.remove()}}function Hx(t){return[t.formID,t]}var Wx=$({nodes:[me],plugins:[{Component:Za,position:"normal"}],slashMenu:{groups:[Z([{Icon:Vr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Vr,isActive:({selection:t})=>{if(!Ux(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ct(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]}});import{c as Vx}from"react/compiler-runtime";import{jsx as Qr}from"react/jsx-runtime";import{ShimmerEffect as Kx,useConfig as Jx}from"@payloadcms/ui";import{lazy as zx,Suspense as Xx,useEffect as Zx,useState as Yx}from"react";var Ya={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",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",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",placeholder:"LexicalEditorTheme__placeholder",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:"LexicalEditorTheme__upload"};var Yr={namespace:"lexical",theme:Ya};function qa({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let s=new Map;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.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:r,resolvedFeatures:i,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as Gx}from"payload/shared";var Qa=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(s=>s.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.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(s=>s.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.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(s=>s.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.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?Gx(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 qr(t,e,o){return{admin:o,features:Qa(t),lexical:e,resolvedFeatureMap:t}}var qx=zx(()=>import("./Field-HJGV32KA.js").then(t=>({default:t.RichText}))),Qx=t=>{let e=Vx(18),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let u=c,a;e[2]!==n?(a=n===void 0?{}:n,e[2]=n,e[3]=a):a=e[3];let m=a,p=i===void 0?Yr:i,{config:f}=Jx(),[h,x]=Yx(null),w,E;e[4]!==u||e[5]!==r||e[6]!==f||e[7]!==m||e[8]!==l||e[9]!==s||e[10]!==h||e[11]!==p||e[12]!==d?(w=()=>{if(h)return;let _=[];for(let g of Object.values(r))g.clientFeatureProvider&&_.push(g.clientFeatureProvider(g.clientFeatureProps));let C=qa({config:f,featureClientImportMap:m,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:_,lexical:p}});x(qr(C,p,u))},E=[u,r,f,m,l,s,h,p,d],e[4]=u,e[5]=r,e[6]=f,e[7]=m,e[8]=l,e[9]=s,e[10]=h,e[11]=p,e[12]=d,e[13]=w,e[14]=E):(w=e[13],E=e[14]),Zx(w,E);let N;return e[15]!==h||e[16]!==t?(N=Qr(Xx,{fallback:Qr(Kx,{height:"35vh"}),children:h&&Qr(qx,{...t,editorConfig:h})}),e[15]=h,e[16]=t,e[17]=N):N=e[17],N};function eC(t){return t instanceof HTMLElement}function tC(...t){return t.filter(Boolean).join(" ")}var Mo=new WeakMap;function ec(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Do(t,e){let o=Mo.get(t);if(o===void 0){let r=new Set,n=s=>{o!==void 0&&(o.start=ec(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=ec(s);for(let c of r)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Mo.set(t,o)}return o.listeners.add(e),()=>{oC(t,e)}}function oC(t,e){let o=Mo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Mo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function rC(t,e){return Do(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function nC(t,e){return Do(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function lC(t,e){return Do(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function iC(t,e){return Do(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as sC}from"react/compiler-runtime";import{jsx as aC}from"react/jsx-runtime";import"react";var cC=()=>{let t=sC(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?aC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as uC}from"react/compiler-runtime";import{jsx as dC}from"react/jsx-runtime";import"react";var mC=()=>{let t=uC(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?dC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as pC}from"react/compiler-runtime";import{jsx as fC}from"react/jsx-runtime";import"react";var hC=()=>{let t=pC(2),{Label:e}=ge(),o;return t[0]!==e?(o=e?fC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gC}from"react/compiler-runtime";import{jsx as xC}from"react/jsx-runtime";import"react";var CC=t=>{let e=gC(3),{children:o}=t,{InlineBlockContainer:r}=ge(),n;return e[0]!==r||e[1]!==o?(n=r?xC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as bC}from"react/jsx-runtime";import"react";var kC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=Ce();return r?bC(r,{...o,children:e}):null};import{c as _C}from"react/compiler-runtime";import{jsx as TC}from"react/jsx-runtime";import"react";var wC=()=>{let t=_C(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?TC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as EC}from"react/compiler-runtime";import{jsx as SC}from"react/jsx-runtime";import"react";var NC=()=>{let t=EC(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?SC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as LC}from"qs-esm";var yC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=LC({depth:e??0,draft:o??!1,locale:r,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var tc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
|
|
61
61
|
`)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
|
|
62
62
|
`+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let r=o?.[1];return t.startsWith(`
|
|
63
63
|
`)&&(t=t.slice(1)),t.endsWith(`
|
|
64
64
|
`)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
|
|
65
|
-
`)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as RC}from"react/jsx-runtime";import{CodeField as IC,useFormFields as vC}from"@payloadcms/ui";import{useId as MC,useMemo as DC}from"react";var $o={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var $C=({autoComplete:t,field:e,forceRender:o,languages:r=$o,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=vC(([w])=>w.language),m=a?.value||a?.initialValue||"typescript",p=MC(),f=r[m],h=DC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),x=`${e.name}-${m}-${f}`;return h&&RC(IC,{autoComplete:t,field:h,forceRender:o,onMount:(w,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),E.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>{c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async _=>{let g=await(await fetch(_.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(g,_.filePath)}))})()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},x)};import{jsx as re,jsxs as cc}from"react/jsx-runtime";import{useLexicalEditable as HC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as UC,Combobox as WC,CopyToClipboard as GC,PopupList as VC,RenderFields as KC,useForm as JC,useFormFields as uc,useTranslation as zC}from"@payloadcms/ui";import XC from"react";import{jsx as oc}from"react/jsx-runtime";import"react";var rc=()=>oc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:oc("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as lc}from"react/jsx-runtime";import"react";import{useCollapsible as OC}from"@payloadcms/ui";import{jsx as nc}from"react/jsx-runtime";import"react";var Ao=()=>nc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:nc("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var AC="code-block-collapse-button",ic=()=>{let{toggle:t}=OC();return lc("button",{className:AC,onClick:t,type:"button",children:lc(Ao,{})})};import{jsx as sc,jsxs as FC}from"react/jsx-runtime";import"react";import{useCollapsible as BC,useTranslation as jC}from"@payloadcms/ui";var PC="code-block-floating-collapse-button",ac=()=>{let{isCollapsed:t,toggle:e}=BC(),{t:o}=jC();return t?FC("button",{className:PC,onClick:e,type:"button",children:[sc("span",{children:o("general:collapse")}),sc(Ao,{})]}):null};var We="payload-richtext-code-block",ZC=t=>{let{languages:e}=t,o=e||$o,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=Ce(),{setModified:s}=JC(),{t:i}=zC(),{codeField:d}=uc(([f])=>({codeField:f?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=uc(([f,h])=>({selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),s(!0)}})),a=o[c?.value],m=HC(),p=XC.useMemo(()=>Object.entries(o).map(([f,h])=>({name:`${f} ${h}`,Component:re(VC.Button,{active:!1,disabled:!1,onClick:()=>{u(f)},children:re("span",{className:`${We}__language-code`,"data-language":f,children:h})})})),[o,u]);return re(r,{Actions:cc("div",{className:`${We}__actions`,children:[re(WC,{button:cc("div",{className:`${We}__language-selector-button`,"data-selected-language":c?.value,children:[re("span",{children:a}),re(UC,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(GC,{value:d?.value??""}),re(ic,{}),m&&re(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:re(ac,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${We}__pill`,children:re(rc,{})}),children:re(KC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as YC}from"react/compiler-runtime";import{jsx as ut}from"react/jsx-runtime";import{FieldContext as qC,FieldPathContext as dc,ServerFunctionsContext as mc,ShimmerEffect as QC,useServerFunctions as e2}from"@payloadcms/ui";import t2,{useEffect as o2,useRef as r2}from"react";var n2=t=>{let e=YC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:s,setValue:i,value:d}=t,[c,u]=t2.useState(null),a=e2(),{_internal_renderField:m}=a,[p,f]=s.split(".",2),h=l??(o&&"name"in o?o?.name:"")??"",x;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==s?(x=()=>{(async function(){let{Field:y}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:s});u(y)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=s,e[5]=x):x=e[5];let w=x,E=r2(!1),N,_;if(e[6]!==w?(N=()=>{E.current||(E.current=!0,w())},_=[w],e[6]=w,e[7]=N,e[8]=_):(N=e[7],_=e[8]),o2(N,_),!c)return typeof n<"u"?n:ut(QC,{});let C={...a,getFormState:async b=>a.getFormState({...b,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof d>"u"&&!i)return ut(mc,{value:{...C},children:ut(dc,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:h,setValue:i??l2,showError:!1,value:d};return ut(mc,{value:{...C},children:ut(dc,{value:h,children:ut(qC,{value:g,children:c})},h)})};function l2(){}function pc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}var i2=pc;export{Nt as $createAutoLinkNode,Ae as $createBlockNode,Ye as $createHorizontalRuleNode,mt as $createInlineBlockNode,_e as $createLinkNode,He as $createRelationshipNode,pe as $createUploadNode,we as $isAutoLinkNode,$e as $isBlockNode,St as $isHorizontalRuleNode,pt as $isInlineBlockNode,J as $isLinkNode,Er as $isRelationshipNode,ct as $isUploadNode,Ac as AlignFeatureClient,Te as AutoLinkNode,kC as BlockCollapsible,wC as BlockEditButton,ie as BlockNode,NC as BlockRemoveButton,Uc as BlockquoteFeatureClient,qu as BlocksFeatureClient,_d as BoldFeatureClient,le as CAN_USE_DOM,Lf as ChecklistFeatureClient,ZC as CodeBlockBlockComponent,$C as CodeComponent,b0 as DETAIL_TYPE_TO_DETAIL,h0 as DOUBLE_LINE_BREAK,I0 as DebugJsxConverterFeatureClient,_0 as ELEMENT_FORMAT_TO_TYPE,k0 as ELEMENT_TYPE_TO_FORMAT,kc as ENABLE_SLASH_MENU_COMMAND,gc as EditorConfigProvider,ft as FieldsDrawer,oh as FixedToolbarFeatureClient,gm as HeadingFeatureClient,$m as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,Xe as INSERT_BLOCK_COMMAND,Ze as INSERT_INLINE_BLOCK_COMMAND,p0 as IS_ALL_FORMATTING,Zm as IndentFeatureClient,CC as InlineBlockContainer,cC as InlineBlockEditButton,hC as InlineBlockLabel,dt as InlineBlockNode,mC as InlineBlockRemoveButton,Nd as InlineCodeFeatureClient,fh as InlineToolbarFeatureClient,Id as ItalicFeatureClient,x0 as LTR_REGEX,Zf as LexicalPluginToLexicalFeatureClient,mf as LinkFeatureClient,oe as LinkNode,f0 as NON_BREAKING_SPACE,F as NodeFormat,Af as OrderedListFeatureClient,l0 as ParagraphFeatureClient,Cc as Point,g0 as RTL_REGEX,_c as Rect,k1 as RelationshipFeatureClient,Se as RelationshipNode,n2 as RenderLexical,Qx as RichTextField,r0 as SlateToLexicalFeatureClient,Ad as StrikethroughFeatureClient,Bd as SubscriptFeatureClient,Wd as SuperscriptFeatureClient,T0 as TEXT_MODE_TO_TYPE,C0 as TEXT_TYPE_TO_FORMAT,w0 as TEXT_TYPE_TO_MODE,ue as TOGGLE_LINK_COMMAND,ix as TableFeatureClient,md as TestRecorderFeatureClient,lm as TextStateFeatureClient,Ft as ToolbarButton,Ue as ToolbarDropdown,xd as TreeViewFeatureClient,zd as UnderlineFeatureClient,Wf as UnorderedListFeatureClient,Wx as UploadFeatureClient,me as UploadNode,iC as addSwipeDownListener,rC as addSwipeLeftListener,nC as addSwipeRightListener,lC as addSwipeUpListener,i2 as buildDefaultEditorState,pc as buildEditorState,tc as codeConverterClient,or as createBlockNode,$ as createClientFeature,v0 as defaultColors,Yr as defaultEditorLexicalConfig,Ir as getDOMRangeRect,Tc as getEnabledNodes,yC as getRestPopulateFn,qe as getSelectedNode,eC as isHTMLElement,bc as isPoint,tC as joinClasses,qr as sanitizeClientEditorConfig,Qa as sanitizeClientFeatures,_o as setFloatingElemPosition,fo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,nr as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,Ce as useBlockComponentContext,H as useEditorConfigContext,ge as useInlineBlockComponentContext,xc as useLexicalDocumentDrawer,he as useLexicalDrawer,Ot as useLexicalListDrawer};
|
|
65
|
+
`)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as RC}from"react/jsx-runtime";import{CodeField as IC,useFormFields as vC}from"@payloadcms/ui";import{useId as MC,useMemo as DC}from"react";var $o={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var $C=({autoComplete:t,field:e,forceRender:o,languages:r=$o,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=vC(([w])=>w.language),m=a?.value||a?.initialValue||"typescript",p=MC(),f=r[m],h=DC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),x=`${e.name}-${m}-${f}`;return h&&RC(IC,{autoComplete:t,field:h,forceRender:o,onMount:(w,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),E.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async _=>{let g=await(await fetch(_.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(g,_.filePath)})))()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},x)};import{jsx as re,jsxs as cc}from"react/jsx-runtime";import{useLexicalEditable as HC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as UC,Combobox as WC,CopyToClipboard as GC,PopupList as VC,RenderFields as KC,useForm as JC,useFormFields as uc,useTranslation as zC}from"@payloadcms/ui";import XC from"react";import{jsx as oc}from"react/jsx-runtime";import"react";var rc=()=>oc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:oc("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as lc}from"react/jsx-runtime";import"react";import{useCollapsible as OC}from"@payloadcms/ui";import{jsx as nc}from"react/jsx-runtime";import"react";var Ao=()=>nc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:nc("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var AC="code-block-collapse-button",ic=()=>{let{toggle:t}=OC();return lc("button",{className:AC,onClick:t,type:"button",children:lc(Ao,{})})};import{jsx as sc,jsxs as FC}from"react/jsx-runtime";import"react";import{useCollapsible as BC,useTranslation as jC}from"@payloadcms/ui";var PC="code-block-floating-collapse-button",ac=()=>{let{isCollapsed:t,toggle:e}=BC(),{t:o}=jC();return t?FC("button",{className:PC,onClick:e,type:"button",children:[sc("span",{children:o("general:collapse")}),sc(Ao,{})]}):null};var We="payload-richtext-code-block",ZC=t=>{let{languages:e}=t,o=e||$o,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=Ce(),{setModified:s}=JC(),{t:i}=zC(),{codeField:d}=uc(([f])=>({codeField:f?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=uc(([f,h])=>({selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),s(!0)}})),a=o[c?.value],m=HC(),p=XC.useMemo(()=>Object.entries(o).map(([f,h])=>({name:`${f} ${h}`,Component:re(VC.Button,{active:!1,disabled:!1,onClick:()=>{u(f)},children:re("span",{className:`${We}__language-code`,"data-language":f,children:h})})})),[o,u]);return re(r,{Actions:cc("div",{className:`${We}__actions`,children:[re(WC,{button:cc("div",{className:`${We}__language-selector-button`,"data-selected-language":c?.value,children:[re("span",{children:a}),re(UC,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(GC,{value:d?.value??""}),re(ic,{}),m&&re(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:re(ac,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${We}__pill`,children:re(rc,{})}),children:re(KC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as YC}from"react/compiler-runtime";import{jsx as ut}from"react/jsx-runtime";import{FieldContext as qC,FieldPathContext as dc,ServerFunctionsContext as mc,ShimmerEffect as QC,useServerFunctions as e2}from"@payloadcms/ui";import t2,{useEffect as o2,useRef as r2}from"react";var n2=t=>{let e=YC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:s,setValue:i,value:d}=t,[c,u]=t2.useState(null),a=e2(),{_internal_renderField:m}=a,[p,f]=s.split(".",2),h=l??(o&&"name"in o?o?.name:"")??"",x;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==s?(x=()=>{(async function(){let{Field:y}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:s});u(y)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=s,e[5]=x):x=e[5];let w=x,E=r2(!1),N,_;if(e[6]!==w?(N=()=>{E.current||(E.current=!0,w())},_=[w],e[6]=w,e[7]=N,e[8]=_):(N=e[7],_=e[8]),o2(N,_),!c)return typeof n<"u"?n:ut(QC,{});let C={...a,getFormState:async b=>a.getFormState({...b,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof d>"u"&&!i)return ut(mc,{value:{...C},children:ut(dc,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:h,setValue:i??l2,showError:!1,value:d};return ut(mc,{value:{...C},children:ut(dc,{value:h,children:ut(qC,{value:g,children:c})},h)})};function l2(){}function pc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}var i2=pc;export{Nt as $createAutoLinkNode,Ae as $createBlockNode,Ye as $createHorizontalRuleNode,mt as $createInlineBlockNode,_e as $createLinkNode,He as $createRelationshipNode,pe as $createUploadNode,we as $isAutoLinkNode,$e as $isBlockNode,St as $isHorizontalRuleNode,pt as $isInlineBlockNode,J as $isLinkNode,Er as $isRelationshipNode,ct as $isUploadNode,Ac as AlignFeatureClient,Te as AutoLinkNode,kC as BlockCollapsible,wC as BlockEditButton,ie as BlockNode,NC as BlockRemoveButton,Uc as BlockquoteFeatureClient,qu as BlocksFeatureClient,_d as BoldFeatureClient,le as CAN_USE_DOM,Lf as ChecklistFeatureClient,ZC as CodeBlockBlockComponent,$C as CodeComponent,b0 as DETAIL_TYPE_TO_DETAIL,h0 as DOUBLE_LINE_BREAK,I0 as DebugJsxConverterFeatureClient,_0 as ELEMENT_FORMAT_TO_TYPE,k0 as ELEMENT_TYPE_TO_FORMAT,kc as ENABLE_SLASH_MENU_COMMAND,gc as EditorConfigProvider,ft as FieldsDrawer,oh as FixedToolbarFeatureClient,gm as HeadingFeatureClient,$m as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,Xe as INSERT_BLOCK_COMMAND,Ze as INSERT_INLINE_BLOCK_COMMAND,p0 as IS_ALL_FORMATTING,Zm as IndentFeatureClient,CC as InlineBlockContainer,cC as InlineBlockEditButton,hC as InlineBlockLabel,dt as InlineBlockNode,mC as InlineBlockRemoveButton,Nd as InlineCodeFeatureClient,fh as InlineToolbarFeatureClient,Id as ItalicFeatureClient,x0 as LTR_REGEX,Zf as LexicalPluginToLexicalFeatureClient,mf as LinkFeatureClient,oe as LinkNode,f0 as NON_BREAKING_SPACE,F as NodeFormat,Af as OrderedListFeatureClient,l0 as ParagraphFeatureClient,Cc as Point,g0 as RTL_REGEX,_c as Rect,k1 as RelationshipFeatureClient,Se as RelationshipNode,n2 as RenderLexical,Qx as RichTextField,r0 as SlateToLexicalFeatureClient,Ad as StrikethroughFeatureClient,Bd as SubscriptFeatureClient,Wd as SuperscriptFeatureClient,T0 as TEXT_MODE_TO_TYPE,C0 as TEXT_TYPE_TO_FORMAT,w0 as TEXT_TYPE_TO_MODE,ue as TOGGLE_LINK_COMMAND,ix as TableFeatureClient,md as TestRecorderFeatureClient,lm as TextStateFeatureClient,Ft as ToolbarButton,Ue as ToolbarDropdown,xd as TreeViewFeatureClient,zd as UnderlineFeatureClient,Wf as UnorderedListFeatureClient,Wx as UploadFeatureClient,me as UploadNode,iC as addSwipeDownListener,rC as addSwipeLeftListener,nC as addSwipeRightListener,lC as addSwipeUpListener,i2 as buildDefaultEditorState,pc as buildEditorState,tc as codeConverterClient,or as createBlockNode,$ as createClientFeature,v0 as defaultColors,Yr as defaultEditorLexicalConfig,Ir as getDOMRangeRect,Tc as getEnabledNodes,yC as getRestPopulateFn,qe as getSelectedNode,eC as isHTMLElement,bc as isPoint,tC as joinClasses,qr as sanitizeClientEditorConfig,Qa as sanitizeClientFeatures,_o as setFloatingElemPosition,fo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,nr as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,Ce as useBlockComponentContext,H as useEditorConfigContext,ge as useInlineBlockComponentContext,xc as useLexicalDocumentDrawer,he as useLexicalDrawer,Ot as useLexicalListDrawer};
|
|
66
66
|
//# sourceMappingURL=index.js.map
|