@payloadcms/richtext-lexical 3.65.0-internal.5b33fe0 → 3.65.0-internal.cebb1a8

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.
@@ -1,13 +1,13 @@
1
- "use client";import{a as he,c as ct,d as ut,e as dt}from"./chunk-TRHFMZ3F.js";import{a as Ve}from"./chunk-DBWINSQN.js";import{a as mt,b as Ke}from"./chunk-O6XRT2H3.js";import{a as fe}from"./chunk-INBEEENE.js";import{a as Cc}from"./chunk-F26IQ5RE.js";import{b as Wt,c as Gt,d as le,e as Vt,f as Fo,g as Po,h as bc,i as kc,k as _c,m as Tc,p as wc}from"./chunk-6NIGQP6A.js";import{a as xc,b as H}from"./chunk-BZZVLW4U.js";function Y(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as ye,$isRangeSelection as Jt,FORMAT_ELEMENT_COMMAND as zt}from"lexical";import{jsx as Bo,jsxs as Ec}from"react/jsx-runtime";import"react";var an=()=>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:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as jo,jsxs as Sc}from"react/jsx-runtime";import"react";var cn=()=>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 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ho,jsxs as Nc}from"react/jsx-runtime";import"react";var Kt=()=>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:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Uo,jsxs as Lc}from"react/jsx-runtime";import"react";var un=()=>Lc("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:[Uo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Uo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Uo("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:i,featureProviderMap:s,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,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 dn=t=>({type:"dropdown",ChildComponent:Kt,items:t,key:"align",order:30});var mn=[dn([{ChildComponent:Kt,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(zt,"left")},order:1},{ChildComponent:an,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(zt,"center")},order:2},{ChildComponent:un,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(zt,"right")},order:3},{ChildComponent:cn,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(zt,"justify")},order:4}])],yc=$({toolbarFixed:{groups:mn},toolbarInline:{groups:mn}});import{$createQuoteNode as bn,$isQuoteNode as xn,QuoteNode as vc}from"@lexical/rich-text";import{$setBlocksType as kn}from"@lexical/selection";import{$getSelection as _n,$isRangeSelection as Mc}from"lexical";import{jsx as pn}from"react/jsx-runtime";import"react";var Wo=()=>pn("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:pn("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 fn}from"react/jsx-runtime";import"react";var pt=()=>fn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:fn("path",{d:"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:pt,items:t,key:"text",order:25});import{$createQuoteNode as Rc,$isQuoteNode as hn,QuoteNode as Ic}from"@lexical/rich-text";var gn={type:"element",dependencies:[Ic],export:(t,e)=>{if(!hn(t))return null;let o=e(t).split(`
1
+ "use client";import{a as he,c as ct,d as ut,e as dt}from"./chunk-TRHFMZ3F.js";import{a as Ve}from"./chunk-DBWINSQN.js";import{a as mt,b as Ke}from"./chunk-O6XRT2H3.js";import{a as fe}from"./chunk-INBEEENE.js";import{a as Cc}from"./chunk-F26IQ5RE.js";import{b as Wt,c as Gt,d as le,e as Vt,f as Fo,g as Po,h as bc,i as kc,k as _c,m as Tc,p as wc}from"./chunk-6NIGQP6A.js";import{a as xc,b as H}from"./chunk-BZZVLW4U.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as ye,$isRangeSelection as Jt,FORMAT_ELEMENT_COMMAND as zt}from"lexical";import{jsx as Bo,jsxs as Ec}from"react/jsx-runtime";import"react";var an=()=>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:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as jo,jsxs as Sc}from"react/jsx-runtime";import"react";var cn=()=>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 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ho,jsxs as Nc}from"react/jsx-runtime";import"react";var Kt=()=>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:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Uo,jsxs as Lc}from"react/jsx-runtime";import"react";var un=()=>Lc("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:[Uo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Uo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Uo("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:i,featureProviderMap:s,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,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 dn=t=>({type:"dropdown",ChildComponent:Kt,items:t,key:"align",order:30});var mn=[dn([{ChildComponent:Kt,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(zt,"left")},order:1},{ChildComponent:an,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(zt,"center")},order:2},{ChildComponent:un,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(zt,"right")},order:3},{ChildComponent:cn,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(zt,"justify")},order:4}])],yc=$({toolbarFixed:{groups:mn},toolbarInline:{groups:mn}});import{$createQuoteNode as bn,$isQuoteNode as xn,QuoteNode as vc}from"@lexical/rich-text";import{$setBlocksType as kn}from"@lexical/selection";import{$getSelection as _n,$isRangeSelection as Mc}from"lexical";import{jsx as pn}from"react/jsx-runtime";import"react";var Wo=()=>pn("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:pn("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 fn}from"react/jsx-runtime";import"react";var pt=()=>fn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:fn("path",{d:"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:pt,items:t,key:"text",order:25});import{$createQuoteNode as Rc,$isQuoteNode as hn,QuoteNode as Ic}from"@lexical/rich-text";var gn={type:"element",dependencies:[Ic],export:(t,e)=>{if(!hn(t))return null;let o=e(t).split(`
2
2
  `),r=[];for(let n of o)r.push("> "+n);return r.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(hn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Rc();n.append(...e),t.replace(n),n.select(0,0)}};var Cn=[te([{ChildComponent:Wo,isActive:({selection:t})=>{if(!Mc(t))return!1;for(let e of t.getNodes())if(!xn(e)&&!xn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=_n();kn(e,()=>bn())})},order:20}])],Dc=$({markdownTransformers:[gn],nodes:[vc],slashMenu:{groups:[Y([{Icon:Wo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=_n();kn(e,()=>bn())})}}])]},toolbarFixed:{groups:Cn},toolbarInline:{groups:Cn}});import{getTranslation as no}from"@payloadcms/translations";import{jsx as Go,jsxs as $c}from"react/jsx-runtime";import"react";var Xt=()=>$c("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Tn}from"react/jsx-runtime";import"react";var Zt=()=>Tn("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:Tn("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 Ac}from"react/jsx-runtime";import"react";function Yt(t,e){return t?()=>Ac("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Xt}import{$parseSerializedNode as Dn}from"lexical";import{JSOX as Vo}from"jsox";function qt({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 i=Oc(t,n);e[o]=i.value,n=i.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Oc(t,e){let o=t[e];return o==='"'?wn(t,e):o==="'"?wn(t,e,!0):o==="{"?Pc(t,e):o==="["?Fc(t,e):jc(t,e)}function Fc(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:Vo.parse(`[${r}]`)}}function wn(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 Pc(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:Bc(r)}}function Bc(t){return t[0]!=="{"?Vo.parse(t):Vo.parse(t.replace(/(\w+):/g,'"$1":'))}function jc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function ft({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${Hc(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,En)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,En)}}`));return e.join(" ")}function Hc(t){return t.replace(/"/g,"&quot;")}function En(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Qt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let i="",s="",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,T=r;e:for(let[S,_]of d.entries()){let b=l?_.trim():_,g=0;if(l)for(let k=0;k<_.length&&_[k]===" ";k++)g++;let C=0;for(S===0&&(C=(n.index??0)+n[0].length-g);C<b.length;){let k=b[C],y=b[C+1];if(c){if(k==="`"&&f++,f%2===0)if(k==="<"&&y==="/"){if(u--,u<0){s[s.length-1]===`
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(hn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Rc();n.append(...e),t.replace(n),n.select(0,0)}};var Cn=[te([{ChildComponent:Wo,isActive:({selection:t})=>{if(!Mc(t))return!1;for(let e of t.getNodes())if(!xn(e)&&!xn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=_n();kn(e,()=>bn())})},order:20}])],Dc=$({markdownTransformers:[gn],nodes:[vc],slashMenu:{groups:[Z([{Icon:Wo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=_n();kn(e,()=>bn())})}}])]},toolbarFixed:{groups:Cn},toolbarInline:{groups:Cn}});import{getTranslation as no}from"@payloadcms/translations";import{jsx as Go,jsxs as $c}from"react/jsx-runtime";import"react";var Xt=()=>$c("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Go("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Tn}from"react/jsx-runtime";import"react";var Zt=()=>Tn("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:Tn("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 Ac}from"react/jsx-runtime";import"react";function Yt(t,e){return t?()=>Ac("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Xt}import{$parseSerializedNode as Dn}from"lexical";import{JSOX as Vo}from"jsox";function qt({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 i=Oc(t,n);e[o]=i.value,n=i.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Oc(t,e){let o=t[e];return o==='"'?wn(t,e):o==="'"?wn(t,e,!0):o==="{"?Pc(t,e):o==="["?Fc(t,e):jc(t,e)}function Fc(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:Vo.parse(`[${r}]`)}}function wn(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 Pc(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:Bc(r)}}function Bc(t){return t[0]!=="{"?Vo.parse(t):Vo.parse(t.replace(/(\w+):/g,'"$1":'))}function jc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function ft({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${Hc(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,En)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,En)}}`));return e.join(" ")}function Hc(t){return t.replace(/"/g,"&quot;")}function En(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Qt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let i="",s="",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,T=r;e:for(let[S,_]of d.entries()){let b=l?_.trim():_,g=0;if(l)for(let k=0;k<_.length&&_[k]===" ";k++)g++;let C=0;for(S===0&&(C=(n.index??0)+n[0].length-g);C<b.length;){let k=b[C],y=b[C+1];if(c){if(k==="`"&&f++,f%2===0)if(k==="<"&&y==="/"){if(u--,u<0){s[s.length-1]===`
4
4
  `&&(s=s.slice(0,-1)),T=S;for(let R=C;R<b.length;R++)if(b[R]===">"){x=R+1;break}break e}}else if(k==="/"&&y===">"){if(u--,u<0){s[s.length-1]===`
5
5
  `&&(s=s.slice(0,-1)),T=S,x=C+2;break e}}else k==="<"&&y!=="/"&&u++;s+=k}else{if(k==="{"&&!m?a++:k==="}"&&!m?a--:(k==='"'||k==="'")&&!m?m=k:k===m&&(m=null),k==="/"&&y===">"&&a===0&&!m){p=!0,T=S,x=C+2;break e}else if(k===">"&&a===0&&!m){c=!0,C++;continue}i+=k}C++}if(c?s?.length>0&&S>0&&(s+=`
6
6
  `):i+=`
7
7
  `,o&&u<0){let k=b.match(o);if(k?.index!==void 0){T=S,x=k.index+k[0].length-1;break}}if(S===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
8
8
  `)+`
9
9
 
10
- . Start match: `+JSON.stringify(n))}return{afterEndLine:d[T].trim().slice(x),beforeStartLine:h,content:s,endLineIndex:r+T,endlineLastCharIndex:x,propsString:i}}import{jsx as ku}from"react/jsx-runtime";import _u from"bson-objectid";import{$applyNodeReplacement as Tu}from"lexical";import"react";import{DecoratorBlockNode as Uc}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Wc}from"@lexical/utils";import Gc from"bson-objectid";import{$applyNodeReplacement as Vc}from"lexical";var ht=class extends Uc{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Kc(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Wc(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function Kc(t){return Vc(new ht({fields:{...t,id:t?.id||new Gc.default().toHexString()}}))}import{jsx as V,jsxs as gt,Fragment as yn}from"react/jsx-runtime";import{useLexicalComposerContext as eu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as tu}from"@lexical/react/useLexicalEditable";import{getTranslation as ou}from"@payloadcms/translations";import{Button as Rn,Collapsible as ru,Drawer as nu,EditDepthProvider as lu,ErrorPill as iu,Form as su,formatDrawerSlug as au,FormSubmit as cu,Pill as uu,RenderFields as du,SectionTitle as mu,useConfig as pu,useDocumentForm as fu,useDocumentInfo as In,useEditDepth as hu,useFormSubmitted as gu,useServerFunctions as xu,useTranslation as Cu}from"@payloadcms/ui";import{abortAndIgnore as Ko}from"@payloadcms/ui/shared";import{$getNodeByKey as to}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as oo,reduceFieldsToValues as vn}from"payload/shared";import xt,{useCallback as Jo,useEffect as zo,useMemo as Ct,useRef as Xo}from"react";import{v4 as bu}from"uuid";import{c as Jc}from"react/compiler-runtime";import{jsx as eo,jsxs as zc}from"react/jsx-runtime";import{useLexicalEditable as Xc}from"@lexical/react/useLexicalEditable";import{RenderFields as Zc,useFormSubmitted as Yc}from"@payloadcms/ui";import qc,{createContext as Qc}from"react";var Sn=Qc({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,CustomBlock:null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ge=()=>qc.use(Sn),Nn=t=>{let e=Jc(4),{Collapsible:o,...r}=t,{BlockDrawer:n,CustomBlock:l,errorCount:i,formSchema:s}=r,c=Yc()&&i>0,u=Xc(),a;e[0]!==o||e[1]!==i||e[2]!==c?(a=p=>{let{children:f,...h}=p;return eo(o,{errorCount:i,fieldHasErrors:c,...h,children:f})},e[0]=o,e[1]=i,e[2]=c,e[3]=a):a=e[3];let m=a;return l?zc(Sn,{value:{...r,BlockCollapsible:m},children:[l,eo(n,{})]}):eo(m,{children:eo(Zc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!u})})};function Ln({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Mn=t=>{let{cacheBuster:e,className:o,formData:r,nodeKey:n}=t,l=gu(),{id:i,collectionSlug:s,globalSlug:d}=In(),{fieldProps:{featureClientSchemaMap:c,field:u,initialLexicalFormState:a,schemaPath:m},uuid:p}=H(),{fields:f}=fu(),h=Xo(new AbortController),x=hu(),[T,E]=xt.useState(0),{config:S}=pu(),_=au({slug:`lexical-blocks-create-${p}-${r.id}`,depth:x}),{toggleDrawer:b}=fe(_),{getDocPreferences:g,setDocFieldPreferences:C}=In(),[k]=eu(),y=tu(),R=r.blockType,{getFormState:M}=xu(),L=`${m}.lexical_internal_feature.blocks.lexical_blocks.${R}.fields`,[w,N]=xt.useState(()=>{let j=a?.[r.id]?.formState;return j?Object.fromEntries(Object.entries(j).map(([X,W])=>[X,X in r?{...W,initialValue:r[X],value:r[X]}:W])):!1}),I=Xo(!1),A=Xo(e);zo(()=>{I.current?(A.current!==e&&N(!1),A.current=e):I.current=!0},[e]);let[v,O]=xt.useState(w?._components?.customComponents?.BlockLabel??void 0),[D,G]=xt.useState(w?._components?.customComponents?.Block??void 0);zo(()=>{let j=new AbortController;return r&&!w&&(async()=>{let{state:W}=await M({id:i,collectionSlug:s,data:r,docPermissions:{fields:!0},docPreferences:await g(),documentFormState:oo(f),globalSlug:d,initialBlockData:r,operation:"update",readOnly:!y,renderAllFields:!0,schemaPath:L,signal:j.signal});if(W){W.blockName={initialValue:r.blockName,passesCondition:!0,valid:!0,value:r.blockName};let Z=vn(oo(W),!0);k.update(()=>{let ee=to(n);if(ee&&Me(ee)){let ne=Z;ne.blockType=R,ee.setFields(ne,!0)}}),N(W),O(W._components?.customComponents?.BlockLabel??void 0),G(W._components?.customComponents?.Block??void 0)}})(),()=>{Ko(j)}},[M,L,y,i,r,k,n,w,s,d,g,f,R]);let[Q,J]=xt.useState(a?.[r.id]?.collapsed??!1),Pt=`${m}.lexical_internal_feature.blocks.lexical_blocks.${R}`,z=c.blocks?.[Pt]?.[0],U=z.blockReferences?typeof z?.blockReferences?.[0]=="string"?S.blocksMap[z?.blockReferences?.[0]]:z?.blockReferences?.[0]:z?.blocks?.[0],{i18n:Ue,t:Ne}=Cu(),pe=Jo(async({formState:j,submit:X})=>{Ko(h.current);let W=new AbortController;h.current=W;let{state:Z}=await M({id:i,collectionSlug:s,docPermissions:{fields:!0},docPreferences:await g(),documentFormState:oo(f),formState:j,globalSlug:d,initialBlockFormState:j,operation:"update",readOnly:!y,renderAllFields:!!X,schemaPath:L,signal:W.signal});if(!Z)return j;j.blockName&&(Z.blockName=j.blockName);let ee=vn(Ln({fields:oo(Z)}),!0);if(setTimeout(()=>{k.update(()=>{let ne=to(n);if(ne&&Me(ne)){let Ge=ee;Ge.blockType=R,ne.setFields(Ge,!0)}})},0),X){O(Z._components?.customComponents?.BlockLabel??void 0),G(Z._components?.customComponents?.Block??void 0);let ne=0;for(let Ge of Object.values(Z))Ge?.valid===!1&&ne++;E(ne)}return Z},[M,i,s,g,d,L,R,f,y,k,n]);zo(()=>()=>{Ko(h.current)},[]);let jt=Jo(()=>{k.update(()=>{to(n)?.remove()})},[k,n]),Le=U?.labels?.singular?ou(U.labels.singular,Ue):U?.slug,Ht=Jo(j=>{g().then(X=>{let Z=X?.fields?.[u.name]?.collapsed,ee=Z&&Z?.length?Z:[];j?ee.includes(r.id)||ee.push(r.id):ee.includes(r.id)&&ee.splice(ee.indexOf(r.id),1),C(u.name,{collapsed:ee,hello:"hi"})})},[g,u.name,C,r.id]),We=Ct(()=>()=>V(Rn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!y,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),b(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:Ne("lexical:blocks:inlineBlocks:edit",{label:Le})}),[o,y,Ne,Le,b]),Ut=Ct(()=>()=>V(Rn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!y,icon:"x",onClick:j=>{j.preventDefault(),jt()},round:!0,tooltip:"Remove Block"}),[o,y,jt]),Ao=Ct(()=>({Actions:j,children:X,className:W,collapsibleProps:Z,disableBlockName:ee,editButton:ne,errorCount:Ge,fieldHasErrors:Oo,Label:nn,Pill:ln,removeButton:gc})=>V("div",{className:`${o}__container ${o}-${R}`,children:V(ru,{className:[`${o}__row`,Oo?`${o}__row--has-errors`:`${o}__row--no-errors`,W].filter(Boolean).join(" "),collapsibleStyle:Oo?"error":"default",header:gt("div",{className:`${o}__block-header`,children:[typeof nn<"u"?nn:typeof v<"u"?v:gt("div",{className:`${o}__block-label`,children:[typeof ln<"u"?ln:V(uu,{className:`${o}__block-pill ${o}__block-pill-${R}`,pillStyle:"white",size:"small",children:Le??R}),!ee&&!U?.admin?.disableBlockName&&V(mu,{path:"blockName",readOnly:!y}),Oo&&V(iu,{count:Ge??0,i18n:Ue,withMessage:!0})]}),V("div",{className:`${o}__block-actions`,children:typeof j<"u"?j:gt(yn,{children:[D&&ne!==!1||!D&&ne?V(We,{}):null,gc!==!1&&y?V(Ut,{}):null]})})]}),isCollapsed:Q,onToggle:sn=>{Ht(sn),J(sn)},...Z||{},children:X},0)}),[D,v,We,Ut,Le,o,U?.admin?.disableBlockName,R,Ue,Q,Ht,y]),on=r?.id,rn=Ct(()=>()=>V(lu,{children:V(nu,{className:"",slug:_,title:Ne(`lexical:blocks:inlineBlocks:${on?"edit":"create"}`,{label:Le??Ne("lexical:blocks:inlineBlocks:label")}),children:w?gt(yn,{children:[V(du,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:L,permissions:!0,readOnly:!y}),V(cu,{programmaticSubmit:!0,children:Ne("fields:saveChanges")})]}):null})}),[w,_,on,Le,Ne,y,U?.fields,L]),hc=Ct(()=>w?V(su,{beforeSubmit:[async({formState:j})=>await pe({formState:j,submit:!0})],el:"div",fields:U?.fields??[],initialState:w,onChange:[pe],onSubmit:(j,X)=>{X.blockType=R,k.update(()=>{let W=to(n);W&&Me(W)&&W.setFields(X,!0)}),b()},submitted:l,uuid:bu(),children:V(Nn,{baseClass:o,BlockDrawer:rn,Collapsible:Ao,CustomBlock:D,EditButton:We,errorCount:T,formSchema:U?.fields??[],initialState:w,nodeKey:n,RemoveButton:Ut})}):null,[Ao,rn,D,R,Ut,We,o,k,T,b,U?.fields,w,n,pe,l]);return U?hc:V(Ao,{disableBlockName:!0,fieldHasErrors:!0,children:gt("div",{className:`${o}-not-found`,children:["Error: Block '",R,"' not found in the config but exists in the lexical data"]})})};var ie=class extends ht{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=De(e.fields);return o.setFormat(e.format),o}decorate(e,o){return ku(Mn,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function De(t){return Tu(new ie({fields:{...t,id:t?.id||new _u.default().toHexString()}}))}function Me(t){return t instanceof ie}import{createHeadlessEditor as wu}from"@lexical/headless";function Zo(t,e){return({editorState:r})=>{let n=wu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(i){console.error("getLexicalToMarkdown: ERROR parsing editor state",i)}let l="";return n.getEditorState().read(()=>{l=Gt(e)}),l}}import{createHeadlessEditor as Eu}from"@lexical/headless";function ro(t,e){return({markdown:r})=>{let n=Eu({nodes:t});return n.update(()=>{Wt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Su(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var An=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=$n(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=$n(r,!0);n&&(o=o.concat(n))}return o};function $n(t,e){if(!t.jsx)return null;let o=Su(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[ct],export:i=>{if(!dt(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Zo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${s.blockType}${u?" "+ft({props:a}):""}>${c.children}</${s.blockType}>`:`<${s.blockType}${u?" "+ft({props:a}):""}/>`},getEndIndex:(i,s)=>{let{endlineLastCharIndex:d}=Qt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:s,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(i,s){let{content:d,propsString:c}=Qt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...s,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=ro(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:s,props:c?qt({propsString:c}):{}});if(a===!1)return;let m=ut({blockType:t.slug,...a});i.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[ie],export:i=>{if(!Me(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Zo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
10
+ . Start match: `+JSON.stringify(n))}return{afterEndLine:d[T].trim().slice(x),beforeStartLine:h,content:s,endLineIndex:r+T,endlineLastCharIndex:x,propsString:i}}import{jsx as ku}from"react/jsx-runtime";import _u from"bson-objectid";import{$applyNodeReplacement as Tu}from"lexical";import"react";import{DecoratorBlockNode as Uc}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Wc}from"@lexical/utils";import Gc from"bson-objectid";import{$applyNodeReplacement as Vc}from"lexical";var ht=class extends Uc{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Kc(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Wc(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function Kc(t){return Vc(new ht({fields:{...t,id:t?.id||new Gc.default().toHexString()}}))}import{jsx as K,jsxs as gt,Fragment as yn}from"react/jsx-runtime";import{useLexicalComposerContext as eu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as tu}from"@lexical/react/useLexicalEditable";import{getTranslation as ou}from"@payloadcms/translations";import{Button as Rn,Collapsible as ru,Drawer as nu,EditDepthProvider as lu,ErrorPill as iu,Form as su,formatDrawerSlug as au,FormSubmit as cu,Pill as uu,RenderFields as du,SectionTitle as mu,useConfig as pu,useDocumentForm as fu,useDocumentInfo as In,useEditDepth as hu,useFormSubmitted as gu,useServerFunctions as xu,useTranslation as Cu}from"@payloadcms/ui";import{abortAndIgnore as Ko}from"@payloadcms/ui/shared";import{$getNodeByKey as to}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as oo,reduceFieldsToValues as vn}from"payload/shared";import xt,{useCallback as Jo,useEffect as zo,useMemo as Ct,useRef as Xo}from"react";import{v4 as bu}from"uuid";import{c as Jc}from"react/compiler-runtime";import{jsx as eo,jsxs as zc}from"react/jsx-runtime";import{useLexicalEditable as Xc}from"@lexical/react/useLexicalEditable";import{RenderFields as Zc,useFormSubmitted as Yc}from"@payloadcms/ui";import qc,{createContext as Qc}from"react";var Sn=Qc({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,CustomBlock:null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ge=()=>qc.use(Sn),Nn=t=>{let e=Jc(4),{Collapsible:o,...r}=t,{BlockDrawer:n,CustomBlock:l,errorCount:i,formSchema:s}=r,c=Yc()&&i>0,u=Xc(),a;e[0]!==o||e[1]!==i||e[2]!==c?(a=p=>{let{children:f,...h}=p;return eo(o,{errorCount:i,fieldHasErrors:c,...h,children:f})},e[0]=o,e[1]=i,e[2]=c,e[3]=a):a=e[3];let m=a;return l?zc(Sn,{value:{...r,BlockCollapsible:m},children:[l,eo(n,{})]}):eo(m,{children:eo(Zc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!u})})};function Ln({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Mn=t=>{let{cacheBuster:e,className:o,formData:r,nodeKey:n}=t,l=gu(),{id:i,collectionSlug:s,globalSlug:d}=In(),{fieldProps:{featureClientSchemaMap:c,field:u,initialLexicalFormState:a,schemaPath:m},uuid:p}=H(),{fields:f}=fu(),h=Xo(new AbortController),x=hu(),[T,E]=xt.useState(0),{config:S}=pu(),_=au({slug:`lexical-blocks-create-${p}-${r.id}`,depth:x}),{toggleDrawer:b}=fe(_),{getDocPreferences:g,setDocFieldPreferences:C}=In(),[k]=eu(),y=tu(),R=r.blockType,{getFormState:M}=xu(),L=`${m}.lexical_internal_feature.blocks.lexical_blocks.${R}.fields`,[w,N]=xt.useState(()=>{let j=a?.[r.id]?.formState;if(!j)return!1;let ee=Object.fromEntries(Object.entries(j).map(([U,V])=>[U,U in r?{...V,initialValue:r[U],value:r[U]}:V]));return ee.blockName={initialValue:r.blockName,passesCondition:!0,valid:!0,value:r.blockName},ee}),I=Xo(!1),A=Xo(e);zo(()=>{I.current?(A.current!==e&&N(!1),A.current=e):I.current=!0},[e]);let[v,O]=xt.useState(w?._components?.customComponents?.BlockLabel??void 0),[D,G]=xt.useState(w?._components?.customComponents?.Block??void 0);zo(()=>{let j=new AbortController;return r&&!w&&(async()=>{let{state:U}=await M({id:i,collectionSlug:s,data:r,docPermissions:{fields:!0},docPreferences:await g(),documentFormState:oo(f),globalSlug:d,initialBlockData:r,operation:"update",readOnly:!y,renderAllFields:!0,schemaPath:L,signal:j.signal});if(U){U.blockName={initialValue:r.blockName,passesCondition:!0,valid:!0,value:r.blockName};let V=vn(oo(U),!0);k.update(()=>{let Q=to(n);if(Q&&Me(Q)){let ne=V;ne.blockType=R,Q.setFields(ne,!0)}}),N(U),O(U._components?.customComponents?.BlockLabel??void 0),G(U._components?.customComponents?.Block??void 0)}})(),()=>{Ko(j)}},[M,L,y,i,r,k,n,w,s,d,g,f,R]);let[q,z]=xt.useState(a?.[r.id]?.collapsed??!1),Pt=`${m}.lexical_internal_feature.blocks.lexical_blocks.${R}`,X=c.blocks?.[Pt]?.[0],W=X.blockReferences?typeof X?.blockReferences?.[0]=="string"?S.blocksMap[X?.blockReferences?.[0]]:X?.blockReferences?.[0]:X?.blocks?.[0],{i18n:Ue,t:Ne}=Cu(),pe=Jo(async({formState:j,submit:ee})=>{Ko(h.current);let U=new AbortController;h.current=U;let{state:V}=await M({id:i,collectionSlug:s,docPermissions:{fields:!0},docPreferences:await g(),documentFormState:oo(f),formState:j,globalSlug:d,initialBlockFormState:j,operation:"update",readOnly:!y,renderAllFields:!!ee,schemaPath:L,signal:U.signal});if(!V)return j;j.blockName&&(V.blockName=j.blockName);let Q=vn(Ln({fields:oo(V)}),!0);if(setTimeout(()=>{k.update(()=>{let ne=to(n);if(ne&&Me(ne)){let Ge=Q;Ge.blockType=R,ne.setFields(Ge,!0)}})},0),ee){O(V._components?.customComponents?.BlockLabel??void 0),G(V._components?.customComponents?.Block??void 0);let ne=0;for(let Ge of Object.values(V))Ge?.valid===!1&&ne++;E(ne)}return V},[M,i,s,g,d,L,R,f,y,k,n]);zo(()=>()=>{Ko(h.current)},[]);let jt=Jo(()=>{k.update(()=>{to(n)?.remove()})},[k,n]),Le=W?.labels?.singular?ou(W.labels.singular,Ue):W?.slug,Ht=Jo(j=>{g().then(ee=>{let V=ee?.fields?.[u.name]?.collapsed,Q=V&&V?.length?V:[];j?Q.includes(r.id)||Q.push(r.id):Q.includes(r.id)&&Q.splice(Q.indexOf(r.id),1),C(u.name,{collapsed:Q,hello:"hi"})})},[g,u.name,C,r.id]),We=Ct(()=>()=>K(Rn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!y,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),b(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:Ne("lexical:blocks:inlineBlocks:edit",{label:Le})}),[o,y,Ne,Le,b]),Ut=Ct(()=>()=>K(Rn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!y,icon:"x",onClick:j=>{j.preventDefault(),jt()},round:!0,tooltip:"Remove Block"}),[o,y,jt]),Ao=Ct(()=>({Actions:j,children:ee,className:U,collapsibleProps:V,disableBlockName:Q,editButton:ne,errorCount:Ge,fieldHasErrors:Oo,Label:nn,Pill:ln,removeButton:gc})=>K("div",{className:`${o}__container ${o}-${R}`,children:K(ru,{className:[`${o}__row`,Oo?`${o}__row--has-errors`:`${o}__row--no-errors`,U].filter(Boolean).join(" "),collapsibleStyle:Oo?"error":"default",header:gt("div",{className:`${o}__block-header`,children:[typeof nn<"u"?nn:typeof v<"u"?v:gt("div",{className:`${o}__block-label`,children:[typeof ln<"u"?ln:K(uu,{className:`${o}__block-pill ${o}__block-pill-${R}`,pillStyle:"white",size:"small",children:Le??R}),!Q&&!W?.admin?.disableBlockName&&K(mu,{path:"blockName",readOnly:!y}),Oo&&K(iu,{count:Ge??0,i18n:Ue,withMessage:!0})]}),K("div",{className:`${o}__block-actions`,children:typeof j<"u"?j:gt(yn,{children:[D&&ne!==!1||!D&&ne?K(We,{}):null,gc!==!1&&y?K(Ut,{}):null]})})]}),isCollapsed:q,onToggle:sn=>{Ht(sn),z(sn)},...V||{},children:ee},0)}),[D,v,We,Ut,Le,o,W?.admin?.disableBlockName,R,Ue,q,Ht,y]),on=r?.id,rn=Ct(()=>()=>K(lu,{children:K(nu,{className:"",slug:_,title:Ne(`lexical:blocks:inlineBlocks:${on?"edit":"create"}`,{label:Le??Ne("lexical:blocks:inlineBlocks:label")}),children:w?gt(yn,{children:[K(du,{fields:W?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:L,permissions:!0,readOnly:!y}),K(cu,{programmaticSubmit:!0,children:Ne("fields:saveChanges")})]}):null})}),[w,_,on,Le,Ne,y,W?.fields,L]),hc=Ct(()=>w?K(su,{beforeSubmit:[async({formState:j})=>await pe({formState:j,submit:!0})],el:"div",fields:W?.fields??[],initialState:w,onChange:[pe],onSubmit:(j,ee)=>{ee.blockType=R,k.update(()=>{let U=to(n);U&&Me(U)&&U.setFields(ee,!0)}),b()},submitted:l,uuid:bu(),children:K(Nn,{baseClass:o,BlockDrawer:rn,Collapsible:Ao,CustomBlock:D,EditButton:We,errorCount:T,formSchema:W?.fields??[],initialState:w,nodeKey:n,RemoveButton:Ut})}):null,[Ao,rn,D,R,Ut,We,o,k,T,b,W?.fields,w,n,pe,l]);return W?hc:K(Ao,{disableBlockName:!0,fieldHasErrors:!0,children:gt("div",{className:`${o}-not-found`,children:["Error: Block '",R,"' not found in the config but exists in the lexical data"]})})};var ie=class extends ht{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=De(e.fields);return o.setFormat(e.format),o}decorate(e,o){return ku(Mn,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function De(t){return Tu(new ie({fields:{...t,id:t?.id||new _u.default().toHexString()}}))}function Me(t){return t instanceof ie}import{createHeadlessEditor as wu}from"@lexical/headless";function Zo(t,e){return({editorState:r})=>{let n=wu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(i){console.error("getLexicalToMarkdown: ERROR parsing editor state",i)}let l="";return n.getEditorState().read(()=>{l=Gt(e)}),l}}import{createHeadlessEditor as Eu}from"@lexical/headless";function ro(t,e){return({markdown:r})=>{let n=Eu({nodes:t});return n.update(()=>{Wt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Su(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var An=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=$n(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=$n(r,!0);n&&(o=o.concat(n))}return o};function $n(t,e){if(!t.jsx)return null;let o=Su(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[ct],export:i=>{if(!dt(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Zo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${s.blockType}${u?" "+ft({props:a}):""}>${c.children}</${s.blockType}>`:`<${s.blockType}${u?" "+ft({props:a}):""}/>`},getEndIndex:(i,s)=>{let{endlineLastCharIndex:d}=Qt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:s,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(i,s){let{content:d,propsString:c}=Qt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...s,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=ro(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:s,props:c?qt({propsString:c}):{}});if(a===!1)return;let m=ut({blockType:t.slug,...a});i.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[ie],export:i=>{if(!Me(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Zo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
11
11
  `))for(let f of m.split(`
12
12
  `)){let h="";!t?.jsx?.doNotTrimChildren&&f!==""&&(h=" "),h+=f+`
13
13
  `,p+=h}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
@@ -51,16 +51,16 @@ ${e.map(Qu).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=$e((_,b)=>{o(g=>{let C=e.length-1,k=e[C];if(k&&k.name===_){if(_==="type")return[...e.slice(0,C),{...k,value:k.value+b}];if(k.value===b)return[...e.slice(0,C),{...k,count:k.count+1}]}return[...g,{name:_,count:1,value:b}]})},[e,o]);jn(()=>{let _=g=>{if(!r)return;let C=g.key;ed(g)?p("selectAll",""):Un.has(C)?p("press",g.key):[...C].length>1?p("keydown",g.key):p("type",g.key)},b=g=>{if(!r)return;let C=g.key;!Un.has(C)&&[...C].length>1&&p("keyup",g.key)};return t.registerRootListener((g,C)=>{C!==null&&(C.removeEventListener("keydown",_),C.removeEventListener("keyup",b)),g!==null&&(g.addEventListener("keydown",_),g.addEventListener("keyup",b))})},[t,r,p]),jn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),qo(()=>{if(e){let _=m();_!==null&&s(_),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),qo(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:g,editorState:C})=>{if(!r)return;let k=C._selection,y=d.current,R=c.current;if(y!==k){if(g.size===0&&b.size===0&&!R){let L=Yo(t._window);if(L&&(L.anchorNode==null||L.focusNode==null))return}d.current=k}c.current=!1;let M=m();M!==null&&s(M)}),[t,m,r,p]),qo(()=>r?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,r]);let f=$e(_=>{r||(_.update(()=>{let b=Zu();b.clear();let g=Xu();b.append(zu().append(g)),g.select()}),o([])),n(b=>!b)},[r]),h=$e(()=>{if(!r)return;let _=Yo(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:b,anchorOffset:g,focusNode:C,focusOffset:k}=td(_),y=a().getRootElement(),R;b!==null&&(R=Hn(b,y));let M;C!==null&&(M=Hn(C,y)),p("snapshot",{anchorNode:b,anchorOffset:g,anchorPath:R,focusNode:C,focusOffset:k,focusPath:M})},[p,r,a]),x=$e(()=>{Yu(m())},[m]),T=$e(()=>{qu("test.js",m())},[m]);return[Ae("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{f(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?er("div",{className:"test-recorder-output",children:[er("div",{className:"test-recorder-toolbar",children:[Ae("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Ae("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{x(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Ae("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{T(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Ae("pre",{id:"test-recorder",ref:u,children:i})]}):null]}var Gn=()=>{let t=Ku(3),[e]=Ju(),[o,r]=od(e),n;return t[0]!==o||t[1]!==r?(n=er(Wn.Fragment,{children:[Ae("p",{children:"HI"}),o,r,Ae("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var rd=$({plugins:[{Component:Gn,position:"bottom"}]});import{c as nd}from"react/compiler-runtime";import{jsx as ld}from"react/jsx-runtime";import{useLexicalComposerContext as id}from"@lexical/react/LexicalComposerContext.js";import{TreeView as sd}from"@lexical/react/LexicalTreeView.js";import"react";var Vn=()=>{let t=nd(2),[e]=id(),o;return t[0]!==e?(o=ld(sd,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var ad=$({plugins:[{Component:Vn,position:"bottom"}]});import{$isTableSelection as cd}from"@lexical/table";import{$isRangeSelection as ud,FORMAT_TEXT_COMMAND as dd}from"lexical";import{jsx as Kn}from"react/jsx-runtime";import"react";var Jn=()=>Kn("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:Kn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var q=t=>({type:"buttons",items:t,key:"format",order:40});var zn={type:"text-format",format:["bold","italic"],tag:"***"},Xn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Zn={type:"text-format",format:["bold"],tag:"**"},Yn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var qn=[q([{ChildComponent:Jn,isActive:({selection:t})=>ud(t)||cd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(dd,"bold")},order:1}])],md=$(({featureProviderMap:t})=>{let e=[Zn,Yn];return t.get("italic")&&e.push(Xn,zn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:qn},toolbarInline:{groups:qn}}});import{$isTableSelection as fd}from"@lexical/table";import{$isRangeSelection as hd,FORMAT_TEXT_COMMAND as gd}from"lexical";import{jsx as Qn,jsxs as pd}from"react/jsx-runtime";import"react";var el=()=>pd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Qn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Qn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var tl={type:"text-format",format:["code"],tag:"`"};var ol=[q([{ChildComponent:el,isActive:({selection:t})=>hd(t)||fd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(gd,"code")},order:7}])],xd=$({enableFormats:["code"],markdownTransformers:[tl],toolbarFixed:{groups:ol},toolbarInline:{groups:ol}});import{$isTableSelection as Cd}from"@lexical/table";import{$isRangeSelection as bd,FORMAT_TEXT_COMMAND as kd}from"lexical";import{jsx as rl}from"react/jsx-runtime";import"react";var nl=()=>rl("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:rl("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var ll={type:"text-format",format:["italic"],tag:"*"},il={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var sl=[q([{ChildComponent:nl,isActive:({selection:t})=>bd(t)||Cd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(kd,"italic")},order:2}])],_d=$({enableFormats:["italic"],markdownTransformers:[ll,il],toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{$isTableSelection as wd}from"@lexical/table";import{$isRangeSelection as Ed,FORMAT_TEXT_COMMAND as Sd}from"lexical";import{jsx as al,jsxs as Td}from"react/jsx-runtime";import"react";var cl=()=>Td("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[al("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),al("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var ul={type:"text-format",format:["strikethrough"],tag:"~~"};var dl=[q([{ChildComponent:cl,isActive:({selection:t})=>Ed(t)||wd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Sd,"strikethrough")},order:4}])],Nd=$({enableFormats:["strikethrough"],markdownTransformers:[ul],toolbarFixed:{groups:dl},toolbarInline:{groups:dl}});import{$isTableSelection as Ld}from"@lexical/table";import{$isRangeSelection as yd,FORMAT_TEXT_COMMAND as Rd}from"lexical";import{jsx as ml}from"react/jsx-runtime";import"react";var pl=()=>ml("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:ml("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var fl=[q([{ChildComponent:pl,isActive:({selection:t})=>yd(t)||Ld(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Rd,"subscript")},order:5}])],Id=$({enableFormats:["subscript"],toolbarFixed:{groups:fl},toolbarInline:{groups:fl}});import{$isTableSelection as vd}from"@lexical/table";import{$isRangeSelection as Md,FORMAT_TEXT_COMMAND as Dd}from"lexical";import{jsx as hl}from"react/jsx-runtime";import"react";var gl=()=>hl("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:hl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var xl=[q([{ChildComponent:gl,isActive:({selection:t})=>Md(t)||vd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Dd,"superscript")},order:6}])],$d=$({enableFormats:["superscript"],toolbarFixed:{groups:xl},toolbarInline:{groups:xl}});import{$isTableSelection as Od}from"@lexical/table";import{$isRangeSelection as Fd,FORMAT_TEXT_COMMAND as Pd}from"lexical";import{jsx as Cl,jsxs as Ad}from"react/jsx-runtime";import"react";var bl=()=>Ad("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:[Cl("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),Cl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var kl=[q([{ChildComponent:bl,isActive:({selection:t})=>Fd(t)||Od(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Pd,"underline")},order:3}])],Bd=$({enableFormats:["underline"],toolbarFixed:{groups:kl},toolbarInline:{groups:kl}});import{jsx as or}from"react/jsx-runtime";import{jsx as jd}from"react/jsx-runtime";function Hd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var io=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Hd(o),r])):{};return jd("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Ud}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Wd}from"@lexical/selection";import{$getNodeByKey as Gd,$getState as Vd,$setState as Kd,createState as Jd,TextNode as zd}from"lexical";import{useEffect as Xd}from"react";function _l(t){let e=new Map;for(let o in t){let r=t[o],n=Jd(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function tr(t,e,o,r){t.update(()=>{Wd(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);Kd(n,l.stateConfig,r)})})}function Tl({stateMap:t}){let[e]=Ud();return Xd(()=>e.registerMutationListener(zd,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=Gd(r),i=e.getElementByKey(r);if(!l||!i)continue;let s=Object.create(null);t.forEach((d,c)=>{let u=Vd(l,d.stateConfig);if(!u){delete i.dataset[c];return}i.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(s,a)}),i.style.cssText="",Object.assign(i.style,s)}})}),[e]),null}var wl=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let i in l){let s=l[i];o.push({ChildComponent:()=>or(io,{css:s.css}),key:i,label:s.label,onSelect:({editor:d})=>{tr(d,e,n,i)}})}}return[{type:"dropdown",ChildComponent:()=>or(io,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>or(io,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)tr(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},Zd=$(({props:t})=>{let e=_l(t.state);return{plugins:[{Component:()=>Tl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:wl(t,e)},toolbarInline:{groups:wl(t,e)}}});import{c as em}from"react/compiler-runtime";import{useLexicalComposerContext as tm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as om,$isHeadingNode as Fl,HeadingNode as jl}from"@lexical/rich-text";import{$setBlocksType as rm}from"@lexical/selection";import{$getSelection as nm,$isRangeSelection as lm}from"lexical";import{useEffect as im}from"react";import{jsx as El}from"react/jsx-runtime";import"react";var Sl=()=>El("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Nl}from"react/jsx-runtime";import"react";var Ll=()=>Nl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Nl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as yl}from"react/jsx-runtime";import"react";var Rl=()=>yl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as Il}from"react/jsx-runtime";import"react";var vl=()=>Il("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Il("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Ml}from"react/jsx-runtime";import"react";var Dl=()=>Ml("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:Ml("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as $l}from"react/jsx-runtime";import"react";var Al=()=>$l("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:$l("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as Yd,$isHeadingNode as qd,HeadingNode as Qd}from"@lexical/rich-text";var rr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Ol=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Qd],export:(n,l)=>{if(!qd(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:rr(n=>{let l="h"+n[1]?.length;return Yd(l)})}};var Pl=t=>{let e=nm();rm(e,()=>om(t))},Bl={h1:Sl,h2:Ll,h3:Rl,h4:vl,h5:Dl,h6:Al},sm=$(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((r,n)=>({ChildComponent:Bl[r],isActive:({selection:l})=>{if(!lm(l))return!1;for(let i of l.getNodes()){if(Fl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(Fl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Pl(r)})},order:n+2})))];return{markdownTransformers:[Ol(e)],nodes:[jl],plugins:[{Component:am,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Y(e.map(r=>({Icon:Bl[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{Pl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),am=t=>{let e=em(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[d]=tm(),c,u;return e[4]!==d||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return d.registerNodeTransform(jl,a=>{l.includes(a.getTag())||a.setTag(s)})},u=[d,l,s],e[4]=d,e[5]=l,e[6]=s,e[7]=c,e[8]=u):(c=e[7],u=e[8]),im(c,u),null};import{$isNodeSelection as Em}from"lexical";import{jsx as Hl}from"react/jsx-runtime";import"react";var nr=()=>Hl("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:Hl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Ul,jsxs as cm}from"react/jsx-runtime";import"react";var Wl=()=>cm("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ul("path",{d:"M5 10h10",stroke:"currentColor"}),Ul("path",{d:"M10 15V5",stroke:"currentColor"})]});var xe=t=>({type:"dropdown",ChildComponent:Wl,items:t,key:"add",order:10});import{addClassNamesToElement as um}from"@lexical/utils";import{$applyNodeReplacement as dm,createCommand as mm,DecoratorNode as pm}from"lexical";var kt=mm("INSERT_HORIZONTAL_RULE_COMMAND"),bt=class extends pm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:fm,priority:0})}}static importJSON(e){return Gl()}createDOM(e){let o=document.createElement("hr");return um(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
- `}isInline(){return!1}updateDOM(){return!1}};function fm(){return{node:Gl()}}function Gl(){return dm(new bt)}import{$applyNodeReplacement as hm}from"lexical";import"react";var Ce=class extends bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Xe()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Xe(){return hm(new Ce)}function _t(t){return t instanceof Ce}var Vl={type:"element",dependencies:[Ce],export:(t,e)=>_t(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Xe();e&&t.replace(e)}};import{c as gm}from"react/compiler-runtime";import{useLexicalComposerContext as xm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Cm}from"@lexical/utils";import{$getSelection as bm,$isRangeSelection as km,COMMAND_PRIORITY_EDITOR as _m}from"lexical";import{useEffect as Tm}from"react";var Kl=()=>{let t=gm(3),[e]=xm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(kt,wm,_m),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Tm(o,r),null};function wm(t){let e=bm();if(!km(e))return!1;if(e.focus.getNode()!==null){let r=Xe();Cm(r)}return!0}var Sm=$({markdownTransformers:[Vl],nodes:[Ce],plugins:[{Component:Kl,position:"normal"}],slashMenu:{groups:[Y([{Icon:nr,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:nr,isActive:({selection:t})=>{if(!Em(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return _t(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]}});import{$findMatchingParent as oi}from"@lexical/utils";import{$isElementNode as Pm,INDENT_CONTENT_COMMAND as Bm,OUTDENT_CONTENT_COMMAND as jm}from"lexical";import{jsx as so,jsxs as Nm}from"react/jsx-runtime";import"react";var Jl=()=>Nm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[so("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ao,jsxs as Lm}from"react/jsx-runtime";import"react";var zl=()=>Lm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ao("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as ym}from"react/jsx-runtime";import{useLexicalComposerContext as Rm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Im}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as vm,mergeRegister as Xl}from"@lexical/utils";import{$getSelection as Mm,$isElementNode as Ql,$isRangeSelection as Dm,COMMAND_PRIORITY_LOW as Zl,INDENT_CONTENT_COMMAND as Yl,KEY_TAB_COMMAND as $m,OUTDENT_CONTENT_COMMAND as Am,TabNode as Om}from"lexical";import{useEffect as ql}from"react";var ei=({clientProps:t})=>{let[e]=Rm(),{disabledNodes:o,disableTabNode:r}=t;return ql(()=>{if(!(!e||!o?.length))return Xl(e.registerCommand(Yl,()=>Fm(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Zl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Ql(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),ql(()=>{if(!(!e||!r))return Xl(e.registerCommand($m,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Am:Yl,void 0)),Zl),e.registerNodeTransform(Om,n=>{n.remove()}))},[e,r]),ym(Im,{})};function Fm(t){let e=Mm();if(!Dm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=vm(l,c=>Ql(c)&&!c.isInline());if(s===null)continue;let d=s.getKey();s.canIndent()&&!o.has(d)&&(o.add(d),t(s))}return o.size>0}var ti=t=>({type:"buttons",items:t,key:"indent",order:35});var ri=({disabledNodes:t})=>[ti([{ChildComponent:Jl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ni(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!oi(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(jm,void 0)},order:1},{ChildComponent:zl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ni(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!oi(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Bm,void 0)},order:2}])],Hm=$(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ei,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:ri({disabledNodes:e})},toolbarInline:{groups:ri({disabledNodes:e})}}}),ni=t=>Pm(t)&&t.canIndent();import{$findMatchingParent as ef}from"@lexical/utils";import{$getSelection as pr,$isRangeSelection as Ai}from"lexical";import{jsx as li}from"react/jsx-runtime";import"react";var ii=()=>li("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:li("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as si}from"@lexical/selection";function Ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?si(o)?r:n:si(e)?r:n}var lr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as qm}from"lexical";import{addClassNamesToElement as Um,isHTMLAnchorElement as Wm}from"@lexical/utils";import ar from"bson-objectid";import{$applyNodeReplacement as Gm,$createTextNode as ai,$getSelection as Vm,$isElementNode as ci,$isRangeSelection as sr,createCommand as Km,ElementNode as Jm}from"lexical";var zm=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends Jm{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Xm,priority:1})}}static importJSON(e){let o=be({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new ar.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=ir(o.rel,"add","noopener")),Um(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!sr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(ci(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!zm.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=ir(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=ir(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Xm(t){let e=null;if(Wm(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new ar.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return Gm(new oe({id:t??new ar.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var ce=Km("TOGGLE_LINK_COMMAND");function cr(t){let e=Vm();if(!sr(e)&&(t===null||!t.selectedNodes?.length))return;let o=sr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();K(i)&&(i.getChildren().forEach(d=>{i.insertBefore(d)}),i.remove())});return}if(o?.length===1){let l=o[0],i=K(l)?l:Zm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ai(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||ci(l)&&!l.isInline())){if(K(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ai(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=be({fields:t.fields}),K(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Zm(t){return Ym(t,e=>K(e))}function Ym(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function ir(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var ui={type:"text-match",dependencies:[oe],export:(t,e)=>{if(!K(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=qm(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Qm,$isElementNode as ep}from"lexical";var ke=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Tt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(ep(r)){let n=Tt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Tt({fields:t}){return Qm(new ke({id:"",fields:t}))}function _e(t){return t instanceof ke}import{c as tp}from"react/compiler-runtime";import{useLexicalComposerContext as op}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as rp}from"@lexical/utils";import{$createTextNode as di,$getSelection as np,$isElementNode as pi,$isLineBreakNode as fi,$isNodeSelection as lp,$isRangeSelection as ip,$isTextNode as wt,TextNode as sp}from"lexical";import{useEffect as ap}from"react";function mi(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function hi(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var cp=/[.,;\s]/;function uo(t){return t!==void 0&&cp.test(t)}function gi(t){return uo(t[t.length-1])}function dr(t){return uo(t[0])}function up(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function xi(t){let e=t.getPreviousSibling();return pi(e)&&(e=e.getLastDescendant()),e===null||fi(e)||wt(e)&&gi(e.getTextContent())}function Ci(t){let e=t.getNextSibling();return pi(e)&&(e=e.getFirstDescendant()),e===null||fi(e)||wt(e)&&dr(e.getTextContent())}function dp(t,e,o,r){return(t>0?uo(o[t-1]):xi(r[0]))?e<o.length?uo(o[e]):Ci(r[r.length-1]):!1}function mp(t,e,o){let r=[],n=[],l=[],i=0,s=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,d.shift()}return[i,r,n,l]}function pp(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Tt({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let d=di(r.text);d.setFormat(s.getFormat()),d.setDetail(s.getDetail()),d.setStyle(s.getStyle()),l.append(d),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,d;e===0?d=i:[,d]=i.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[x,T]=a.splitText(o-f);x&&c.push(x),u=T}s+=p}),d){let a=np(),m=a?a.getNodes().find(wt):void 0,p=di(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(ip(a)?p.select(a.anchor.offset,a.focus.offset):lp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function fp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,i,s=0;for(;(i=hi(l,e))!=null&&i!==null;){let d=i.index,c=i.length,u=d+c;if(dp(s+d,s+u,n,r)){let[m,,p,f]=mp(r,s+d,s+u),h=s+d-m,x=s+u-m,T=pp(p,h,x,i);r=T?[T,...f]:f,o(i.url,null),s=0}else s+=u;l=l.substring(u)}}function ur(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!wt(c)||!c.isSimpleText()){co(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=hi(l,e);if(i===null||i.text!==l){co(t),o(null,t.getFields()?.url??null);return}if(!xi(t)||!Ci(t)){co(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let d=t.getFields();d.url=i?.url,t.setFields(d),o(i.url,s??null)}}function hp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(_e(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!dr(l)||up(l,i))&&(r.append(t),ur(r,e,o),o(null,r.getFields()?.url??null))}_e(n)&&!gi(l)&&(co(n),ur(n,e,o),o(null,n.getFields()?.url??null))}function co(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function gp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&wt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function xp(t,e,o){let r=tp(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,d)=>{o?.(s,d)};return rp(t.registerNodeTransform(sp,s=>{let d=s.getParentOrThrow(),c=s.getPreviousSibling();if(_e(d))ur(d,e,i);else if(!K(d)){if(s.isSimpleText()&&(dr(s.getTextContent())||!_e(c))){let u=gp(s);fp(u,e,i)}hp(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),ap(n,l)}var Cp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,bp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,kp=[mi(Cp,t=>t.startsWith("http")?t:`https://${t}`),mi(bp,t=>`mailto:${t}`)],bi=()=>{let[t]=op();return xp(t,kp),null};import{jsx as _p}from"react/jsx-runtime";import{ClickableLinkPlugin as Tp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var ki=()=>_p(Tp,{});import{jsx as Hp}from"react/jsx-runtime";import"react";import{createPortal as Up}from"react-dom";import{jsx as Te,jsxs as Et,Fragment as Ep}from"react/jsx-runtime";import{useLexicalComposerContext as Sp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Np}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as _i,mergeRegister as Ti}from"@lexical/utils";import{getTranslation as mr}from"@payloadcms/translations";import{CloseMenuIcon as Lp,EditIcon as yp,ExternalLinkIcon as wi,formatDrawerSlug as Rp,useConfig as Ip,useEditDepth as vp,useLocale as Mp,useTranslation as Dp}from"@payloadcms/ui";import{requests as $p}from"@payloadcms/ui/shared";import{$getSelection as Ei,$isLineBreakNode as Ap,$isRangeSelection as Si,COMMAND_PRIORITY_HIGH as Op,COMMAND_PRIORITY_LOW as Ni,getDOMSelection as Fp,KEY_ESCAPE_COMMAND as Pp,SELECTION_CHANGE_COMMAND as Bp}from"lexical";import Li,{useCallback as yi,useEffect as fo,useRef as jp,useState as Oe}from"react";function mo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),d=l.getBoundingClientRect(),c=t.top-r,u=t.left-n;c<d.top&&(c+=i.height+t.height+r*2),u+i.width>d.right&&(u=d.right-i.width-n),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as wp}from"lexical";var po=wp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ri(t){t.preventDefault()}function Ii({anchorElem:t}){let[e]=Sp(),[o,r]=Oe(),n=jp(null),[l,i]=Oe(null),[s,d]=Oe(null),{fieldProps:{schemaPath:c},uuid:u}=H(),a=Np(),{config:m,getEntityConfig:p}=Ip(),{i18n:f,t:h}=Dp(),[x,T]=Oe(),E=vp(),[S,_]=Oe(!1),[b,g]=Oe([]),C=Mp(),[k,y]=Oe(!1),R=Rp({slug:"lexical-rich-text-link-"+u,depth:E}),{toggleDrawer:M}=fe(R),L=yi(()=>{_(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),y(!1),i(null),d(null),g([]),T(void 0)},[_,i,d,g]),w=yi(()=>{let N=Ei(),I;if(!Si(N)||!N){L();return}let A=Ze(N);I=e.getElementByKey(A.getKey())?.getBoundingClientRect();let v=_i(A,K),O=N.getNodes().filter(z=>!Ap(z)).find(z=>{let U=_i(z,K);return v&&!v.is(U)||U&&!U.is(v)});if(v==null||O){L();return}r(v);let D=v.getFields(),G={...D,id:v.getID(),text:v.getTextContent()};if(D?.linkType==="custom")i(D?.url??null),d(null);else{i(`${m.routes.admin==="/"?"":m.routes.admin}/collections/${D?.doc?.relationTo}/${D?.doc?.value}`);let z=D?.doc?.relationTo?p({collectionSlug:D?.doc?.relationTo}):void 0;if(!z)d(D?.label?String(D?.label):null),i(D?.url?String(D?.url):null);else{let U=typeof D.doc?.value=="object"?D.doc.value.id:D.doc?.value,Ue=D.doc?.relationTo;if(!U||!Ue)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Ne=h("fields:linkedTo",{label:`${mr(z.labels.singular,f)} - ${h("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(Ne),$p.get(`${m.serverURL}${m.routes.api}/${Ue}/${U}`,{headers:{"Accept-Language":f.language},params:{depth:0,locale:C?.code}}).then(async pe=>{if(!pe.ok)throw new Error(`HTTP error! Status: ${pe.status}`);let jt=await pe.json(),Le=z?.admin?.useAsTitle||"id",Ht=jt[Le],We=h("fields:linkedTo",{label:`${mr(z.labels.singular,f)} - ${Ht}`}).replace(/<[^>]*>?/g,"");d(We)}).catch(()=>{let pe=h("fields:linkedTo",{label:`${mr(z.labels.singular,f)} - ${h("general:untitled",f)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");d(pe)})}}T(G),_(!0),g(N?N?.getNodes():[]),_e(v)?y(!0):y(!1);let Q=n.current,J=Fp(e._window),{activeElement:Pt}=document;if(Q===null)return;let Bt=e.getRootElement();return J!==null&&Bt!==null&&Bt.contains(J.anchorNode)?(I||(I=J.getRangeAt(0).getBoundingClientRect()),I!=null&&(I.y+=40,mo(I,Q,t))):(Pt==null||Pt.className!=="link-input")&&(Bt!==null&&mo(null,Q,t),i(null),d(null)),!0},[e,L,m.routes.admin,m.routes.api,m.serverURL,p,h,f,C?.code,t]);return fo(()=>Ti(e.registerCommand(po,N=>(e.dispatchCommand(ce,N),w(),M(),!0),Ni)),[e,w,M,R]),fo(()=>{let N=t.parentElement,I=()=>{e.getEditorState().read(()=>{w()})};return window.addEventListener("resize",I),N?.addEventListener("scroll",I),()=>{window.removeEventListener("resize",I),N?.removeEventListener("scroll",I)}},[t.parentElement,e,w]),fo(()=>Ti(e.registerUpdateListener(({editorState:N})=>{N.read(()=>{w()})}),e.registerCommand(Bp,()=>(w(),!0),Ni),e.registerCommand(Pp,()=>S?(L(),!0):!1,Op)),[e,w,S,L]),fo(()=>{e.getEditorState().read(()=>{w()})},[e,w]),Et(Li.Fragment,{children:[Te("div",{className:"link-editor",ref:n,children:Et("div",{className:"link-input",children:[l&&l.length>0?Et("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Te(wi,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Et(Ep,{children:[o?.__fields.newTab?Te(wi,{}):null,Te("span",{className:"link-input__label-pure",children:s})]}):null,a&&Et(Li.Fragment,{children:[Te("button",{"aria-label":"Edit link",className:"link-edit",onClick:N=>{N.preventDefault(),M()},onMouseDown:Ri,tabIndex:0,type:"button",children:Te(yp,{})}),!k&&Te("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ce,null)},onMouseDown:Ri,tabIndex:0,type:"button",children:Te(Lp,{})})]})]})}),Te(mt,{className:"lexical-link-edit-drawer",data:x,drawerSlug:R,drawerTitle:h("fields:editLink"),featureKey:"link",handleDrawerSubmit:(N,I)=>{let A=I,v={...A};delete v.text,e.update(()=>{let O=Ei(),D=null;if(Si(O)?D=Ze(O).getParent():b.length&&(D=b[0]?.getParent()??null),D&&_e(D)){let G=be({fields:v});D.replace(G,!0)}}),e.dispatchCommand(ce,{fields:v,selectedNodes:b,text:A.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var vi=t=>{let{anchorElem:e=document.body}=t;return Up(Hp(Ii,{anchorElem:e}),e)};import{c as Vp}from"react/compiler-runtime";import{useLexicalComposerContext as Kp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Jp}from"@lexical/utils";import{$getSelection as zp,$isElementNode as Xp,$isRangeSelection as Zp,COMMAND_PRIORITY_LOW as Di,PASTE_COMMAND as Yp}from"lexical";import{useEffect as qp}from"react";var Wp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Gp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Mi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||Wp.test(t)||Gp.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}var $i=t=>{let e=Vp(5),{clientProps:o}=t,[r]=Kp(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Jp(r.registerCommand(ce,i=>i===null?(cr(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),cr(i),!0),Di),r.registerCommand(Yp,i=>{let s=zp();if(!Zp(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let d=i.clipboardData.getData("text");if(!Mi(d))return!1;if(!s.getNodes().some(Qp)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ce,{fields:c,text:null}),i.preventDefault(),!0}return!1},Di))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),qp(n,l),null};function Qp(t){return Xp(t)}var Oi=[lr([{ChildComponent:ii,isActive:({selection:t})=>{if(Ai(t)){let e=Ze(t);return ef(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(Ai(t)&&pr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ce,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=pr()?.getTextContent(),r=pr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(po,{fields:n,selectedNodes:r,text:o})}},order:1}])],tf=$(({props:t})=>({markdownTransformers:[ui],nodes:[oe,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:$i,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:bi,position:"normal"},{Component:ki,position:"normal"},{Component:vi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Oi},toolbarInline:{groups:Oi}}));import{$isListNode as gr,INSERT_CHECK_LIST_COMMAND as Ui,ListItemNode as ff,ListNode as hf}from"@lexical/list";import{$isRangeSelection as gf}from"lexical";import{jsx as Fi,jsxs as of}from"react/jsx-runtime";import"react";var fr=()=>of("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:[Fi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Fi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as rf}from"react/jsx-runtime";import{ListPlugin as nf}from"@lexical/react/LexicalListPlugin.js";import"react";var Ye=()=>rf(nf,{});function ho(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function qe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as cf,ListItemNode as uf,ListNode as df}from"@lexical/list";import{$createListItemNode as lf,$createListNode as sf,$isListItemNode as af,$isListNode as hr}from"@lexical/list";var Pi=4,Qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=lf(t==="check"?r[3]==="x":void 0);if(hr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(i):l.append(i),e.remove()}else if(hr(n)&&n.getListType()===t)n.append(i),e.remove();else{let d=sf(t,t==="number"?Number(r[2]):void 0);d.append(i),e.replace(d)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/Pi);s&&i.setIndent(s)},Fe=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(af(i)){if(i.getChildrenSize()===1){let u=i.getFirstChild();if(hr(u)){r.push(Fe(u,e,o+1));continue}}let s=" ".repeat(o*Pi),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
56
- `)};var Bi={type:"element",dependencies:[df,uf],export:(t,e)=>cf(t)?Fe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Qe("check")};import{jsx as mf}from"react/jsx-runtime";import{CheckListPlugin as pf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var ji=()=>mf(pf,{});var Hi=[te([{ChildComponent:fr,isActive:({selection:t})=>{if(!gf(t))return!1;for(let e of t.getNodes()){if(gr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(gr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(gr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ui,void 0)},order:12}])],xf=$(({featureProviderMap:t})=>{let e=[{Component:ji,position:"normal"}],o=ho("checklist",t);return o&&e.push({Component:Ye,position:"normal"}),{markdownTransformers:[Bi],nodes:o?[hf,ff]:[],plugins:e,slashMenu:{groups:[qe([{Icon:fr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(Ui,void 0)}}])]},toolbarFixed:{groups:Hi},toolbarInline:{groups:Hi}}});import{$isListNode as Cr,INSERT_ORDERED_LIST_COMMAND as Vi,ListItemNode as Tf,ListNode as wf}from"@lexical/list";import{$isRangeSelection as Ef}from"lexical";import{jsx as St,jsxs as Cf}from"react/jsx-runtime";import"react";var xr=()=>Cf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[St("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),St("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),St("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as bf,ListItemNode as kf,ListNode as _f}from"@lexical/list";var Wi={type:"element",dependencies:[_f,kf],export:(t,e)=>bf(t)?Fe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Qe("number")};var Gi=[te([{ChildComponent:xr,isActive:({selection:t})=>{if(!Ef(t))return!1;for(let e of t.getNodes()){if(Cr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Cr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Cr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Vi,void 0)},order:10}])],Sf=$(({featureProviderMap:t})=>{let e=ho("ordered",t);return{markdownTransformers:[Wi],nodes:e?[wf,Tf]:[],plugins:e?[{Component:Ye,position:"normal"}]:[],slashMenu:{groups:[qe([{Icon:xr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Vi,void 0)}}])]},toolbarFixed:{groups:Gi},toolbarInline:{groups:Gi}}});import{$isListNode as kr,INSERT_UNORDERED_LIST_COMMAND as zi,ListItemNode as If,ListNode as vf}from"@lexical/list";import{$isRangeSelection as Mf}from"lexical";import{jsx as et,jsxs as Nf}from"react/jsx-runtime";import"react";var br=()=>Nf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[et("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),et("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),et("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Lf,ListItemNode as yf,ListNode as Rf}from"@lexical/list";var Ki={type:"element",dependencies:[Rf,yf],export:(t,e)=>Lf(t)?Fe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Qe("bullet")};var Ji=[te([{ChildComponent:br,isActive:({selection:t})=>{if(!Mf(t))return!1;for(let e of t.getNodes()){if(kr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(kr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(kr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(zi,void 0)},order:11}])],Df=$({markdownTransformers:[Ki],nodes:[vf,If],plugins:[{Component:Ye,position:"normal"}],slashMenu:{groups:[qe([{Icon:br,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(zi,void 0)}}])]},toolbarFixed:{groups:Ji},toolbarInline:{groups:Ji}});import{jsx as $f}from"react/jsx-runtime";import{addClassNamesToElement as Af}from"@lexical/utils";import{$applyNodeReplacement as Of,DecoratorNode as Ff}from"lexical";import*as Xi from"react";var Pf=Xi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Nt=class extends Ff{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Bf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Af(o,"unknownConverted"),o}decorate(){return $f(Pf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Bf({data:t}){return Of(new Nt({data:t}))}var jf=$(()=>({nodes:[Nt]}));import{jsx as Hf}from"react/jsx-runtime";import{addClassNamesToElement as Uf}from"@lexical/utils";import{$applyNodeReplacement as Wf,DecoratorNode as Gf}from"lexical";import*as Zi from"react";var Vf=Zi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Lt=class extends Gf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Kf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Uf(o,"unknownConverted"),o}decorate(){return Hf(Vf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Kf({data:t}){return Wf(new Lt({data:t}))}var Jf=$(()=>({nodes:[Lt]}));import{$setBlocksType as Qi}from"@lexical/selection";import{$createParagraphNode as es,$getSelection as ts,$isParagraphNode as Yi,$isRangeSelection as zf}from"lexical";var qi=[te([{ChildComponent:pt,isActive:({selection:t})=>{if(!zf(t))return!1;for(let e of t.getNodes())if(!Yi(e)&&!Yi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ts();Qi(e,()=>es())})},order:1}])],Xf=$({slashMenu:{groups:[Y([{Icon:pt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ts();Qi(e,()=>es())})}}])]},toolbarFixed:{groups:qi},toolbarInline:{groups:qi}});import{c as x0}from"react/compiler-runtime";import{jsx as ks}from"react/jsx-runtime";import{useLexicalComposerContext as C0}from"@lexical/react/LexicalComposerContext";import{useEffect as b0,useState as k0}from"react";import{jsx as bs,Fragment as g0}from"react/jsx-runtime";import"react";import{jsx as Zf}from"react/jsx-runtime";var os={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Zf("blockquote",{children:o})}};import{jsx as Yf}from"react/jsx-runtime";var rs={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Yf(r,{children:o})}};import{jsx as qf}from"react/jsx-runtime";var ns={horizontalrule:qf("hr",{})};import{jsx as Qf}from"react/jsx-runtime";var ls={linebreak:Qf("br",{})};import{jsx as is}from"react/jsx-runtime";var ss=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return is("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),is("a",{href:i,rel:n,target:l,children:r})}});import{jsx as tt,jsxs as e0,Fragment as t0}from"react/jsx-runtime";import{v4 as o0}from"uuid";var as={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return tt(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=o0();return tt("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:e0(t0,{children:[tt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),tt("label",{htmlFor:l,children:n}),tt("br",{})]})})}else return tt("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as _r}from"react/jsx-runtime";var cs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?_r("p",{children:o}):_r("p",{children:_r("br",{})})}};var us={tab:" "};import{jsx as yt}from"react/jsx-runtime";var ds={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yt("div",{className:"lexical-table-container",children:yt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:yt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return yt(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Pe}from"react/jsx-runtime";import"react";var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},r0=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,n0="\xA0",l0=`
54
+ `},[t,e]),p=$e((_,b)=>{o(g=>{let C=e.length-1,k=e[C];if(k&&k.name===_){if(_==="type")return[...e.slice(0,C),{...k,value:k.value+b}];if(k.value===b)return[...e.slice(0,C),{...k,count:k.count+1}]}return[...g,{name:_,count:1,value:b}]})},[e,o]);jn(()=>{let _=g=>{if(!r)return;let C=g.key;ed(g)?p("selectAll",""):Un.has(C)?p("press",g.key):[...C].length>1?p("keydown",g.key):p("type",g.key)},b=g=>{if(!r)return;let C=g.key;!Un.has(C)&&[...C].length>1&&p("keyup",g.key)};return t.registerRootListener((g,C)=>{C!==null&&(C.removeEventListener("keydown",_),C.removeEventListener("keyup",b)),g!==null&&(g.addEventListener("keydown",_),g.addEventListener("keyup",b))})},[t,r,p]),jn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),qo(()=>{if(e){let _=m();_!==null&&s(_),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),qo(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:g,editorState:C})=>{if(!r)return;let k=C._selection,y=d.current,R=c.current;if(y!==k){if(g.size===0&&b.size===0&&!R){let L=Yo(t._window);if(L&&(L.anchorNode==null||L.focusNode==null))return}d.current=k}c.current=!1;let M=m();M!==null&&s(M)}),[t,m,r,p]),qo(()=>r?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,r]);let f=$e(_=>{r||(_.update(()=>{let b=Zu();b.clear();let g=Xu();b.append(zu().append(g)),g.select()}),o([])),n(b=>!b)},[r]),h=$e(()=>{if(!r)return;let _=Yo(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:b,anchorOffset:g,focusNode:C,focusOffset:k}=td(_),y=a().getRootElement(),R;b!==null&&(R=Hn(b,y));let M;C!==null&&(M=Hn(C,y)),p("snapshot",{anchorNode:b,anchorOffset:g,anchorPath:R,focusNode:C,focusOffset:k,focusPath:M})},[p,r,a]),x=$e(()=>{Yu(m())},[m]),T=$e(()=>{qu("test.js",m())},[m]);return[Ae("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{f(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?er("div",{className:"test-recorder-output",children:[er("div",{className:"test-recorder-toolbar",children:[Ae("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Ae("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{x(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Ae("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{T(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Ae("pre",{id:"test-recorder",ref:u,children:i})]}):null]}var Gn=()=>{let t=Ku(3),[e]=Ju(),[o,r]=od(e),n;return t[0]!==o||t[1]!==r?(n=er(Wn.Fragment,{children:[Ae("p",{children:"HI"}),o,r,Ae("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var rd=$({plugins:[{Component:Gn,position:"bottom"}]});import{c as nd}from"react/compiler-runtime";import{jsx as ld}from"react/jsx-runtime";import{useLexicalComposerContext as id}from"@lexical/react/LexicalComposerContext.js";import{TreeView as sd}from"@lexical/react/LexicalTreeView.js";import"react";var Vn=()=>{let t=nd(2),[e]=id(),o;return t[0]!==e?(o=ld(sd,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var ad=$({plugins:[{Component:Vn,position:"bottom"}]});import{$isTableSelection as cd}from"@lexical/table";import{$isRangeSelection as ud,FORMAT_TEXT_COMMAND as dd}from"lexical";import{jsx as Kn}from"react/jsx-runtime";import"react";var Jn=()=>Kn("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:Kn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var zn={type:"text-format",format:["bold","italic"],tag:"***"},Xn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Zn={type:"text-format",format:["bold"],tag:"**"},Yn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var qn=[Y([{ChildComponent:Jn,isActive:({selection:t})=>ud(t)||cd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(dd,"bold")},order:1}])],md=$(({featureProviderMap:t})=>{let e=[Zn,Yn];return t.get("italic")&&e.push(Xn,zn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:qn},toolbarInline:{groups:qn}}});import{$isTableSelection as fd}from"@lexical/table";import{$isRangeSelection as hd,FORMAT_TEXT_COMMAND as gd}from"lexical";import{jsx as Qn,jsxs as pd}from"react/jsx-runtime";import"react";var el=()=>pd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Qn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Qn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var tl={type:"text-format",format:["code"],tag:"`"};var ol=[Y([{ChildComponent:el,isActive:({selection:t})=>hd(t)||fd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(gd,"code")},order:7}])],xd=$({enableFormats:["code"],markdownTransformers:[tl],toolbarFixed:{groups:ol},toolbarInline:{groups:ol}});import{$isTableSelection as Cd}from"@lexical/table";import{$isRangeSelection as bd,FORMAT_TEXT_COMMAND as kd}from"lexical";import{jsx as rl}from"react/jsx-runtime";import"react";var nl=()=>rl("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:rl("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var ll={type:"text-format",format:["italic"],tag:"*"},il={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var sl=[Y([{ChildComponent:nl,isActive:({selection:t})=>bd(t)||Cd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(kd,"italic")},order:2}])],_d=$({enableFormats:["italic"],markdownTransformers:[ll,il],toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{$isTableSelection as wd}from"@lexical/table";import{$isRangeSelection as Ed,FORMAT_TEXT_COMMAND as Sd}from"lexical";import{jsx as al,jsxs as Td}from"react/jsx-runtime";import"react";var cl=()=>Td("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[al("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),al("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var ul={type:"text-format",format:["strikethrough"],tag:"~~"};var dl=[Y([{ChildComponent:cl,isActive:({selection:t})=>Ed(t)||wd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Sd,"strikethrough")},order:4}])],Nd=$({enableFormats:["strikethrough"],markdownTransformers:[ul],toolbarFixed:{groups:dl},toolbarInline:{groups:dl}});import{$isTableSelection as Ld}from"@lexical/table";import{$isRangeSelection as yd,FORMAT_TEXT_COMMAND as Rd}from"lexical";import{jsx as ml}from"react/jsx-runtime";import"react";var pl=()=>ml("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:ml("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var fl=[Y([{ChildComponent:pl,isActive:({selection:t})=>yd(t)||Ld(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Rd,"subscript")},order:5}])],Id=$({enableFormats:["subscript"],toolbarFixed:{groups:fl},toolbarInline:{groups:fl}});import{$isTableSelection as vd}from"@lexical/table";import{$isRangeSelection as Md,FORMAT_TEXT_COMMAND as Dd}from"lexical";import{jsx as hl}from"react/jsx-runtime";import"react";var gl=()=>hl("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:hl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var xl=[Y([{ChildComponent:gl,isActive:({selection:t})=>Md(t)||vd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Dd,"superscript")},order:6}])],$d=$({enableFormats:["superscript"],toolbarFixed:{groups:xl},toolbarInline:{groups:xl}});import{$isTableSelection as Od}from"@lexical/table";import{$isRangeSelection as Fd,FORMAT_TEXT_COMMAND as Pd}from"lexical";import{jsx as Cl,jsxs as Ad}from"react/jsx-runtime";import"react";var bl=()=>Ad("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:[Cl("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),Cl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var kl=[Y([{ChildComponent:bl,isActive:({selection:t})=>Fd(t)||Od(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Pd,"underline")},order:3}])],Bd=$({enableFormats:["underline"],toolbarFixed:{groups:kl},toolbarInline:{groups:kl}});import{jsx as or}from"react/jsx-runtime";import{jsx as jd}from"react/jsx-runtime";function Hd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var io=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Hd(o),r])):{};return jd("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Ud}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Wd}from"@lexical/selection";import{$getNodeByKey as Gd,$getState as Vd,$setState as Kd,createState as Jd,TextNode as zd}from"lexical";import{useEffect as Xd}from"react";function _l(t){let e=new Map;for(let o in t){let r=t[o],n=Jd(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function tr(t,e,o,r){t.update(()=>{Wd(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);Kd(n,l.stateConfig,r)})})}function Tl({stateMap:t}){let[e]=Ud();return Xd(()=>e.registerMutationListener(zd,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=Gd(r),i=e.getElementByKey(r);if(!l||!i)continue;let s=Object.create(null);t.forEach((d,c)=>{let u=Vd(l,d.stateConfig);if(!u){delete i.dataset[c];return}i.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(s,a)}),i.style.cssText="",Object.assign(i.style,s)}})}),[e]),null}var wl=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let i in l){let s=l[i];o.push({ChildComponent:()=>or(io,{css:s.css}),key:i,label:s.label,onSelect:({editor:d})=>{tr(d,e,n,i)}})}}return[{type:"dropdown",ChildComponent:()=>or(io,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>or(io,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)tr(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},Zd=$(({props:t})=>{let e=_l(t.state);return{plugins:[{Component:()=>Tl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:wl(t,e)},toolbarInline:{groups:wl(t,e)}}});import{c as em}from"react/compiler-runtime";import{useLexicalComposerContext as tm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as om,$isHeadingNode as Fl,HeadingNode as jl}from"@lexical/rich-text";import{$setBlocksType as rm}from"@lexical/selection";import{$getSelection as nm,$isRangeSelection as lm}from"lexical";import{useEffect as im}from"react";import{jsx as El}from"react/jsx-runtime";import"react";var Sl=()=>El("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Nl}from"react/jsx-runtime";import"react";var Ll=()=>Nl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Nl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as yl}from"react/jsx-runtime";import"react";var Rl=()=>yl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as Il}from"react/jsx-runtime";import"react";var vl=()=>Il("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Il("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Ml}from"react/jsx-runtime";import"react";var Dl=()=>Ml("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:Ml("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as $l}from"react/jsx-runtime";import"react";var Al=()=>$l("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:$l("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as Yd,$isHeadingNode as qd,HeadingNode as Qd}from"@lexical/rich-text";var rr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Ol=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Qd],export:(n,l)=>{if(!qd(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:rr(n=>{let l="h"+n[1]?.length;return Yd(l)})}};var Pl=t=>{let e=nm();rm(e,()=>om(t))},Bl={h1:Sl,h2:Ll,h3:Rl,h4:vl,h5:Dl,h6:Al},sm=$(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((r,n)=>({ChildComponent:Bl[r],isActive:({selection:l})=>{if(!lm(l))return!1;for(let i of l.getNodes()){if(Fl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(Fl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Pl(r)})},order:n+2})))];return{markdownTransformers:[Ol(e)],nodes:[jl],plugins:[{Component:am,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Bl[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{Pl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),am=t=>{let e=em(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[d]=tm(),c,u;return e[4]!==d||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return d.registerNodeTransform(jl,a=>{l.includes(a.getTag())||a.setTag(s)})},u=[d,l,s],e[4]=d,e[5]=l,e[6]=s,e[7]=c,e[8]=u):(c=e[7],u=e[8]),im(c,u),null};import{$isNodeSelection as Em}from"lexical";import{jsx as Hl}from"react/jsx-runtime";import"react";var nr=()=>Hl("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:Hl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Ul,jsxs as cm}from"react/jsx-runtime";import"react";var Wl=()=>cm("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ul("path",{d:"M5 10h10",stroke:"currentColor"}),Ul("path",{d:"M10 15V5",stroke:"currentColor"})]});var xe=t=>({type:"dropdown",ChildComponent:Wl,items:t,key:"add",order:10});import{addClassNamesToElement as um}from"@lexical/utils";import{$applyNodeReplacement as dm,createCommand as mm,DecoratorNode as pm}from"lexical";var kt=mm("INSERT_HORIZONTAL_RULE_COMMAND"),bt=class extends pm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:fm,priority:0})}}static importJSON(e){return Gl()}createDOM(e){let o=document.createElement("hr");return um(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function fm(){return{node:Gl()}}function Gl(){return dm(new bt)}import{$applyNodeReplacement as hm}from"lexical";import"react";var Ce=class extends bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Xe()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Xe(){return hm(new Ce)}function _t(t){return t instanceof Ce}var Vl={type:"element",dependencies:[Ce],export:(t,e)=>_t(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Xe();e&&t.replace(e)}};import{c as gm}from"react/compiler-runtime";import{useLexicalComposerContext as xm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Cm}from"@lexical/utils";import{$getSelection as bm,$isRangeSelection as km,COMMAND_PRIORITY_EDITOR as _m}from"lexical";import{useEffect as Tm}from"react";var Kl=()=>{let t=gm(3),[e]=xm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(kt,wm,_m),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Tm(o,r),null};function wm(t){let e=bm();if(!km(e))return!1;if(e.focus.getNode()!==null){let r=Xe();Cm(r)}return!0}var Sm=$({markdownTransformers:[Vl],nodes:[Ce],plugins:[{Component:Kl,position:"normal"}],slashMenu:{groups:[Z([{Icon:nr,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:nr,isActive:({selection:t})=>{if(!Em(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return _t(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]}});import{$findMatchingParent as oi}from"@lexical/utils";import{$isElementNode as Pm,INDENT_CONTENT_COMMAND as Bm,OUTDENT_CONTENT_COMMAND as jm}from"lexical";import{jsx as so,jsxs as Nm}from"react/jsx-runtime";import"react";var Jl=()=>Nm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[so("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ao,jsxs as Lm}from"react/jsx-runtime";import"react";var zl=()=>Lm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ao("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as ym}from"react/jsx-runtime";import{useLexicalComposerContext as Rm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Im}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as vm,mergeRegister as Xl}from"@lexical/utils";import{$getSelection as Mm,$isElementNode as Ql,$isRangeSelection as Dm,COMMAND_PRIORITY_LOW as Zl,INDENT_CONTENT_COMMAND as Yl,KEY_TAB_COMMAND as $m,OUTDENT_CONTENT_COMMAND as Am,TabNode as Om}from"lexical";import{useEffect as ql}from"react";var ei=({clientProps:t})=>{let[e]=Rm(),{disabledNodes:o,disableTabNode:r}=t;return ql(()=>{if(!(!e||!o?.length))return Xl(e.registerCommand(Yl,()=>Fm(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Zl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Ql(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),ql(()=>{if(!(!e||!r))return Xl(e.registerCommand($m,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Am:Yl,void 0)),Zl),e.registerNodeTransform(Om,n=>{n.remove()}))},[e,r]),ym(Im,{})};function Fm(t){let e=Mm();if(!Dm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=vm(l,c=>Ql(c)&&!c.isInline());if(s===null)continue;let d=s.getKey();s.canIndent()&&!o.has(d)&&(o.add(d),t(s))}return o.size>0}var ti=t=>({type:"buttons",items:t,key:"indent",order:35});var ri=({disabledNodes:t})=>[ti([{ChildComponent:Jl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ni(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!oi(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(jm,void 0)},order:1},{ChildComponent:zl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ni(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!oi(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Bm,void 0)},order:2}])],Hm=$(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ei,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:ri({disabledNodes:e})},toolbarInline:{groups:ri({disabledNodes:e})}}}),ni=t=>Pm(t)&&t.canIndent();import{$findMatchingParent as ef}from"@lexical/utils";import{$getSelection as pr,$isRangeSelection as Ai}from"lexical";import{jsx as li}from"react/jsx-runtime";import"react";var ii=()=>li("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:li("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as si}from"@lexical/selection";function Ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?si(o)?r:n:si(e)?r:n}var lr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as qm}from"lexical";import{addClassNamesToElement as Um,isHTMLAnchorElement as Wm}from"@lexical/utils";import ar from"bson-objectid";import{$applyNodeReplacement as Gm,$createTextNode as ai,$getSelection as Vm,$isElementNode as ci,$isRangeSelection as sr,createCommand as Km,ElementNode as Jm}from"lexical";var zm=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends Jm{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Xm,priority:1})}}static importJSON(e){let o=be({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new ar.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=ir(o.rel,"add","noopener")),Um(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!sr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(ci(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!zm.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=ir(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=ir(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Xm(t){let e=null;if(Wm(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new ar.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return Gm(new oe({id:t??new ar.default().toHexString(),fields:e}))}function J(t){return t instanceof oe}var ce=Km("TOGGLE_LINK_COMMAND");function cr(t){let e=Vm();if(!sr(e)&&(t===null||!t.selectedNodes?.length))return;let o=sr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();J(i)&&(i.getChildren().forEach(d=>{i.insertBefore(d)}),i.remove())});return}if(o?.length===1){let l=o[0],i=J(l)?l:Zm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ai(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||ci(l)&&!l.isInline())){if(J(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ai(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=be({fields:t.fields}),J(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),J(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Zm(t){return Ym(t,e=>J(e))}function Ym(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function ir(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var ui={type:"text-match",dependencies:[oe],export:(t,e)=>{if(!J(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=qm(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Qm,$isElementNode as ep}from"lexical";var ke=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Tt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(ep(r)){let n=Tt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Tt({fields:t}){return Qm(new ke({id:"",fields:t}))}function _e(t){return t instanceof ke}import{c as tp}from"react/compiler-runtime";import{useLexicalComposerContext as op}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as rp}from"@lexical/utils";import{$createTextNode as di,$getSelection as np,$isElementNode as pi,$isLineBreakNode as fi,$isNodeSelection as lp,$isRangeSelection as ip,$isTextNode as wt,TextNode as sp}from"lexical";import{useEffect as ap}from"react";function mi(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function hi(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var cp=/[.,;\s]/;function uo(t){return t!==void 0&&cp.test(t)}function gi(t){return uo(t[t.length-1])}function dr(t){return uo(t[0])}function up(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function xi(t){let e=t.getPreviousSibling();return pi(e)&&(e=e.getLastDescendant()),e===null||fi(e)||wt(e)&&gi(e.getTextContent())}function Ci(t){let e=t.getNextSibling();return pi(e)&&(e=e.getFirstDescendant()),e===null||fi(e)||wt(e)&&dr(e.getTextContent())}function dp(t,e,o,r){return(t>0?uo(o[t-1]):xi(r[0]))?e<o.length?uo(o[e]):Ci(r[r.length-1]):!1}function mp(t,e,o){let r=[],n=[],l=[],i=0,s=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,d.shift()}return[i,r,n,l]}function pp(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Tt({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let d=di(r.text);d.setFormat(s.getFormat()),d.setDetail(s.getDetail()),d.setStyle(s.getStyle()),l.append(d),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,d;e===0?d=i:[,d]=i.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[x,T]=a.splitText(o-f);x&&c.push(x),u=T}s+=p}),d){let a=np(),m=a?a.getNodes().find(wt):void 0,p=di(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(ip(a)?p.select(a.anchor.offset,a.focus.offset):lp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function fp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,i,s=0;for(;(i=hi(l,e))!=null&&i!==null;){let d=i.index,c=i.length,u=d+c;if(dp(s+d,s+u,n,r)){let[m,,p,f]=mp(r,s+d,s+u),h=s+d-m,x=s+u-m,T=pp(p,h,x,i);r=T?[T,...f]:f,o(i.url,null),s=0}else s+=u;l=l.substring(u)}}function ur(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!wt(c)||!c.isSimpleText()){co(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=hi(l,e);if(i===null||i.text!==l){co(t),o(null,t.getFields()?.url??null);return}if(!xi(t)||!Ci(t)){co(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let d=t.getFields();d.url=i?.url,t.setFields(d),o(i.url,s??null)}}function hp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(_e(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!dr(l)||up(l,i))&&(r.append(t),ur(r,e,o),o(null,r.getFields()?.url??null))}_e(n)&&!gi(l)&&(co(n),ur(n,e,o),o(null,n.getFields()?.url??null))}function co(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function gp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&wt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function xp(t,e,o){let r=tp(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,d)=>{o?.(s,d)};return rp(t.registerNodeTransform(sp,s=>{let d=s.getParentOrThrow(),c=s.getPreviousSibling();if(_e(d))ur(d,e,i);else if(!J(d)){if(s.isSimpleText()&&(dr(s.getTextContent())||!_e(c))){let u=gp(s);fp(u,e,i)}hp(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),ap(n,l)}var Cp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,bp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,kp=[mi(Cp,t=>t.startsWith("http")?t:`https://${t}`),mi(bp,t=>`mailto:${t}`)],bi=()=>{let[t]=op();return xp(t,kp),null};import{jsx as _p}from"react/jsx-runtime";import{ClickableLinkPlugin as Tp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var ki=()=>_p(Tp,{});import{jsx as Hp}from"react/jsx-runtime";import"react";import{createPortal as Up}from"react-dom";import{jsx as Te,jsxs as Et,Fragment as Ep}from"react/jsx-runtime";import{useLexicalComposerContext as Sp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Np}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as _i,mergeRegister as Ti}from"@lexical/utils";import{getTranslation as mr}from"@payloadcms/translations";import{CloseMenuIcon as Lp,EditIcon as yp,ExternalLinkIcon as wi,formatDrawerSlug as Rp,useConfig as Ip,useEditDepth as vp,useLocale as Mp,useTranslation as Dp}from"@payloadcms/ui";import{requests as $p}from"@payloadcms/ui/shared";import{$getSelection as Ei,$isLineBreakNode as Ap,$isRangeSelection as Si,COMMAND_PRIORITY_HIGH as Op,COMMAND_PRIORITY_LOW as Ni,getDOMSelection as Fp,KEY_ESCAPE_COMMAND as Pp,SELECTION_CHANGE_COMMAND as Bp}from"lexical";import Li,{useCallback as yi,useEffect as fo,useRef as jp,useState as Oe}from"react";function mo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),d=l.getBoundingClientRect(),c=t.top-r,u=t.left-n;c<d.top&&(c+=i.height+t.height+r*2),u+i.width>d.right&&(u=d.right-i.width-n),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as wp}from"lexical";var po=wp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ri(t){t.preventDefault()}function Ii({anchorElem:t}){let[e]=Sp(),[o,r]=Oe(),n=jp(null),[l,i]=Oe(null),[s,d]=Oe(null),{fieldProps:{schemaPath:c},uuid:u}=H(),a=Np(),{config:m,getEntityConfig:p}=Ip(),{i18n:f,t:h}=Dp(),[x,T]=Oe(),E=vp(),[S,_]=Oe(!1),[b,g]=Oe([]),C=Mp(),[k,y]=Oe(!1),R=Rp({slug:"lexical-rich-text-link-"+u,depth:E}),{toggleDrawer:M}=fe(R),L=yi(()=>{_(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),y(!1),i(null),d(null),g([]),T(void 0)},[_,i,d,g]),w=yi(()=>{let N=Ei(),I;if(!Si(N)||!N){L();return}let A=Ze(N);I=e.getElementByKey(A.getKey())?.getBoundingClientRect();let v=_i(A,J),O=N.getNodes().filter(X=>!Ap(X)).find(X=>{let W=_i(X,J);return v&&!v.is(W)||W&&!W.is(v)});if(v==null||O){L();return}r(v);let D=v.getFields(),G={...D,id:v.getID(),text:v.getTextContent()};if(D?.linkType==="custom")i(D?.url??null),d(null);else{i(`${m.routes.admin==="/"?"":m.routes.admin}/collections/${D?.doc?.relationTo}/${D?.doc?.value}`);let X=D?.doc?.relationTo?p({collectionSlug:D?.doc?.relationTo}):void 0;if(!X)d(D?.label?String(D?.label):null),i(D?.url?String(D?.url):null);else{let W=typeof D.doc?.value=="object"?D.doc.value.id:D.doc?.value,Ue=D.doc?.relationTo;if(!W||!Ue)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Ne=h("fields:linkedTo",{label:`${mr(X.labels.singular,f)} - ${h("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(Ne),$p.get(`${m.serverURL}${m.routes.api}/${Ue}/${W}`,{headers:{"Accept-Language":f.language},params:{depth:0,locale:C?.code}}).then(async pe=>{if(!pe.ok)throw new Error(`HTTP error! Status: ${pe.status}`);let jt=await pe.json(),Le=X?.admin?.useAsTitle||"id",Ht=jt[Le],We=h("fields:linkedTo",{label:`${mr(X.labels.singular,f)} - ${Ht}`}).replace(/<[^>]*>?/g,"");d(We)}).catch(()=>{let pe=h("fields:linkedTo",{label:`${mr(X.labels.singular,f)} - ${h("general:untitled",f)} - ID: ${W}`}).replace(/<[^>]*>?/g,"");d(pe)})}}T(G),_(!0),g(N?N?.getNodes():[]),_e(v)?y(!0):y(!1);let q=n.current,z=Fp(e._window),{activeElement:Pt}=document;if(q===null)return;let Bt=e.getRootElement();return z!==null&&Bt!==null&&Bt.contains(z.anchorNode)?(I||(I=z.getRangeAt(0).getBoundingClientRect()),I!=null&&(I.y+=40,mo(I,q,t))):(Pt==null||Pt.className!=="link-input")&&(Bt!==null&&mo(null,q,t),i(null),d(null)),!0},[e,L,m.routes.admin,m.routes.api,m.serverURL,p,h,f,C?.code,t]);return fo(()=>Ti(e.registerCommand(po,N=>(e.dispatchCommand(ce,N),w(),M(),!0),Ni)),[e,w,M,R]),fo(()=>{let N=t.parentElement,I=()=>{e.getEditorState().read(()=>{w()})};return window.addEventListener("resize",I),N?.addEventListener("scroll",I),()=>{window.removeEventListener("resize",I),N?.removeEventListener("scroll",I)}},[t.parentElement,e,w]),fo(()=>Ti(e.registerUpdateListener(({editorState:N})=>{N.read(()=>{w()})}),e.registerCommand(Bp,()=>(w(),!0),Ni),e.registerCommand(Pp,()=>S?(L(),!0):!1,Op)),[e,w,S,L]),fo(()=>{e.getEditorState().read(()=>{w()})},[e,w]),Et(Li.Fragment,{children:[Te("div",{className:"link-editor",ref:n,children:Et("div",{className:"link-input",children:[l&&l.length>0?Et("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Te(wi,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Et(Ep,{children:[o?.__fields.newTab?Te(wi,{}):null,Te("span",{className:"link-input__label-pure",children:s})]}):null,a&&Et(Li.Fragment,{children:[Te("button",{"aria-label":"Edit link",className:"link-edit",onClick:N=>{N.preventDefault(),M()},onMouseDown:Ri,tabIndex:0,type:"button",children:Te(yp,{})}),!k&&Te("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ce,null)},onMouseDown:Ri,tabIndex:0,type:"button",children:Te(Lp,{})})]})]})}),Te(mt,{className:"lexical-link-edit-drawer",data:x,drawerSlug:R,drawerTitle:h("fields:editLink"),featureKey:"link",handleDrawerSubmit:(N,I)=>{let A=I,v={...A};delete v.text,e.update(()=>{let O=Ei(),D=null;if(Si(O)?D=Ze(O).getParent():b.length&&(D=b[0]?.getParent()??null),D&&_e(D)){let G=be({fields:v});D.replace(G,!0)}}),e.dispatchCommand(ce,{fields:v,selectedNodes:b,text:A.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var vi=t=>{let{anchorElem:e=document.body}=t;return Up(Hp(Ii,{anchorElem:e}),e)};import{c as Vp}from"react/compiler-runtime";import{useLexicalComposerContext as Kp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Jp}from"@lexical/utils";import{$getSelection as zp,$isElementNode as Xp,$isRangeSelection as Zp,COMMAND_PRIORITY_LOW as Di,PASTE_COMMAND as Yp}from"lexical";import{useEffect as qp}from"react";var Wp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Gp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Mi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||Wp.test(t)||Gp.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}var $i=t=>{let e=Vp(5),{clientProps:o}=t,[r]=Kp(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Jp(r.registerCommand(ce,i=>i===null?(cr(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),cr(i),!0),Di),r.registerCommand(Yp,i=>{let s=zp();if(!Zp(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let d=i.clipboardData.getData("text");if(!Mi(d))return!1;if(!s.getNodes().some(Qp)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ce,{fields:c,text:null}),i.preventDefault(),!0}return!1},Di))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),qp(n,l),null};function Qp(t){return Xp(t)}var Oi=[lr([{ChildComponent:ii,isActive:({selection:t})=>{if(Ai(t)){let e=Ze(t);return ef(e,J)!=null}return!1},isEnabled:({selection:t})=>!!(Ai(t)&&pr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ce,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=pr()?.getTextContent(),r=pr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(po,{fields:n,selectedNodes:r,text:o})}},order:1}])],tf=$(({props:t})=>({markdownTransformers:[ui],nodes:[oe,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:$i,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:bi,position:"normal"},{Component:ki,position:"normal"},{Component:vi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Oi},toolbarInline:{groups:Oi}}));import{$isListNode as gr,INSERT_CHECK_LIST_COMMAND as Ui,ListItemNode as ff,ListNode as hf}from"@lexical/list";import{$isRangeSelection as gf}from"lexical";import{jsx as Fi,jsxs as of}from"react/jsx-runtime";import"react";var fr=()=>of("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:[Fi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Fi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as rf}from"react/jsx-runtime";import{ListPlugin as nf}from"@lexical/react/LexicalListPlugin.js";import"react";var Ye=()=>rf(nf,{});function ho(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function qe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as cf,ListItemNode as uf,ListNode as df}from"@lexical/list";import{$createListItemNode as lf,$createListNode as sf,$isListItemNode as af,$isListNode as hr}from"@lexical/list";var Pi=4,Qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=lf(t==="check"?r[3]==="x":void 0);if(hr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(i):l.append(i),e.remove()}else if(hr(n)&&n.getListType()===t)n.append(i),e.remove();else{let d=sf(t,t==="number"?Number(r[2]):void 0);d.append(i),e.replace(d)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/Pi);s&&i.setIndent(s)},Fe=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(af(i)){if(i.getChildrenSize()===1){let u=i.getFirstChild();if(hr(u)){r.push(Fe(u,e,o+1));continue}}let s=" ".repeat(o*Pi),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
56
+ `)};var Bi={type:"element",dependencies:[df,uf],export:(t,e)=>cf(t)?Fe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Qe("check")};import{jsx as mf}from"react/jsx-runtime";import{CheckListPlugin as pf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var ji=()=>mf(pf,{});var Hi=[te([{ChildComponent:fr,isActive:({selection:t})=>{if(!gf(t))return!1;for(let e of t.getNodes()){if(gr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(gr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(gr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ui,void 0)},order:12}])],xf=$(({featureProviderMap:t})=>{let e=[{Component:ji,position:"normal"}],o=ho("checklist",t);return o&&e.push({Component:Ye,position:"normal"}),{markdownTransformers:[Bi],nodes:o?[hf,ff]:[],plugins:e,slashMenu:{groups:[qe([{Icon:fr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(Ui,void 0)}}])]},toolbarFixed:{groups:Hi},toolbarInline:{groups:Hi}}});import{$isListNode as Cr,INSERT_ORDERED_LIST_COMMAND as Vi,ListItemNode as Tf,ListNode as wf}from"@lexical/list";import{$isRangeSelection as Ef}from"lexical";import{jsx as St,jsxs as Cf}from"react/jsx-runtime";import"react";var xr=()=>Cf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[St("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),St("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),St("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as bf,ListItemNode as kf,ListNode as _f}from"@lexical/list";var Wi={type:"element",dependencies:[_f,kf],export:(t,e)=>bf(t)?Fe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Qe("number")};var Gi=[te([{ChildComponent:xr,isActive:({selection:t})=>{if(!Ef(t))return!1;for(let e of t.getNodes()){if(Cr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Cr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Cr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Vi,void 0)},order:10}])],Sf=$(({featureProviderMap:t})=>{let e=ho("ordered",t);return{markdownTransformers:[Wi],nodes:e?[wf,Tf]:[],plugins:e?[{Component:Ye,position:"normal"}]:[],slashMenu:{groups:[qe([{Icon:xr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Vi,void 0)}}])]},toolbarFixed:{groups:Gi},toolbarInline:{groups:Gi}}});import{$isListNode as kr,INSERT_UNORDERED_LIST_COMMAND as zi,ListItemNode as If,ListNode as vf}from"@lexical/list";import{$isRangeSelection as Mf}from"lexical";import{jsx as et,jsxs as Nf}from"react/jsx-runtime";import"react";var br=()=>Nf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[et("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),et("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),et("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Lf,ListItemNode as yf,ListNode as Rf}from"@lexical/list";var Ki={type:"element",dependencies:[Rf,yf],export:(t,e)=>Lf(t)?Fe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Qe("bullet")};var Ji=[te([{ChildComponent:br,isActive:({selection:t})=>{if(!Mf(t))return!1;for(let e of t.getNodes()){if(kr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(kr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(kr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(zi,void 0)},order:11}])],Df=$({markdownTransformers:[Ki],nodes:[vf,If],plugins:[{Component:Ye,position:"normal"}],slashMenu:{groups:[qe([{Icon:br,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(zi,void 0)}}])]},toolbarFixed:{groups:Ji},toolbarInline:{groups:Ji}});import{jsx as $f}from"react/jsx-runtime";import{addClassNamesToElement as Af}from"@lexical/utils";import{$applyNodeReplacement as Of,DecoratorNode as Ff}from"lexical";import*as Xi from"react";var Pf=Xi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Nt=class extends Ff{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Bf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Af(o,"unknownConverted"),o}decorate(){return $f(Pf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Bf({data:t}){return Of(new Nt({data:t}))}var jf=$(()=>({nodes:[Nt]}));import{jsx as Hf}from"react/jsx-runtime";import{addClassNamesToElement as Uf}from"@lexical/utils";import{$applyNodeReplacement as Wf,DecoratorNode as Gf}from"lexical";import*as Zi from"react";var Vf=Zi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Lt=class extends Gf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Kf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Uf(o,"unknownConverted"),o}decorate(){return Hf(Vf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Kf({data:t}){return Wf(new Lt({data:t}))}var Jf=$(()=>({nodes:[Lt]}));import{$setBlocksType as Qi}from"@lexical/selection";import{$createParagraphNode as es,$getSelection as ts,$isParagraphNode as Yi,$isRangeSelection as zf}from"lexical";var qi=[te([{ChildComponent:pt,isActive:({selection:t})=>{if(!zf(t))return!1;for(let e of t.getNodes())if(!Yi(e)&&!Yi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ts();Qi(e,()=>es())})},order:1}])],Xf=$({slashMenu:{groups:[Z([{Icon:pt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ts();Qi(e,()=>es())})}}])]},toolbarFixed:{groups:qi},toolbarInline:{groups:qi}});import{c as x0}from"react/compiler-runtime";import{jsx as ks}from"react/jsx-runtime";import{useLexicalComposerContext as C0}from"@lexical/react/LexicalComposerContext";import{useEffect as b0,useState as k0}from"react";import{jsx as bs,Fragment as g0}from"react/jsx-runtime";import"react";import{jsx as Zf}from"react/jsx-runtime";var os={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Zf("blockquote",{children:o})}};import{jsx as Yf}from"react/jsx-runtime";var rs={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Yf(r,{children:o})}};import{jsx as qf}from"react/jsx-runtime";var ns={horizontalrule:qf("hr",{})};import{jsx as Qf}from"react/jsx-runtime";var ls={linebreak:Qf("br",{})};import{jsx as is}from"react/jsx-runtime";var ss=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return is("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),is("a",{href:i,rel:n,target:l,children:r})}});import{jsx as tt,jsxs as e0,Fragment as t0}from"react/jsx-runtime";import{v4 as o0}from"uuid";var as={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return tt(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=o0();return tt("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:e0(t0,{children:[tt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),tt("label",{htmlFor:l,children:n}),tt("br",{})]})})}else return tt("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as _r}from"react/jsx-runtime";var cs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?_r("p",{children:o}):_r("p",{children:_r("br",{})})}};var us={tab:" "};import{jsx as yt}from"react/jsx-runtime";var ds={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yt("div",{className:"lexical-table-container",children:yt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:yt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return yt(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Pe}from"react/jsx-runtime";import"react";var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},r0=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,n0="\xA0",l0=`
57
57
 
58
- `,ms="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ps="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",i0=new RegExp("^[^"+ps+"]*["+ms+"]"),s0=new RegExp("^[^"+ms+"]*["+ps+"]"),a0={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},c0={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},u0={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},d0={[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"},m0={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},p0={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};var fs={text:({node:t})=>{let e=t.text;return t.format&F.IS_BOLD&&(e=Pe("strong",{children:e})),t.format&F.IS_ITALIC&&(e=Pe("em",{children:e})),t.format&F.IS_STRIKETHROUGH&&(e=Pe("span",{style:{textDecoration:"line-through"},children:e})),t.format&F.IS_UNDERLINE&&(e=Pe("span",{style:{textDecoration:"underline"},children:e})),t.format&F.IS_CODE&&(e=Pe("code",{children:e})),t.format&F.IS_SUBSCRIPT&&(e=Pe("sub",{children:e})),t.format&F.IS_SUPERSCRIPT&&(e=Pe("sup",{children:e})),e}};import{jsx as Rt}from"react/jsx-runtime";var hs={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Rt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Rt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Rt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Rt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Rt("picture",{children:n})}};var ot={...cs,...fs,...ls,...os,...ds,...rs,...ns,...as,...ss({}),...hs,...us};import{jsx as Er,Fragment as f0}from"react/jsx-runtime";import Tr from"react";function gs(t){if(!!!t?.root?.children?.length)return!1;let 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!o}function wr(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let r=typeof t.html=="function"?t.html(o):t.html;return Er("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function h0(t){let e={};for(let[o,r]of Object.entries(t)){if(!r||typeof r!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,i]of Object.entries(r)){let s=i;(s.Component||s.html)&&(e.blocks[l]=wr(s))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,i]of Object.entries(r)){let s=i;(s.Component||s.html)&&(e.inlineBlocks[l]=wr(s))}continue}let n=r;(n.Component||n.html)&&(e[o]=wr(n))}return e}function xs({converters:t,data:e,disableIndent:o,disableTextAlign:r,nodeMap:n}){if(gs(e)){let l=n?{...t,...h0(n)}:t;return Cs({converters:l,disableIndent:o,disableTextAlign:r,nodes:e.root.children,parent:e.root})}return Er(f0,{})}function Cs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,d)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:s,nodesToJSX:p=>Cs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:u=Er("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),Tr.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return Tr.cloneElement(u,{key:d,style:m})}return Tr.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",s),null}}).filter(Boolean)}var Sr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l,nodeMap:i})=>{if(!o)return null;let s={};e?typeof e=="function"?s=e({defaultConverters:ot}):s=e:s=ot;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&xs({converters:s,data:o,disableIndent:n,disableTextAlign:l,nodeMap:i});return r?bs(g0,{children:d}):bs("div",{className:t??"payload-richtext",children:d})};function _s(){let t=x0(7),[e]=C0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=k0(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),b0(l,i);let s;return t[5]!==r?(s=ks("div",{className:"debug-jsx-converter",children:ks(Sr,{converters:ot,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var _0=$({plugins:[{Component:_s,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)"}},T0={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 u1}from"lexical";import{jsx as It,jsxs as w0}from"react/jsx-runtime";import"react";var Nr=()=>w0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[It("g",{clipPath:"url(#clip0_4397_10817)",children:It("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),It("defs",{children:It("clipPath",{id:"clip0_4397_10817",children:It("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as y0}from"react/jsx-runtime";import{$applyNodeReplacement as R0}from"lexical";import*as ws from"react";import{DecoratorBlockNode as E0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as S0}from"@lexical/utils";import{$applyNodeReplacement as N0}from"lexical";function L0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ts({relationTo:o,value:e})}:null}var vt=class extends E0{__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:L0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Ts(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return S0(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 Ts(t){return N0(new vt({data:t}))}var I0=ws.lazy(()=>import("./RelationshipComponent-UCIWIEVD.js").then(t=>({default:t.RelationshipComponent})));function v0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Be({relationTo:o,value:e})}:null}var we=class extends vt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:v0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Be(o);return r.setFormat(e.format),r}decorate(e,o){return y0(I0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return R0(new we({data:t}))}function Lr(t){return t instanceof we}import{c as q0}from"react/compiler-runtime";import{jsx as Q0}from"react/jsx-runtime";import{useLexicalComposerContext as e1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as t1}from"@lexical/utils";import{$getPreviousSelection as o1,$getSelection as r1,$isParagraphNode as n1,$isRangeSelection as l1,COMMAND_PRIORITY_EDITOR as i1,createCommand as s1}from"lexical";import{useEffect as a1}from"react";import{c as Ns}from"react/compiler-runtime";import{jsx as yr}from"react/jsx-runtime";import{useLexicalComposerContext as Ls}from"@lexical/react/LexicalComposerContext.js";import{toast as W0}from"@payloadcms/ui";import{$getNodeByKey as G0,COMMAND_PRIORITY_EDITOR as ys}from"lexical";import{useEffect as Rs,useState as V0}from"react";import{c as M0}from"react/compiler-runtime";import{jsx as D0}from"react/jsx-runtime";import{useLexicalComposerContext as $0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as A0,useModal as O0}from"@payloadcms/ui";import{$getNodeByKey as Es,$getPreviousSelection as F0,$getRoot as P0,$getSelection as B0,$isRangeSelection as j0,$setSelection as H0}from"lexical";import{useEffect as U0,useState as Ss}from"react";var Mt=t=>{let e=M0(23),[o]=$0(),[r,n]=Ss(null),[l,i]=Ss(!1),[s,d,c]=A0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=O0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let R=B0()??F0();n(R)},e[0]=h):h=e[0];let x=h,T;e[1]!==o||e[2]!==r?(T=()=>{r&&o.update(()=>{if(j0(r)){let{anchor:R,focus:M}=r;Es(R.key)&&Es(M.key)&&H0(r.clone())}else P0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=T):T=e[3];let E=T,S;e[4]!==u?(S=()=>{u()},e[4]=u,e[5]=S):S=e[5];let _=S,b,g;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let R=f[a];R&&!R?.isOpen&&(i(!1),setTimeout(()=>{E()},1))},g=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=b,e[11]=g):(b=e[10],g=e[11]),U0(b,g);let C;e[12]!==d?(C=R=>D0(d,{...R,onClick:()=>{x()}}),e[12]=d,e[13]=C):C=e[13];let k;e[14]!==p?(k=()=>{x(),p(),i(!0)},e[14]=p,e[15]=k):k=e[15];let y;return e[16]!==s||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==C||e[21]!==k?(y={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:C,openListDrawer:k},e[16]=s,e[17]=_,e[18]=m,e[19]=a,e[20]=C,e[21]=k,e[22]=y):y=e[22],y};var K0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=G0(o);n&&n.replace(Be({relationTo:e,value:r}))}):t.dispatchCommand(Rr,{relationTo:e,value:r})},J0=t=>{let e=Ns(14),{enabledCollectionSlugs:o}=t,[r]=Ls(),[n,l]=V0(null),i=o?.[0],s;e[0]!==o||e[1]!==i?(s={collectionSlugs:o,selectedCollection:i},e[0]=o,e[1]=i,e[2]=s):s=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Mt(s),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Ve,x=>(l(x?.replace?x?.replace.nodeKey:null),u(),!0),ys),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Rs(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=x=>{let{collectionSlug:T,doc:E}=x;K0({editor:r,relationTo:T,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=yr(c,{onSelect:f}),e[11]=c,e[12]=f,e[13]=h):h=e[13],h},z0=()=>{let t=Ns(3),[e]=Ls(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ve,X0,ys),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Rs(o,r),null},Is=({enabledCollectionSlugs:t})=>t?.length?yr(J0,{enabledCollectionSlugs:t}):yr(z0,{});function X0(){return W0.error("No relationship collections enabled"),!0}import{useConfig as Z0,useEntityVisibility as Y0}from"@payloadcms/ui";import*as vs from"react";var go=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=Z0(),{visibleEntities:l}=Y0();return vs.useMemo(()=>{let s=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:f}=a;if(l?.collections.includes(m)){if(r){if(!p||!f)continue}else if(f||!p)continue;c&&!c.has(m)||u&&u.has(m)||(s.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:s}},[n,l,r,o,e])};var Rr=s1("INSERT_RELATIONSHIP_COMMAND"),Ms=t=>{let e=q0(8),{clientProps:o}=t,[r]=e1(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=go(i),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Rr,c1,i1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),a1(d,c);let u;return e[6]!==s?(u=Q0(Is,{enabledCollectionSlugs:s}),e[6]=s,e[7]=u):u=e[7],u};function c1(t){let e=r1()||o1();if(l1(e)){let o=Be(t),{focus:r}=e,n=r.getNode();t1(o),n1(n)&&!n.__first&&n.remove()}return!0}var d1=$({nodes:[we],plugins:[{Component:Ms,position:"normal"}],slashMenu:{groups:[Y([{Icon:Nr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Nr,isActive:({selection:t})=>{if(!u1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Lr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]}});import{c as Hs}from"react/compiler-runtime";import{jsx as se,jsxs as P1}from"react/jsx-runtime";import{useLexicalComposerContext as B1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Us}from"@lexical/react/useLexicalEditable";import{useScrollInfo as j1,useThrottledEffect as H1,useTranslation as U1}from"@payloadcms/ui";import*as Ee from"react";import{useMemo as W1}from"react";import{c as m1}from"react/compiler-runtime";import{jsx as p1}from"react/jsx-runtime";import{mergeRegister as f1}from"@lexical/utils";import{$addUpdateTag as h1,$getSelection as g1}from"lexical";import{useDeferredValue as x1,useEffect as C1,useState as b1}from"react";var Ds="toolbar-popup__button",Dt=t=>{let e=m1(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=b1(l),d=x1(i),c=H(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Ds}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Ds,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=g1();if(!k)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:k}):!1,R=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:k}):!0;s(M=>M.active===y&&M.enabled===R?M:{active:y,enabled:R})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,T=Vt(),E,S;e[9]!==r||e[10]!==T||e[11]!==x?(E=()=>{T(x);let k=()=>T(x),y=f1(r.registerUpdateListener(k));return document.addEventListener("mouseup",k),()=>{y(),document.removeEventListener("mouseup",k)}},S=[r,T,x],e[9]=r,e[10]=T,e[11]=x,e[12]=E,e[13]=S):(E=e[12],S=e[13]),C1(E,S);let _;e[14]!==i||e[15]!==r||e[16]!==n?(_=()=>{i.enabled&&r.focus(()=>{r.update(k1),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=_):_=e[17];let b=_,g=_1,C;return e[18]!==o||e[19]!==f||e[20]!==b||e[21]!==n.key?(C=p1("button",{className:f,"data-button-key":n.key,onClick:b,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=b,e[21]=n.key,e[22]=C):C=e[22],C};function k1(){h1("toolbar")}function _1(t){t.preventDefault()}import{c as y1}from"react/compiler-runtime";import{jsx as rt}from"react/jsx-runtime";import js,{useCallback as R1,useDeferredValue as I1,useEffect as v1,useMemo as M1}from"react";import{mergeRegister as D1}from"@lexical/utils";import{useTranslation as $1}from"@payloadcms/ui";import{$getSelection as A1}from"lexical";import{jsx as Re,jsxs as $s}from"react/jsx-runtime";import{Button as T1}from"@payloadcms/ui";import{$addUpdateTag as w1,isDOMNode as E1}from"lexical";import xo,{useCallback as S1,useEffect as Co,useMemo as Os,useRef as Ir,useState as vr}from"react";import{createPortal as N1}from"react-dom";var As="toolbar-popup__dropdown-item",Fs=xo.createContext(null);function Ps({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let d=Os(()=>[As,r===!1?"disabled":"",t?"active":"",l?.key?`${As}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Ir(null),u=xo.use(Fs);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return Co(()=>{c?.current!=null&&a(c)},[c,a]),Re(T1,{"aria-label":s,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{w1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function L1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=vr(),[i,s]=vr(),d=S1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=Os(()=>({registerItem:d}),[d]);return Co(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Re(Fs,{value:u,children:Re("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Bs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:d}){let c=Ir(null),u=Ir(null),[a,m]=vr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};Co(()=>{let h=u.current,x=c.current;if(a&&h!==null&&x!==null){let{left:T,top:E}=h.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;x.style.top=`${E+S+h.offsetHeight+5}px`,x.style.left=`${Math.min(T-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),Co(()=>{let h=u.current;if(h!==null&&a){let x=T=>{let E=T.target;E1(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=N1(Re(L1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return $s(xo.Fragment,{children:[$s("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:u,type:"button",children:[l&&Re(l,{}),s&&Re("span",{className:"toolbar-popup__dropdown-label",children:s}),Re("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Re(xo.Fragment,{children:f})]})}var Mr="toolbar-popup__dropdown",O1=t=>{let e=y1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=$1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&rt(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==u){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=rt(Ps,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?rt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:rt("span",{className:"text",children:p})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=u,e[13]=a}else a=e[13];return a},F1=js.memo(O1),je=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:d})=>{let[c,u]=js.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=I1(c),m=H(),{items:p,key:f}=r,h=Vt(),x=R1(()=>{o.getEditorState().read(()=>{let E=A1();if(!E)return;let S=[],_=[],b=[];for(let g of p)g.isActive&&(!s||S.length<s)&&g.isActive({editor:o,editorConfigContext:m,selection:E})&&(S.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:E})&&b.push(g.key):b.push(g.key);u({activeItemKeys:S,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:E}):!0,enabledItemKeys:b}),d&&d({activeItems:_})})},[o,m,r,p,s,d]);v1(()=>(h(x),D1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let T=M1(()=>p?.length?p.map(E=>rt(F1,{active:a.activeItemKeys.includes(E.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(E.key),item:E},E.key)):null,[p,a,t,o]);return rt(Bs,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[Mr,`${Mr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${Mr}-items`,...l||[]],label:i,children:T},f)};function G1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(Dt,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function V1(t){let e=Hs(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=U1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Ee.useState(void 0),[p,f]=Ee.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Ee.useEffect(h,x);let T;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==u?(T=b=>{let{activeItems:g}=b;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 C=g[0],k=C.key;C.label&&(k=typeof C.label=="function"?C.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):C.label),k.length>25&&(k=k.substring(0,25)+"..."),g.length===1?(m(k),f(()=>C.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=u,e[12]=T):T=e[12];let E=T,S=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==E||e[21]!==S?(_=P1("div",{className:S,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?se(je,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):se(je,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):null,l.type==="buttons"&&l.items.length?l.items.map(b=>se(G1,{anchorElem:o,editor:r,item:b},b.key)):null,i<n.features.toolbarFixed?.groups.length-1&&se("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=E,e[21]=S,e[22]=_):_=e[22],_}function K1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ee.useRef(null),i=Us(),{y:s}=j1(),d=W1(()=>{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 H1(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,s]),se("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:i&&se(Ee.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>se(V1,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Ws=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Ws(t.parentEditor)}return!1},Gs=t=>{let e=Hs(6),{clientProps:o}=t,[r]=B1(),n=H();if(!Us())return null;let{editorConfig:i}=n,s=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==s||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=Ws(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=se(K1,{anchorElem:document.body,editor:s,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=s,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var J1=$({plugins:[{Component:Gs,position:"aboveContainer"}]});import{c as Js}from"react/compiler-runtime";import{jsx as ue,jsxs as zs}from"react/jsx-runtime";import{useLexicalComposerContext as z1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as X1}from"@lexical/react/useLexicalEditable";import{mergeRegister as Xs}from"@lexical/utils";import{$getSelection as Zs,$isRangeSelection as Vs,$isTextNode as Z1,COMMAND_PRIORITY_LOW as Y1,getDOMSelection as Ys,SELECTION_CHANGE_COMMAND as q1}from"lexical";import{useCallback as ko,useEffect as $t,useRef as Ks,useState as Q1}from"react";import*as _o from"react";import{createPortal as eh}from"react-dom";function Dr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function bo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=d.top-a.height-c,h=d.left-l;i==="center"&&(h=d.left+d.width/2-a.width/2);let x=0;return!e&&f<p.top&&!s&&(x=a.height+d.height+c*2,f+=x),i==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function th({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ue(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ue(Dt,{editor:e,item:o,children:ue(o.ChildComponent,{})},o.key):null}function oh(t){let e=Js(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=H(),[s,d]=_o.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],_o.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let T=x[0];d(()=>T?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(f=zs("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ue(je,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):ue(je,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ue(th,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ue("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function rh({anchorElem:t,editor:e}){let o=Ks(null),r=Ks(null),{editorConfig:n}=H(),l=ko(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),i=ko(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),s=ko(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);$t(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let d=ko(()=>{let c=Zs(),u=Ys(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=Dr(u,p),h=bo({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&bo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return $t(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),$t(()=>(e.getEditorState().read(()=>{d()}),Xs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(q1,()=>(d(),!1),Y1))),[e,d]),zs("div",{className:"inline-toolbar-popup",ref:o,children:[ue("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>ue(oh,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function nh(t,e){let o=Js(12),[r,n]=Q1(!1),l=X1(),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Zs(),f=Ys(t._window),h=t.getRootElement();if(f!==null&&(!Vs(p)||h===null||!h.contains(f.anchorNode))){n(!1);return}if(!Vs(p))return;if(p.getTextContent()!==""){let T=p.getNodes(),E=!1;for(let S of T)if(Z1(S)){n(!0),E=!0;break}E||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let s=i,d,c;o[2]!==s?(d=()=>(document.addEventListener("selectionchange",s),document.addEventListener("mouseup",s),()=>{document.removeEventListener("selectionchange",s),document.removeEventListener("mouseup",s)}),c=[s],o[2]=s,o[3]=d,o[4]=c):(d=o[3],c=o[4]),$t(d,c);let u,a;if(o[5]!==t||o[6]!==s?(u=()=>Xs(t.registerUpdateListener(()=>{s()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,s],o[5]=t,o[6]=s,o[7]=u,o[8]=a):(u=o[7],a=o[8]),$t(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=eh(ue(rh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var qs=t=>{let{anchorElem:e}=t,[o]=z1();return nh(o,e)};var lh=$({plugins:[{Component:qs,position:"floatingAnchorElem"}]});import{TableCellNode as zg,TableNode as Xg,TableRowNode as Zg}from"@lexical/table";import{jsx as Qs}from"react/jsx-runtime";import"react";var $r=()=>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 ih,$createTableNode as sh,$createTableRowNode as ah,$isTableCellNode as ea,$isTableNode as Ar,$isTableRowNode as Or,TableCellHeaderStates as To,TableCellNode as ch,TableNode as uh,TableRowNode as dh}from"@lexical/table";import{$isParagraphNode as mh,$isTextNode as ph}from"lexical";var oa=/^\|(.+)\|\s?$/,fh=/^(\| ?:?-*:? ?)+\|\s?$/,ra=({allTransformers:t})=>({type:"element",dependencies:[uh,dh,ch],export:e=>{if(!Ar(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Or(r))continue;let l=!1;for(let i of r.getChildren())ea(i)&&(n.push(Gt(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===To.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
58
+ `,ms="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ps="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",i0=new RegExp("^[^"+ps+"]*["+ms+"]"),s0=new RegExp("^[^"+ms+"]*["+ps+"]"),a0={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},c0={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},u0={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},d0={[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"},m0={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},p0={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};var fs={text:({node:t})=>{let e=t.text;return t.format&F.IS_BOLD&&(e=Pe("strong",{children:e})),t.format&F.IS_ITALIC&&(e=Pe("em",{children:e})),t.format&F.IS_STRIKETHROUGH&&(e=Pe("span",{style:{textDecoration:"line-through"},children:e})),t.format&F.IS_UNDERLINE&&(e=Pe("span",{style:{textDecoration:"underline"},children:e})),t.format&F.IS_CODE&&(e=Pe("code",{children:e})),t.format&F.IS_SUBSCRIPT&&(e=Pe("sub",{children:e})),t.format&F.IS_SUPERSCRIPT&&(e=Pe("sup",{children:e})),e}};import{jsx as Rt}from"react/jsx-runtime";var hs={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Rt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Rt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Rt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Rt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Rt("picture",{children:n})}};var ot={...cs,...fs,...ls,...os,...ds,...rs,...ns,...as,...ss({}),...hs,...us};import{jsx as Er,Fragment as f0}from"react/jsx-runtime";import Tr from"react";function gs(t){if(!!!t?.root?.children?.length)return!1;let 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!o}function wr(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let r=typeof t.html=="function"?t.html(o):t.html;return Er("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function h0(t){let e={};for(let[o,r]of Object.entries(t)){if(!r||typeof r!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,i]of Object.entries(r)){let s=i;(s.Component||s.html)&&(e.blocks[l]=wr(s))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,i]of Object.entries(r)){let s=i;(s.Component||s.html)&&(e.inlineBlocks[l]=wr(s))}continue}let n=r;(n.Component||n.html)&&(e[o]=wr(n))}return e}function xs({converters:t,data:e,disableIndent:o,disableTextAlign:r,nodeMap:n}){if(gs(e)){let l=n?{...t,...h0(n)}:t;return Cs({converters:l,disableIndent:o,disableTextAlign:r,nodes:e.root.children,parent:e.root})}return Er(f0,{})}function Cs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,d)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:s,nodesToJSX:p=>Cs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:u=Er("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),Tr.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return Tr.cloneElement(u,{key:d,style:m})}return Tr.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",s),null}}).filter(Boolean)}var Sr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l,nodeMap:i})=>{if(!o)return null;let s={};e?typeof e=="function"?s=e({defaultConverters:ot}):s=e:s=ot;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&xs({converters:s,data:o,disableIndent:n,disableTextAlign:l,nodeMap:i});return r?bs(g0,{children:d}):bs("div",{className:t??"payload-richtext",children:d})};function _s(){let t=x0(7),[e]=C0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=k0(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),b0(l,i);let s;return t[5]!==r?(s=ks("div",{className:"debug-jsx-converter",children:ks(Sr,{converters:ot,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var _0=$({plugins:[{Component:_s,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)"}},T0={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 u1}from"lexical";import{jsx as It,jsxs as w0}from"react/jsx-runtime";import"react";var Nr=()=>w0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[It("g",{clipPath:"url(#clip0_4397_10817)",children:It("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),It("defs",{children:It("clipPath",{id:"clip0_4397_10817",children:It("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as y0}from"react/jsx-runtime";import{$applyNodeReplacement as R0}from"lexical";import*as ws from"react";import{DecoratorBlockNode as E0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as S0}from"@lexical/utils";import{$applyNodeReplacement as N0}from"lexical";function L0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ts({relationTo:o,value:e})}:null}var vt=class extends E0{__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:L0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Ts(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return S0(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 Ts(t){return N0(new vt({data:t}))}var I0=ws.lazy(()=>import("./RelationshipComponent-UCIWIEVD.js").then(t=>({default:t.RelationshipComponent})));function v0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Be({relationTo:o,value:e})}:null}var we=class extends vt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:v0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Be(o);return r.setFormat(e.format),r}decorate(e,o){return y0(I0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return R0(new we({data:t}))}function Lr(t){return t instanceof we}import{c as q0}from"react/compiler-runtime";import{jsx as Q0}from"react/jsx-runtime";import{useLexicalComposerContext as e1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as t1}from"@lexical/utils";import{$getPreviousSelection as o1,$getSelection as r1,$isParagraphNode as n1,$isRangeSelection as l1,COMMAND_PRIORITY_EDITOR as i1,createCommand as s1}from"lexical";import{useEffect as a1}from"react";import{c as Ns}from"react/compiler-runtime";import{jsx as yr}from"react/jsx-runtime";import{useLexicalComposerContext as Ls}from"@lexical/react/LexicalComposerContext.js";import{toast as W0}from"@payloadcms/ui";import{$getNodeByKey as G0,COMMAND_PRIORITY_EDITOR as ys}from"lexical";import{useEffect as Rs,useState as V0}from"react";import{c as M0}from"react/compiler-runtime";import{jsx as D0}from"react/jsx-runtime";import{useLexicalComposerContext as $0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as A0,useModal as O0}from"@payloadcms/ui";import{$getNodeByKey as Es,$getPreviousSelection as F0,$getRoot as P0,$getSelection as B0,$isRangeSelection as j0,$setSelection as H0}from"lexical";import{useEffect as U0,useState as Ss}from"react";var Mt=t=>{let e=M0(23),[o]=$0(),[r,n]=Ss(null),[l,i]=Ss(!1),[s,d,c]=A0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=O0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let R=B0()??F0();n(R)},e[0]=h):h=e[0];let x=h,T;e[1]!==o||e[2]!==r?(T=()=>{r&&o.update(()=>{if(j0(r)){let{anchor:R,focus:M}=r;Es(R.key)&&Es(M.key)&&H0(r.clone())}else P0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=T):T=e[3];let E=T,S;e[4]!==u?(S=()=>{u()},e[4]=u,e[5]=S):S=e[5];let _=S,b,g;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let R=f[a];R&&!R?.isOpen&&(i(!1),setTimeout(()=>{E()},1))},g=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=b,e[11]=g):(b=e[10],g=e[11]),U0(b,g);let C;e[12]!==d?(C=R=>D0(d,{...R,onClick:()=>{x()}}),e[12]=d,e[13]=C):C=e[13];let k;e[14]!==p?(k=()=>{x(),p(),i(!0)},e[14]=p,e[15]=k):k=e[15];let y;return e[16]!==s||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==C||e[21]!==k?(y={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:C,openListDrawer:k},e[16]=s,e[17]=_,e[18]=m,e[19]=a,e[20]=C,e[21]=k,e[22]=y):y=e[22],y};var K0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=G0(o);n&&n.replace(Be({relationTo:e,value:r}))}):t.dispatchCommand(Rr,{relationTo:e,value:r})},J0=t=>{let e=Ns(14),{enabledCollectionSlugs:o}=t,[r]=Ls(),[n,l]=V0(null),i=o?.[0],s;e[0]!==o||e[1]!==i?(s={collectionSlugs:o,selectedCollection:i},e[0]=o,e[1]=i,e[2]=s):s=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Mt(s),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Ve,x=>(l(x?.replace?x?.replace.nodeKey:null),u(),!0),ys),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Rs(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=x=>{let{collectionSlug:T,doc:E}=x;K0({editor:r,relationTo:T,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=yr(c,{onSelect:f}),e[11]=c,e[12]=f,e[13]=h):h=e[13],h},z0=()=>{let t=Ns(3),[e]=Ls(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ve,X0,ys),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Rs(o,r),null},Is=({enabledCollectionSlugs:t})=>t?.length?yr(J0,{enabledCollectionSlugs:t}):yr(z0,{});function X0(){return W0.error("No relationship collections enabled"),!0}import{useConfig as Z0,useEntityVisibility as Y0}from"@payloadcms/ui";import*as vs from"react";var go=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=Z0(),{visibleEntities:l}=Y0();return vs.useMemo(()=>{let s=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:f}=a;if(l?.collections.includes(m)){if(r){if(!p||!f)continue}else if(f||!p)continue;c&&!c.has(m)||u&&u.has(m)||(s.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:s}},[n,l,r,o,e])};var Rr=s1("INSERT_RELATIONSHIP_COMMAND"),Ms=t=>{let e=q0(8),{clientProps:o}=t,[r]=e1(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=go(i),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Rr,c1,i1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),a1(d,c);let u;return e[6]!==s?(u=Q0(Is,{enabledCollectionSlugs:s}),e[6]=s,e[7]=u):u=e[7],u};function c1(t){let e=r1()||o1();if(l1(e)){let o=Be(t),{focus:r}=e,n=r.getNode();t1(o),n1(n)&&!n.__first&&n.remove()}return!0}var d1=$({nodes:[we],plugins:[{Component:Ms,position:"normal"}],slashMenu:{groups:[Z([{Icon:Nr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Nr,isActive:({selection:t})=>{if(!u1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Lr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]}});import{c as Hs}from"react/compiler-runtime";import{jsx as se,jsxs as P1}from"react/jsx-runtime";import{useLexicalComposerContext as B1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Us}from"@lexical/react/useLexicalEditable";import{useScrollInfo as j1,useThrottledEffect as H1,useTranslation as U1}from"@payloadcms/ui";import*as Ee from"react";import{useMemo as W1}from"react";import{c as m1}from"react/compiler-runtime";import{jsx as p1}from"react/jsx-runtime";import{mergeRegister as f1}from"@lexical/utils";import{$addUpdateTag as h1,$getSelection as g1}from"lexical";import{useDeferredValue as x1,useEffect as C1,useState as b1}from"react";var Ds="toolbar-popup__button",Dt=t=>{let e=m1(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=b1(l),d=x1(i),c=H(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Ds}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Ds,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=g1();if(!k)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:k}):!1,R=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:k}):!0;s(M=>M.active===y&&M.enabled===R?M:{active:y,enabled:R})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,T=Vt(),E,S;e[9]!==r||e[10]!==T||e[11]!==x?(E=()=>{T(x);let k=()=>T(x),y=f1(r.registerUpdateListener(k));return document.addEventListener("mouseup",k),()=>{y(),document.removeEventListener("mouseup",k)}},S=[r,T,x],e[9]=r,e[10]=T,e[11]=x,e[12]=E,e[13]=S):(E=e[12],S=e[13]),C1(E,S);let _;e[14]!==i||e[15]!==r||e[16]!==n?(_=()=>{i.enabled&&r.focus(()=>{r.update(k1),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=_):_=e[17];let b=_,g=_1,C;return e[18]!==o||e[19]!==f||e[20]!==b||e[21]!==n.key?(C=p1("button",{className:f,"data-button-key":n.key,onClick:b,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=b,e[21]=n.key,e[22]=C):C=e[22],C};function k1(){h1("toolbar")}function _1(t){t.preventDefault()}import{c as y1}from"react/compiler-runtime";import{jsx as rt}from"react/jsx-runtime";import js,{useCallback as R1,useDeferredValue as I1,useEffect as v1,useMemo as M1}from"react";import{mergeRegister as D1}from"@lexical/utils";import{useTranslation as $1}from"@payloadcms/ui";import{$getSelection as A1}from"lexical";import{jsx as Re,jsxs as $s}from"react/jsx-runtime";import{Button as T1}from"@payloadcms/ui";import{$addUpdateTag as w1,isDOMNode as E1}from"lexical";import xo,{useCallback as S1,useEffect as Co,useMemo as Os,useRef as Ir,useState as vr}from"react";import{createPortal as N1}from"react-dom";var As="toolbar-popup__dropdown-item",Fs=xo.createContext(null);function Ps({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let d=Os(()=>[As,r===!1?"disabled":"",t?"active":"",l?.key?`${As}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Ir(null),u=xo.use(Fs);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return Co(()=>{c?.current!=null&&a(c)},[c,a]),Re(T1,{"aria-label":s,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{w1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function L1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=vr(),[i,s]=vr(),d=S1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=Os(()=>({registerItem:d}),[d]);return Co(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Re(Fs,{value:u,children:Re("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Bs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:d}){let c=Ir(null),u=Ir(null),[a,m]=vr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};Co(()=>{let h=u.current,x=c.current;if(a&&h!==null&&x!==null){let{left:T,top:E}=h.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;x.style.top=`${E+S+h.offsetHeight+5}px`,x.style.left=`${Math.min(T-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),Co(()=>{let h=u.current;if(h!==null&&a){let x=T=>{let E=T.target;E1(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=N1(Re(L1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return $s(xo.Fragment,{children:[$s("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:u,type:"button",children:[l&&Re(l,{}),s&&Re("span",{className:"toolbar-popup__dropdown-label",children:s}),Re("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Re(xo.Fragment,{children:f})]})}var Mr="toolbar-popup__dropdown",O1=t=>{let e=y1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=$1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&rt(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==u){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=rt(Ps,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?rt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:rt("span",{className:"text",children:p})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=u,e[13]=a}else a=e[13];return a},F1=js.memo(O1),je=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:d})=>{let[c,u]=js.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=I1(c),m=H(),{items:p,key:f}=r,h=Vt(),x=R1(()=>{o.getEditorState().read(()=>{let E=A1();if(!E)return;let S=[],_=[],b=[];for(let g of p)g.isActive&&(!s||S.length<s)&&g.isActive({editor:o,editorConfigContext:m,selection:E})&&(S.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:E})&&b.push(g.key):b.push(g.key);u({activeItemKeys:S,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:E}):!0,enabledItemKeys:b}),d&&d({activeItems:_})})},[o,m,r,p,s,d]);v1(()=>(h(x),D1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let T=M1(()=>p?.length?p.map(E=>rt(F1,{active:a.activeItemKeys.includes(E.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(E.key),item:E},E.key)):null,[p,a,t,o]);return rt(Bs,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[Mr,`${Mr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${Mr}-items`,...l||[]],label:i,children:T},f)};function G1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(Dt,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function V1(t){let e=Hs(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=U1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Ee.useState(void 0),[p,f]=Ee.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Ee.useEffect(h,x);let T;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==u?(T=b=>{let{activeItems:g}=b;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 C=g[0],k=C.key;C.label&&(k=typeof C.label=="function"?C.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):C.label),k.length>25&&(k=k.substring(0,25)+"..."),g.length===1?(m(k),f(()=>C.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=u,e[12]=T):T=e[12];let E=T,S=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==E||e[21]!==S?(_=P1("div",{className:S,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?se(je,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):se(je,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):null,l.type==="buttons"&&l.items.length?l.items.map(b=>se(G1,{anchorElem:o,editor:r,item:b},b.key)):null,i<n.features.toolbarFixed?.groups.length-1&&se("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=E,e[21]=S,e[22]=_):_=e[22],_}function K1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ee.useRef(null),i=Us(),{y:s}=j1(),d=W1(()=>{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 H1(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,s]),se("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:i&&se(Ee.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>se(V1,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Ws=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Ws(t.parentEditor)}return!1},Gs=t=>{let e=Hs(6),{clientProps:o}=t,[r]=B1(),n=H();if(!Us())return null;let{editorConfig:i}=n,s=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==s||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=Ws(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=se(K1,{anchorElem:document.body,editor:s,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=s,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var J1=$({plugins:[{Component:Gs,position:"aboveContainer"}]});import{c as Js}from"react/compiler-runtime";import{jsx as ue,jsxs as zs}from"react/jsx-runtime";import{useLexicalComposerContext as z1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as X1}from"@lexical/react/useLexicalEditable";import{mergeRegister as Xs}from"@lexical/utils";import{$getSelection as Zs,$isRangeSelection as Vs,$isTextNode as Z1,COMMAND_PRIORITY_LOW as Y1,getDOMSelection as Ys,SELECTION_CHANGE_COMMAND as q1}from"lexical";import{useCallback as ko,useEffect as $t,useRef as Ks,useState as Q1}from"react";import*as _o from"react";import{createPortal as eh}from"react-dom";function Dr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function bo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=d.top-a.height-c,h=d.left-l;i==="center"&&(h=d.left+d.width/2-a.width/2);let x=0;return!e&&f<p.top&&!s&&(x=a.height+d.height+c*2,f+=x),i==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function th({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ue(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ue(Dt,{editor:e,item:o,children:ue(o.ChildComponent,{})},o.key):null}function oh(t){let e=Js(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=H(),[s,d]=_o.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],_o.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let T=x[0];d(()=>T?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(f=zs("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ue(je,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):ue(je,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ue(th,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ue("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function rh({anchorElem:t,editor:e}){let o=Ks(null),r=Ks(null),{editorConfig:n}=H(),l=ko(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),i=ko(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),s=ko(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);$t(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let d=ko(()=>{let c=Zs(),u=Ys(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=Dr(u,p),h=bo({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&bo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return $t(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),$t(()=>(e.getEditorState().read(()=>{d()}),Xs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(q1,()=>(d(),!1),Y1))),[e,d]),zs("div",{className:"inline-toolbar-popup",ref:o,children:[ue("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>ue(oh,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function nh(t,e){let o=Js(12),[r,n]=Q1(!1),l=X1(),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Zs(),f=Ys(t._window),h=t.getRootElement();if(f!==null&&(!Vs(p)||h===null||!h.contains(f.anchorNode))){n(!1);return}if(!Vs(p))return;if(p.getTextContent()!==""){let T=p.getNodes(),E=!1;for(let S of T)if(Z1(S)){n(!0),E=!0;break}E||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let s=i,d,c;o[2]!==s?(d=()=>(document.addEventListener("selectionchange",s),document.addEventListener("mouseup",s),()=>{document.removeEventListener("selectionchange",s),document.removeEventListener("mouseup",s)}),c=[s],o[2]=s,o[3]=d,o[4]=c):(d=o[3],c=o[4]),$t(d,c);let u,a;if(o[5]!==t||o[6]!==s?(u=()=>Xs(t.registerUpdateListener(()=>{s()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,s],o[5]=t,o[6]=s,o[7]=u,o[8]=a):(u=o[7],a=o[8]),$t(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=eh(ue(rh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var qs=t=>{let{anchorElem:e}=t,[o]=z1();return nh(o,e)};var lh=$({plugins:[{Component:qs,position:"floatingAnchorElem"}]});import{TableCellNode as zg,TableNode as Xg,TableRowNode as Zg}from"@lexical/table";import{jsx as Qs}from"react/jsx-runtime";import"react";var $r=()=>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 ih,$createTableNode as sh,$createTableRowNode as ah,$isTableCellNode as ea,$isTableNode as Ar,$isTableRowNode as Or,TableCellHeaderStates as To,TableCellNode as ch,TableNode as uh,TableRowNode as dh}from"@lexical/table";import{$isParagraphNode as mh,$isTextNode as ph}from"lexical";var oa=/^\|(.+)\|\s?$/,fh=/^(\| ?:?-*:? ?)+\|\s?$/,ra=({allTransformers:t})=>({type:"element",dependencies:[uh,dh,ch],export:e=>{if(!Ar(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Or(r))continue;let l=!1;for(let i of r.getChildren())ea(i)&&(n.push(Gt(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===To.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
59
59
  `)},regExp:oa,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(fh.test(n)){let a=e.getPreviousSibling();if(!a||!Ar(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Or(p))return;p.getChildren().forEach(f=>{ea(f)&&f.setHeaderStyles(To.ROW,To.ROW)}),e.remove();return}let l=ta(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),d=l.length;for(;s&&!(!mh(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!ph(a))break;let m=ta(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),i.unshift(m);let p=s.getPreviousSibling();s.remove(),s=p}let c=sh();for(let a of i){let m=ah();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:na("",t))}let u=e.getPreviousSibling();Ar(u)&&hh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function hh(t){let e=t.getFirstChild();return Or(e)?e.getChildrenSize():0}var na=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=ih(To.NO_STATUS);return Wt(t,e,o),o},ta=(t,e)=>{let o=t.match(oa);return!o||!o[1]?null:o[1].split("|").map(r=>na(r,e))};import{c as xh}from"react/compiler-runtime";import{jsx as P,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as ca}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ch}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ia,$deleteTableColumnAtSelection as bh,$deleteTableRowAtSelection as kh,$getNodeTriplet as _h,$getTableCellNodeFromLexicalNode as sa,$getTableColumnIndexFromTableCellNode as Th,$getTableNodeFromLexicalNodeOrThrow as ve,$getTableRowIndexFromTableCellNode as wh,$insertTableColumnAtSelection as Eh,$insertTableRowAtSelection as Sh,$isTableCellNode as ua,$isTableSelection as At,$mergeCells as Nh,$unmergeCell as Lh,getTableElement as Pr,getTableObserverFromTableElement as Br,TableCellHeaderStates as Ie,TableCellNode as yh}from"@lexical/table";import{mergeRegister as Rh}from"@lexical/utils";import{useScrollInfo as Ih}from"@payloadcms/ui";import{$getSelection as Eo,$isElementNode as vh,$isRangeSelection as jr,$isTextNode as Mh,$setSelection as Dh,COMMAND_PRIORITY_CRITICAL as $h,getDOMSelection as Ah,isDOMNode as Oh,SELECTION_CHANGE_COMMAND as Fh}from"lexical";import*as Hr from"react";import{useCallback as ae,useEffect as nt,useRef as wo,useState as lt}from"react";import{createPortal as da}from"react-dom";import{jsx as Fr,jsxs as gh}from"react/jsx-runtime";import"react";var la=()=>gh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Fr("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"}),Fr("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"}),Fr("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 aa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Ph(){let t=Eo();if(jr(t)&&!t.isCollapsed()||At(t)&&!t.anchor.is(t.focus)||!jr(t)&&!At(t))return!1;let[e]=_h(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Bh(t){let e=t.getLastDescendant();Mh(e)?e.select():vh(e)?e.selectEnd():e!==null&&e.selectNext()}function jh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=ca(),i=wo(null),[s,d]=lt(n),[c,u]=lt({columns:1,rows:1}),[a,m]=lt(!1),[p,f]=lt(!1),{y:h}=Ih();nt(()=>l.registerMutationListener(yh,w=>{w.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{d(s.getLatest())})},{skipInitialization:!0}),[l,s]),nt(()=>{l.getEditorState().read(()=>{let w=Eo();if(At(w)){let N=aa(w);u(aa(w)),m(N.columns>1||N.rows>1)}f(Ph())})},[l]),nt(()=>{let w=e.current,N=i.current,I=l.getRootElement();if(w!=null&&N!=null&&I!=null){let A=I.getBoundingClientRect(),v=w.getBoundingClientRect();N.style.opacity="1";let O=N.getBoundingClientRect(),D=5,G=v.right+D;if(G+O.width>window.innerWidth||G+O.width>A.right){let J=v.left-O.width-D;G=(J<0?D:J)+window.pageXOffset}N.style.left=`${G+window.pageXOffset}px`;let Q=v.top;if(Q+O.height>window.innerHeight){let J=v.bottom-O.height;Q=J<0?D:J}N.style.top=`${Q}px`}},[e,i,l,h]),nt(()=>{function w(N){i.current!=null&&e.current!=null&&Oh(N.target)&&!i.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let x=ae(()=>{l.update(()=>{if(s.isAttached()){let w=ve(s),N=Pr(w,l.getElementByKey(w.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let I=Br(N);I!==null&&I.$clearHighlight(),w.markDirty(),d(s.getLatest())}Dh(null)})},[l,s]),T=()=>{l.update(()=>{let w=Eo();if(!At(w))return;let I=w.getNodes().filter(ua),A=Nh(I);A&&(Bh(A),o())})},E=()=>{l.update(()=>{Lh()})},S=ae(w=>{l.update(()=>{for(let N=0;N<c.rows;N++)Sh(w);o()})},[l,o,c.rows]),_=ae(w=>{l.update(()=>{for(let N=0;N<c.columns;N++)Eh(w);o()})},[l,o,c.columns]),b=ae(()=>{l.update(()=>{kh(),o()})},[l,o]),g=ae(()=>{l.update(()=>{ve(s).remove(),x(),o()})},[l,s,x,o]),C=ae(()=>{l.update(()=>{bh(),o()})},[l,o]),k=ae(()=>{l.update(()=>{let w=ve(s),N=wh(s),[I]=ia(w,null,null),A=new Set,v=s.getHeaderStyles()^Ie.ROW;if(I[N])for(let O=0;O<I[N].length;O++){let D=I[N][O];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Ie.ROW)))}x(),o()})},[l,s,x,o]),y=ae(()=>{l.update(()=>{let w=ve(s),N=Th(s),[I]=ia(w,null,null),A=new Set,v=s.getHeaderStyles()^Ie.COLUMN;if(I)for(let O=0;O<I.length;O++){let D=I?.[O]?.[N];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Ie.COLUMN)))}x(),o()})},[l,s,x,o]),R=ae(()=>{l.update(()=>{if(s.isAttached()){let w=ve(s);w&&w.setRowStriping(!w.getRowStriping())}x(),o()})},[l,s,x,o]),M=ae(()=>{l.update(()=>{if(s.isAttached()){let w=ve(s);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),L=null;return t&&(a?L=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),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"})}))),da(Se("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:i,children:[L?Se(Hr.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:()=>S(!1),type:"button",children:Se("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:()=>S(!0),type:"button",children:Se("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:Se("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:Se("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:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),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:Se("span",{className:"text",children:[(s.__headerState&Ie.ROW)===Ie.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&Ie.COLUMN)===Ie.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Hh({anchorElem:t,cellMerge:e}){let[o]=ca(),r=wo(null),n=wo(null),[l,i]=lt(!1),[s,d]=lt(null),c=ae(()=>{let a=r.current,m=Eo(),p=Ah(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(),T=null,E=null;if(jr(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=sa(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return h();let b=ve(_),g=Pr(b,o.getElementByKey(b.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Br(g),d(_)}else if(At(m)){let _=sa(m.anchor.getNode());if(!ua(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=ve(_),g=Pr(b,o.getElementByKey(b.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Br(g),E=o.getElementByKey(_.getKey())}else if(!f)return h();if(T===null||E===null)return h();let S=!T||!T.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let _=E.getBoundingClientRect(),b=t.getBoundingClientRect(),g=_.top-b.top,C=_.right-b.left;a.style.transform=`translate(${C}px, ${g}px)`}},[o,t]);nt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Rh(o.registerUpdateListener(p),o.registerCommand(Fh,p,$h),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=wo(s);return nt(()=>{u.current!==s&&i(!1),u.current=s},[u,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Se(Hr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(la,{})}),l&&P(jh,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var ma=t=>{let e=xh(3),{anchorElem:o}=t,r=Ch(),n;return e[0]!==o||e[1]!==r?(n=da(r?P(Hh,{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 Uh}from"react/compiler-runtime";import{jsx as No,jsxs as Wh}from"react/jsx-runtime";import{useLexicalComposerContext as Gh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Vh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Kh,$getTableNodeFromLexicalNodeOrThrow as Ur,$getTableRowIndexFromTableCellNode as Jh,$isTableCellNode as pa,$isTableRowNode as zh,getDOMCellFromTarget as Xh,getTableElement as Zh,TableNode as fa}from"@lexical/table";import{calculateZoomLevel as ha,mergeRegister as Yh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Wr,isHTMLElement as qh,SKIP_SCROLL_INTO_VIEW_TAG as ga}from"lexical";import*as Ca from"react";import{useCallback as Ot,useEffect as Gr,useRef as So,useState as it}from"react";import{createPortal as Qh}from"react-dom";var eg=33,xa=92;function tg({editor:t}){let e=So(null),o=So(null),r=So(null),[n,l]=it(!1),i=H(),s=So(null),[d,c]=it(null),[u,a]=it(null),[m,p]=it(!1),[f,h]=it(null),x=Ot(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),T=M=>(M.buttons&1)===1;Gr(()=>{let M=new Set;return Yh(t.registerMutationListener(fa,L=>{for(let[w,N]of L)N==="destroyed"?M.delete(w):M.add(w);l(M.size>0)}),t.registerNodeTransform(fa,L=>{if(L.getColWidths())return L;let w=L.getColumnCount(),N=xa;return L.setColWidths(Array(w).fill(N)),L}))},[t]),Gr(()=>{if(!n)return;let M=I=>{let A=I.target;if(qh(A)){if(f){c({x:I.clientX,y:I.clientY});return}if(p(T(I)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let v=Xh(A);v&&u!==v?t.getEditorState().read(()=>{let O=Wr(v.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let D=Ur(O),G=Zh(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)},w=I=>{p(!1)},N=t.registerRootListener((I,A)=>{A?.removeEventListener("mousemove",M),A?.removeEventListener("mousedown",L),A?.removeEventListener("mouseup",w),I?.addEventListener("mousemove",M),I?.addEventListener("mousedown",L),I?.addEventListener("mouseup",w)});return()=>{N()}},[u,f,t,n,x]);let E=M=>M==="bottom",S=Ot(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Wr(u.elem);if(!pa(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Ur(L),N=Jh(L),I=w.getChildren(),v=L.getColSpan()===w.getColumnCount()?N:N+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(!zh(O))throw new Error("Expected table row");let D=O.getHeight();if(D===void 0){let Q=O.getChildren();D=Math.min(...Q.map(J=>_(J,t)??1/0))}let G=Math.max(D+M,eg);O.setHeight(G)},{tag:ga})},[u,t]),_=(M,L)=>L.getElementByKey(M.getKey())?.clientHeight,b=(M,L)=>{let w;return L.forEach(N=>{N.forEach((I,A)=>{I.cell===M&&(w=A)})}),w},g=Ot(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Wr(u.elem);if(!pa(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Ur(L),[N]=Kh(w,null,null),I=b(L,N);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let A=w.getColWidths();if(!A)return;let v=A[I];if(v===void 0)return;let O=[...A],D=Math.max(v+M,xa);O[I]=D,w.setColWidths(O)},{tag:ga})},[u,t]),C=Ot(M=>{let L=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y:I}=s.current;if(u===null)return;let A=ha(w.target);if(E(M)){let v=(w.clientY-I)/A;S(v)}else{let v=(w.clientX-N)/A;g(v)}x(),document.removeEventListener("mouseup",L)}};return L},[u,x,g,S]),k=Ot(M=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");s.current={x:L.clientX,y:L.clientY},c(s.current),h(M),document.addEventListener("mouseup",C(M))},[u,C]),[y,R]=it({bottom:null,left:null,right:null,top:null});return Gr(()=>{if(u){let{height:M,left:L,top:w,width:N}=u.elem.getBoundingClientRect(),I=ha(u.elem),A=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${A}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+w+M-A/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${M}px`,left:`${window.scrollX+L+N-A/2}px`,top:`${window.scrollY+w}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]),No("div",{ref:o,children:u!=null&&!m&&Wh(Ca.Fragment,{children:[No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("right"),style:y.right||void 0}),No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("bottom"),style:y.bottom||void 0})]})})}var ba=()=>{let t=Uh(3),[e]=Gh(),o=Vh(),r;return t[0]!==e||t[1]!==o?(r=o?Qh(No(tg,{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 Vr,jsxs as ug,Fragment as dg}from"react/jsx-runtime";import{useLexicalComposerContext as mg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as La}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as pg,$getTableColumnIndexFromTableCellNode as fg,$getTableRowIndexFromTableCellNode as hg,$insertTableColumnAtSelection as gg,$insertTableRowAtSelection as xg,$isTableCellNode as Cg,$isTableNode as Ta,getTableElement as bg,TableNode as kg}from"@lexical/table";import{$findMatchingParent as _g,mergeRegister as Tg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as wa,isHTMLElement as wg}from"lexical";import{useEffect as Ea,useMemo as Eg,useRef as Sa,useState as Lo}from"react";import"react";import{createPortal as Sg}from"react-dom";import{c as ig}from"react/compiler-runtime";import{useEffect as sg,useRef as ag}from"react";var og="Expected a function",rg=Math.max,ng=Math.min;function lg(t,e,o){let r,n,l=0,i,s=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(og);e=e||0,typeof o=="object"&&(s=!!o.leading,d="maxWait"in o,c=d?rg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let C=r,k=i;return r=i=void 0,l=g,u=t.apply(k,C),u}function f(g){return l=g,a=setTimeout(T,e),s?p(g):u}function h(g){let C=g-n,k=g-l,y=e-C;return d?ng(y,c-k):y}function x(g){let C=g-n,k=g-l;return n===void 0||C>=e||C<0||d&&k>=c}function T(){let g=Date.now();if(x(g))return E(g);a=setTimeout(T,h(g))}function E(g){return a=void 0,m&&r?p(g):(r=i=void 0,u)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function _(){return a===void 0?u:E(Date.now())}function b(){let g=Date.now(),C=x(g);if(r=arguments,i=this,n=g,C){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(T,e),p(n)}return a===void 0&&(a=setTimeout(T,e)),u}return b.cancel=S,b.flush=_,b}var ka=lg;function _a(t,e,o){let r=ig(6),n=ag(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ka(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),sg(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=s):s=r[5],s}var Na=20;function Ng({anchorElem:t}){let[e]=mg(),o=La(),r=H(),[n,l]=Lo(!1),[i,s]=Lo(!1),[d,c]=Lo(!1),[u,a]=Lo({}),m=Sa(new Set),p=Sa(null),f=_a(T=>{let{isOutside:E,tableDOMNode:S}=Lg(T,r.editorConfig?.lexical);if(E){l(!1),s(!1);return}if(!S)return;p.current=S;let _=null,b=null,g=null;if(e.getEditorState().read(()=>{let v=wa(S);if(Cg(v)){let O=_g(v,D=>Ta(D));if(!Ta(O))return;if(g=bg(O,e.getElementByKey(O.getKey())),g){let D=O.getChildrenSize(),G=O.getChildAtIndex(0)?.getChildrenSize(),Q=hg(v),J=fg(v);Q===D-1?_=v:J===G-1&&(b=v)}}},{editor:e}),!g)return;let C=g.parentElement;if(!C)return;let{bottom:k,height:y,left:R,right:M,width:L,y:w}=g.getBoundingClientRect(),N=!1;C&&C.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(N=C.scrollWidth>C.clientWidth);let{left:I,y:A}=t.getBoundingClientRect();_?(s(!1),l(!0),a({height:Na,left:N&&C?C.offsetLeft:R-I,top:k-A+5,width:N&&C?C.offsetWidth:L})):b&&(s(!0),l(!1),a({height:y,left:M-I+5,top:w-A,width:Na}))},50,250),h=Eg(()=>new ResizeObserver(()=>{l(!1),s(!1)}),[]);Ea(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),s(!1),document.removeEventListener("mousemove",f)}},[d,f]),Ea(()=>Tg(e.registerMutationListener(kg,T=>{e.getEditorState().read(()=>{let E=!1;for(let[S,_]of T)switch(_){case"created":{m.current.add(S),E=!0;break}case"destroyed":{m.current.delete(S),E=!0;break}default:break}if(E){h.disconnect();for(let S of m.current){let{tableElement:_}=pg(S);h.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=T=>{e.update(()=>{p.current&&(wa(p.current)?.selectEnd(),T?(xg(),l(!1)):(gg(),s(!1)))})};return o?ug(dg,{children:[n&&Vr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),i&&Vr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function Lg(t,e){let o=t.target;if(wg(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 ya(t){let e=cg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!La())return null;let l;return e[0]!==r?(l=Sg(Vr(Ng,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as yg}from"react/compiler-runtime";import{jsx as Kr,jsxs as Rg}from"react/jsx-runtime";import{useLexicalComposerContext as Ig}from"@lexical/react/LexicalComposerContext";import{TablePlugin as vg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Mg,TableCellNode as Dg,TableNode as $g,TableRowNode as Ag}from"@lexical/table";import{mergeRegister as Og}from"@lexical/utils";import{formatDrawerSlug as Fg,useEditDepth as Pg}from"@payloadcms/ui";import{$getSelection as Bg,$isRangeSelection as jg,COMMAND_PRIORITY_EDITOR as Hg,createCommand as Ug}from"lexical";import{createContext as Wg,use as Gg,useEffect as Vg,useMemo as Kg,useState as Jg}from"react";import*as Ra from"react";var yo=Ug("OPEN_EMBED_DRAWER_COMMAND"),Ia=Wg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function va({children:t}){let[e,o]=Jg({cellEditorConfig:null,cellEditorPlugins:null});return Kr(Ia,{value:Kg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ma=()=>{let t=yg(16),[e]=Ig(),o=Gg(Ia),r=Pg(),{fieldProps:n,uuid:l}=H(),{schemaPath:i}=n,s="lexical-table-create-"+l,d;t[0]!==r||t[1]!==s?(d=Fg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=fe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([$g,Ag,Dg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Og(e.registerCommand(yo,()=>{let h=null;return e.getEditorState().read(()=>{let x=Bg();jg(x)&&(h=x)}),h&&u(),!0},Hg))},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],Vg(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(Mg,{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]!==i||t[14]!==p?(f=Rg(Ra.Fragment,{children:[Kr(mt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Kr(vg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var Yg=$({markdownTransformers:[ra],nodes:[Xg,zg,Zg],plugins:[{Component:Ma,position:"normal"},{Component:ba,position:"normal"},{Component:ma,position:"floatingAnchorElem"},{Component:ya,position:"floatingAnchorElem"}],providers:[va],slashMenu:{groups:[Y([{Icon:$r,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:$r,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]}});import{$isNodeSelection as Dx}from"lexical";import{jsx as Jr,jsxs as qg}from"react/jsx-runtime";import"react";var zr=()=>qg("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Jr("path",{d:"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"}),Jr("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"}),Jr("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 Fa}from"react/jsx-runtime";import Pa from"bson-objectid";import{$applyNodeReplacement as nx}from"lexical";import*as Ba from"react";import Qg from"bson-objectid";function Ro(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 Qg.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as ex}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as tx}from"@lexical/utils";import $a from"bson-objectid";import{$applyNodeReplacement as ox}from"lexical";var Ft=class extends ex{__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=>Ro(o,Da),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new $a.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Da({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return tx(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 Da({data:t}){return t?.id||(t.id=new $a.default().toHexString()),ox(new Ft({data:t}))}import{jsx as Aa}from"react/jsx-runtime";import{ShimmerEffect as rx}from"@payloadcms/ui";var Oa=()=>Aa("div",{className:"lexical-upload",children:Aa(rx,{height:"95px",width:"203px"})});var lx=Ba.lazy(()=>import("./component-5YLBQB5B.js").then(t=>({default:t.UploadComponent}))),de=class extends Ft{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Ro(o,me),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Pa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=me({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?Fa(Oa,{}):Fa(lx,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function me({data:t}){return t?.id||(t.id=new Pa.default().toHexString()),nx(new de({data:t}))}function st(t){return t instanceof de}import{c as px}from"react/compiler-runtime";import{jsx as fx}from"react/jsx-runtime";import{useLexicalComposerContext as hx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Za,$insertNodeToNearestRoot as Yr,mergeRegister as gx}from"@lexical/utils";import{useBulkUpload as xx,useEffectEvent as Cx,useModal as bx}from"@payloadcms/ui";import qr from"bson-objectid";import{$createRangeSelection as kx,$getPreviousSelection as Va,$getSelection as Ka,$isParagraphNode as Qr,$isRangeSelection as Ja,$setSelection as _x,COMMAND_PRIORITY_EDITOR as Tx,COMMAND_PRIORITY_LOW as za,createCommand as wx,DROP_COMMAND as Ex,getDOMSelectionFromTarget as Sx,isHTMLElement as Xa,PASTE_COMMAND as Nx}from"lexical";import{useEffect as Lx}from"react";import{c as ja}from"react/compiler-runtime";import{jsx as Xr}from"react/jsx-runtime";import{useLexicalComposerContext as Ha}from"@lexical/react/LexicalComposerContext.js";import{toast as ix}from"@payloadcms/ui";import{$getNodeByKey as sx,COMMAND_PRIORITY_EDITOR as Ua}from"lexical";import{useEffect as Wa,useState as ax}from"react";var cx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=sx(o);n&&n.replace(me({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Zr,{fields:null,relationTo:e,value:r})},ux=t=>{let e=ja(13),{enabledCollectionSlugs:o}=t,[r]=Ha(),[n,l]=ax(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:d,openListDrawer:c}=Mt(i),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Ua),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Wa(u,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:T}=h;s(),cx({editor:r,relationTo:x,replaceNodeKey:n,value:T.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==d||e[11]!==p?(f=Xr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},dx=()=>{let t=ja(3),[e]=Ha(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,mx,Ua),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Wa(o,r),null},Ga=({enabledCollectionSlugs:t})=>t?.length?Xr(ux,{enabledCollectionSlugs:t}):Xr(dx,{});function mx(){return ix.error("No upload collections enabled"),!0}function yx(t){let e=t.target;return!!(Xa(e)&&!e.closest("code, span.editor-image")&&Xa(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Rx(t){let e,o=Sx(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 Zr=wx("INSERT_UPLOAD_COMMAND"),Ya=t=>{let e=px(21),{clientProps:o}=t,[r]=hx(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=go(i),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=xx(),{isModalOpen:f,openModal:h}=bx(),x;e[3]!==d||e[4]!==r||e[5]!==s||e[6]!==f||e[7]!==h||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(x=b=>{let{files:g}=b;if(g?.length!==0&&(u(C=>[...C??[],...g.map(Ix)]),!f(d))){if(!s.length||!s[0])return;c(s[0]),p(s),a(()=>{r.update(vx)}),m(C=>{let k=new Map(C.map(Mx));r.update(()=>{for(let y of Za()){let R=y.node;if(st(R)){let M=R.getData();if(M?.pending){let L=k.get(M.pending?.formID);L&&R.replace(me({data:{id:new qr.default().toHexString(),fields:{},relationTo:L.collectionSlug,value:L.doc.id}}))}}}})}),h(d)}},e[3]=d,e[4]=r,e[5]=s,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 T=Cx(x),E;e[14]!==r||e[15]!==T?(E=()=>{if(!r.hasNodes([de]))throw new Error("UploadPlugin: UploadNode not registered on editor");return gx(r.registerNodeTransform(de,b=>{let g=b.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,/),w=L?L[1]:"image/png",N=R.replace(/^data:image\/[a-zA-Z]+;base64,/,""),I=atob(N),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."+w?.split("/",2)[1],{type:w}),formID:M}}else if(R?.startsWith("http")||R?.startsWith("https")){let w=await(await fetch(R)).blob(),N=R.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];y={alt:void 0,file:new File([w],N,{type:w.type}),formID:M}}y&&T({files:[y]})})()}),r.registerCommand(Zr,b=>(r.update(()=>{let g=Ka()||Va();if(Ja(g)){let C=me({data:{id:b.id,fields:b.fields,relationTo:b.relationTo,value:b.value}}),{focus:k}=g,y=k.getNode();Yr(C),Qr(y)&&!y.__first&&y.remove()}}),!0),Tx),r.registerCommand(Nx,b=>{if(!(b instanceof ClipboardEvent))return!1;let g=b.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{C.push({alt:"",file:k,formID:new qr.default().toHexString()})}),C.length?(r.update(()=>{let k=Ka()||Va();if(Ja(k))for(let y of C){let R=me({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:M}=k,L=M.getNode();Yr(R),Qr(L)&&!L.__first&&L.remove()}}),T({files:C}),!0):!1},za),r.registerCommand(Ex,b=>{if(!(b instanceof DragEvent))return!1;let g=b.dataTransfer;if(!g?.types?.length)return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{C.push({alt:"",file:k,formID:new qr.default().toHexString()})}),C.length?(b.preventDefault(),b.stopPropagation(),r.update(()=>{if(yx(b)){let k=Rx(b),y=kx();k!=null&&y.applyDOMRange(k),_x(y);for(let R of C){let M=me({data:{pending:{formID:R.formID,src:URL.createObjectURL(R.file)}}}),{focus:L}=y,w=L.getNode();Yr(M),Qr(w)&&!w.__first&&w.remove()}}}),T({files:C}),!0):!1},za))},e[14]=r,e[15]=T,e[16]=E):E=e[16];let S;e[17]!==r?(S=[r],e[17]=r,e[18]=S):S=e[18],Lx(E,S);let _;return e[19]!==s?(_=fx(Ga,{enabledCollectionSlugs:s}),e[19]=s,e[20]=_):_=e[20],_};function Ix(t){return{file:t.file,formID:t.formID}}function vx(){for(let t of Za()){let e=t.node;st(e)&&e.getData()?.pending&&e.remove()}}function Mx(t){return[t.formID,t]}var $x=$({nodes:[de],plugins:[{Component:Ya,position:"normal"}],slashMenu:{groups:[Y([{Icon:zr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:zr,isActive:({selection:t})=>{if(!Dx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return st(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as Ox}from"react/compiler-runtime";import{jsx as Io}from"react/jsx-runtime";import{createElement as Fx}from"react";import{ShimmerEffect as Px,useConfig as Bx}from"@payloadcms/ui";import{lazy as jx,Suspense as Hx,useEffect as Ux,useState as Wx}from"react";var qa={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 en={namespace:"lexical",theme:qa};function Qa({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let i=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.");i.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let s=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:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,s.set(c.clientFeatureProps.featureKey,u),d++}return s}import{deepMerge as Ax}from"payload/shared";var ec=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Ax(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 tn(t,e,o,r){return{admin:o,features:ec(t),lexical:e,resolvedFeatureMap:t,view:r}}var Gx=jx(()=>import("./Field-CFLUGR3C.js").then(t=>({default:t.RichText}))),Vx=t=>Io(Fo,{views:t.views,children:Io(Kx,{...t})}),Kx=t=>{let e=Ox(19),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==n?(m=n===void 0?{}:n,e[2]=n,e[3]=m):m=e[3];let p=m,f=s===void 0?en:s,{currentView:h}=Po(),x=c?.[h]?.admin??a,T=c?.[h]?.lexical??f,{config:E}=Bx(),[S,_]=Wx(null),b,g;e[4]!==r||e[5]!==E||e[6]!==h||e[7]!==x||e[8]!==T||e[9]!==p||e[10]!==l||e[11]!==i||e[12]!==S||e[13]!==d?(b=()=>{if(S&&S.view===h)return;let k=[];for(let R of Object.values(r))R.clientFeatureProvider&&k.push(R.clientFeatureProvider(R.clientFeatureProps));let y=Qa({config:E,featureClientImportMap:p,featureClientSchemaMap:l,field:i,schemaPath:d??i.name,unSanitizedEditorConfig:{features:k,lexical:T}});_(tn(y,T,x,h))},g=[x,r,E,p,l,i,S,T,d,h],e[4]=r,e[5]=E,e[6]=h,e[7]=x,e[8]=T,e[9]=p,e[10]=l,e[11]=i,e[12]=S,e[13]=d,e[14]=b,e[15]=g):(b=e[14],g=e[15]),Ux(b,g);let C;return e[16]!==S||e[17]!==t?(C=Io(Hx,{fallback:Io(Px,{height:"35vh"}),children:S&&Fx(Gx,{...t,editorConfig:S,key:S.view})}),e[16]=S,e[17]=t,e[18]=C):C=e[18],C};function Jx(t){return t instanceof HTMLElement}function zx(...t){return t.filter(Boolean).join(" ")}var vo=new WeakMap;function tc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mo(t,e){let o=vo.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=tc(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let d=tc(i);for(let c of r)d!==null&&c([d[0]-s[0],d[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},vo.set(t,o)}return o.listeners.add(e),()=>{Xx(t,e)}}function Xx(t,e){let o=vo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(vo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Zx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Yx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function qx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Qx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as eC}from"react/compiler-runtime";import{jsx as tC}from"react/jsx-runtime";import"react";var oC=()=>{let t=eC(2),{EditButton:e}=he(),o;return t[0]!==e?(o=e?tC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as rC}from"react/compiler-runtime";import{jsx as nC}from"react/jsx-runtime";import"react";var lC=()=>{let t=rC(2),{RemoveButton:e}=he(),o;return t[0]!==e?(o=e?nC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as iC}from"react/compiler-runtime";import{jsx as sC}from"react/jsx-runtime";import"react";var aC=()=>{let t=iC(2),{Label:e}=he(),o;return t[0]!==e?(o=e?sC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as cC}from"react/compiler-runtime";import{jsx as uC}from"react/jsx-runtime";import"react";var dC=t=>{let e=cC(3),{children:o}=t,{InlineBlockContainer:r}=he(),n;return e[0]!==r||e[1]!==o?(n=r?uC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as mC}from"react/jsx-runtime";import"react";var pC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=ge();return r?mC(r,{...o,children:e}):null};import{c as fC}from"react/compiler-runtime";import{jsx as hC}from"react/jsx-runtime";import"react";var gC=()=>{let t=fC(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?hC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as xC}from"react/compiler-runtime";import{jsx as CC}from"react/jsx-runtime";import"react";var bC=()=>{let t=xC(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?CC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as kC}from"qs-esm";var _C=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let d=kC({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var oc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
60
+ `);let o=ih(To.NO_STATUS);return Wt(t,e,o),o},ta=(t,e)=>{let o=t.match(oa);return!o||!o[1]?null:o[1].split("|").map(r=>na(r,e))};import{c as xh}from"react/compiler-runtime";import{jsx as P,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as ca}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ch}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ia,$deleteTableColumnAtSelection as bh,$deleteTableRowAtSelection as kh,$getNodeTriplet as _h,$getTableCellNodeFromLexicalNode as sa,$getTableColumnIndexFromTableCellNode as Th,$getTableNodeFromLexicalNodeOrThrow as ve,$getTableRowIndexFromTableCellNode as wh,$insertTableColumnAtSelection as Eh,$insertTableRowAtSelection as Sh,$isTableCellNode as ua,$isTableSelection as At,$mergeCells as Nh,$unmergeCell as Lh,getTableElement as Pr,getTableObserverFromTableElement as Br,TableCellHeaderStates as Ie,TableCellNode as yh}from"@lexical/table";import{mergeRegister as Rh}from"@lexical/utils";import{useScrollInfo as Ih}from"@payloadcms/ui";import{$getSelection as Eo,$isElementNode as vh,$isRangeSelection as jr,$isTextNode as Mh,$setSelection as Dh,COMMAND_PRIORITY_CRITICAL as $h,getDOMSelection as Ah,isDOMNode as Oh,SELECTION_CHANGE_COMMAND as Fh}from"lexical";import*as Hr from"react";import{useCallback as ae,useEffect as nt,useRef as wo,useState as lt}from"react";import{createPortal as da}from"react-dom";import{jsx as Fr,jsxs as gh}from"react/jsx-runtime";import"react";var la=()=>gh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Fr("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"}),Fr("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"}),Fr("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 aa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Ph(){let t=Eo();if(jr(t)&&!t.isCollapsed()||At(t)&&!t.anchor.is(t.focus)||!jr(t)&&!At(t))return!1;let[e]=_h(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Bh(t){let e=t.getLastDescendant();Mh(e)?e.select():vh(e)?e.selectEnd():e!==null&&e.selectNext()}function jh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=ca(),i=wo(null),[s,d]=lt(n),[c,u]=lt({columns:1,rows:1}),[a,m]=lt(!1),[p,f]=lt(!1),{y:h}=Ih();nt(()=>l.registerMutationListener(yh,w=>{w.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{d(s.getLatest())})},{skipInitialization:!0}),[l,s]),nt(()=>{l.getEditorState().read(()=>{let w=Eo();if(At(w)){let N=aa(w);u(aa(w)),m(N.columns>1||N.rows>1)}f(Ph())})},[l]),nt(()=>{let w=e.current,N=i.current,I=l.getRootElement();if(w!=null&&N!=null&&I!=null){let A=I.getBoundingClientRect(),v=w.getBoundingClientRect();N.style.opacity="1";let O=N.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}N.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}N.style.top=`${q}px`}},[e,i,l,h]),nt(()=>{function w(N){i.current!=null&&e.current!=null&&Oh(N.target)&&!i.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let x=ae(()=>{l.update(()=>{if(s.isAttached()){let w=ve(s),N=Pr(w,l.getElementByKey(w.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let I=Br(N);I!==null&&I.$clearHighlight(),w.markDirty(),d(s.getLatest())}Dh(null)})},[l,s]),T=()=>{l.update(()=>{let w=Eo();if(!At(w))return;let I=w.getNodes().filter(ua),A=Nh(I);A&&(Bh(A),o())})},E=()=>{l.update(()=>{Lh()})},S=ae(w=>{l.update(()=>{for(let N=0;N<c.rows;N++)Sh(w);o()})},[l,o,c.rows]),_=ae(w=>{l.update(()=>{for(let N=0;N<c.columns;N++)Eh(w);o()})},[l,o,c.columns]),b=ae(()=>{l.update(()=>{kh(),o()})},[l,o]),g=ae(()=>{l.update(()=>{ve(s).remove(),x(),o()})},[l,s,x,o]),C=ae(()=>{l.update(()=>{bh(),o()})},[l,o]),k=ae(()=>{l.update(()=>{let w=ve(s),N=wh(s),[I]=ia(w,null,null),A=new Set,v=s.getHeaderStyles()^Ie.ROW;if(I[N])for(let O=0;O<I[N].length;O++){let D=I[N][O];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Ie.ROW)))}x(),o()})},[l,s,x,o]),y=ae(()=>{l.update(()=>{let w=ve(s),N=Th(s),[I]=ia(w,null,null),A=new Set,v=s.getHeaderStyles()^Ie.COLUMN;if(I)for(let O=0;O<I.length;O++){let D=I?.[O]?.[N];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Ie.COLUMN)))}x(),o()})},[l,s,x,o]),R=ae(()=>{l.update(()=>{if(s.isAttached()){let w=ve(s);w&&w.setRowStriping(!w.getRowStriping())}x(),o()})},[l,s,x,o]),M=ae(()=>{l.update(()=>{if(s.isAttached()){let w=ve(s);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),L=null;return t&&(a?L=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),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"})}))),da(Se("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:i,children:[L?Se(Hr.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:()=>S(!1),type:"button",children:Se("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:()=>S(!0),type:"button",children:Se("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:Se("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:Se("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:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),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:Se("span",{className:"text",children:[(s.__headerState&Ie.ROW)===Ie.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&Ie.COLUMN)===Ie.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Hh({anchorElem:t,cellMerge:e}){let[o]=ca(),r=wo(null),n=wo(null),[l,i]=lt(!1),[s,d]=lt(null),c=ae(()=>{let a=r.current,m=Eo(),p=Ah(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(),T=null,E=null;if(jr(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=sa(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return h();let b=ve(_),g=Pr(b,o.getElementByKey(b.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Br(g),d(_)}else if(At(m)){let _=sa(m.anchor.getNode());if(!ua(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=ve(_),g=Pr(b,o.getElementByKey(b.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");T=Br(g),E=o.getElementByKey(_.getKey())}else if(!f)return h();if(T===null||E===null)return h();let S=!T||!T.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let _=E.getBoundingClientRect(),b=t.getBoundingClientRect(),g=_.top-b.top,C=_.right-b.left;a.style.transform=`translate(${C}px, ${g}px)`}},[o,t]);nt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Rh(o.registerUpdateListener(p),o.registerCommand(Fh,p,$h),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=wo(s);return nt(()=>{u.current!==s&&i(!1),u.current=s},[u,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Se(Hr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(la,{})}),l&&P(jh,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var ma=t=>{let e=xh(3),{anchorElem:o}=t,r=Ch(),n;return e[0]!==o||e[1]!==r?(n=da(r?P(Hh,{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 Uh}from"react/compiler-runtime";import{jsx as No,jsxs as Wh}from"react/jsx-runtime";import{useLexicalComposerContext as Gh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Vh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Kh,$getTableNodeFromLexicalNodeOrThrow as Ur,$getTableRowIndexFromTableCellNode as Jh,$isTableCellNode as pa,$isTableRowNode as zh,getDOMCellFromTarget as Xh,getTableElement as Zh,TableNode as fa}from"@lexical/table";import{calculateZoomLevel as ha,mergeRegister as Yh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Wr,isHTMLElement as qh,SKIP_SCROLL_INTO_VIEW_TAG as ga}from"lexical";import*as Ca from"react";import{useCallback as Ot,useEffect as Gr,useRef as So,useState as it}from"react";import{createPortal as Qh}from"react-dom";var eg=33,xa=92;function tg({editor:t}){let e=So(null),o=So(null),r=So(null),[n,l]=it(!1),i=H(),s=So(null),[d,c]=it(null),[u,a]=it(null),[m,p]=it(!1),[f,h]=it(null),x=Ot(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),T=M=>(M.buttons&1)===1;Gr(()=>{let M=new Set;return Yh(t.registerMutationListener(fa,L=>{for(let[w,N]of L)N==="destroyed"?M.delete(w):M.add(w);l(M.size>0)}),t.registerNodeTransform(fa,L=>{if(L.getColWidths())return L;let w=L.getColumnCount(),N=xa;return L.setColWidths(Array(w).fill(N)),L}))},[t]),Gr(()=>{if(!n)return;let M=I=>{let A=I.target;if(qh(A)){if(f){c({x:I.clientX,y:I.clientY});return}if(p(T(I)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let v=Xh(A);v&&u!==v?t.getEditorState().read(()=>{let O=Wr(v.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let D=Ur(O),G=Zh(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)},w=I=>{p(!1)},N=t.registerRootListener((I,A)=>{A?.removeEventListener("mousemove",M),A?.removeEventListener("mousedown",L),A?.removeEventListener("mouseup",w),I?.addEventListener("mousemove",M),I?.addEventListener("mousedown",L),I?.addEventListener("mouseup",w)});return()=>{N()}},[u,f,t,n,x]);let E=M=>M==="bottom",S=Ot(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Wr(u.elem);if(!pa(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Ur(L),N=Jh(L),I=w.getChildren(),v=L.getColSpan()===w.getColumnCount()?N:N+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(!zh(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,eg);O.setHeight(G)},{tag:ga})},[u,t]),_=(M,L)=>L.getElementByKey(M.getKey())?.clientHeight,b=(M,L)=>{let w;return L.forEach(N=>{N.forEach((I,A)=>{I.cell===M&&(w=A)})}),w},g=Ot(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Wr(u.elem);if(!pa(L))throw new Error("TableCellResizer: Table cell node not found.");let w=Ur(L),[N]=Kh(w,null,null),I=b(L,N);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let A=w.getColWidths();if(!A)return;let v=A[I];if(v===void 0)return;let O=[...A],D=Math.max(v+M,xa);O[I]=D,w.setColWidths(O)},{tag:ga})},[u,t]),C=Ot(M=>{let L=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y:I}=s.current;if(u===null)return;let A=ha(w.target);if(E(M)){let v=(w.clientY-I)/A;S(v)}else{let v=(w.clientX-N)/A;g(v)}x(),document.removeEventListener("mouseup",L)}};return L},[u,x,g,S]),k=Ot(M=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");s.current={x:L.clientX,y:L.clientY},c(s.current),h(M),document.addEventListener("mouseup",C(M))},[u,C]),[y,R]=it({bottom:null,left:null,right:null,top:null});return Gr(()=>{if(u){let{height:M,left:L,top:w,width:N}=u.elem.getBoundingClientRect(),I=ha(u.elem),A=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${A}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+w+M-A/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${M}px`,left:`${window.scrollX+L+N-A/2}px`,top:`${window.scrollY+w}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]),No("div",{ref:o,children:u!=null&&!m&&Wh(Ca.Fragment,{children:[No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("right"),style:y.right||void 0}),No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("bottom"),style:y.bottom||void 0})]})})}var ba=()=>{let t=Uh(3),[e]=Gh(),o=Vh(),r;return t[0]!==e||t[1]!==o?(r=o?Qh(No(tg,{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 Vr,jsxs as ug,Fragment as dg}from"react/jsx-runtime";import{useLexicalComposerContext as mg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as La}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as pg,$getTableColumnIndexFromTableCellNode as fg,$getTableRowIndexFromTableCellNode as hg,$insertTableColumnAtSelection as gg,$insertTableRowAtSelection as xg,$isTableCellNode as Cg,$isTableNode as Ta,getTableElement as bg,TableNode as kg}from"@lexical/table";import{$findMatchingParent as _g,mergeRegister as Tg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as wa,isHTMLElement as wg}from"lexical";import{useEffect as Ea,useMemo as Eg,useRef as Sa,useState as Lo}from"react";import"react";import{createPortal as Sg}from"react-dom";import{c as ig}from"react/compiler-runtime";import{useEffect as sg,useRef as ag}from"react";var og="Expected a function",rg=Math.max,ng=Math.min;function lg(t,e,o){let r,n,l=0,i,s=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(og);e=e||0,typeof o=="object"&&(s=!!o.leading,d="maxWait"in o,c=d?rg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let C=r,k=i;return r=i=void 0,l=g,u=t.apply(k,C),u}function f(g){return l=g,a=setTimeout(T,e),s?p(g):u}function h(g){let C=g-n,k=g-l,y=e-C;return d?ng(y,c-k):y}function x(g){let C=g-n,k=g-l;return n===void 0||C>=e||C<0||d&&k>=c}function T(){let g=Date.now();if(x(g))return E(g);a=setTimeout(T,h(g))}function E(g){return a=void 0,m&&r?p(g):(r=i=void 0,u)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function _(){return a===void 0?u:E(Date.now())}function b(){let g=Date.now(),C=x(g);if(r=arguments,i=this,n=g,C){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(T,e),p(n)}return a===void 0&&(a=setTimeout(T,e)),u}return b.cancel=S,b.flush=_,b}var ka=lg;function _a(t,e,o){let r=ig(6),n=ag(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ka(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),sg(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=s):s=r[5],s}var Na=20;function Ng({anchorElem:t}){let[e]=mg(),o=La(),r=H(),[n,l]=Lo(!1),[i,s]=Lo(!1),[d,c]=Lo(!1),[u,a]=Lo({}),m=Sa(new Set),p=Sa(null),f=_a(T=>{let{isOutside:E,tableDOMNode:S}=Lg(T,r.editorConfig?.lexical);if(E){l(!1),s(!1);return}if(!S)return;p.current=S;let _=null,b=null,g=null;if(e.getEditorState().read(()=>{let v=wa(S);if(Cg(v)){let O=_g(v,D=>Ta(D));if(!Ta(O))return;if(g=bg(O,e.getElementByKey(O.getKey())),g){let D=O.getChildrenSize(),G=O.getChildAtIndex(0)?.getChildrenSize(),q=hg(v),z=fg(v);q===D-1?_=v:z===G-1&&(b=v)}}},{editor:e}),!g)return;let C=g.parentElement;if(!C)return;let{bottom:k,height:y,left:R,right:M,width:L,y:w}=g.getBoundingClientRect(),N=!1;C&&C.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(N=C.scrollWidth>C.clientWidth);let{left:I,y:A}=t.getBoundingClientRect();_?(s(!1),l(!0),a({height:Na,left:N&&C?C.offsetLeft:R-I,top:k-A+5,width:N&&C?C.offsetWidth:L})):b&&(s(!0),l(!1),a({height:y,left:M-I+5,top:w-A,width:Na}))},50,250),h=Eg(()=>new ResizeObserver(()=>{l(!1),s(!1)}),[]);Ea(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),s(!1),document.removeEventListener("mousemove",f)}},[d,f]),Ea(()=>Tg(e.registerMutationListener(kg,T=>{e.getEditorState().read(()=>{let E=!1;for(let[S,_]of T)switch(_){case"created":{m.current.add(S),E=!0;break}case"destroyed":{m.current.delete(S),E=!0;break}default:break}if(E){h.disconnect();for(let S of m.current){let{tableElement:_}=pg(S);h.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=T=>{e.update(()=>{p.current&&(wa(p.current)?.selectEnd(),T?(xg(),l(!1)):(gg(),s(!1)))})};return o?ug(dg,{children:[n&&Vr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),i&&Vr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function Lg(t,e){let o=t.target;if(wg(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 ya(t){let e=cg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!La())return null;let l;return e[0]!==r?(l=Sg(Vr(Ng,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as yg}from"react/compiler-runtime";import{jsx as Kr,jsxs as Rg}from"react/jsx-runtime";import{useLexicalComposerContext as Ig}from"@lexical/react/LexicalComposerContext";import{TablePlugin as vg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Mg,TableCellNode as Dg,TableNode as $g,TableRowNode as Ag}from"@lexical/table";import{mergeRegister as Og}from"@lexical/utils";import{formatDrawerSlug as Fg,useEditDepth as Pg}from"@payloadcms/ui";import{$getSelection as Bg,$isRangeSelection as jg,COMMAND_PRIORITY_EDITOR as Hg,createCommand as Ug}from"lexical";import{createContext as Wg,use as Gg,useEffect as Vg,useMemo as Kg,useState as Jg}from"react";import*as Ra from"react";var yo=Ug("OPEN_EMBED_DRAWER_COMMAND"),Ia=Wg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function va({children:t}){let[e,o]=Jg({cellEditorConfig:null,cellEditorPlugins:null});return Kr(Ia,{value:Kg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ma=()=>{let t=yg(16),[e]=Ig(),o=Gg(Ia),r=Pg(),{fieldProps:n,uuid:l}=H(),{schemaPath:i}=n,s="lexical-table-create-"+l,d;t[0]!==r||t[1]!==s?(d=Fg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=fe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([$g,Ag,Dg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Og(e.registerCommand(yo,()=>{let h=null;return e.getEditorState().read(()=>{let x=Bg();jg(x)&&(h=x)}),h&&u(),!0},Hg))},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],Vg(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(Mg,{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]!==i||t[14]!==p?(f=Rg(Ra.Fragment,{children:[Kr(mt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Kr(vg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var Yg=$({markdownTransformers:[ra],nodes:[Xg,zg,Zg],plugins:[{Component:Ma,position:"normal"},{Component:ba,position:"normal"},{Component:ma,position:"floatingAnchorElem"},{Component:ya,position:"floatingAnchorElem"}],providers:[va],slashMenu:{groups:[Z([{Icon:$r,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:$r,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]}});import{$isNodeSelection as Dx}from"lexical";import{jsx as Jr,jsxs as qg}from"react/jsx-runtime";import"react";var zr=()=>qg("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Jr("path",{d:"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"}),Jr("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"}),Jr("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 Fa}from"react/jsx-runtime";import Pa from"bson-objectid";import{$applyNodeReplacement as nx}from"lexical";import*as Ba from"react";import Qg from"bson-objectid";function Ro(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 Qg.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as ex}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as tx}from"@lexical/utils";import $a from"bson-objectid";import{$applyNodeReplacement as ox}from"lexical";var Ft=class extends ex{__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=>Ro(o,Da),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new $a.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Da({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return tx(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 Da({data:t}){return t?.id||(t.id=new $a.default().toHexString()),ox(new Ft({data:t}))}import{jsx as Aa}from"react/jsx-runtime";import{ShimmerEffect as rx}from"@payloadcms/ui";var Oa=()=>Aa("div",{className:"lexical-upload",children:Aa(rx,{height:"95px",width:"203px"})});var lx=Ba.lazy(()=>import("./component-5YLBQB5B.js").then(t=>({default:t.UploadComponent}))),de=class extends Ft{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Ro(o,me),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Pa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=me({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?Fa(Oa,{}):Fa(lx,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function me({data:t}){return t?.id||(t.id=new Pa.default().toHexString()),nx(new de({data:t}))}function st(t){return t instanceof de}import{c as px}from"react/compiler-runtime";import{jsx as fx}from"react/jsx-runtime";import{useLexicalComposerContext as hx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Za,$insertNodeToNearestRoot as Yr,mergeRegister as gx}from"@lexical/utils";import{useBulkUpload as xx,useEffectEvent as Cx,useModal as bx}from"@payloadcms/ui";import qr from"bson-objectid";import{$createRangeSelection as kx,$getPreviousSelection as Va,$getSelection as Ka,$isParagraphNode as Qr,$isRangeSelection as Ja,$setSelection as _x,COMMAND_PRIORITY_EDITOR as Tx,COMMAND_PRIORITY_LOW as za,createCommand as wx,DROP_COMMAND as Ex,getDOMSelectionFromTarget as Sx,isHTMLElement as Xa,PASTE_COMMAND as Nx}from"lexical";import{useEffect as Lx}from"react";import{c as ja}from"react/compiler-runtime";import{jsx as Xr}from"react/jsx-runtime";import{useLexicalComposerContext as Ha}from"@lexical/react/LexicalComposerContext.js";import{toast as ix}from"@payloadcms/ui";import{$getNodeByKey as sx,COMMAND_PRIORITY_EDITOR as Ua}from"lexical";import{useEffect as Wa,useState as ax}from"react";var cx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=sx(o);n&&n.replace(me({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Zr,{fields:null,relationTo:e,value:r})},ux=t=>{let e=ja(13),{enabledCollectionSlugs:o}=t,[r]=Ha(),[n,l]=ax(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:d,openListDrawer:c}=Mt(i),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Ua),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Wa(u,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:T}=h;s(),cx({editor:r,relationTo:x,replaceNodeKey:n,value:T.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==d||e[11]!==p?(f=Xr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},dx=()=>{let t=ja(3),[e]=Ha(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,mx,Ua),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Wa(o,r),null},Ga=({enabledCollectionSlugs:t})=>t?.length?Xr(ux,{enabledCollectionSlugs:t}):Xr(dx,{});function mx(){return ix.error("No upload collections enabled"),!0}function yx(t){let e=t.target;return!!(Xa(e)&&!e.closest("code, span.editor-image")&&Xa(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Rx(t){let e,o=Sx(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 Zr=wx("INSERT_UPLOAD_COMMAND"),Ya=t=>{let e=px(21),{clientProps:o}=t,[r]=hx(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=go(i),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=xx(),{isModalOpen:f,openModal:h}=bx(),x;e[3]!==d||e[4]!==r||e[5]!==s||e[6]!==f||e[7]!==h||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(x=b=>{let{files:g}=b;if(g?.length!==0&&(u(C=>[...C??[],...g.map(Ix)]),!f(d))){if(!s.length||!s[0])return;c(s[0]),p(s),a(()=>{r.update(vx)}),m(C=>{let k=new Map(C.map(Mx));r.update(()=>{for(let y of Za()){let R=y.node;if(st(R)){let M=R.getData();if(M?.pending){let L=k.get(M.pending?.formID);L&&R.replace(me({data:{id:new qr.default().toHexString(),fields:{},relationTo:L.collectionSlug,value:L.doc.id}}))}}}})}),h(d)}},e[3]=d,e[4]=r,e[5]=s,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 T=Cx(x),E;e[14]!==r||e[15]!==T?(E=()=>{if(!r.hasNodes([de]))throw new Error("UploadPlugin: UploadNode not registered on editor");return gx(r.registerNodeTransform(de,b=>{let g=b.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,/),w=L?L[1]:"image/png",N=R.replace(/^data:image\/[a-zA-Z]+;base64,/,""),I=atob(N),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."+w?.split("/",2)[1],{type:w}),formID:M}}else if(R?.startsWith("http")||R?.startsWith("https")){let w=await(await fetch(R)).blob(),N=R.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];y={alt:void 0,file:new File([w],N,{type:w.type}),formID:M}}y&&T({files:[y]})})()}),r.registerCommand(Zr,b=>(r.update(()=>{let g=Ka()||Va();if(Ja(g)){let C=me({data:{id:b.id,fields:b.fields,relationTo:b.relationTo,value:b.value}}),{focus:k}=g,y=k.getNode();Yr(C),Qr(y)&&!y.__first&&y.remove()}}),!0),Tx),r.registerCommand(Nx,b=>{if(!(b instanceof ClipboardEvent))return!1;let g=b.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{C.push({alt:"",file:k,formID:new qr.default().toHexString()})}),C.length?(r.update(()=>{let k=Ka()||Va();if(Ja(k))for(let y of C){let R=me({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:M}=k,L=M.getNode();Yr(R),Qr(L)&&!L.__first&&L.remove()}}),T({files:C}),!0):!1},za),r.registerCommand(Ex,b=>{if(!(b instanceof DragEvent))return!1;let g=b.dataTransfer;if(!g?.types?.length)return!1;let C=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{C.push({alt:"",file:k,formID:new qr.default().toHexString()})}),C.length?(b.preventDefault(),b.stopPropagation(),r.update(()=>{if(yx(b)){let k=Rx(b),y=kx();k!=null&&y.applyDOMRange(k),_x(y);for(let R of C){let M=me({data:{pending:{formID:R.formID,src:URL.createObjectURL(R.file)}}}),{focus:L}=y,w=L.getNode();Yr(M),Qr(w)&&!w.__first&&w.remove()}}}),T({files:C}),!0):!1},za))},e[14]=r,e[15]=T,e[16]=E):E=e[16];let S;e[17]!==r?(S=[r],e[17]=r,e[18]=S):S=e[18],Lx(E,S);let _;return e[19]!==s?(_=fx(Ga,{enabledCollectionSlugs:s}),e[19]=s,e[20]=_):_=e[20],_};function Ix(t){return{file:t.file,formID:t.formID}}function vx(){for(let t of Za()){let e=t.node;st(e)&&e.getData()?.pending&&e.remove()}}function Mx(t){return[t.formID,t]}var $x=$({nodes:[de],plugins:[{Component:Ya,position:"normal"}],slashMenu:{groups:[Z([{Icon:zr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:zr,isActive:({selection:t})=>{if(!Dx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return st(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as Ox}from"react/compiler-runtime";import{jsx as Io}from"react/jsx-runtime";import{createElement as Fx}from"react";import{ShimmerEffect as Px,useConfig as Bx}from"@payloadcms/ui";import{lazy as jx,Suspense as Hx,useEffect as Ux,useState as Wx}from"react";var qa={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 en={namespace:"lexical",theme:qa};function Qa({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let i=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.");i.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let s=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:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,s.set(c.clientFeatureProps.featureKey,u),d++}return s}import{deepMerge as Ax}from"payload/shared";var ec=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Ax(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 tn(t,e,o,r){return{admin:o,features:ec(t),lexical:e,resolvedFeatureMap:t,view:r}}var Gx=jx(()=>import("./Field-CFLUGR3C.js").then(t=>({default:t.RichText}))),Vx=t=>Io(Fo,{views:t.views,children:Io(Kx,{...t})}),Kx=t=>{let e=Ox(19),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==n?(m=n===void 0?{}:n,e[2]=n,e[3]=m):m=e[3];let p=m,f=s===void 0?en:s,{currentView:h}=Po(),x=c?.[h]?.admin??a,T=c?.[h]?.lexical??f,{config:E}=Bx(),[S,_]=Wx(null),b,g;e[4]!==r||e[5]!==E||e[6]!==h||e[7]!==x||e[8]!==T||e[9]!==p||e[10]!==l||e[11]!==i||e[12]!==S||e[13]!==d?(b=()=>{if(S&&S.view===h)return;let k=[];for(let R of Object.values(r))R.clientFeatureProvider&&k.push(R.clientFeatureProvider(R.clientFeatureProps));let y=Qa({config:E,featureClientImportMap:p,featureClientSchemaMap:l,field:i,schemaPath:d??i.name,unSanitizedEditorConfig:{features:k,lexical:T}});_(tn(y,T,x,h))},g=[x,r,E,p,l,i,S,T,d,h],e[4]=r,e[5]=E,e[6]=h,e[7]=x,e[8]=T,e[9]=p,e[10]=l,e[11]=i,e[12]=S,e[13]=d,e[14]=b,e[15]=g):(b=e[14],g=e[15]),Ux(b,g);let C;return e[16]!==S||e[17]!==t?(C=Io(Hx,{fallback:Io(Px,{height:"35vh"}),children:S&&Fx(Gx,{...t,editorConfig:S,key:S.view})}),e[16]=S,e[17]=t,e[18]=C):C=e[18],C};function Jx(t){return t instanceof HTMLElement}function zx(...t){return t.filter(Boolean).join(" ")}var vo=new WeakMap;function tc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mo(t,e){let o=vo.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=tc(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let d=tc(i);for(let c of r)d!==null&&c([d[0]-s[0],d[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},vo.set(t,o)}return o.listeners.add(e),()=>{Xx(t,e)}}function Xx(t,e){let o=vo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(vo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Zx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Yx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function qx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Qx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as eC}from"react/compiler-runtime";import{jsx as tC}from"react/jsx-runtime";import"react";var oC=()=>{let t=eC(2),{EditButton:e}=he(),o;return t[0]!==e?(o=e?tC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as rC}from"react/compiler-runtime";import{jsx as nC}from"react/jsx-runtime";import"react";var lC=()=>{let t=rC(2),{RemoveButton:e}=he(),o;return t[0]!==e?(o=e?nC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as iC}from"react/compiler-runtime";import{jsx as sC}from"react/jsx-runtime";import"react";var aC=()=>{let t=iC(2),{Label:e}=he(),o;return t[0]!==e?(o=e?sC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as cC}from"react/compiler-runtime";import{jsx as uC}from"react/jsx-runtime";import"react";var dC=t=>{let e=cC(3),{children:o}=t,{InlineBlockContainer:r}=he(),n;return e[0]!==r||e[1]!==o?(n=r?uC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as mC}from"react/jsx-runtime";import"react";var pC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=ge();return r?mC(r,{...o,children:e}):null};import{c as fC}from"react/compiler-runtime";import{jsx as hC}from"react/jsx-runtime";import"react";var gC=()=>{let t=fC(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?hC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as xC}from"react/compiler-runtime";import{jsx as CC}from"react/jsx-runtime";import"react";var bC=()=>{let t=xC(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?CC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as kC}from"qs-esm";var _C=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let d=kC({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var oc={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 TC}from"react/jsx-runtime";import{CodeField as wC,useFormFields as EC}from"@payloadcms/ui";import{useId as SC,useMemo as NC}from"react";var Do={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 LC=({autoComplete:t,field:e,forceRender:o,languages:r=Do,path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,typescript:c,validate:u})=>{let a=EC(([T])=>T.language),m=a?.value||a?.initialValue||"typescript",p=SC(),f=r[m],h=NC(()=>({...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&&TC(wC,{autoComplete:t,field:h,forceRender:o,onMount:(T,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:i,renderedBlocks:s,schemaPath:d,validate:u},x)};import{jsx as re,jsxs as uc}from"react/jsx-runtime";import{useLexicalEditable as $C}from"@lexical/react/useLexicalEditable";import{ChevronIcon as AC,Combobox as OC,CopyToClipboard as FC,PopupList as PC,RenderFields as BC,useForm as jC,useFormFields as dc,useTranslation as HC}from"@payloadcms/ui";import UC from"react";import{jsx as rc}from"react/jsx-runtime";import"react";var nc=()=>rc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:rc("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 ic}from"react/jsx-runtime";import"react";import{useCollapsible as RC}from"@payloadcms/ui";import{jsx as lc}from"react/jsx-runtime";import"react";var $o=()=>lc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:lc("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 yC="code-block-collapse-button",sc=()=>{let{toggle:t}=RC();return ic("button",{className:yC,onClick:t,type:"button",children:ic($o,{})})};import{jsx as ac,jsxs as IC}from"react/jsx-runtime";import"react";import{useCollapsible as MC,useTranslation as DC}from"@payloadcms/ui";var vC="code-block-floating-collapse-button",cc=()=>{let{isCollapsed:t,toggle:e}=MC(),{t:o}=DC();return t?IC("button",{className:vC,onClick:e,type:"button",children:[ac("span",{children:o("general:collapse")}),ac($o,{})]}):null};var He="payload-richtext-code-block",WC=t=>{let{languages:e}=t,o=e||Do,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=ge(),{setModified:i}=jC(),{t:s}=HC(),{codeField:d}=dc(([f])=>({codeField:f?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=dc(([f,h])=>({selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),i(!0)}})),a=o[c?.value],m=$C(),p=UC.useMemo(()=>Object.entries(o).map(([f,h])=>({name:`${f} ${h}`,Component:re(PC.Button,{active:!1,disabled:!1,onClick:()=>{u(f)},children:re("span",{className:`${He}__language-code`,"data-language":f,children:h})})})),[o,u]);return re(r,{Actions:uc("div",{className:`${He}__actions`,children:[re(OC,{button:uc("div",{className:`${He}__language-selector-button`,"data-selected-language":c?.value,children:[re("span",{children:a}),re(AC,{className:`${He}__chevron`})]}),buttonType:"custom",className:`${He}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:s("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(FC,{value:d?.value??""}),re(sc,{}),m&&re(l,{})]}),className:He,collapsibleProps:{AfterCollapsible:re(cc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${He}__pill`,children:re(nc,{})}),children:re(BC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as GC}from"react/compiler-runtime";import{jsx as at}from"react/jsx-runtime";import{FieldContext as VC,FieldPathContext as mc,ServerFunctionsContext as pc,ShimmerEffect as KC,useServerFunctions as JC}from"@payloadcms/ui";import zC,{useEffect as XC,useRef as ZC}from"react";var YC=t=>{let e=GC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:d}=t,[c,u]=zC.useState(null),a=JC(),{_internal_renderField:m}=a,[p,f]=i.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]!==i?(x=()=>{(async function(){let{Field:y}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});u(y)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=x):x=e[5];let T=x,E=ZC(!1),S,_;if(e[6]!==T?(S=()=>{E.current||(E.current=!0,T())},_=[T],e[6]=T,e[7]=S,e[8]=_):(S=e[7],_=e[8]),XC(S,_),!c)return typeof n<"u"?n:at(KC,{});let b={...a,getFormState:async C=>a.getFormState({...C,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof d>"u"&&!s)return at(pc,{value:{...b},children:at(mc,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:h,setValue:s??qC,showError:!1,value:d};return at(pc,{value:{...b},children:at(mc,{value:h,children:at(VC,{value:g,children:c})},h)})};function qC(){}function fc({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 QC=fc;export{Tt as $createAutoLinkNode,De as $createBlockNode,Xe as $createHorizontalRuleNode,ut as $createInlineBlockNode,be as $createLinkNode,Be as $createRelationshipNode,me as $createUploadNode,_e as $isAutoLinkNode,Me as $isBlockNode,_t as $isHorizontalRuleNode,dt as $isInlineBlockNode,K as $isLinkNode,Lr as $isRelationshipNode,st as $isUploadNode,yc as AlignFeatureClient,ke as AutoLinkNode,pC as BlockCollapsible,gC as BlockEditButton,ie as BlockNode,bC as BlockRemoveButton,Dc as BlockquoteFeatureClient,Wu as BlocksFeatureClient,md as BoldFeatureClient,le as CAN_USE_DOM,xf as ChecklistFeatureClient,WC as CodeBlockBlockComponent,LC as CodeComponent,c0 as DETAIL_TYPE_TO_DETAIL,l0 as DOUBLE_LINE_BREAK,_0 as DebugJsxConverterFeatureClient,d0 as ELEMENT_FORMAT_TO_TYPE,u0 as ELEMENT_TYPE_TO_FORMAT,_c as ENABLE_SLASH_MENU_COMMAND,xc as EditorConfigProvider,mt as FieldsDrawer,J1 as FixedToolbarFeatureClient,sm as HeadingFeatureClient,Sm as HorizontalRuleFeatureClient,Ce as HorizontalRuleNode,Je as INSERT_BLOCK_COMMAND,ze as INSERT_INLINE_BLOCK_COMMAND,r0 as IS_ALL_FORMATTING,Hm as IndentFeatureClient,dC as InlineBlockContainer,oC as InlineBlockEditButton,aC as InlineBlockLabel,ct as InlineBlockNode,lC as InlineBlockRemoveButton,xd as InlineCodeFeatureClient,lh as InlineToolbarFeatureClient,_d as ItalicFeatureClient,s0 as LTR_REGEX,jf as LexicalPluginToLexicalFeatureClient,tf as LinkFeatureClient,oe as LinkNode,n0 as NON_BREAKING_SPACE,F as NodeFormat,Sf as OrderedListFeatureClient,Xf as ParagraphFeatureClient,bc as Point,i0 as RTL_REGEX,Tc as Rect,d1 as RelationshipFeatureClient,we as RelationshipNode,YC as RenderLexical,Vx as RichTextField,Fo as RichTextViewProvider,Jf as SlateToLexicalFeatureClient,Nd as StrikethroughFeatureClient,Id as SubscriptFeatureClient,$d as SuperscriptFeatureClient,m0 as TEXT_MODE_TO_TYPE,a0 as TEXT_TYPE_TO_FORMAT,p0 as TEXT_TYPE_TO_MODE,ce as TOGGLE_LINK_COMMAND,Yg as TableFeatureClient,rd as TestRecorderFeatureClient,Zd as TextStateFeatureClient,Dt as ToolbarButton,je as ToolbarDropdown,ad as TreeViewFeatureClient,Bd as UnderlineFeatureClient,Df as UnorderedListFeatureClient,$x as UploadFeatureClient,de as UploadNode,Qx as addSwipeDownListener,Zx as addSwipeLeftListener,Yx as addSwipeRightListener,qx as addSwipeUpListener,QC as buildDefaultEditorState,fc as buildEditorState,oc as codeConverterClient,rr as createBlockNode,$ as createClientFeature,T0 as defaultColors,en as defaultEditorLexicalConfig,Dr as getDOMRangeRect,wc as getEnabledNodes,_C as getRestPopulateFn,Ze as getSelectedNode,Jx as isHTMLElement,kc as isPoint,zx as joinClasses,tn as sanitizeClientEditorConfig,ec as sanitizeClientFeatures,bo as setFloatingElemPosition,mo as setFloatingElemPositionForLinkEditor,Y as slashMenuBasicGroupWithItems,xe as toolbarAddDropdownGroupWithItems,lr as toolbarFeatureButtonsGroupWithItems,q as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ge as useBlockComponentContext,H as useEditorConfigContext,he as useInlineBlockComponentContext,Cc as useLexicalDocumentDrawer,fe as useLexicalDrawer,Mt as useLexicalListDrawer,Po as useRichTextView};
65
+ `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as TC}from"react/jsx-runtime";import{CodeField as wC,useFormFields as EC}from"@payloadcms/ui";import{useId as SC,useMemo as NC}from"react";var Do={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 LC=({autoComplete:t,field:e,forceRender:o,languages:r=Do,path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,typescript:c,validate:u})=>{let a=EC(([T])=>T.language),m=a?.value||a?.initialValue||"typescript",p=SC(),f=r[m],h=NC(()=>({...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&&TC(wC,{autoComplete:t,field:h,forceRender:o,onMount:(T,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:i,renderedBlocks:s,schemaPath:d,validate:u},x)};import{jsx as re,jsxs as uc}from"react/jsx-runtime";import{useLexicalEditable as $C}from"@lexical/react/useLexicalEditable";import{ChevronIcon as AC,Combobox as OC,CopyToClipboard as FC,PopupList as PC,RenderFields as BC,useForm as jC,useFormFields as dc,useTranslation as HC}from"@payloadcms/ui";import UC from"react";import{jsx as rc}from"react/jsx-runtime";import"react";var nc=()=>rc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:rc("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 ic}from"react/jsx-runtime";import"react";import{useCollapsible as RC}from"@payloadcms/ui";import{jsx as lc}from"react/jsx-runtime";import"react";var $o=()=>lc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:lc("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 yC="code-block-collapse-button",sc=()=>{let{toggle:t}=RC();return ic("button",{className:yC,onClick:t,type:"button",children:ic($o,{})})};import{jsx as ac,jsxs as IC}from"react/jsx-runtime";import"react";import{useCollapsible as MC,useTranslation as DC}from"@payloadcms/ui";var vC="code-block-floating-collapse-button",cc=()=>{let{isCollapsed:t,toggle:e}=MC(),{t:o}=DC();return t?IC("button",{className:vC,onClick:e,type:"button",children:[ac("span",{children:o("general:collapse")}),ac($o,{})]}):null};var He="payload-richtext-code-block",WC=t=>{let{languages:e}=t,o=e||Do,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=ge(),{setModified:i}=jC(),{t:s}=HC(),{codeField:d}=dc(([f])=>({codeField:f?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=dc(([f,h])=>({selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),i(!0)}})),a=o[c?.value],m=$C(),p=UC.useMemo(()=>Object.entries(o).map(([f,h])=>({name:`${f} ${h}`,Component:re(PC.Button,{active:!1,disabled:!1,onClick:()=>{u(f)},children:re("span",{className:`${He}__language-code`,"data-language":f,children:h})})})),[o,u]);return re(r,{Actions:uc("div",{className:`${He}__actions`,children:[re(OC,{button:uc("div",{className:`${He}__language-selector-button`,"data-selected-language":c?.value,children:[re("span",{children:a}),re(AC,{className:`${He}__chevron`})]}),buttonType:"custom",className:`${He}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:s("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(FC,{value:d?.value??""}),re(sc,{}),m&&re(l,{})]}),className:He,collapsibleProps:{AfterCollapsible:re(cc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${He}__pill`,children:re(nc,{})}),children:re(BC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as GC}from"react/compiler-runtime";import{jsx as at}from"react/jsx-runtime";import{FieldContext as VC,FieldPathContext as mc,ServerFunctionsContext as pc,ShimmerEffect as KC,useServerFunctions as JC}from"@payloadcms/ui";import zC,{useEffect as XC,useRef as ZC}from"react";var YC=t=>{let e=GC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:d}=t,[c,u]=zC.useState(null),a=JC(),{_internal_renderField:m}=a,[p,f]=i.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]!==i?(x=()=>{(async function(){let{Field:y}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});u(y)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=x):x=e[5];let T=x,E=ZC(!1),S,_;if(e[6]!==T?(S=()=>{E.current||(E.current=!0,T())},_=[T],e[6]=T,e[7]=S,e[8]=_):(S=e[7],_=e[8]),XC(S,_),!c)return typeof n<"u"?n:at(KC,{});let b={...a,getFormState:async C=>a.getFormState({...C,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof d>"u"&&!s)return at(pc,{value:{...b},children:at(mc,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:h,setValue:s??qC,showError:!1,value:d};return at(pc,{value:{...b},children:at(mc,{value:h,children:at(VC,{value:g,children:c})},h)})};function qC(){}function fc({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 QC=fc;export{Tt as $createAutoLinkNode,De as $createBlockNode,Xe as $createHorizontalRuleNode,ut as $createInlineBlockNode,be as $createLinkNode,Be as $createRelationshipNode,me as $createUploadNode,_e as $isAutoLinkNode,Me as $isBlockNode,_t as $isHorizontalRuleNode,dt as $isInlineBlockNode,J as $isLinkNode,Lr as $isRelationshipNode,st as $isUploadNode,yc as AlignFeatureClient,ke as AutoLinkNode,pC as BlockCollapsible,gC as BlockEditButton,ie as BlockNode,bC as BlockRemoveButton,Dc as BlockquoteFeatureClient,Wu as BlocksFeatureClient,md as BoldFeatureClient,le as CAN_USE_DOM,xf as ChecklistFeatureClient,WC as CodeBlockBlockComponent,LC as CodeComponent,c0 as DETAIL_TYPE_TO_DETAIL,l0 as DOUBLE_LINE_BREAK,_0 as DebugJsxConverterFeatureClient,d0 as ELEMENT_FORMAT_TO_TYPE,u0 as ELEMENT_TYPE_TO_FORMAT,_c as ENABLE_SLASH_MENU_COMMAND,xc as EditorConfigProvider,mt as FieldsDrawer,J1 as FixedToolbarFeatureClient,sm as HeadingFeatureClient,Sm as HorizontalRuleFeatureClient,Ce as HorizontalRuleNode,Je as INSERT_BLOCK_COMMAND,ze as INSERT_INLINE_BLOCK_COMMAND,r0 as IS_ALL_FORMATTING,Hm as IndentFeatureClient,dC as InlineBlockContainer,oC as InlineBlockEditButton,aC as InlineBlockLabel,ct as InlineBlockNode,lC as InlineBlockRemoveButton,xd as InlineCodeFeatureClient,lh as InlineToolbarFeatureClient,_d as ItalicFeatureClient,s0 as LTR_REGEX,jf as LexicalPluginToLexicalFeatureClient,tf as LinkFeatureClient,oe as LinkNode,n0 as NON_BREAKING_SPACE,F as NodeFormat,Sf as OrderedListFeatureClient,Xf as ParagraphFeatureClient,bc as Point,i0 as RTL_REGEX,Tc as Rect,d1 as RelationshipFeatureClient,we as RelationshipNode,YC as RenderLexical,Vx as RichTextField,Fo as RichTextViewProvider,Jf as SlateToLexicalFeatureClient,Nd as StrikethroughFeatureClient,Id as SubscriptFeatureClient,$d as SuperscriptFeatureClient,m0 as TEXT_MODE_TO_TYPE,a0 as TEXT_TYPE_TO_FORMAT,p0 as TEXT_TYPE_TO_MODE,ce as TOGGLE_LINK_COMMAND,Yg as TableFeatureClient,rd as TestRecorderFeatureClient,Zd as TextStateFeatureClient,Dt as ToolbarButton,je as ToolbarDropdown,ad as TreeViewFeatureClient,Bd as UnderlineFeatureClient,Df as UnorderedListFeatureClient,$x as UploadFeatureClient,de as UploadNode,Qx as addSwipeDownListener,Zx as addSwipeLeftListener,Yx as addSwipeRightListener,qx as addSwipeUpListener,QC as buildDefaultEditorState,fc as buildEditorState,oc as codeConverterClient,rr as createBlockNode,$ as createClientFeature,T0 as defaultColors,en as defaultEditorLexicalConfig,Dr as getDOMRangeRect,wc as getEnabledNodes,_C as getRestPopulateFn,Ze as getSelectedNode,Jx as isHTMLElement,kc as isPoint,zx as joinClasses,tn as sanitizeClientEditorConfig,ec as sanitizeClientFeatures,bo as setFloatingElemPosition,mo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,xe as toolbarAddDropdownGroupWithItems,lr as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ge as useBlockComponentContext,H as useEditorConfigContext,he as useInlineBlockComponentContext,Cc as useLexicalDocumentDrawer,fe as useLexicalDrawer,Mt as useLexicalListDrawer,Po as useRichTextView};
66
66
  //# sourceMappingURL=index.js.map