@payloadcms/richtext-lexical 3.66.0-canary.6 → 3.66.0-canary.7

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,26 +1,26 @@
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 hc}from"./chunk-F26IQ5RE.js";import{b as Wt,c as Gt,d as le,e as Vt,f as gc,g as xc,i as Cc,k as bc,l as kc}from"./chunk-AFXLIYGL.js";import{a as fc,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 Oo,jsxs as _c}from"react/jsx-runtime";import"react";var rn=()=>_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:[Oo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Oo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Oo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Fo,jsxs as Tc}from"react/jsx-runtime";import"react";var nn=()=>Tc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Fo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Fo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Fo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Po,jsxs as wc}from"react/jsx-runtime";import"react";var Kt=()=>wc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Po("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Po("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Po("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bo,jsxs as Ec}from"react/jsx-runtime";import"react";var ln=()=>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:"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 sn=t=>({type:"dropdown",ChildComponent:Kt,items:t,key:"align",order:30});var an=[sn([{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:rn,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:ln,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:nn,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}])],Sc=$({toolbarFixed:{groups:an},toolbarInline:{groups:an}});import{$createQuoteNode as hn,$isQuoteNode as pn,QuoteNode as yc}from"@lexical/rich-text";import{$setBlocksType as gn}from"@lexical/selection";import{$getSelection as xn,$isRangeSelection as Rc}from"lexical";import{jsx as cn}from"react/jsx-runtime";import"react";var jo=()=>cn("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:cn("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 un}from"react/jsx-runtime";import"react";var pt=()=>un("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:un("path",{d:"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 Nc,$isQuoteNode as dn,QuoteNode as Lc}from"@lexical/rich-text";var mn={type:"element",dependencies:[Lc],export:(t,e)=>{if(!dn(t))return null;let o=e(t).split(`
1
+ "use client";import{a as ge,c as dt,d as mt,e as pt}from"./chunk-TRHFMZ3F.js";import{a as Je}from"./chunk-DBWINSQN.js";import{a as ft,b as ze}from"./chunk-O6XRT2H3.js";import{a as he}from"./chunk-INBEEENE.js";import{a as xc}from"./chunk-F26IQ5RE.js";import{b as Jt,c as zt,d as le,e as Xt,f as Cc,g as bc,i as kc,k as _c,l as Tc}from"./chunk-AFXLIYGL.js";import{a as gc,b as H}from"./chunk-BZZVLW4U.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Lc}from"react/compiler-runtime";import{useLexicalComposerContext as yc}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as xe}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Rc}from"@lexical/utils";import{$getSelection as Ic,$isElementNode as ce,$isNodeSelection as vc,$isRangeSelection as ht,COMMAND_PRIORITY_LOW as Mc,FORMAT_ELEMENT_COMMAND as gt}from"lexical";import{useEffect as Dc}from"react";import{jsx as Po,jsxs as wc}from"react/jsx-runtime";import"react";var ln=()=>wc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Po("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Po("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Po("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bo,jsxs as Ec}from"react/jsx-runtime";import"react";var sn=()=>Ec("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as jo,jsxs as Sc}from"react/jsx-runtime";import"react";var Zt=()=>Sc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[jo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ho,jsxs as Nc}from"react/jsx-runtime";import"react";var an=()=>Nc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ho("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ho("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ho("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var $=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap: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 cn=t=>({type:"dropdown",ChildComponent:Zt,items:t,key:"align",order:30});var Ie=t=>ce(t)?t.getFormatType():t.__format,un=[cn([{ChildComponent:Zt,isActive:({selection:t})=>{if(!ht(t))return!1;for(let e of t.getNodes()){if((ce(e)||xe(e))&&Ie(e)==="left")continue;let o=e.getParent();if(!((ce(o)||xe(o))&&Ie(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(gt,"left")},order:1},{ChildComponent:ln,isActive:({selection:t})=>{if(!ht(t))return!1;for(let e of t.getNodes()){if((ce(e)||xe(e))&&Ie(e)==="center")continue;let o=e.getParent();if(!((ce(o)||xe(o))&&Ie(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(gt,"center")},order:2},{ChildComponent:an,isActive:({selection:t})=>{if(!ht(t))return!1;for(let e of t.getNodes()){if((ce(e)||xe(e))&&Ie(e)==="right")continue;let o=e.getParent();if(!((ce(o)||xe(o))&&Ie(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(gt,"right")},order:3},{ChildComponent:sn,isActive:({selection:t})=>{if(!ht(t))return!1;for(let e of t.getNodes()){if((ce(e)||xe(e))&&Ie(e)==="justify")continue;let o=e.getParent();if(!((ce(o)||xe(o))&&Ie(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(gt,"justify")},order:4}])],$c=()=>{let t=Lc(3),[e]=yc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(gt,Fc,Mc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Dc(o,r),null},Ac=$({plugins:[{Component:$c,position:"normal"}],toolbarFixed:{groups:un},toolbarInline:{groups:un}});function Oc(t){return(ce(t)||xe(t))&&!t.isInline()}function Fc(t){let e=Ic();if(!ht(e)&&!vc(e))return!1;let o=e.getNodes();for(let r of o){let n=Rc(r,Oc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as xn,$isQuoteNode as hn,QuoteNode as jc}from"@lexical/rich-text";import{$setBlocksType as Cn}from"@lexical/selection";import{$getSelection as bn,$isRangeSelection as Hc}from"lexical";import{jsx as dn}from"react/jsx-runtime";import"react";var Uo=()=>dn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dn("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as mn}from"react/jsx-runtime";import"react";var xt=()=>mn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:mn("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var te=t=>({type:"dropdown",ChildComponent:xt,items:t,key:"text",order:25});import{$createQuoteNode as Pc,$isQuoteNode as pn,QuoteNode as Bc}from"@lexical/rich-text";var fn={type:"element",dependencies:[Bc],export:(t,e)=>{if(!pn(t))return null;let o=e(t).split(`
2
2
  `),r=[];for(let n of o)r.push("> "+n);return r.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(dn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Nc();n.append(...e),t.replace(n),n.select(0,0)}};var fn=[te([{ChildComponent:jo,isActive:({selection:t})=>{if(!Rc(t))return!1;for(let e of t.getNodes())if(!pn(e)&&!pn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=xn();gn(e,()=>hn())})},order:20}])],Ic=$({markdownTransformers:[mn],nodes:[yc],slashMenu:{groups:[Z([{Icon:jo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=xn();gn(e,()=>hn())})}}])]},toolbarFixed:{groups:fn},toolbarInline:{groups:fn}});import{getTranslation as no}from"@payloadcms/translations";import{jsx as Ho,jsxs as vc}from"react/jsx-runtime";import"react";var Xt=()=>vc("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("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Cn}from"react/jsx-runtime";import"react";var Zt=()=>Cn("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:Cn("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 Mc}from"react/jsx-runtime";import"react";function Yt(t,e){return t?()=>Mc("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Xt}import{$parseSerializedNode as Rn}from"lexical";import{JSOX as Uo}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=Dc(t,n);e[o]=i.value,n=i.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Dc(t,e){let o=t[e];return o==='"'?bn(t,e):o==="'"?bn(t,e,!0):o==="{"?Ac(t,e):o==="["?$c(t,e):Fc(t,e)}function $c(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:Uo.parse(`[${r}]`)}}function bn(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 Ac(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:Oc(r)}}function Oc(t){return t[0]!=="{"?Uo.parse(t):Uo.parse(t.replace(/(\w+):/g,'"$1":'))}function Fc(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}="${Pc(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,kn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,kn)}}`));return e.join(" ")}function Pc(t){return t.replace(/"/g,"&quot;")}function kn(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,w=r;e:for(let[N,_]of d.entries()){let C=l?_.trim():_,g=0;if(l)for(let k=0;k<_.length&&_[k]===" ";k++)g++;let b=0;for(N===0&&(b=(n.index??0)+n[0].length-g);b<C.length;){let k=C[b],y=C[b+1];if(c){if(k==="`"&&f++,f%2===0)if(k==="<"&&y==="/"){if(u--,u<0){s[s.length-1]===`
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(pn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Pc();n.append(...e),t.replace(n),n.select(0,0)}};var gn=[te([{ChildComponent:Uo,isActive:({selection:t})=>{if(!Hc(t))return!1;for(let e of t.getNodes())if(!hn(e)&&!hn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=bn();Cn(e,()=>xn())})},order:20}])],Uc=$({markdownTransformers:[fn],nodes:[jc],slashMenu:{groups:[Z([{Icon:Uo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=bn();Cn(e,()=>xn())})}}])]},toolbarFixed:{groups:gn},toolbarInline:{groups:gn}});import{getTranslation as io}from"@payloadcms/translations";import{jsx as Wo,jsxs as Wc}from"react/jsx-runtime";import"react";var Yt=()=>Wc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as kn}from"react/jsx-runtime";import"react";var qt=()=>kn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:kn("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as Gc}from"react/jsx-runtime";import"react";function Qt(t,e){return t?()=>Gc("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Yt}import{$parseSerializedNode as vn}from"lexical";import{JSOX as Go}from"jsox";function eo({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let i=Vc(t,n);e[o]=i.value,n=i.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Vc(t,e){let o=t[e];return o==='"'?_n(t,e):o==="'"?_n(t,e,!0):o==="{"?Jc(t,e):o==="["?Kc(t,e):Xc(t,e)}function Kc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Go.parse(`[${r}]`)}}function _n(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function Jc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:zc(r)}}function zc(t){return t[0]!=="{"?Go.parse(t):Go.parse(t.replace(/(\w+):/g,'"$1":'))}function Xc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function Ct({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${Zc(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,Tn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,Tn)}}`));return e.join(" ")}function Zc(t){return t.replace(/"/g,"&quot;")}function Tn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function to({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let 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,w=r;e:for(let[N,_]of d.entries()){let C=l?_.trim():_,g=0;if(l)for(let k=0;k<_.length&&_[k]===" ";k++)g++;let b=0;for(N===0&&(b=(n.index??0)+n[0].length-g);b<C.length;){let k=C[b],y=C[b+1];if(c){if(k==="`"&&f++,f%2===0)if(k==="<"&&y==="/"){if(u--,u<0){s[s.length-1]===`
4
4
  `&&(s=s.slice(0,-1)),w=N;for(let R=b;R<C.length;R++)if(C[R]===">"){x=R+1;break}break e}}else if(k==="/"&&y===">"){if(u--,u<0){s[s.length-1]===`
5
5
  `&&(s=s.slice(0,-1)),w=N,x=b+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,w=N,x=b+2;break e}else if(k===">"&&a===0&&!m){c=!0,b++;continue}i+=k}b++}if(c?s?.length>0&&N>0&&(s+=`
6
6
  `):i+=`
7
7
  `,o&&u<0){let k=C.match(o);if(k?.index!==void 0){w=N,x=k.index+k[0].length-1;break}}if(N===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[w].trim().slice(x),beforeStartLine:h,content:s,endLineIndex:r+w,endlineLastCharIndex:x,propsString:i}}import{jsx as xu}from"react/jsx-runtime";import Cu from"bson-objectid";import{$applyNodeReplacement as bu}from"lexical";import"react";import{DecoratorBlockNode as Bc}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as jc}from"@lexical/utils";import Hc from"bson-objectid";import{$applyNodeReplacement as Uc}from"lexical";var ht=class extends Bc{__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=Wc(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return jc(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 Wc(t){return Uc(new ht({fields:{...t,id:t?.id||new Hc.default().toHexString()}}))}import{jsx as K,jsxs as gt,Fragment as En}from"react/jsx-runtime";import{useLexicalComposerContext as Yc}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as qc}from"@lexical/react/useLexicalEditable";import{getTranslation as Qc}from"@payloadcms/translations";import{Button as Sn,Collapsible as eu,Drawer as tu,EditDepthProvider as ou,ErrorPill as ru,Form as nu,formatDrawerSlug as lu,FormSubmit as iu,Pill as su,RenderFields as au,SectionTitle as cu,useConfig as uu,useDocumentForm as du,useDocumentInfo as Nn,useEditDepth as mu,useFormSubmitted as pu,useServerFunctions as fu,useTranslation as hu}from"@payloadcms/ui";import{abortAndIgnore as Wo}from"@payloadcms/ui/shared";import{$getNodeByKey as to}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as oo,reduceFieldsToValues as Ln}from"payload/shared";import xt,{useCallback as Go,useEffect as Vo,useMemo as Ct,useRef as Ko}from"react";import{v4 as gu}from"uuid";import{c as Gc}from"react/compiler-runtime";import{jsx as eo,jsxs as Vc}from"react/jsx-runtime";import{useLexicalEditable as Kc}from"@lexical/react/useLexicalEditable";import{RenderFields as Jc,useFormSubmitted as zc}from"@payloadcms/ui";import Xc,{createContext as Zc}from"react";var _n=Zc({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,CustomBlock:null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ge=()=>Xc.use(_n),Tn=t=>{let e=Gc(4),{Collapsible:o,...r}=t,{BlockDrawer:n,CustomBlock:l,errorCount:i,formSchema:s}=r,c=zc()&&i>0,u=Kc(),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?Vc(_n,{value:{...r,BlockCollapsible:m},children:[l,eo(n,{})]}):eo(m,{children:eo(Jc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!u})})};function wn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var yn=t=>{let{cacheBuster:e,className:o,formData:r,nodeKey:n}=t,l=pu(),{id:i,collectionSlug:s,globalSlug:d}=Nn(),{fieldProps:{featureClientSchemaMap:c,field:u,initialLexicalFormState:a,schemaPath:m},uuid:p}=H(),{fields:f}=du(),h=Ko(new AbortController),x=mu(),[w,E]=xt.useState(0),{config:N}=uu(),_=lu({slug:`lexical-blocks-create-${p}-${r.id}`,depth:x}),{toggleDrawer:C}=fe(_),{getDocPreferences:g,setDocFieldPreferences:b}=Nn(),[k]=Yc(),y=qc(),R=r.blockType,{getFormState:M}=fu(),L=`${m}.lexical_internal_feature.blocks.lexical_blocks.${R}.fields`,[T,S]=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=Ko(!1),A=Ko(e);Vo(()=>{I.current?(A.current!==e&&S(!1),A.current=e):I.current=!0},[e]);let[v,O]=xt.useState(T?._components?.customComponents?.BlockLabel??void 0),[D,G]=xt.useState(T?._components?.customComponents?.Block??void 0);Vo(()=>{let j=new AbortController;return r&&!T&&(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=Ln(oo(U),!0);k.update(()=>{let Q=to(n);if(Q&&Me(Q)){let ne=V;ne.blockType=R,Q.setFields(ne,!0)}}),S(U),O(U._components?.customComponents?.BlockLabel??void 0),G(U._components?.customComponents?.Block??void 0)}})(),()=>{Wo(j)}},[M,L,y,i,r,k,n,T,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"?N.blocksMap[X?.blockReferences?.[0]]:X?.blockReferences?.[0]:X?.blocks?.[0],{i18n:Ue,t:Ne}=hu(),pe=Go(async({formState:j,submit:ee})=>{Wo(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=Ln(wn({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]);Vo(()=>()=>{Wo(h.current)},[]);let jt=Go(()=>{k.update(()=>{to(n)?.remove()})},[k,n]),Le=W?.labels?.singular?Qc(W.labels.singular,Ue):W?.slug,Ht=Go(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),b(u.name,{collapsed:Q,hello:"hi"})})},[g,u.name,b,r.id]),We=Ct(()=>()=>K(Sn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!y,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),C(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:Ne("lexical:blocks:inlineBlocks:edit",{label:Le})}),[o,y,Ne,Le,C]),Ut=Ct(()=>()=>K(Sn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!y,icon:"x",onClick:j=>{j.preventDefault(),jt()},round:!0,tooltip:"Remove Block"}),[o,y,jt]),$o=Ct(()=>({Actions:j,children:ee,className:U,collapsibleProps:V,disableBlockName:Q,editButton:ne,errorCount:Ge,fieldHasErrors:Ao,Label:en,Pill:tn,removeButton:pc})=>K("div",{className:`${o}__container ${o}-${R}`,children:K(eu,{className:[`${o}__row`,Ao?`${o}__row--has-errors`:`${o}__row--no-errors`,U].filter(Boolean).join(" "),collapsibleStyle:Ao?"error":"default",header:gt("div",{className:`${o}__block-header`,children:[typeof en<"u"?en:typeof v<"u"?v:gt("div",{className:`${o}__block-label`,children:[typeof tn<"u"?tn:K(su,{className:`${o}__block-pill ${o}__block-pill-${R}`,pillStyle:"white",size:"small",children:Le??R}),!Q&&!W?.admin?.disableBlockName&&K(cu,{path:"blockName",readOnly:!y}),Ao&&K(ru,{count:Ge??0,i18n:Ue,withMessage:!0})]}),K("div",{className:`${o}__block-actions`,children:typeof j<"u"?j:gt(En,{children:[D&&ne!==!1||!D&&ne?K(We,{}):null,pc!==!1&&y?K(Ut,{}):null]})})]}),isCollapsed:q,onToggle:on=>{Ht(on),z(on)},...V||{},children:ee},0)}),[D,v,We,Ut,Le,o,W?.admin?.disableBlockName,R,Ue,q,Ht,y]),qr=r?.id,Qr=Ct(()=>()=>K(ou,{children:K(tu,{className:"",slug:_,title:Ne(`lexical:blocks:inlineBlocks:${qr?"edit":"create"}`,{label:Le??Ne("lexical:blocks:inlineBlocks:label")}),children:T?gt(En,{children:[K(au,{fields:W?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:L,permissions:!0,readOnly:!y}),K(iu,{programmaticSubmit:!0,children:Ne("fields:saveChanges")})]}):null})}),[T,_,qr,Le,Ne,y,W?.fields,L]),mc=Ct(()=>T?K(nu,{beforeSubmit:[async({formState:j})=>await pe({formState:j,submit:!0})],el:"div",fields:W?.fields??[],initialState:T,onChange:[pe],onSubmit:(j,ee)=>{ee.blockType=R,k.update(()=>{let U=to(n);U&&Me(U)&&U.setFields(ee,!0)}),C()},submitted:l,uuid:gu(),children:K(Tn,{baseClass:o,BlockDrawer:Qr,Collapsible:$o,CustomBlock:D,EditButton:We,errorCount:w,formSchema:W?.fields??[],initialState:T,nodeKey:n,RemoveButton:Ut})}):null,[$o,Qr,D,R,Ut,We,o,k,w,C,W?.fields,T,n,pe,l]);return W?mc:K($o,{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 xu(yn,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function De(t){return bu(new ie({fields:{...t,id:t?.id||new Cu.default().toHexString()}}))}function Me(t){return t instanceof ie}import{createHeadlessEditor as ku}from"@lexical/headless";function Jo(t,e){return({editorState:r})=>{let n=ku({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 _u}from"@lexical/headless";function ro(t,e){return({markdown:r})=>{let n=_u({nodes:t});return n.update(()=>{Wt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Tu(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var vn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=In(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=In(r,!0);n&&(o=o.concat(n))}return o};function In(t,e){if(!t.jsx)return null;let o=Tu(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=Jo(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=Jo(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[w].trim().slice(x),beforeStartLine:h,content:s,endLineIndex:r+w,endlineLastCharIndex:x,propsString:i}}import{jsx as Ru}from"react/jsx-runtime";import Iu from"bson-objectid";import{$applyNodeReplacement as vu}from"lexical";import"react";import{DecoratorBlockNode as Yc}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as qc}from"@lexical/utils";import Qc from"bson-objectid";import{$applyNodeReplacement as eu}from"lexical";var bt=class extends Yc{__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=tu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return qc(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 tu(t){return eu(new bt({fields:{...t,id:t?.id||new Qc.default().toHexString()}}))}import{jsx as K,jsxs as kt,Fragment as Nn}from"react/jsx-runtime";import{useLexicalComposerContext as cu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as uu}from"@lexical/react/useLexicalEditable";import{getTranslation as du}from"@payloadcms/translations";import{Button as Ln,Collapsible as mu,Drawer as pu,EditDepthProvider as fu,ErrorPill as hu,Form as gu,formatDrawerSlug as xu,FormSubmit as Cu,Pill as bu,RenderFields as ku,SectionTitle as _u,useConfig as Tu,useDocumentForm as wu,useDocumentInfo as yn,useEditDepth as Eu,useFormSubmitted as Su,useServerFunctions as Nu,useTranslation as Lu}from"@payloadcms/ui";import{abortAndIgnore as Vo}from"@payloadcms/ui/shared";import{$getNodeByKey as ro}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as no,reduceFieldsToValues as Rn}from"payload/shared";import _t,{useCallback as Ko,useEffect as Jo,useMemo as Tt,useRef as zo}from"react";import{v4 as yu}from"uuid";import{c as ou}from"react/compiler-runtime";import{jsx as oo,jsxs as ru}from"react/jsx-runtime";import{useLexicalEditable as nu}from"@lexical/react/useLexicalEditable";import{RenderFields as lu,useFormSubmitted as iu}from"@payloadcms/ui";import su,{createContext as au}from"react";var wn=au({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,CustomBlock:null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),Ce=()=>su.use(wn),En=t=>{let e=ou(4),{Collapsible:o,...r}=t,{BlockDrawer:n,CustomBlock:l,errorCount:i,formSchema:s}=r,c=iu()&&i>0,u=nu(),a;e[0]!==o||e[1]!==i||e[2]!==c?(a=p=>{let{children:f,...h}=p;return oo(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?ru(wn,{value:{...r,BlockCollapsible:m},children:[l,oo(n,{})]}):oo(m,{children:oo(lu,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!u})})};function Sn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var In=t=>{let{cacheBuster:e,className:o,formData:r,nodeKey:n}=t,l=Su(),{id:i,collectionSlug:s,globalSlug:d}=yn(),{fieldProps:{featureClientSchemaMap:c,field:u,initialLexicalFormState:a,schemaPath:m},uuid:p}=H(),{fields:f}=wu(),h=zo(new AbortController),x=Eu(),[w,E]=_t.useState(0),{config:N}=Tu(),_=xu({slug:`lexical-blocks-create-${p}-${r.id}`,depth:x}),{toggleDrawer:C}=he(_),{getDocPreferences:g,setDocFieldPreferences:b}=yn(),[k]=cu(),y=uu(),R=r.blockType,{getFormState:M}=Nu(),L=`${m}.lexical_internal_feature.blocks.lexical_blocks.${R}.fields`,[T,S]=_t.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=zo(!1),A=zo(e);Jo(()=>{I.current?(A.current!==e&&S(!1),A.current=e):I.current=!0},[e]);let[v,O]=_t.useState(T?._components?.customComponents?.BlockLabel??void 0),[D,G]=_t.useState(T?._components?.customComponents?.Block??void 0);Jo(()=>{let j=new AbortController;return r&&!T&&(async()=>{let{state:U}=await M({id:i,collectionSlug:s,data:r,docPermissions:{fields:!0},docPreferences:await g(),documentFormState:no(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=Rn(no(U),!0);k.update(()=>{let Q=ro(n);if(Q&&$e(Q)){let ne=V;ne.blockType=R,Q.setFields(ne,!0)}}),S(U),O(U._components?.customComponents?.BlockLabel??void 0),G(U._components?.customComponents?.Block??void 0)}})(),()=>{Vo(j)}},[M,L,y,i,r,k,n,T,s,d,g,f,R]);let[q,z]=_t.useState(a?.[r.id]?.collapsed??!1),Ut=`${m}.lexical_internal_feature.blocks.lexical_blocks.${R}`,X=c.blocks?.[Ut]?.[0],W=X.blockReferences?typeof X?.blockReferences?.[0]=="string"?N.blocksMap[X?.blockReferences?.[0]]:X?.blockReferences?.[0]:X?.blocks?.[0],{i18n:Ge,t:ye}=Lu(),fe=Ko(async({formState:j,submit:ee})=>{Vo(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:no(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=Rn(Sn({fields:no(V)}),!0);if(setTimeout(()=>{k.update(()=>{let ne=ro(n);if(ne&&$e(ne)){let Ke=Q;Ke.blockType=R,ne.setFields(Ke,!0)}})},0),ee){O(V._components?.customComponents?.BlockLabel??void 0),G(V._components?.customComponents?.Block??void 0);let ne=0;for(let Ke of Object.values(V))Ke?.valid===!1&&ne++;E(ne)}return V},[M,i,s,g,d,L,R,f,y,k,n]);Jo(()=>()=>{Vo(h.current)},[]);let Gt=Ko(()=>{k.update(()=>{ro(n)?.remove()})},[k,n]),Re=W?.labels?.singular?du(W.labels.singular,Ge):W?.slug,Vt=Ko(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),b(u.name,{collapsed:Q,hello:"hi"})})},[g,u.name,b,r.id]),Ve=Tt(()=>()=>K(Ln,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!y,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),C(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:ye("lexical:blocks:inlineBlocks:edit",{label:Re})}),[o,y,ye,Re,C]),Kt=Tt(()=>()=>K(Ln,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!y,icon:"x",onClick:j=>{j.preventDefault(),Gt()},round:!0,tooltip:"Remove Block"}),[o,y,Gt]),Oo=Tt(()=>({Actions:j,children:ee,className:U,collapsibleProps:V,disableBlockName:Q,editButton:ne,errorCount:Ke,fieldHasErrors:Fo,Label:on,Pill:rn,removeButton:hc})=>K("div",{className:`${o}__container ${o}-${R}`,children:K(mu,{className:[`${o}__row`,Fo?`${o}__row--has-errors`:`${o}__row--no-errors`,U].filter(Boolean).join(" "),collapsibleStyle:Fo?"error":"default",header:kt("div",{className:`${o}__block-header`,children:[typeof on<"u"?on:typeof v<"u"?v:kt("div",{className:`${o}__block-label`,children:[typeof rn<"u"?rn:K(bu,{className:`${o}__block-pill ${o}__block-pill-${R}`,pillStyle:"white",size:"small",children:Re??R}),!Q&&!W?.admin?.disableBlockName&&K(_u,{path:"blockName",readOnly:!y}),Fo&&K(hu,{count:Ke??0,i18n:Ge,withMessage:!0})]}),K("div",{className:`${o}__block-actions`,children:typeof j<"u"?j:kt(Nn,{children:[D&&ne!==!1||!D&&ne?K(Ve,{}):null,hc!==!1&&y?K(Kt,{}):null]})})]}),isCollapsed:q,onToggle:nn=>{Vt(nn),z(nn)},...V||{},children:ee},0)}),[D,v,Ve,Kt,Re,o,W?.admin?.disableBlockName,R,Ge,q,Vt,y]),en=r?.id,tn=Tt(()=>()=>K(fu,{children:K(pu,{className:"",slug:_,title:ye(`lexical:blocks:inlineBlocks:${en?"edit":"create"}`,{label:Re??ye("lexical:blocks:inlineBlocks:label")}),children:T?kt(Nn,{children:[K(ku,{fields:W?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:L,permissions:!0,readOnly:!y}),K(Cu,{programmaticSubmit:!0,children:ye("fields:saveChanges")})]}):null})}),[T,_,en,Re,ye,y,W?.fields,L]),fc=Tt(()=>T?K(gu,{beforeSubmit:[async({formState:j})=>await fe({formState:j,submit:!0})],el:"div",fields:W?.fields??[],initialState:T,onChange:[fe],onSubmit:(j,ee)=>{ee.blockType=R,k.update(()=>{let U=ro(n);U&&$e(U)&&U.setFields(ee,!0)}),C()},submitted:l,uuid:yu(),children:K(En,{baseClass:o,BlockDrawer:tn,Collapsible:Oo,CustomBlock:D,EditButton:Ve,errorCount:w,formSchema:W?.fields??[],initialState:T,nodeKey:n,RemoveButton:Kt})}):null,[Oo,tn,D,R,Kt,Ve,o,k,w,C,W?.fields,T,n,fe,l]);return W?fc:K(Oo,{disableBlockName:!0,fieldHasErrors:!0,children:kt("div",{className:`${o}-not-found`,children:["Error: Block '",R,"' not found in the config but exists in the lexical data"]})})};var ie=class extends bt{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=Ae(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Ru(In,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ae(t){return vu(new ie({fields:{...t,id:t?.id||new Iu.default().toHexString()}}))}function $e(t){return t instanceof ie}import{createHeadlessEditor as Mu}from"@lexical/headless";function Xo(t,e){return({editorState:r})=>{let n=Mu({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=zt(e)}),l}}import{createHeadlessEditor as Du}from"@lexical/headless";function lo(t,e){return({markdown:r})=>{let n=Du({nodes:t});return n.update(()=>{Jt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function $u(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Dn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Mn(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Mn(r,!0);n&&(o=o.concat(n))}return o};function Mn(t,e){if(!t.jsx)return null;let o=$u(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[dt],export:i=>{if(!pt(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Xo(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?" "+Ct({props:a}):""}>${c.children}</${s.blockType}>`:`<${s.blockType}${u?" "+Ct({props:a}):""}/>`},getEndIndex:(i,s)=>{let{endlineLastCharIndex:d}=to({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}=to({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...s,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=lo(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:s,props:c?eo({propsString:c}):{}});if(a===!1)return;let m=mt({blockType:t.slug,...a});i.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[ie],export:i=>{if(!$e(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Xo(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+`
14
- `;return`<${s.blockType}${u?" "+ft({props:a}):""}>
15
- ${p}</${s.blockType}>`}return`<${s.blockType}${u?" "+ft({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:i,rootNode:s,startLineIndex:d,startMatch:c,transformer:u})=>{let a=typeof u.regExpEnd=="object"&&"regExp"in u.regExpEnd?u.regExpEnd.regExp:u.regExpEnd,m=u.regExpEnd&&typeof u.regExpEnd=="object"&&"optional"in u.regExpEnd?u.regExpEnd.optional:!u.regExpEnd,{afterEndLine:p,beforeStartLine:f,content:h,endLineIndex:x,propsString:w}=Qt({isEndOptional:m,lines:i,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=h.endsWith(`
14
+ `;return`<${s.blockType}${u?" "+Ct({props:a}):""}>
15
+ ${p}</${s.blockType}>`}return`<${s.blockType}${u?" "+Ct({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:i,rootNode:s,startLineIndex:d,startMatch:c,transformer:u})=>{let a=typeof u.regExpEnd=="object"&&"regExp"in u.regExpEnd?u.regExpEnd.regExp:u.regExpEnd,m=u.regExpEnd&&typeof u.regExpEnd=="object"&&"optional"in u.regExpEnd?u.regExpEnd.optional:!u.regExpEnd,{afterEndLine:p,beforeStartLine:f,content:h,endLineIndex:x,propsString:w}=to({isEndOptional:m,lines:i,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=h.endsWith(`
16
16
  `)?h.slice(0,-1):h;else if(h.includes(`
17
17
  `)){let g=h.split(`
18
18
  `),b=0;for(let k of g){if(b++,k.startsWith(" "))E+=k.slice(2);else if(k==="")E+=k;else{E=h.endsWith(`
19
19
  `)?h.slice(0,-1):h;break}E+=b===g.length?"":`
20
20
  `}}else E=(h.startsWith(" ")?h.slice(2):h)+`
21
- `;if(!t?.jsx?.import)return[!1,d];let N=ro(n,l),_=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:N,openMatch:c,props:w?qt({propsString:w}):{}});if(_===!1)return[!1,d];let C=De({blockType:t.slug,..._});if(C){let g=null,b=null;if(f?.length){g=N({markdown:f})?.root?.children??[];let k=g?.[0];k&&s.append(Rn(k))}if(s.append(C),p?.length){b=N({markdown:p})?.root?.children;let k=s.getChildren()[s.getChildren().length-1],y=Rn(b[0])?.getChildren();if(y?.length)for(let R of y)k.append(R)}}return[!0,x]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(i,s,d,c,u)=>{if(t?.jsx?.import){if(!u){let x="";if(s)for(let w of s)x+=w.getTextContent();u=[x]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
21
+ `;if(!t?.jsx?.import)return[!1,d];let N=lo(n,l),_=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:N,openMatch:c,props:w?eo({propsString:w}):{}});if(_===!1)return[!1,d];let C=Ae({blockType:t.slug,..._});if(C){let g=null,b=null;if(f?.length){g=N({markdown:f})?.root?.children??[];let k=g?.[0];k&&s.append(vn(k))}if(s.append(C),p?.length){b=N({markdown:p})?.root?.children;let k=s.getChildren()[s.getChildren().length-1],y=vn(b[0])?.getChildren();if(y?.length)for(let R of y)k.append(R)}}return[!0,x]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(i,s,d,c,u)=>{if(t?.jsx?.import){if(!u){let x="";if(s)for(let w of s)x+=w.getTextContent();u=[x]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
22
22
  `):a=u.join(`
23
- `).trim();let m=d[1]?.trim(),p=ro(n,l),f=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?qt({propsString:m}):{}});if(f===!1)return!1;let h=De({blockType:t.slug,...f});h&&i.append(h);return}return!1}})),r)}import{createCommand as Mn}from"lexical";var Je=Mn("INSERT_BLOCK_COMMAND"),ze=Mn("INSERT_INLINE_BLOCK_COMMAND");import{c as wu}from"react/compiler-runtime";import{useLexicalComposerContext as Eu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Su,$wrapNodeInElement as Nu,mergeRegister as Lu}from"@lexical/utils";import{formatDrawerSlug as yu,useEditDepth as Ru}from"@payloadcms/ui";import{$createParagraphNode as Iu,$getNodeByKey as vu,$getPreviousSelection as Mu,$getSelection as Du,$insertNodes as $u,$isParagraphNode as Au,$isRangeSelection as Ou,$isRootOrShadowRoot as Fu,COMMAND_PRIORITY_EDITOR as Dn}from"lexical";import{useEffect as Pu,useState as Bu}from"react";var $n=()=>{let t=wu(12),[e]=Eu(),[o,r]=Bu(null),{setCreatedInlineBlock:n,uuid:l}=H(),i=Ru(),s="lexical-inlineBlocks-create-"+l,d;t[0]!==i||t[1]!==s?(d=yu({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=fe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([ie]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Lu(e.registerCommand(Je,p=>(e.update(()=>{let f=Du()||Mu();if(Ou(f)){let h=De(p),{focus:x}=f,w=x.getNode();Su(h),Au(w)&&!w.__first&&w.remove()}}),!0),Dn),e.registerCommand(ze,p=>{if(o){let h=vu(o);return!h||!dt(h)?!1:(h.setFields(p),r(null),!0)}let f=ut(p);return n?.(f),$u([f]),Fu(f.getParentOrThrow())&&Nu(f,Iu).selectEnd(),!0},Dn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==u?(m=[e,n,o,u],t[7]=e,t[8]=n,t[9]=o,t[10]=u,t[11]=m):m=t[11],Pu(a,m),null};var ju=$(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),u=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:vn({blocks:c,inlineBlocks:u}),nodes:[ie,ct],plugins:[{Component:$n,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Yt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?no(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:Zt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?no(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ze,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Xt,items:c.map((a,m)=>({ChildComponent:Yt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?no(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Je,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:Zt,items:u.map((a,m)=>({ChildComponent:a.imageURL?Yt(a.imageURL,a.imageAltText):Zt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?no(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(ze,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Wu}from"react/compiler-runtime";import{jsx as Ae,jsxs as Yo}from"react/jsx-runtime";import{useLexicalComposerContext as Gu}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Vu,$createTextNode as Ku,$getRoot as Ju,getDOMSelection as zo}from"lexical";import*as Bn from"react";import{useCallback as $e,useEffect as Xo,useLayoutEffect as On,useRef as Zo,useState as lo}from"react";var Hu=le&&"documentMode"in document?document.documentMode:null,An=le&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),I5=le&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),v5=le&&"InputEvent"in window&&!Hu?"getTargetRanges"in new window.InputEvent("input"):!1,M5=le&&/Version\/[\d.].*Safari/.test(navigator.userAgent),D5=le&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$5=le&&/Android/.test(navigator.userAgent),A5=le&&/Win/.test(navigator.platform),Uu=le&&/^(?=.*Chrome).*/i.test(navigator.userAgent),O5=le&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Uu;var zu=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},Xu=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},Zu=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
23
+ `).trim();let m=d[1]?.trim(),p=lo(n,l),f=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?eo({propsString:m}):{}});if(f===!1)return!1;let h=Ae({blockType:t.slug,...f});h&&i.append(h);return}return!1}})),r)}import{createCommand as $n}from"lexical";var Xe=$n("INSERT_BLOCK_COMMAND"),Ze=$n("INSERT_INLINE_BLOCK_COMMAND");import{c as Au}from"react/compiler-runtime";import{useLexicalComposerContext as Ou}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Fu,$wrapNodeInElement as Pu,mergeRegister as Bu}from"@lexical/utils";import{formatDrawerSlug as ju,useEditDepth as Hu}from"@payloadcms/ui";import{$createParagraphNode as Uu,$getNodeByKey as Wu,$getPreviousSelection as Gu,$getSelection as Vu,$insertNodes as Ku,$isParagraphNode as Ju,$isRangeSelection as zu,$isRootOrShadowRoot as Xu,COMMAND_PRIORITY_EDITOR as An}from"lexical";import{useEffect as Zu,useState as Yu}from"react";var On=()=>{let t=Au(12),[e]=Ou(),[o,r]=Yu(null),{setCreatedInlineBlock:n,uuid:l}=H(),i=Hu(),s="lexical-inlineBlocks-create-"+l,d;t[0]!==i||t[1]!==s?(d=ju({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=he(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([ie]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Bu(e.registerCommand(Xe,p=>(e.update(()=>{let f=Vu()||Gu();if(zu(f)){let h=Ae(p),{focus:x}=f,w=x.getNode();Fu(h),Ju(w)&&!w.__first&&w.remove()}}),!0),An),e.registerCommand(Ze,p=>{if(o){let h=Wu(o);return!h||!pt(h)?!1:(h.setFields(p),r(null),!0)}let f=mt(p);return n?.(f),Ku([f]),Xu(f.getParentOrThrow())&&Pu(f,Uu).selectEnd(),!0},An))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==u?(m=[e,n,o,u],t[7]=e,t[8]=n,t[9]=o,t[10]=u,t[11]=m):m=t[11],Zu(a,m),null};var qu=$(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),u=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:Dn({blocks:c,inlineBlocks:u}),nodes:[ie,dt],plugins:[{Component:On,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Qt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?io(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Xe,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:qt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?io(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ze,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Yt,items:c.map((a,m)=>({ChildComponent:Qt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?io(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Xe,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:qt,items:u.map((a,m)=>({ChildComponent:a.imageURL?Qt(a.imageURL,a.imageAltText):qt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?io(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ze,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as td}from"react/compiler-runtime";import{jsx as Fe,jsxs as Qo}from"react/jsx-runtime";import{useLexicalComposerContext as od}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as rd,$createTextNode as nd,$getRoot as ld,getDOMSelection as Zo}from"lexical";import*as Hn from"react";import{useCallback as Oe,useEffect as Yo,useLayoutEffect as Pn,useRef as qo,useState as so}from"react";var Qu=le&&"documentMode"in document?document.documentMode:null,Fn=le&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),J5=le&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),z5=le&&"InputEvent"in window&&!Qu?"getTargetRanges"in new window.InputEvent("input"):!1,X5=le&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Z5=le&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Y5=le&&/Android/.test(navigator.userAgent),q5=le&&/Win/.test(navigator.platform),ed=le&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Q5=le&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ed;var id=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},sd=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},ad=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
24
24
  await assertSelection(page, {
25
25
  anchorPath: [${n.anchorPath.toString()}],
26
26
  anchorOffset: ${n.anchorOffset},
@@ -30,7 +30,7 @@ ${p}</${s.blockType}>`}return`<${s.blockType}${u?" "+ft({props:a}):""}/>`},handl
30
30
  `;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
31
31
  `);default:return` await repeat(${t.count}, async () => {
32
32
  ${o}
33
- );`}};function Yu(t){return t.key.toLowerCase()==="a"&&(An?t.metaKey:t.ctrlKey)}function qu(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function Fn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var Pn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Qu(t){let[e,o]=lo([]),[r,n]=lo(!1),[,l]=lo(""),[i,s]=lo(""),d=Zo(null),c=Zo(!1),u=Zo(null),a=$e(()=>t,[t]),m=$e(()=>{let _=t.getRootElement(),C=zo(t._window);return _==null||C==null||C.anchorNode==null||C.focusNode==null||!_.contains(C.anchorNode)||!_.contains(C.focusNode)?null:`
33
+ );`}};function cd(t){return t.key.toLowerCase()==="a"&&(Fn?t.metaKey:t.ctrlKey)}function ud(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function Bn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var jn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function dd(t){let[e,o]=so([]),[r,n]=so(!1),[,l]=so(""),[i,s]=so(""),d=qo(null),c=qo(!1),u=qo(null),a=Oe(()=>t,[t]),m=Oe(()=>{let _=t.getRootElement(),C=Zo(t._window);return _==null||C==null||C.anchorNode==null||C.focusNode==null||!_.contains(C.anchorNode)||!_.contains(C.focusNode)?null:`
34
34
  import {
35
35
  initializeE2E,
36
36
  assertHTMLSnapshot,
@@ -47,20 +47,20 @@ describe('Test case', () => {
47
47
  const {page} = e2e;
48
48
 
49
49
  await page.focus('div[contenteditable="true"]');
50
- ${e.map(Zu).join(`
50
+ ${e.map(ad).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=$e((_,C)=>{o(g=>{let b=e.length-1,k=e[b];if(k&&k.name===_){if(_==="type")return[...e.slice(0,b),{...k,value:k.value+C}];if(k.value===C)return[...e.slice(0,b),{...k,count:k.count+1}]}return[...g,{name:_,count:1,value:C}]})},[e,o]);On(()=>{let _=g=>{if(!r)return;let b=g.key;Yu(g)?p("selectAll",""):Pn.has(b)?p("press",g.key):[...b].length>1?p("keydown",g.key):p("type",g.key)},C=g=>{if(!r)return;let b=g.key;!Pn.has(b)&&[...b].length>1&&p("keyup",g.key)};return t.registerRootListener((g,b)=>{b!==null&&(b.removeEventListener("keydown",_),b.removeEventListener("keyup",C)),g!==null&&(g.addEventListener("keydown",_),g.addEventListener("keyup",C))})},[t,r,p]),On(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),Xo(()=>{if(e){let _=m();_!==null&&s(_),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),Xo(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:g,editorState:b})=>{if(!r)return;let k=b._selection,y=d.current,R=c.current;if(y!==k){if(g.size===0&&C.size===0&&!R){let L=zo(t._window);if(L&&(L.anchorNode==null||L.focusNode==null))return}d.current=k}c.current=!1;let M=m();M!==null&&s(M)}),[t,m,r,p]),Xo(()=>r?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,r]);let f=$e(_=>{r||(_.update(()=>{let C=Ju();C.clear();let g=Ku();C.append(Vu().append(g)),g.select()}),o([])),n(C=>!C)},[r]),h=$e(()=>{if(!r)return;let _=zo(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:C,anchorOffset:g,focusNode:b,focusOffset:k}=qu(_),y=a().getRootElement(),R;C!==null&&(R=Fn(C,y));let M;b!==null&&(M=Fn(b,y)),p("snapshot",{anchorNode:C,anchorOffset:g,anchorPath:R,focusNode:b,focusOffset:k,focusPath:M})},[p,r,a]),x=$e(()=>{zu(m())},[m]),w=$e(()=>{Xu("test.js",m())},[m]);return[Ae("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{f(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Yo("div",{className:"test-recorder-output",children:[Yo("div",{className:"test-recorder-toolbar",children:[Ae("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Ae("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{x(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Ae("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{w(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Ae("pre",{id:"test-recorder",ref:u,children:i})]}):null]}var jn=()=>{let t=Wu(3),[e]=Gu(),[o,r]=Qu(e),n;return t[0]!==o||t[1]!==r?(n=Yo(Bn.Fragment,{children:[Ae("p",{children:"HI"}),o,r,Ae("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var ed=$({plugins:[{Component:jn,position:"bottom"}]});import{c as td}from"react/compiler-runtime";import{jsx as od}from"react/jsx-runtime";import{useLexicalComposerContext as rd}from"@lexical/react/LexicalComposerContext.js";import{TreeView as nd}from"@lexical/react/LexicalTreeView.js";import"react";var Hn=()=>{let t=td(2),[e]=rd(),o;return t[0]!==e?(o=od(nd,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var ld=$({plugins:[{Component:Hn,position:"bottom"}]});import{$isTableSelection as id}from"@lexical/table";import{$isRangeSelection as sd,FORMAT_TEXT_COMMAND as ad}from"lexical";import{jsx as Un}from"react/jsx-runtime";import"react";var Wn=()=>Un("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Un("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var Gn={type:"text-format",format:["bold","italic"],tag:"***"},Vn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Kn={type:"text-format",format:["bold"],tag:"**"},Jn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var zn=[Y([{ChildComponent:Wn,isActive:({selection:t})=>sd(t)||id(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(ad,"bold")},order:1}])],cd=$(({featureProviderMap:t})=>{let e=[Kn,Jn];return t.get("italic")&&e.push(Vn,Gn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:zn},toolbarInline:{groups:zn}}});import{$isTableSelection as dd}from"@lexical/table";import{$isRangeSelection as md,FORMAT_TEXT_COMMAND as pd}from"lexical";import{jsx as Xn,jsxs as ud}from"react/jsx-runtime";import"react";var Zn=()=>ud("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Xn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Xn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Yn={type:"text-format",format:["code"],tag:"`"};var qn=[Y([{ChildComponent:Zn,isActive:({selection:t})=>md(t)||dd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(pd,"code")},order:7}])],fd=$({enableFormats:["code"],markdownTransformers:[Yn],toolbarFixed:{groups:qn},toolbarInline:{groups:qn}});import{$isTableSelection as hd}from"@lexical/table";import{$isRangeSelection as gd,FORMAT_TEXT_COMMAND as xd}from"lexical";import{jsx as Qn}from"react/jsx-runtime";import"react";var el=()=>Qn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var tl={type:"text-format",format:["italic"],tag:"*"},ol={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var rl=[Y([{ChildComponent:el,isActive:({selection:t})=>gd(t)||hd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(xd,"italic")},order:2}])],Cd=$({enableFormats:["italic"],markdownTransformers:[tl,ol],toolbarFixed:{groups:rl},toolbarInline:{groups:rl}});import{$isTableSelection as kd}from"@lexical/table";import{$isRangeSelection as _d,FORMAT_TEXT_COMMAND as Td}from"lexical";import{jsx as nl,jsxs as bd}from"react/jsx-runtime";import"react";var ll=()=>bd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[nl("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),nl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var il={type:"text-format",format:["strikethrough"],tag:"~~"};var sl=[Y([{ChildComponent:ll,isActive:({selection:t})=>_d(t)||kd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Td,"strikethrough")},order:4}])],wd=$({enableFormats:["strikethrough"],markdownTransformers:[il],toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{$isTableSelection as Ed}from"@lexical/table";import{$isRangeSelection as Sd,FORMAT_TEXT_COMMAND as Nd}from"lexical";import{jsx as al}from"react/jsx-runtime";import"react";var cl=()=>al("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:al("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var ul=[Y([{ChildComponent:cl,isActive:({selection:t})=>Sd(t)||Ed(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Nd,"subscript")},order:5}])],Ld=$({enableFormats:["subscript"],toolbarFixed:{groups:ul},toolbarInline:{groups:ul}});import{$isTableSelection as yd}from"@lexical/table";import{$isRangeSelection as Rd,FORMAT_TEXT_COMMAND as Id}from"lexical";import{jsx as dl}from"react/jsx-runtime";import"react";var ml=()=>dl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var pl=[Y([{ChildComponent:ml,isActive:({selection:t})=>Rd(t)||yd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Id,"superscript")},order:6}])],vd=$({enableFormats:["superscript"],toolbarFixed:{groups:pl},toolbarInline:{groups:pl}});import{$isTableSelection as Dd}from"@lexical/table";import{$isRangeSelection as $d,FORMAT_TEXT_COMMAND as Ad}from"lexical";import{jsx as fl,jsxs as Md}from"react/jsx-runtime";import"react";var hl=()=>Md("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[fl("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),fl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var gl=[Y([{ChildComponent:hl,isActive:({selection:t})=>$d(t)||Dd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Ad,"underline")},order:3}])],Od=$({enableFormats:["underline"],toolbarFixed:{groups:gl},toolbarInline:{groups:gl}});import{jsx as Qo}from"react/jsx-runtime";import{jsx as Fd}from"react/jsx-runtime";function Pd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var io=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Pd(o),r])):{};return Fd("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Bd}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as jd}from"@lexical/selection";import{$getNodeByKey as Hd,$getState as Ud,$setState as Wd,createState as Gd,TextNode as Vd}from"lexical";import{useEffect as Kd}from"react";function xl(t){let e=new Map;for(let o in t){let r=t[o],n=Gd(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function qo(t,e,o,r){t.update(()=>{jd(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);Wd(n,l.stateConfig,r)})})}function Cl({stateMap:t}){let[e]=Bd();return Kd(()=>e.registerMutationListener(Vd,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=Hd(r),i=e.getElementByKey(r);if(!l||!i)continue;let s=Object.create(null);t.forEach((d,c)=>{let u=Ud(l,d.stateConfig);if(!u){delete i.dataset[c];return}i.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(s,a)}),i.style.cssText="",Object.assign(i.style,s)}})}),[e]),null}var bl=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let i in l){let s=l[i];o.push({ChildComponent:()=>Qo(io,{css:s.css}),key:i,label:s.label,onSelect:({editor:d})=>{qo(d,e,n,i)}})}}return[{type:"dropdown",ChildComponent:()=>Qo(io,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Qo(io,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)qo(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},Jd=$(({props:t})=>{let e=xl(t.state);return{plugins:[{Component:()=>Cl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:bl(t,e)},toolbarInline:{groups:bl(t,e)}}});import{c as Yd}from"react/compiler-runtime";import{useLexicalComposerContext as qd}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Qd,$isHeadingNode as Dl,HeadingNode as Ol}from"@lexical/rich-text";import{$setBlocksType as em}from"@lexical/selection";import{$getSelection as tm,$isRangeSelection as om}from"lexical";import{useEffect as rm}from"react";import{jsx as kl}from"react/jsx-runtime";import"react";var _l=()=>kl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:kl("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Tl}from"react/jsx-runtime";import"react";var wl=()=>Tl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as El}from"react/jsx-runtime";import"react";var Sl=()=>El("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as Nl}from"react/jsx-runtime";import"react";var Ll=()=>Nl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Nl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as yl}from"react/jsx-runtime";import"react";var Rl=()=>yl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as Il}from"react/jsx-runtime";import"react";var vl=()=>Il("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Il("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as zd,$isHeadingNode as Xd,HeadingNode as Zd}from"@lexical/rich-text";var er=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Ml=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Zd],export:(n,l)=>{if(!Xd(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:er(n=>{let l="h"+n[1]?.length;return zd(l)})}};var $l=t=>{let e=tm();em(e,()=>Qd(t))},Al={h1:_l,h2:wl,h3:Sl,h4:Ll,h5:Rl,h6:vl},nm=$(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((r,n)=>({ChildComponent:Al[r],isActive:({selection:l})=>{if(!om(l))return!1;for(let i of l.getNodes()){if(Dl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(Dl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{$l(r)})},order:n+2})))];return{markdownTransformers:[Ml(e)],nodes:[Ol],plugins:[{Component:lm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Al[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{$l(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),lm=t=>{let e=Yd(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[d]=qd(),c,u;return e[4]!==d||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return d.registerNodeTransform(Ol,a=>{l.includes(a.getTag())||a.setTag(s)})},u=[d,l,s],e[4]=d,e[5]=l,e[6]=s,e[7]=c,e[8]=u):(c=e[7],u=e[8]),rm(c,u),null};import{$isNodeSelection as _m}from"lexical";import{jsx as Fl}from"react/jsx-runtime";import"react";var tr=()=>Fl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Fl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Pl,jsxs as im}from"react/jsx-runtime";import"react";var Bl=()=>im("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pl("path",{d:"M5 10h10",stroke:"currentColor"}),Pl("path",{d:"M10 15V5",stroke:"currentColor"})]});var xe=t=>({type:"dropdown",ChildComponent:Bl,items:t,key:"add",order:10});import{addClassNamesToElement as sm}from"@lexical/utils";import{$applyNodeReplacement as am,createCommand as cm,DecoratorNode as um}from"lexical";var kt=cm("INSERT_HORIZONTAL_RULE_COMMAND"),bt=class extends um{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:dm,priority:0})}}static importJSON(e){return jl()}createDOM(e){let o=document.createElement("hr");return sm(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
- `}isInline(){return!1}updateDOM(){return!1}};function dm(){return{node:jl()}}function jl(){return am(new bt)}import{$applyNodeReplacement as mm}from"lexical";import"react";var Ce=class extends bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Xe()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Xe(){return mm(new Ce)}function _t(t){return t instanceof Ce}var Hl={type:"element",dependencies:[Ce],export:(t,e)=>_t(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Xe();e&&t.replace(e)}};import{c as pm}from"react/compiler-runtime";import{useLexicalComposerContext as fm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as hm}from"@lexical/utils";import{$getSelection as gm,$isRangeSelection as xm,COMMAND_PRIORITY_EDITOR as Cm}from"lexical";import{useEffect as bm}from"react";var Ul=()=>{let t=pm(3),[e]=fm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(kt,km,Cm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),bm(o,r),null};function km(t){let e=gm();if(!xm(e))return!1;if(e.focus.getNode()!==null){let r=Xe();hm(r)}return!0}var Tm=$({markdownTransformers:[Hl],nodes:[Ce],plugins:[{Component:Ul,position:"normal"}],slashMenu:{groups:[Z([{Icon:tr,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:tr,isActive:({selection:t})=>{if(!_m(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return _t(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]}});import{$findMatchingParent as ql}from"@lexical/utils";import{$isElementNode as Am,INDENT_CONTENT_COMMAND as Om,OUTDENT_CONTENT_COMMAND as Fm}from"lexical";import{jsx as so,jsxs as wm}from"react/jsx-runtime";import"react";var Wl=()=>wm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[so("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ao,jsxs as Em}from"react/jsx-runtime";import"react";var Gl=()=>Em("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ao("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Sm}from"react/jsx-runtime";import{useLexicalComposerContext as Nm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Lm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as ym,mergeRegister as Vl}from"@lexical/utils";import{$getSelection as Rm,$isElementNode as Xl,$isRangeSelection as Im,COMMAND_PRIORITY_LOW as Kl,INDENT_CONTENT_COMMAND as Jl,KEY_TAB_COMMAND as vm,OUTDENT_CONTENT_COMMAND as Mm,TabNode as Dm}from"lexical";import{useEffect as zl}from"react";var Zl=({clientProps:t})=>{let[e]=Nm(),{disabledNodes:o,disableTabNode:r}=t;return zl(()=>{if(!(!e||!o?.length))return Vl(e.registerCommand(Jl,()=>$m(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Kl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Xl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),zl(()=>{if(!(!e||!r))return Vl(e.registerCommand(vm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Mm:Jl,void 0)),Kl),e.registerNodeTransform(Dm,n=>{n.remove()}))},[e,r]),Sm(Lm,{})};function $m(t){let e=Rm();if(!Im(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=ym(l,c=>Xl(c)&&!c.isInline());if(s===null)continue;let d=s.getKey();s.canIndent()&&!o.has(d)&&(o.add(d),t(s))}return o.size>0}var Yl=t=>({type:"buttons",items:t,key:"indent",order:35});var Ql=({disabledNodes:t})=>[Yl([{ChildComponent:Wl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ei(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ql(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Fm,void 0)},order:1},{ChildComponent:Gl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>ei(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ql(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Om,void 0)},order:2}])],Pm=$(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Zl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ql({disabledNodes:e})},toolbarInline:{groups:Ql({disabledNodes:e})}}}),ei=t=>Am(t)&&t.canIndent();import{$findMatchingParent as Yp}from"@lexical/utils";import{$getSelection as ur,$isRangeSelection as vi}from"lexical";import{jsx as ti}from"react/jsx-runtime";import"react";var oi=()=>ti("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ti("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as ri}from"@lexical/selection";function Ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?ri(o)?r:n:ri(e)?r:n}var or=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Xm}from"lexical";import{addClassNamesToElement as Bm,isHTMLAnchorElement as jm}from"@lexical/utils";import lr from"bson-objectid";import{$applyNodeReplacement as Hm,$createTextNode as ni,$getSelection as Um,$isElementNode as li,$isRangeSelection as nr,createCommand as Wm,ElementNode as Gm}from"lexical";var Vm=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends Gm{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Km,priority:1})}}static importJSON(e){let o=be({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new lr.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=rr(o.rel,"add","noopener")),Bm(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!nr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(li(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Vm.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=rr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=rr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Km(t){let e=null;if(jm(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new lr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return Hm(new oe({id:t??new lr.default().toHexString(),fields:e}))}function J(t){return t instanceof oe}var ce=Wm("TOGGLE_LINK_COMMAND");function ir(t){let e=Um();if(!nr(e)&&(t===null||!t.selectedNodes?.length))return;let o=nr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();J(i)&&(i.getChildren().forEach(d=>{i.insertBefore(d)}),i.remove())});return}if(o?.length===1){let l=o[0],i=J(l)?l:Jm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ni(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||li(l)&&!l.isInline())){if(J(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ni(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=be({fields:t.fields}),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 Jm(t){return zm(t,e=>J(e))}function zm(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function rr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var ii={type:"text-match",dependencies:[oe],export:(t,e)=>{if(!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=Xm(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Zm,$isElementNode as Ym}from"lexical";var ke=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Tt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Ym(r)){let n=Tt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Tt({fields:t}){return Zm(new ke({id:"",fields:t}))}function _e(t){return t instanceof ke}import{c as qm}from"react/compiler-runtime";import{useLexicalComposerContext as Qm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ep}from"@lexical/utils";import{$createTextNode as si,$getSelection as tp,$isElementNode as ci,$isLineBreakNode as ui,$isNodeSelection as op,$isRangeSelection as rp,$isTextNode as wt,TextNode as np}from"lexical";import{useEffect as lp}from"react";function ai(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function di(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var ip=/[.,;\s]/;function uo(t){return t!==void 0&&ip.test(t)}function mi(t){return uo(t[t.length-1])}function ar(t){return uo(t[0])}function sp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function pi(t){let e=t.getPreviousSibling();return ci(e)&&(e=e.getLastDescendant()),e===null||ui(e)||wt(e)&&mi(e.getTextContent())}function fi(t){let e=t.getNextSibling();return ci(e)&&(e=e.getFirstDescendant()),e===null||ui(e)||wt(e)&&ar(e.getTextContent())}function ap(t,e,o,r){return(t>0?uo(o[t-1]):pi(r[0]))?e<o.length?uo(o[e]):fi(r[r.length-1]):!1}function cp(t,e,o){let r=[],n=[],l=[],i=0,s=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,d.shift()}return[i,r,n,l]}function up(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Tt({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let d=si(r.text);d.setFormat(s.getFormat()),d.setDetail(s.getDetail()),d.setStyle(s.getStyle()),l.append(d),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,d;e===0?d=i:[,d]=i.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[x,w]=a.splitText(o-f);x&&c.push(x),u=w}s+=p}),d){let a=tp(),m=a?a.getNodes().find(wt):void 0,p=si(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(rp(a)?p.select(a.anchor.offset,a.focus.offset):op(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function dp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,i,s=0;for(;(i=di(l,e))!=null&&i!==null;){let d=i.index,c=i.length,u=d+c;if(ap(s+d,s+u,n,r)){let[m,,p,f]=cp(r,s+d,s+u),h=s+d-m,x=s+u-m,w=up(p,h,x,i);r=w?[w,...f]:f,o(i.url,null),s=0}else s+=u;l=l.substring(u)}}function sr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!wt(c)||!c.isSimpleText()){co(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=di(l,e);if(i===null||i.text!==l){co(t),o(null,t.getFields()?.url??null);return}if(!pi(t)||!fi(t)){co(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let d=t.getFields();d.url=i?.url,t.setFields(d),o(i.url,s??null)}}function mp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(_e(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!ar(l)||sp(l,i))&&(r.append(t),sr(r,e,o),o(null,r.getFields()?.url??null))}_e(n)&&!mi(l)&&(co(n),sr(n,e,o),o(null,n.getFields()?.url??null))}function co(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function pp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&wt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function fp(t,e,o){let r=qm(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,d)=>{o?.(s,d)};return ep(t.registerNodeTransform(np,s=>{let d=s.getParentOrThrow(),c=s.getPreviousSibling();if(_e(d))sr(d,e,i);else if(!J(d)){if(s.isSimpleText()&&(ar(s.getTextContent())||!_e(c))){let u=pp(s);dp(u,e,i)}mp(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),lp(n,l)}var hp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,gp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,xp=[ai(hp,t=>t.startsWith("http")?t:`https://${t}`),ai(gp,t=>`mailto:${t}`)],hi=()=>{let[t]=Qm();return fp(t,xp),null};import{jsx as Cp}from"react/jsx-runtime";import{ClickableLinkPlugin as bp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var gi=()=>Cp(bp,{});import{jsx as Pp}from"react/jsx-runtime";import"react";import{createPortal as Bp}from"react-dom";import{jsx as Te,jsxs as Et,Fragment as _p}from"react/jsx-runtime";import{useLexicalComposerContext as Tp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as wp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as xi,mergeRegister as Ci}from"@lexical/utils";import{getTranslation as cr}from"@payloadcms/translations";import{CloseMenuIcon as Ep,EditIcon as Sp,ExternalLinkIcon as bi,formatDrawerSlug as Np,useConfig as Lp,useEditDepth as yp,useLocale as Rp,useTranslation as Ip}from"@payloadcms/ui";import{requests as vp}from"@payloadcms/ui/shared";import{$getSelection as ki,$isLineBreakNode as Mp,$isRangeSelection as _i,COMMAND_PRIORITY_HIGH as Dp,COMMAND_PRIORITY_LOW as Ti,getDOMSelection as $p,KEY_ESCAPE_COMMAND as Ap,SELECTION_CHANGE_COMMAND as Op}from"lexical";import wi,{useCallback as Ei,useEffect as fo,useRef as Fp,useState as Oe}from"react";function mo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),d=l.getBoundingClientRect(),c=t.top-r,u=t.left-n;c<d.top&&(c+=i.height+t.height+r*2),u+i.width>d.right&&(u=d.right-i.width-n),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as kp}from"lexical";var po=kp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Si(t){t.preventDefault()}function Ni({anchorElem:t}){let[e]=Tp(),[o,r]=Oe(),n=Fp(null),[l,i]=Oe(null),[s,d]=Oe(null),{fieldProps:{schemaPath:c},uuid:u}=H(),a=wp(),{config:m,getEntityConfig:p}=Lp(),{i18n:f,t:h}=Ip(),[x,w]=Oe(),E=yp(),[N,_]=Oe(!1),[C,g]=Oe([]),b=Rp(),[k,y]=Oe(!1),R=Np({slug:"lexical-rich-text-link-"+u,depth:E}),{toggleDrawer:M}=fe(R),L=Ei(()=>{_(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),y(!1),i(null),d(null),g([]),w(void 0)},[_,i,d,g]),T=Ei(()=>{let S=ki(),I;if(!_i(S)||!S){L();return}let A=Ze(S);I=e.getElementByKey(A.getKey())?.getBoundingClientRect();let v=xi(A,J),O=S.getNodes().filter(X=>!Mp(X)).find(X=>{let W=xi(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:`${cr(X.labels.singular,f)} - ${h("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(Ne),vp.get(`${m.serverURL}${m.routes.api}/${Ue}/${W}`,{headers:{"Accept-Language":f.language},params:{depth:0,locale:b?.code}}).then(async pe=>{if(!pe.ok)throw new Error(`HTTP error! Status: ${pe.status}`);let jt=await pe.json(),Le=X?.admin?.useAsTitle||"id",Ht=jt[Le],We=h("fields:linkedTo",{label:`${cr(X.labels.singular,f)} - ${Ht}`}).replace(/<[^>]*>?/g,"");d(We)}).catch(()=>{let pe=h("fields:linkedTo",{label:`${cr(X.labels.singular,f)} - ${h("general:untitled",f)} - ID: ${W}`}).replace(/<[^>]*>?/g,"");d(pe)})}}w(G),_(!0),g(S?S?.getNodes():[]),_e(v)?y(!0):y(!1);let q=n.current,z=$p(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,b?.code,t]);return fo(()=>Ci(e.registerCommand(po,S=>(e.dispatchCommand(ce,S),T(),M(),!0),Ti)),[e,T,M,R]),fo(()=>{let S=t.parentElement,I=()=>{e.getEditorState().read(()=>{T()})};return window.addEventListener("resize",I),S?.addEventListener("scroll",I),()=>{window.removeEventListener("resize",I),S?.removeEventListener("scroll",I)}},[t.parentElement,e,T]),fo(()=>Ci(e.registerUpdateListener(({editorState:S})=>{S.read(()=>{T()})}),e.registerCommand(Op,()=>(T(),!0),Ti),e.registerCommand(Ap,()=>N?(L(),!0):!1,Dp)),[e,T,N,L]),fo(()=>{e.getEditorState().read(()=>{T()})},[e,T]),Et(wi.Fragment,{children:[Te("div",{className:"link-editor",ref:n,children:Et("div",{className:"link-input",children:[l&&l.length>0?Et("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Te(bi,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Et(_p,{children:[o?.__fields.newTab?Te(bi,{}):null,Te("span",{className:"link-input__label-pure",children:s})]}):null,a&&Et(wi.Fragment,{children:[Te("button",{"aria-label":"Edit link",className:"link-edit",onClick:S=>{S.preventDefault(),M()},onMouseDown:Si,tabIndex:0,type:"button",children:Te(Sp,{})}),!k&&Te("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ce,null)},onMouseDown:Si,tabIndex:0,type:"button",children:Te(Ep,{})})]})]})}),Te(mt,{className:"lexical-link-edit-drawer",data:x,drawerSlug:R,drawerTitle:h("fields:editLink"),featureKey:"link",handleDrawerSubmit:(S,I)=>{let A=I,v={...A};delete v.text,e.update(()=>{let O=ki(),D=null;if(_i(O)?D=Ze(O).getParent():C.length&&(D=C[0]?.getParent()??null),D&&_e(D)){let G=be({fields:v});D.replace(G,!0)}}),e.dispatchCommand(ce,{fields:v,selectedNodes:C,text:A.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Li=t=>{let{anchorElem:e=document.body}=t;return Bp(Pp(Ni,{anchorElem:e}),e)};import{c as Up}from"react/compiler-runtime";import{useLexicalComposerContext as Wp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Gp}from"@lexical/utils";import{$getSelection as Vp,$isElementNode as Kp,$isRangeSelection as Jp,COMMAND_PRIORITY_LOW as Ri,PASTE_COMMAND as zp}from"lexical";import{useEffect as Xp}from"react";var jp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Hp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function yi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||jp.test(t)||Hp.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}var Ii=t=>{let e=Up(5),{clientProps:o}=t,[r]=Wp(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Gp(r.registerCommand(ce,i=>i===null?(ir(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),ir(i),!0),Ri),r.registerCommand(zp,i=>{let s=Vp();if(!Jp(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let d=i.clipboardData.getData("text");if(!yi(d))return!1;if(!s.getNodes().some(Zp)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ce,{fields:c,text:null}),i.preventDefault(),!0}return!1},Ri))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Xp(n,l),null};function Zp(t){return Kp(t)}var Mi=[or([{ChildComponent:oi,isActive:({selection:t})=>{if(vi(t)){let e=Ze(t);return Yp(e,J)!=null}return!1},isEnabled:({selection:t})=>!!(vi(t)&&ur()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ce,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=ur()?.getTextContent(),r=ur()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(po,{fields:n,selectedNodes:r,text:o})}},order:1}])],qp=$(({props:t})=>({markdownTransformers:[ii],nodes:[oe,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:Ii,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:hi,position:"normal"},{Component:gi,position:"normal"},{Component:Li,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Mi},toolbarInline:{groups:Mi}}));import{$isListNode as pr,INSERT_CHECK_LIST_COMMAND as Pi,ListItemNode as df,ListNode as mf}from"@lexical/list";import{$isRangeSelection as pf}from"lexical";import{jsx as Di,jsxs as Qp}from"react/jsx-runtime";import"react";var dr=()=>Qp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Di("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Di("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as ef}from"react/jsx-runtime";import{ListPlugin as tf}from"@lexical/react/LexicalListPlugin.js";import"react";var Ye=()=>ef(tf,{});function ho(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function qe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as lf,ListItemNode as sf,ListNode as af}from"@lexical/list";import{$createListItemNode as of,$createListNode as rf,$isListItemNode as nf,$isListNode as mr}from"@lexical/list";var $i=4,Qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=of(t==="check"?r[3]==="x":void 0);if(mr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(i):l.append(i),e.remove()}else if(mr(n)&&n.getListType()===t)n.append(i),e.remove();else{let d=rf(t,t==="number"?Number(r[2]):void 0);d.append(i),e.replace(d)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/$i);s&&i.setIndent(s)},Fe=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(nf(i)){if(i.getChildrenSize()===1){let u=i.getFirstChild();if(mr(u)){r.push(Fe(u,e,o+1));continue}}let s=" ".repeat(o*$i),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
56
- `)};var Ai={type:"element",dependencies:[af,sf],export:(t,e)=>lf(t)?Fe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Qe("check")};import{jsx as cf}from"react/jsx-runtime";import{CheckListPlugin as uf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Oi=()=>cf(uf,{});var Fi=[te([{ChildComponent:dr,isActive:({selection:t})=>{if(!pf(t))return!1;for(let e of t.getNodes()){if(pr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(pr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(pr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Pi,void 0)},order:12}])],ff=$(({featureProviderMap:t})=>{let e=[{Component:Oi,position:"normal"}],o=ho("checklist",t);return o&&e.push({Component:Ye,position:"normal"}),{markdownTransformers:[Ai],nodes:o?[mf,df]:[],plugins:e,slashMenu:{groups:[qe([{Icon:dr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(Pi,void 0)}}])]},toolbarFixed:{groups:Fi},toolbarInline:{groups:Fi}}});import{$isListNode as hr,INSERT_ORDERED_LIST_COMMAND as Hi,ListItemNode as bf,ListNode as kf}from"@lexical/list";import{$isRangeSelection as _f}from"lexical";import{jsx as St,jsxs as hf}from"react/jsx-runtime";import"react";var fr=()=>hf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[St("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),St("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),St("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as gf,ListItemNode as xf,ListNode as Cf}from"@lexical/list";var Bi={type:"element",dependencies:[Cf,xf],export:(t,e)=>gf(t)?Fe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Qe("number")};var ji=[te([{ChildComponent:fr,isActive:({selection:t})=>{if(!_f(t))return!1;for(let e of t.getNodes()){if(hr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(hr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(hr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Hi,void 0)},order:10}])],Tf=$(({featureProviderMap:t})=>{let e=ho("ordered",t);return{markdownTransformers:[Bi],nodes:e?[kf,bf]:[],plugins:e?[{Component:Ye,position:"normal"}]:[],slashMenu:{groups:[qe([{Icon:fr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Hi,void 0)}}])]},toolbarFixed:{groups:ji},toolbarInline:{groups:ji}}});import{$isListNode as xr,INSERT_UNORDERED_LIST_COMMAND as Gi,ListItemNode as Lf,ListNode as yf}from"@lexical/list";import{$isRangeSelection as Rf}from"lexical";import{jsx as et,jsxs as wf}from"react/jsx-runtime";import"react";var gr=()=>wf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[et("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),et("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),et("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Ef,ListItemNode as Sf,ListNode as Nf}from"@lexical/list";var Ui={type:"element",dependencies:[Nf,Sf],export:(t,e)=>Ef(t)?Fe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Qe("bullet")};var Wi=[te([{ChildComponent:gr,isActive:({selection:t})=>{if(!Rf(t))return!1;for(let e of t.getNodes()){if(xr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(xr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(xr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)},order:11}])],If=$({markdownTransformers:[Ui],nodes:[yf,Lf],plugins:[{Component:Ye,position:"normal"}],slashMenu:{groups:[qe([{Icon:gr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)}}])]},toolbarFixed:{groups:Wi},toolbarInline:{groups:Wi}});import{jsx as vf}from"react/jsx-runtime";import{addClassNamesToElement as Mf}from"@lexical/utils";import{$applyNodeReplacement as Df,DecoratorNode as $f}from"lexical";import*as Vi from"react";var Af=Vi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Nt=class extends $f{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Of({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Mf(o,"unknownConverted"),o}decorate(){return vf(Af,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Of({data:t}){return Df(new Nt({data:t}))}var Ff=$(()=>({nodes:[Nt]}));import{jsx as Pf}from"react/jsx-runtime";import{addClassNamesToElement as Bf}from"@lexical/utils";import{$applyNodeReplacement as jf,DecoratorNode as Hf}from"lexical";import*as Ki from"react";var Uf=Ki.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Lt=class extends Hf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Wf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Bf(o,"unknownConverted"),o}decorate(){return Pf(Uf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Wf({data:t}){return jf(new Lt({data:t}))}var Gf=$(()=>({nodes:[Lt]}));import{$setBlocksType as Xi}from"@lexical/selection";import{$createParagraphNode as Zi,$getSelection as Yi,$isParagraphNode as Ji,$isRangeSelection as Vf}from"lexical";var zi=[te([{ChildComponent:pt,isActive:({selection:t})=>{if(!Vf(t))return!1;for(let e of t.getNodes())if(!Ji(e)&&!Ji(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Yi();Xi(e,()=>Zi())})},order:1}])],Kf=$({slashMenu:{groups:[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=Yi();Xi(e,()=>Zi())})}}])]},toolbarFixed:{groups:zi},toolbarInline:{groups:zi}});import{c as p0}from"react/compiler-runtime";import{jsx as xs}from"react/jsx-runtime";import{useLexicalComposerContext as f0}from"@lexical/react/LexicalComposerContext";import{useEffect as h0,useState as g0}from"react";import{jsx as gs,Fragment as m0}from"react/jsx-runtime";import"react";import{jsx as Jf}from"react/jsx-runtime";var qi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Jf("blockquote",{children:o})}};import{jsx as zf}from"react/jsx-runtime";var Qi={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return zf(r,{children:o})}};import{jsx as Xf}from"react/jsx-runtime";var es={horizontalrule:Xf("hr",{})};import{jsx as Zf}from"react/jsx-runtime";var ts={linebreak:Zf("br",{})};import{jsx as os}from"react/jsx-runtime";var rs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return os("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),os("a",{href:i,rel:n,target:l,children:r})}});import{jsx as tt,jsxs as Yf,Fragment as qf}from"react/jsx-runtime";import{v4 as Qf}from"uuid";var ns={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return tt(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Qf();return tt("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Yf(qf,{children:[tt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),tt("label",{htmlFor:l,children:n}),tt("br",{})]})})}else return tt("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as Cr}from"react/jsx-runtime";var ls={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Cr("p",{children:o}):Cr("p",{children:Cr("br",{})})}};var is={tab:" "};import{jsx as yt}from"react/jsx-runtime";var ss={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yt("div",{className:"lexical-table-container",children:yt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:yt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return yt(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Pe}from"react/jsx-runtime";import"react";var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},e0=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,t0="\xA0",o0=`
54
+ `},[t,e]),p=Oe((_,C)=>{o(g=>{let b=e.length-1,k=e[b];if(k&&k.name===_){if(_==="type")return[...e.slice(0,b),{...k,value:k.value+C}];if(k.value===C)return[...e.slice(0,b),{...k,count:k.count+1}]}return[...g,{name:_,count:1,value:C}]})},[e,o]);Pn(()=>{let _=g=>{if(!r)return;let b=g.key;cd(g)?p("selectAll",""):jn.has(b)?p("press",g.key):[...b].length>1?p("keydown",g.key):p("type",g.key)},C=g=>{if(!r)return;let b=g.key;!jn.has(b)&&[...b].length>1&&p("keyup",g.key)};return t.registerRootListener((g,b)=>{b!==null&&(b.removeEventListener("keydown",_),b.removeEventListener("keyup",C)),g!==null&&(g.addEventListener("keydown",_),g.addEventListener("keyup",C))})},[t,r,p]),Pn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),Yo(()=>{if(e){let _=m();_!==null&&s(_),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),Yo(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:g,editorState:b})=>{if(!r)return;let k=b._selection,y=d.current,R=c.current;if(y!==k){if(g.size===0&&C.size===0&&!R){let L=Zo(t._window);if(L&&(L.anchorNode==null||L.focusNode==null))return}d.current=k}c.current=!1;let M=m();M!==null&&s(M)}),[t,m,r,p]),Yo(()=>r?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,r]);let f=Oe(_=>{r||(_.update(()=>{let C=ld();C.clear();let g=nd();C.append(rd().append(g)),g.select()}),o([])),n(C=>!C)},[r]),h=Oe(()=>{if(!r)return;let _=Zo(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:C,anchorOffset:g,focusNode:b,focusOffset:k}=ud(_),y=a().getRootElement(),R;C!==null&&(R=Bn(C,y));let M;b!==null&&(M=Bn(b,y)),p("snapshot",{anchorNode:C,anchorOffset:g,anchorPath:R,focusNode:b,focusOffset:k,focusPath:M})},[p,r,a]),x=Oe(()=>{id(m())},[m]),w=Oe(()=>{sd("test.js",m())},[m]);return[Fe("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?Qo("div",{className:"test-recorder-output",children:[Qo("div",{className:"test-recorder-toolbar",children:[Fe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{x(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{w(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Fe("pre",{id:"test-recorder",ref:u,children:i})]}):null]}var Un=()=>{let t=td(3),[e]=od(),[o,r]=dd(e),n;return t[0]!==o||t[1]!==r?(n=Qo(Hn.Fragment,{children:[Fe("p",{children:"HI"}),o,r,Fe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var md=$({plugins:[{Component:Un,position:"bottom"}]});import{c as pd}from"react/compiler-runtime";import{jsx as fd}from"react/jsx-runtime";import{useLexicalComposerContext as hd}from"@lexical/react/LexicalComposerContext.js";import{TreeView as gd}from"@lexical/react/LexicalTreeView.js";import"react";var Wn=()=>{let t=pd(2),[e]=hd(),o;return t[0]!==e?(o=fd(gd,{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 xd=$({plugins:[{Component:Wn,position:"bottom"}]});import{$isTableSelection as Cd}from"@lexical/table";import{$isRangeSelection as bd,FORMAT_TEXT_COMMAND as kd}from"lexical";import{jsx as Gn}from"react/jsx-runtime";import"react";var Vn=()=>Gn("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:Gn("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 Kn={type:"text-format",format:["bold","italic"],tag:"***"},Jn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},zn={type:"text-format",format:["bold"],tag:"**"},Xn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Zn=[Y([{ChildComponent:Vn,isActive:({selection:t})=>bd(t)||Cd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(kd,"bold")},order:1}])],_d=$(({featureProviderMap:t})=>{let e=[zn,Xn];return t.get("italic")&&e.push(Jn,Kn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Zn},toolbarInline:{groups:Zn}}});import{$isTableSelection as wd}from"@lexical/table";import{$isRangeSelection as Ed,FORMAT_TEXT_COMMAND as Sd}from"lexical";import{jsx as Yn,jsxs as Td}from"react/jsx-runtime";import"react";var qn=()=>Td("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:[Yn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Yn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Qn={type:"text-format",format:["code"],tag:"`"};var el=[Y([{ChildComponent:qn,isActive:({selection:t})=>Ed(t)||wd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Sd,"code")},order:7}])],Nd=$({enableFormats:["code"],markdownTransformers:[Qn],toolbarFixed:{groups:el},toolbarInline:{groups:el}});import{$isTableSelection as Ld}from"@lexical/table";import{$isRangeSelection as yd,FORMAT_TEXT_COMMAND as Rd}from"lexical";import{jsx as tl}from"react/jsx-runtime";import"react";var ol=()=>tl("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:tl("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 rl={type:"text-format",format:["italic"],tag:"*"},nl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var ll=[Y([{ChildComponent:ol,isActive:({selection:t})=>yd(t)||Ld(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Rd,"italic")},order:2}])],Id=$({enableFormats:["italic"],markdownTransformers:[rl,nl],toolbarFixed:{groups:ll},toolbarInline:{groups:ll}});import{$isTableSelection as Md}from"@lexical/table";import{$isRangeSelection as Dd,FORMAT_TEXT_COMMAND as $d}from"lexical";import{jsx as il,jsxs as vd}from"react/jsx-runtime";import"react";var sl=()=>vd("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:[il("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"}),il("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var al={type:"text-format",format:["strikethrough"],tag:"~~"};var cl=[Y([{ChildComponent:sl,isActive:({selection:t})=>Dd(t)||Md(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand($d,"strikethrough")},order:4}])],Ad=$({enableFormats:["strikethrough"],markdownTransformers:[al],toolbarFixed:{groups:cl},toolbarInline:{groups:cl}});import{$isTableSelection as Od}from"@lexical/table";import{$isRangeSelection as Fd,FORMAT_TEXT_COMMAND as Pd}from"lexical";import{jsx as ul}from"react/jsx-runtime";import"react";var dl=()=>ul("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:ul("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 ml=[Y([{ChildComponent:dl,isActive:({selection:t})=>Fd(t)||Od(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Pd,"subscript")},order:5}])],Bd=$({enableFormats:["subscript"],toolbarFixed:{groups:ml},toolbarInline:{groups:ml}});import{$isTableSelection as jd}from"@lexical/table";import{$isRangeSelection as Hd,FORMAT_TEXT_COMMAND as Ud}from"lexical";import{jsx as pl}from"react/jsx-runtime";import"react";var fl=()=>pl("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:pl("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 hl=[Y([{ChildComponent:fl,isActive:({selection:t})=>Hd(t)||jd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Ud,"superscript")},order:6}])],Wd=$({enableFormats:["superscript"],toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{$isTableSelection as Vd}from"@lexical/table";import{$isRangeSelection as Kd,FORMAT_TEXT_COMMAND as Jd}from"lexical";import{jsx as gl,jsxs as Gd}from"react/jsx-runtime";import"react";var xl=()=>Gd("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:[gl("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"}),gl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Cl=[Y([{ChildComponent:xl,isActive:({selection:t})=>Kd(t)||Vd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Jd,"underline")},order:3}])],zd=$({enableFormats:["underline"],toolbarFixed:{groups:Cl},toolbarInline:{groups:Cl}});import{jsx as tr}from"react/jsx-runtime";import{jsx as Xd}from"react/jsx-runtime";function Zd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var ao=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Zd(o),r])):{};return Xd("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Yd}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as qd}from"@lexical/selection";import{$getNodeByKey as Qd,$getState as em,$setState as tm,createState as om,TextNode as rm}from"lexical";import{useEffect as nm}from"react";function bl(t){let e=new Map;for(let o in t){let r=t[o],n=om(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function er(t,e,o,r){t.update(()=>{qd(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);tm(n,l.stateConfig,r)})})}function kl({stateMap:t}){let[e]=Yd();return nm(()=>e.registerMutationListener(rm,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=Qd(r),i=e.getElementByKey(r);if(!l||!i)continue;let s=Object.create(null);t.forEach((d,c)=>{let u=em(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 _l=(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:()=>tr(ao,{css:s.css}),key:i,label:s.label,onSelect:({editor:d})=>{er(d,e,n,i)}})}}return[{type:"dropdown",ChildComponent:()=>tr(ao,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>tr(ao,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)er(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},lm=$(({props:t})=>{let e=bl(t.state);return{plugins:[{Component:()=>kl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:_l(t,e)},toolbarInline:{groups:_l(t,e)}}});import{c as cm}from"react/compiler-runtime";import{useLexicalComposerContext as um}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as dm,$isHeadingNode as Al,HeadingNode as Pl}from"@lexical/rich-text";import{$setBlocksType as mm}from"@lexical/selection";import{$getSelection as pm,$isRangeSelection as fm}from"lexical";import{useEffect as hm}from"react";import{jsx as Tl}from"react/jsx-runtime";import"react";var wl=()=>Tl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tl("path",{d:"M4.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 El}from"react/jsx-runtime";import"react";var Sl=()=>El("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.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 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.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 yl}from"react/jsx-runtime";import"react";var Rl=()=>yl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.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 Il}from"react/jsx-runtime";import"react";var vl=()=>Il("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Il("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.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 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.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 im,$isHeadingNode as sm,HeadingNode as am}from"@lexical/rich-text";var or=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var $l=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[am],export:(n,l)=>{if(!sm(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:or(n=>{let l="h"+n[1]?.length;return im(l)})}};var Ol=t=>{let e=pm();mm(e,()=>dm(t))},Fl={h1:wl,h2:Sl,h3:Ll,h4:Rl,h5:vl,h6:Dl},gm=$(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[te(e.map((r,n)=>({ChildComponent:Fl[r],isActive:({selection:l})=>{if(!fm(l))return!1;for(let i of l.getNodes()){if(Al(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(Al(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(()=>{Ol(r)})},order:n+2})))];return{markdownTransformers:[$l(e)],nodes:[Pl],plugins:[{Component:xm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Fl[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(()=>{Ol(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),xm=t=>{let e=cm(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]=um(),c,u;return e[4]!==d||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return d.registerNodeTransform(Pl,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]),hm(c,u),null};import{$isNodeSelection as Dm}from"lexical";import{jsx as Bl}from"react/jsx-runtime";import"react";var rr=()=>Bl("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:Bl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as jl,jsxs as Cm}from"react/jsx-runtime";import"react";var Hl=()=>Cm("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[jl("path",{d:"M5 10h10",stroke:"currentColor"}),jl("path",{d:"M10 15V5",stroke:"currentColor"})]});var be=t=>({type:"dropdown",ChildComponent:Hl,items:t,key:"add",order:10});import{addClassNamesToElement as bm}from"@lexical/utils";import{$applyNodeReplacement as km,createCommand as _m,DecoratorNode as Tm}from"lexical";var Et=_m("INSERT_HORIZONTAL_RULE_COMMAND"),wt=class extends Tm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:wm,priority:0})}}static importJSON(e){return Ul()}createDOM(e){let o=document.createElement("hr");return bm(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 wm(){return{node:Ul()}}function Ul(){return km(new wt)}import{$applyNodeReplacement as Em}from"lexical";import"react";var ke=class extends wt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Ye()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Ye(){return Em(new ke)}function St(t){return t instanceof ke}var Wl={type:"element",dependencies:[ke],export:(t,e)=>St(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ye();e&&t.replace(e)}};import{c as Sm}from"react/compiler-runtime";import{useLexicalComposerContext as Nm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Lm}from"@lexical/utils";import{$getSelection as ym,$isRangeSelection as Rm,COMMAND_PRIORITY_EDITOR as Im}from"lexical";import{useEffect as vm}from"react";var Gl=()=>{let t=Sm(3),[e]=Nm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Et,Mm,Im),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),vm(o,r),null};function Mm(t){let e=ym();if(!Rm(e))return!1;if(e.focus.getNode()!==null){let r=Ye();Lm(r)}return!0}var $m=$({markdownTransformers:[Wl],nodes:[ke],plugins:[{Component:Gl,position:"normal"}],slashMenu:{groups:[Z([{Icon:rr,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Et,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:rr,isActive:({selection:t})=>{if(!Dm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return St(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Et,void 0)}}])]}});import{$findMatchingParent as ei}from"@lexical/utils";import{$isElementNode as Jm,INDENT_CONTENT_COMMAND as zm,OUTDENT_CONTENT_COMMAND as Xm}from"lexical";import{jsx as co,jsxs as Am}from"react/jsx-runtime";import"react";var Vl=()=>Am("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:[co("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as uo,jsxs as Om}from"react/jsx-runtime";import"react";var Kl=()=>Om("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:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Fm}from"react/jsx-runtime";import{useLexicalComposerContext as Pm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Bm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as jm,mergeRegister as Jl}from"@lexical/utils";import{$getSelection as Hm,$isElementNode as Yl,$isRangeSelection as Um,COMMAND_PRIORITY_LOW as zl,INDENT_CONTENT_COMMAND as Xl,KEY_TAB_COMMAND as Wm,OUTDENT_CONTENT_COMMAND as Gm,TabNode as Vm}from"lexical";import{useEffect as Zl}from"react";var ql=({clientProps:t})=>{let[e]=Pm(),{disabledNodes:o,disableTabNode:r}=t;return Zl(()=>{if(!(!e||!o?.length))return Jl(e.registerCommand(Xl,()=>Km(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);Yl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Zl(()=>{if(!(!e||!r))return Jl(e.registerCommand(Wm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Gm:Xl,void 0)),zl),e.registerNodeTransform(Vm,n=>{n.remove()}))},[e,r]),Fm(Bm,{})};function Km(t){let e=Hm();if(!Um(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=jm(l,c=>Yl(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 Ql=t=>({type:"buttons",items:t,key:"indent",order:35});var ti=({disabledNodes:t})=>[Ql([{ChildComponent:Vl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>oi(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ei(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Xm,void 0)},order:1},{ChildComponent:Kl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>oi(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ei(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(zm,void 0)},order:2}])],Zm=$(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ql,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:ti({disabledNodes:e})},toolbarInline:{groups:ti({disabledNodes:e})}}}),oi=t=>Jm(t)&&t.canIndent();import{$findMatchingParent as uf}from"@lexical/utils";import{$getSelection as mr,$isRangeSelection as Di}from"lexical";import{jsx as ri}from"react/jsx-runtime";import"react";var ni=()=>ri("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:ri("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 li}from"@lexical/selection";function qe(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?li(o)?r:n:li(e)?r:n}var nr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as sp}from"lexical";import{addClassNamesToElement as Ym,isHTMLAnchorElement as qm}from"@lexical/utils";import sr from"bson-objectid";import{$applyNodeReplacement as Qm,$createTextNode as ii,$getSelection as ep,$isElementNode as si,$isRangeSelection as ir,createCommand as tp,ElementNode as op}from"lexical";var rp=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends op{__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:np,priority:1})}}static importJSON(e){let o=_e({}).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 sr.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=lr(o.rel,"add","noopener")),Ym(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(!ir(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(si(r)){let n=_e({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!rp.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=lr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=lr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function np(t){let e=null;if(qm(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new sr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function _e({id:t,fields:e}){return Qm(new oe({id:t??new sr.default().toHexString(),fields:e}))}function J(t){return t instanceof oe}var ue=tp("TOGGLE_LINK_COMMAND");function ar(t){let e=ep();if(!ir(e)&&(t===null||!t.selectedNodes?.length))return;let o=ir(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:lp(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ii(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||si(l)&&!l.isInline())){if(J(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ii(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=_e({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 lp(t){return ip(t,e=>J(e))}function ip(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function lr(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 ai={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=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=sp(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as ap,$isElementNode as cp}from"lexical";var Te=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=Nt({}).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(cp(r)){let n=Nt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Nt({fields:t}){return ap(new Te({id:"",fields:t}))}function we(t){return t instanceof Te}import{c as up}from"react/compiler-runtime";import{useLexicalComposerContext as dp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as mp}from"@lexical/utils";import{$createTextNode as ci,$getSelection as pp,$isElementNode as di,$isLineBreakNode as mi,$isNodeSelection as fp,$isRangeSelection as hp,$isTextNode as Lt,TextNode as gp}from"lexical";import{useEffect as xp}from"react";function ui(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 pi(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Cp=/[.,;\s]/;function po(t){return t!==void 0&&Cp.test(t)}function fi(t){return po(t[t.length-1])}function ur(t){return po(t[0])}function bp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function hi(t){let e=t.getPreviousSibling();return di(e)&&(e=e.getLastDescendant()),e===null||mi(e)||Lt(e)&&fi(e.getTextContent())}function gi(t){let e=t.getNextSibling();return di(e)&&(e=e.getFirstDescendant()),e===null||mi(e)||Lt(e)&&ur(e.getTextContent())}function kp(t,e,o,r){return(t>0?po(o[t-1]):hi(r[0]))?e<o.length?po(o[e]):gi(r[r.length-1]):!1}function _p(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 Tp(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Nt({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=ci(r.text);d.setFormat(s.getFormat()),d.setDetail(s.getDetail()),d.setStyle(s.getStyle()),l.append(d),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,d;e===0?d=i:[,d]=i.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[x,w]=a.splitText(o-f);x&&c.push(x),u=w}s+=p}),d){let a=pp(),m=a?a.getNodes().find(Lt):void 0,p=ci(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(hp(a)?p.select(a.anchor.offset,a.focus.offset):fp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function wp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,i,s=0;for(;(i=pi(l,e))!=null&&i!==null;){let d=i.index,c=i.length,u=d+c;if(kp(s+d,s+u,n,r)){let[m,,p,f]=_p(r,s+d,s+u),h=s+d-m,x=s+u-m,w=Tp(p,h,x,i);r=w?[w,...f]:f,o(i.url,null),s=0}else s+=u;l=l.substring(u)}}function cr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!Lt(c)||!c.isSimpleText()){mo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=pi(l,e);if(i===null||i.text!==l){mo(t),o(null,t.getFields()?.url??null);return}if(!hi(t)||!gi(t)){mo(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 Ep(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(we(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!ur(l)||bp(l,i))&&(r.append(t),cr(r,e,o),o(null,r.getFields()?.url??null))}we(n)&&!fi(l)&&(mo(n),cr(n,e,o),o(null,n.getFields()?.url??null))}function mo(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 Sp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&Lt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Np(t,e,o){let r=up(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([Te]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,d)=>{o?.(s,d)};return mp(t.registerNodeTransform(gp,s=>{let d=s.getParentOrThrow(),c=s.getPreviousSibling();if(we(d))cr(d,e,i);else if(!J(d)){if(s.isSimpleText()&&(ur(s.getTextContent())||!we(c))){let u=Sp(s);wp(u,e,i)}Ep(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]),xp(n,l)}var Lp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,yp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Rp=[ui(Lp,t=>t.startsWith("http")?t:`https://${t}`),ui(yp,t=>`mailto:${t}`)],xi=()=>{let[t]=dp();return Np(t,Rp),null};import{jsx as Ip}from"react/jsx-runtime";import{ClickableLinkPlugin as vp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ci=()=>Ip(vp,{});import{jsx as Zp}from"react/jsx-runtime";import"react";import{createPortal as Yp}from"react-dom";import{jsx as Ee,jsxs as yt,Fragment as Dp}from"react/jsx-runtime";import{useLexicalComposerContext as $p}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ap}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as bi,mergeRegister as ki}from"@lexical/utils";import{getTranslation as dr}from"@payloadcms/translations";import{CloseMenuIcon as Op,EditIcon as Fp,ExternalLinkIcon as _i,formatDrawerSlug as Pp,useConfig as Bp,useEditDepth as jp,useLocale as Hp,useTranslation as Up}from"@payloadcms/ui";import{requests as Wp}from"@payloadcms/ui/shared";import{$getSelection as Ti,$isLineBreakNode as Gp,$isRangeSelection as wi,COMMAND_PRIORITY_HIGH as Vp,COMMAND_PRIORITY_LOW as Ei,getDOMSelection as Kp,KEY_ESCAPE_COMMAND as Jp,SELECTION_CHANGE_COMMAND as zp}from"lexical";import Si,{useCallback as Ni,useEffect as go,useRef as Xp,useState as Pe}from"react";function fo(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 Mp}from"lexical";var ho=Mp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Li(t){t.preventDefault()}function yi({anchorElem:t}){let[e]=$p(),[o,r]=Pe(),n=Xp(null),[l,i]=Pe(null),[s,d]=Pe(null),{fieldProps:{schemaPath:c},uuid:u}=H(),a=Ap(),{config:m,getEntityConfig:p}=Bp(),{i18n:f,t:h}=Up(),[x,w]=Pe(),E=jp(),[N,_]=Pe(!1),[C,g]=Pe([]),b=Hp(),[k,y]=Pe(!1),R=Pp({slug:"lexical-rich-text-link-"+u,depth:E}),{toggleDrawer:M}=he(R),L=Ni(()=>{_(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),y(!1),i(null),d(null),g([]),w(void 0)},[_,i,d,g]),T=Ni(()=>{let S=Ti(),I;if(!wi(S)||!S){L();return}let A=qe(S);I=e.getElementByKey(A.getKey())?.getBoundingClientRect();let v=bi(A,J),O=S.getNodes().filter(X=>!Gp(X)).find(X=>{let W=bi(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,Ge=D.doc?.relationTo;if(!W||!Ge)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ye=h("fields:linkedTo",{label:`${dr(X.labels.singular,f)} - ${h("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(ye),Wp.get(`${m.serverURL}${m.routes.api}/${Ge}/${W}`,{headers:{"Accept-Language":f.language},params:{depth:0,locale:b?.code}}).then(async fe=>{if(!fe.ok)throw new Error(`HTTP error! Status: ${fe.status}`);let Gt=await fe.json(),Re=X?.admin?.useAsTitle||"id",Vt=Gt[Re],Ve=h("fields:linkedTo",{label:`${dr(X.labels.singular,f)} - ${Vt}`}).replace(/<[^>]*>?/g,"");d(Ve)}).catch(()=>{let fe=h("fields:linkedTo",{label:`${dr(X.labels.singular,f)} - ${h("general:untitled",f)} - ID: ${W}`}).replace(/<[^>]*>?/g,"");d(fe)})}}w(G),_(!0),g(S?S?.getNodes():[]),we(v)?y(!0):y(!1);let q=n.current,z=Kp(e._window),{activeElement:Ut}=document;if(q===null)return;let Wt=e.getRootElement();return z!==null&&Wt!==null&&Wt.contains(z.anchorNode)?(I||(I=z.getRangeAt(0).getBoundingClientRect()),I!=null&&(I.y+=40,fo(I,q,t))):(Ut==null||Ut.className!=="link-input")&&(Wt!==null&&fo(null,q,t),i(null),d(null)),!0},[e,L,m.routes.admin,m.routes.api,m.serverURL,p,h,f,b?.code,t]);return go(()=>ki(e.registerCommand(ho,S=>(e.dispatchCommand(ue,S),T(),M(),!0),Ei)),[e,T,M,R]),go(()=>{let S=t.parentElement,I=()=>{e.getEditorState().read(()=>{T()})};return window.addEventListener("resize",I),S?.addEventListener("scroll",I),()=>{window.removeEventListener("resize",I),S?.removeEventListener("scroll",I)}},[t.parentElement,e,T]),go(()=>ki(e.registerUpdateListener(({editorState:S})=>{S.read(()=>{T()})}),e.registerCommand(zp,()=>(T(),!0),Ei),e.registerCommand(Jp,()=>N?(L(),!0):!1,Vp)),[e,T,N,L]),go(()=>{e.getEditorState().read(()=>{T()})},[e,T]),yt(Si.Fragment,{children:[Ee("div",{className:"link-editor",ref:n,children:yt("div",{className:"link-input",children:[l&&l.length>0?yt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Ee(_i,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?yt(Dp,{children:[o?.__fields.newTab?Ee(_i,{}):null,Ee("span",{className:"link-input__label-pure",children:s})]}):null,a&&yt(Si.Fragment,{children:[Ee("button",{"aria-label":"Edit link",className:"link-edit",onClick:S=>{S.preventDefault(),M()},onMouseDown:Li,tabIndex:0,type:"button",children:Ee(Fp,{})}),!k&&Ee("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ue,null)},onMouseDown:Li,tabIndex:0,type:"button",children:Ee(Op,{})})]})]})}),Ee(ft,{className:"lexical-link-edit-drawer",data:x,drawerSlug:R,drawerTitle:h("fields:editLink"),featureKey:"link",handleDrawerSubmit:(S,I)=>{let A=I,v={...A};delete v.text,e.update(()=>{let O=Ti(),D=null;if(wi(O)?D=qe(O).getParent():C.length&&(D=C[0]?.getParent()??null),D&&we(D)){let G=_e({fields:v});D.replace(G,!0)}}),e.dispatchCommand(ue,{fields:v,selectedNodes:C,text:A.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Ri=t=>{let{anchorElem:e=document.body}=t;return Yp(Zp(yi,{anchorElem:e}),e)};import{c as ef}from"react/compiler-runtime";import{useLexicalComposerContext as tf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as of}from"@lexical/utils";import{$getSelection as rf,$isElementNode as nf,$isRangeSelection as lf,COMMAND_PRIORITY_LOW as vi,PASTE_COMMAND as sf}from"lexical";import{useEffect as af}from"react";var qp=/^(?:[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+)?$/,Qp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Ii(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||qp.test(t)||Qp.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}var Mi=t=>{let e=ef(5),{clientProps:o}=t,[r]=tf(),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 of(r.registerCommand(ue,i=>i===null?(ar(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),ar(i),!0),vi),r.registerCommand(sf,i=>{let s=rf();if(!lf(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let d=i.clipboardData.getData("text");if(!Ii(d))return!1;if(!s.getNodes().some(cf)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ue,{fields:c,text:null}),i.preventDefault(),!0}return!1},vi))},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]),af(n,l),null};function cf(t){return nf(t)}var $i=[nr([{ChildComponent:ni,isActive:({selection:t})=>{if(Di(t)){let e=qe(t);return uf(e,J)!=null}return!1},isEnabled:({selection:t})=>!!(Di(t)&&mr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ue,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=mr()?.getTextContent(),r=mr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(ho,{fields:n,selectedNodes:r,text:o})}},order:1}])],df=$(({props:t})=>({markdownTransformers:[ai],nodes:[oe,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:Mi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:xi,position:"normal"},{Component:Ci,position:"normal"},{Component:Ri,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:$i},toolbarInline:{groups:$i}}));import{$isListNode as hr,INSERT_CHECK_LIST_COMMAND as ji,ListItemNode as wf,ListNode as Ef}from"@lexical/list";import{$isRangeSelection as Sf}from"lexical";import{jsx as Ai,jsxs as mf}from"react/jsx-runtime";import"react";var pr=()=>mf("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:[Ai("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ai("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as pf}from"react/jsx-runtime";import{ListPlugin as ff}from"@lexical/react/LexicalListPlugin.js";import"react";var Qe=()=>pf(ff,{});function xo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function et(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Cf,ListItemNode as bf,ListNode as kf}from"@lexical/list";import{$createListItemNode as hf,$createListNode as gf,$isListItemNode as xf,$isListNode as fr}from"@lexical/list";var Oi=4,tt=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=hf(t==="check"?r[3]==="x":void 0);if(fr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(i):l.append(i),e.remove()}else if(fr(n)&&n.getListType()===t)n.append(i),e.remove();else{let d=gf(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/Oi);s&&i.setIndent(s)},Be=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(xf(i)){if(i.getChildrenSize()===1){let u=i.getFirstChild();if(fr(u)){r.push(Be(u,e,o+1));continue}}let s=" ".repeat(o*Oi),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 Fi={type:"element",dependencies:[kf,bf],export:(t,e)=>Cf(t)?Be(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:tt("check")};import{jsx as _f}from"react/jsx-runtime";import{CheckListPlugin as Tf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Pi=()=>_f(Tf,{});var Bi=[te([{ChildComponent:pr,isActive:({selection:t})=>{if(!Sf(t))return!1;for(let e of t.getNodes()){if(hr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(hr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(hr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(ji,void 0)},order:12}])],Nf=$(({featureProviderMap:t})=>{let e=[{Component:Pi,position:"normal"}],o=xo("checklist",t);return o&&e.push({Component:Qe,position:"normal"}),{markdownTransformers:[Fi],nodes:o?[Ef,wf]:[],plugins:e,slashMenu:{groups:[et([{Icon:pr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(ji,void 0)}}])]},toolbarFixed:{groups:Bi},toolbarInline:{groups:Bi}}});import{$isListNode as xr,INSERT_ORDERED_LIST_COMMAND as Wi,ListItemNode as vf,ListNode as Mf}from"@lexical/list";import{$isRangeSelection as Df}from"lexical";import{jsx as Rt,jsxs as Lf}from"react/jsx-runtime";import"react";var gr=()=>Lf("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:[Rt("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"}),Rt("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"}),Rt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Rt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Rt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as yf,ListItemNode as Rf,ListNode as If}from"@lexical/list";var Hi={type:"element",dependencies:[If,Rf],export:(t,e)=>yf(t)?Be(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:tt("number")};var Ui=[te([{ChildComponent:gr,isActive:({selection:t})=>{if(!Df(t))return!1;for(let e of t.getNodes()){if(xr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(xr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(xr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Wi,void 0)},order:10}])],$f=$(({featureProviderMap:t})=>{let e=xo("ordered",t);return{markdownTransformers:[Hi],nodes:e?[Mf,vf]:[],plugins:e?[{Component:Qe,position:"normal"}]:[],slashMenu:{groups:[et([{Icon:gr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Wi,void 0)}}])]},toolbarFixed:{groups:Ui},toolbarInline:{groups:Ui}}});import{$isListNode as br,INSERT_UNORDERED_LIST_COMMAND as Ki,ListItemNode as Bf,ListNode as jf}from"@lexical/list";import{$isRangeSelection as Hf}from"lexical";import{jsx as ot,jsxs as Af}from"react/jsx-runtime";import"react";var Cr=()=>Af("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:[ot("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),ot("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),ot("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),ot("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Of,ListItemNode as Ff,ListNode as Pf}from"@lexical/list";var Gi={type:"element",dependencies:[Pf,Ff],export:(t,e)=>Of(t)?Be(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:tt("bullet")};var Vi=[te([{ChildComponent:Cr,isActive:({selection:t})=>{if(!Hf(t))return!1;for(let e of t.getNodes()){if(br(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(br(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(br(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ki,void 0)},order:11}])],Uf=$({markdownTransformers:[Gi],nodes:[jf,Bf],plugins:[{Component:Qe,position:"normal"}],slashMenu:{groups:[et([{Icon:Cr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ki,void 0)}}])]},toolbarFixed:{groups:Vi},toolbarInline:{groups:Vi}});import{jsx as Wf}from"react/jsx-runtime";import{addClassNamesToElement as Gf}from"@lexical/utils";import{$applyNodeReplacement as Vf,DecoratorNode as Kf}from"lexical";import*as Ji from"react";var Jf=Ji.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),It=class extends Kf{__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 zf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Gf(o,"unknownConverted"),o}decorate(){return Wf(Jf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function zf({data:t}){return Vf(new It({data:t}))}var Xf=$(()=>({nodes:[It]}));import{jsx as Zf}from"react/jsx-runtime";import{addClassNamesToElement as Yf}from"@lexical/utils";import{$applyNodeReplacement as qf,DecoratorNode as Qf}from"lexical";import*as zi from"react";var e0=zi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),vt=class extends Qf{__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 t0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Yf(o,"unknownConverted"),o}decorate(){return Zf(e0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function t0({data:t}){return qf(new vt({data:t}))}var o0=$(()=>({nodes:[vt]}));import{$setBlocksType as Yi}from"@lexical/selection";import{$createParagraphNode as qi,$getSelection as Qi,$isParagraphNode as Xi,$isRangeSelection as r0}from"lexical";var Zi=[te([{ChildComponent:xt,isActive:({selection:t})=>{if(!r0(t))return!1;for(let e of t.getNodes())if(!Xi(e)&&!Xi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Qi();Yi(e,()=>qi())})},order:1}])],n0=$({slashMenu:{groups:[Z([{Icon:xt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qi();Yi(e,()=>qi())})}}])]},toolbarFixed:{groups:Zi},toolbarInline:{groups:Zi}});import{c as S0}from"react/compiler-runtime";import{jsx as bs}from"react/jsx-runtime";import{useLexicalComposerContext as N0}from"@lexical/react/LexicalComposerContext";import{useEffect as L0,useState as y0}from"react";import{jsx as Cs,Fragment as E0}from"react/jsx-runtime";import"react";import{jsx as l0}from"react/jsx-runtime";var es={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return l0("blockquote",{children:o})}};import{jsx as i0}from"react/jsx-runtime";var ts={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return i0(r,{children:o})}};import{jsx as s0}from"react/jsx-runtime";var os={horizontalrule:s0("hr",{})};import{jsx as a0}from"react/jsx-runtime";var rs={linebreak:a0("br",{})};import{jsx as ns}from"react/jsx-runtime";var ls=({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 ns("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="#")),ns("a",{href:i,rel:n,target:l,children:r})}});import{jsx as rt,jsxs as c0,Fragment as u0}from"react/jsx-runtime";import{v4 as d0}from"uuid";var is={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return rt(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=d0();return rt("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:c0(u0,{children:[rt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),rt("label",{htmlFor:l,children:n}),rt("br",{})]})})}else return rt("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as kr}from"react/jsx-runtime";var ss={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?kr("p",{children:o}):kr("p",{children:kr("br",{})})}};var as={tab:" "};import{jsx as Mt}from"react/jsx-runtime";var cs={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("div",{className:"lexical-table-container",children:Mt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Mt("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 Mt(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 Mt("tr",{className:"lexical-table-row",children:o})}};import{jsx as je}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},m0=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,p0="\xA0",f0=`
57
57
 
58
- `,as="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",cs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",r0=new RegExp("^[^"+cs+"]*["+as+"]"),n0=new RegExp("^[^"+as+"]*["+cs+"]"),l0={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},i0={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},s0={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},a0={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},c0={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},u0={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};var us={text:({node:t})=>{let e=t.text;return t.format&F.IS_BOLD&&(e=Pe("strong",{children:e})),t.format&F.IS_ITALIC&&(e=Pe("em",{children:e})),t.format&F.IS_STRIKETHROUGH&&(e=Pe("span",{style:{textDecoration:"line-through"},children:e})),t.format&F.IS_UNDERLINE&&(e=Pe("span",{style:{textDecoration:"underline"},children:e})),t.format&F.IS_CODE&&(e=Pe("code",{children:e})),t.format&F.IS_SUBSCRIPT&&(e=Pe("sub",{children:e})),t.format&F.IS_SUPERSCRIPT&&(e=Pe("sup",{children:e})),e}};import{jsx as Rt}from"react/jsx-runtime";var ds={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Rt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Rt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Rt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Rt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Rt("picture",{children:n})}};var ot={...ls,...us,...ts,...qi,...ss,...Qi,...es,...ns,...rs({}),...ds,...is};import{jsx as ps,Fragment as d0}from"react/jsx-runtime";import br from"react";function ms(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function fs({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return ms(e)?hs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):ps(d0,{})}function hs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,d)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:s,nodesToJSX:p=>hs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:u=ps("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),br.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return br.cloneElement(u,{key:d,style:m})}return br.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",s),null}}).filter(Boolean)}var kr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:ot}):i=e:i=ot;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&fs({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?gs(m0,{children:s}):gs("div",{className:t??"payload-richtext",children:s})};function Cs(){let t=p0(7),[e]=f0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=g0(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),h0(l,i);let s;return t[5]!==r?(s=xs("div",{className:"debug-jsx-converter",children:xs(kr,{converters:ot,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var x0=$({plugins:[{Component:Cs,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},C0={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as i1}from"lexical";import{jsx as It,jsxs as b0}from"react/jsx-runtime";import"react";var _r=()=>b0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[It("g",{clipPath:"url(#clip0_4397_10817)",children:It("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),It("defs",{children:It("clipPath",{id:"clip0_4397_10817",children:It("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as E0}from"react/jsx-runtime";import{$applyNodeReplacement as S0}from"lexical";import*as ks from"react";import{DecoratorBlockNode as k0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as _0}from"@lexical/utils";import{$applyNodeReplacement as T0}from"lexical";function w0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:bs({relationTo:o,value:e})}:null}var vt=class extends k0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:w0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=bs(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return _0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function bs(t){return T0(new vt({data:t}))}var N0=ks.lazy(()=>import("./RelationshipComponent-UCIWIEVD.js").then(t=>({default:t.RelationshipComponent})));function L0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Be({relationTo:o,value:e})}:null}var we=class extends vt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:L0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Be(o);return r.setFormat(e.format),r}decorate(e,o){return E0(N0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return S0(new we({data:t}))}function Tr(t){return t instanceof we}import{c as z0}from"react/compiler-runtime";import{jsx as X0}from"react/jsx-runtime";import{useLexicalComposerContext as Z0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Y0}from"@lexical/utils";import{$getPreviousSelection as q0,$getSelection as Q0,$isParagraphNode as e1,$isRangeSelection as t1,COMMAND_PRIORITY_EDITOR as o1,createCommand as r1}from"lexical";import{useEffect as n1}from"react";import{c as ws}from"react/compiler-runtime";import{jsx as wr}from"react/jsx-runtime";import{useLexicalComposerContext as Es}from"@lexical/react/LexicalComposerContext.js";import{toast as B0}from"@payloadcms/ui";import{$getNodeByKey as j0,COMMAND_PRIORITY_EDITOR as Ss}from"lexical";import{useEffect as Ns,useState as H0}from"react";import{c as y0}from"react/compiler-runtime";import{jsx as R0}from"react/jsx-runtime";import{useLexicalComposerContext as I0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as v0,useModal as M0}from"@payloadcms/ui";import{$getNodeByKey as _s,$getPreviousSelection as D0,$getRoot as $0,$getSelection as A0,$isRangeSelection as O0,$setSelection as F0}from"lexical";import{useEffect as P0,useState as Ts}from"react";var Mt=t=>{let e=y0(23),[o]=I0(),[r,n]=Ts(null),[l,i]=Ts(!1),[s,d,c]=v0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=M0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let R=A0()??D0();n(R)},e[0]=h):h=e[0];let x=h,w;e[1]!==o||e[2]!==r?(w=()=>{r&&o.update(()=>{if(O0(r)){let{anchor:R,focus:M}=r;_s(R.key)&&_s(M.key)&&F0(r.clone())}else $0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=w):w=e[3];let E=w,N;e[4]!==u?(N=()=>{u()},e[4]=u,e[5]=N):N=e[5];let _=N,C,g;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(C=()=>{if(!l)return;let R=f[a];R&&!R?.isOpen&&(i(!1),setTimeout(()=>{E()},1))},g=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=C,e[11]=g):(C=e[10],g=e[11]),P0(C,g);let b;e[12]!==d?(b=R=>R0(d,{...R,onClick:()=>{x()}}),e[12]=d,e[13]=b):b=e[13];let k;e[14]!==p?(k=()=>{x(),p(),i(!0)},e[14]=p,e[15]=k):k=e[15];let y;return e[16]!==s||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==b||e[21]!==k?(y={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:b,openListDrawer:k},e[16]=s,e[17]=_,e[18]=m,e[19]=a,e[20]=b,e[21]=k,e[22]=y):y=e[22],y};var U0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=j0(o);n&&n.replace(Be({relationTo:e,value:r}))}):t.dispatchCommand(Er,{relationTo:e,value:r})},W0=t=>{let e=ws(14),{enabledCollectionSlugs:o}=t,[r]=Es(),[n,l]=H0(null),i=o?.[0],s;e[0]!==o||e[1]!==i?(s={collectionSlugs:o,selectedCollection:i},e[0]=o,e[1]=i,e[2]=s):s=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Mt(s),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Ve,x=>(l(x?.replace?x?.replace.nodeKey:null),u(),!0),Ss),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Ns(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=x=>{let{collectionSlug:w,doc:E}=x;U0({editor:r,relationTo:w,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let f=p,h;return e[11]!==c||e[12]!==f?(h=wr(c,{onSelect:f}),e[11]=c,e[12]=f,e[13]=h):h=e[13],h},G0=()=>{let t=ws(3),[e]=Es(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ve,V0,Ss),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ns(o,r),null},Ls=({enabledCollectionSlugs:t})=>t?.length?wr(W0,{enabledCollectionSlugs:t}):wr(G0,{});function V0(){return B0.error("No relationship collections enabled"),!0}import{useConfig as K0,useEntityVisibility as J0}from"@payloadcms/ui";import*as ys from"react";var go=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=K0(),{visibleEntities:l}=J0();return ys.useMemo(()=>{let s=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:f}=a;if(l?.collections.includes(m)){if(r){if(!p||!f)continue}else if(f||!p)continue;c&&!c.has(m)||u&&u.has(m)||(s.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:s}},[n,l,r,o,e])};var Er=r1("INSERT_RELATIONSHIP_COMMAND"),Rs=t=>{let e=z0(8),{clientProps:o}=t,[r]=Z0(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=go(i),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Er,l1,o1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),n1(d,c);let u;return e[6]!==s?(u=X0(Ls,{enabledCollectionSlugs:s}),e[6]=s,e[7]=u):u=e[7],u};function l1(t){let e=Q0()||q0();if(t1(e)){let o=Be(t),{focus:r}=e,n=r.getNode();Y0(o),e1(n)&&!n.__first&&n.remove()}return!0}var s1=$({nodes:[we],plugins:[{Component:Rs,position:"normal"}],slashMenu:{groups:[Z([{Icon:_r,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:_r,isActive:({selection:t})=>{if(!i1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Tr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]}});import{c as Ps}from"react/compiler-runtime";import{jsx as se,jsxs as $1}from"react/jsx-runtime";import{useLexicalComposerContext as A1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Bs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as O1,useThrottledEffect as F1,useTranslation as P1}from"@payloadcms/ui";import*as Ee from"react";import{useMemo as B1}from"react";import{c as a1}from"react/compiler-runtime";import{jsx as c1}from"react/jsx-runtime";import{mergeRegister as u1}from"@lexical/utils";import{$addUpdateTag as d1,$getSelection as m1}from"lexical";import{useDeferredValue as p1,useEffect as f1,useState as h1}from"react";var Is="toolbar-popup__button",Dt=t=>{let e=a1(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=h1(l),d=p1(i),c=H(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Is}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Is,u,a,m].filter(Boolean),e[1]=u,e[2]=a,e[3]=m,e[4]=p):p=e[4];let f=p.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let k=m1();if(!k)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:k}):!1,R=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:k}):!0;s(M=>M.active===y&&M.enabled===R?M:{active:y,enabled:R})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,w=Vt(),E,N;e[9]!==r||e[10]!==w||e[11]!==x?(E=()=>{w(x);let k=()=>w(x),y=u1(r.registerUpdateListener(k));return document.addEventListener("mouseup",k),()=>{y(),document.removeEventListener("mouseup",k)}},N=[r,w,x],e[9]=r,e[10]=w,e[11]=x,e[12]=E,e[13]=N):(E=e[12],N=e[13]),f1(E,N);let _;e[14]!==i||e[15]!==r||e[16]!==n?(_=()=>{i.enabled&&r.focus(()=>{r.update(g1),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=_):_=e[17];let C=_,g=x1,b;return e[18]!==o||e[19]!==f||e[20]!==C||e[21]!==n.key?(b=c1("button",{className:f,"data-button-key":n.key,onClick:C,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=C,e[21]=n.key,e[22]=b):b=e[22],b};function g1(){d1("toolbar")}function x1(t){t.preventDefault()}import{c as E1}from"react/compiler-runtime";import{jsx as rt}from"react/jsx-runtime";import Fs,{useCallback as S1,useDeferredValue as N1,useEffect as L1,useMemo as y1}from"react";import{mergeRegister as R1}from"@lexical/utils";import{useTranslation as I1}from"@payloadcms/ui";import{$getSelection as v1}from"lexical";import{jsx as Re,jsxs as vs}from"react/jsx-runtime";import{Button as C1}from"@payloadcms/ui";import{$addUpdateTag as b1,isDOMNode as k1}from"lexical";import xo,{useCallback as _1,useEffect as Co,useMemo as Ds,useRef as Sr,useState as Nr}from"react";import{createPortal as T1}from"react-dom";var Ms="toolbar-popup__dropdown-item",$s=xo.createContext(null);function As({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let d=Ds(()=>[Ms,r===!1?"disabled":"",t?"active":"",l?.key?`${Ms}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Sr(null),u=xo.use($s);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return Co(()=>{c?.current!=null&&a(c)},[c,a]),Re(C1,{"aria-label":s,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{b1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function w1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Nr(),[i,s]=Nr(),d=_1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=Ds(()=>({registerItem:d}),[d]);return Co(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Re($s,{value:u,children:Re("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Os({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:d}){let c=Sr(null),u=Sr(null),[a,m]=Nr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};Co(()=>{let h=u.current,x=c.current;if(a&&h!==null&&x!==null){let{left:w,top:E}=h.getBoundingClientRect(),N=window.scrollY||document.documentElement.scrollTop;x.style.top=`${E+N+h.offsetHeight+5}px`,x.style.left=`${Math.min(w-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),Co(()=>{let h=u.current;if(h!==null&&a){let x=w=>{let E=w.target;k1(E)&&(d&&c.current&&c.current.contains(E)||h.contains(E)||m(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,u,a,d]);let f=T1(Re(w1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return vs(xo.Fragment,{children:[vs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:u,type:"button",children:[l&&Re(l,{}),s&&Re("span",{className:"toolbar-popup__dropdown-label",children:s}),Re("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Re(xo.Fragment,{children:f})]})}var Lr="toolbar-popup__dropdown",M1=t=>{let e=E1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=I1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&rt(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==u){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=rt(As,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?rt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:rt("span",{className:"text",children:p})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=u,e[13]=a}else a=e[13];return a},D1=Fs.memo(M1),je=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:d})=>{let[c,u]=Fs.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=N1(c),m=H(),{items:p,key:f}=r,h=Vt(),x=S1(()=>{o.getEditorState().read(()=>{let E=v1();if(!E)return;let N=[],_=[],C=[];for(let g of p)g.isActive&&(!s||N.length<s)&&g.isActive({editor:o,editorConfigContext:m,selection:E})&&(N.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:E})&&C.push(g.key):C.push(g.key);u({activeItemKeys:N,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:E}):!0,enabledItemKeys:C}),d&&d({activeItems:_})})},[o,m,r,p,s,d]);L1(()=>(h(x),R1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let w=y1(()=>p?.length?p.map(E=>rt(D1,{active:a.activeItemKeys.includes(E.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(E.key),item:E},E.key)):null,[p,a,t,o]);return rt(Os,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[Lr,`${Lr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${Lr}-items`,...l||[]],label:i,children:w},f)};function j1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(Dt,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function H1(t){let e=Ps(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=P1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Ee.useState(void 0),[p,f]=Ee.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Ee.useEffect(h,x);let w;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==u?(w=C=>{let{activeItems:g}=C;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let b=g[0],k=b.key;b.label&&(k=typeof b.label=="function"?b.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):b.label),k.length>25&&(k=k.substring(0,25)+"..."),g.length===1?(m(k),f(()=>b.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=u,e[12]=w):w=e[12];let E=w,N=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==E||e[21]!==N?(_=$1("div",{className:N,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?se(je,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):se(je,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):null,l.type==="buttons"&&l.items.length?l.items.map(C=>se(j1,{anchorElem:o,editor:r,item:C},C.key)):null,i<n.features.toolbarFixed?.groups.length-1&&se("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=E,e[21]=N,e[22]=_):_=e[22],_}function U1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ee.useRef(null),i=Bs(),{y:s}=O1(),d=B1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return F1(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,s]),se("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:i&&se(Ee.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>se(H1,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var js=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return js(t.parentEditor)}return!1},Hs=t=>{let e=Ps(6),{clientProps:o}=t,[r]=A1(),n=H();if(!Bs())return null;let{editorConfig:i}=n,s=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==s||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=js(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=se(U1,{anchorElem:document.body,editor:s,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=s,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var W1=$({plugins:[{Component:Hs,position:"aboveContainer"}]});import{c as Gs}from"react/compiler-runtime";import{jsx as ue,jsxs as Vs}from"react/jsx-runtime";import{useLexicalComposerContext as G1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as V1}from"@lexical/react/useLexicalEditable";import{mergeRegister as Ks}from"@lexical/utils";import{$getSelection as Js,$isRangeSelection as Us,$isTextNode as K1,COMMAND_PRIORITY_LOW as J1,getDOMSelection as zs,SELECTION_CHANGE_COMMAND as z1}from"lexical";import{useCallback as ko,useEffect as $t,useRef as Ws,useState as X1}from"react";import*as _o from"react";import{createPortal as Z1}from"react-dom";function yr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function bo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=d.top-a.height-c,h=d.left-l;i==="center"&&(h=d.left+d.width/2-a.width/2);let x=0;return!e&&f<p.top&&!s&&(x=a.height+d.height+c*2,f+=x),i==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function Y1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ue(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ue(Dt,{editor:e,item:o,children:ue(o.ChildComponent,{})},o.key):null}function q1(t){let e=Gs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=H(),[s,d]=_o.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],_o.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let w=x[0];d(()=>w?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(f=Vs("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ue(je,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):ue(je,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ue(Y1,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ue("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function Q1({anchorElem:t,editor:e}){let o=Ws(null),r=Ws(null),{editorConfig:n}=H(),l=ko(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),i=ko(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),s=ko(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);$t(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let d=ko(()=>{let c=Js(),u=zs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let f=yr(u,p),h=bo({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&bo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return $t(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),$t(()=>(e.getEditorState().read(()=>{d()}),Ks(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(z1,()=>(d(),!1),J1))),[e,d]),Vs("div",{className:"inline-toolbar-popup",ref:o,children:[ue("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>ue(q1,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function eh(t,e){let o=Gs(12),[r,n]=X1(!1),l=V1(),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Js(),f=zs(t._window),h=t.getRootElement();if(f!==null&&(!Us(p)||h===null||!h.contains(f.anchorNode))){n(!1);return}if(!Us(p))return;if(p.getTextContent()!==""){let w=p.getNodes(),E=!1;for(let N of w)if(K1(N)){n(!0),E=!0;break}E||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let s=i,d,c;o[2]!==s?(d=()=>(document.addEventListener("selectionchange",s),document.addEventListener("mouseup",s),()=>{document.removeEventListener("selectionchange",s),document.removeEventListener("mouseup",s)}),c=[s],o[2]=s,o[3]=d,o[4]=c):(d=o[3],c=o[4]),$t(d,c);let u,a;if(o[5]!==t||o[6]!==s?(u=()=>Ks(t.registerUpdateListener(()=>{s()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,s],o[5]=t,o[6]=s,o[7]=u,o[8]=a):(u=o[7],a=o[8]),$t(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=Z1(ue(Q1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Xs=t=>{let{anchorElem:e}=t,[o]=G1();return eh(o,e)};var th=$({plugins:[{Component:Xs,position:"floatingAnchorElem"}]});import{TableCellNode as Gg,TableNode as Vg,TableRowNode as Kg}from"@lexical/table";import{jsx as Zs}from"react/jsx-runtime";import"react";var Rr=()=>Zs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Zs("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as oh,$createTableNode as rh,$createTableRowNode as nh,$isTableCellNode as Ys,$isTableNode as Ir,$isTableRowNode as vr,TableCellHeaderStates as To,TableCellNode as lh,TableNode as ih,TableRowNode as sh}from"@lexical/table";import{$isParagraphNode as ah,$isTextNode as ch}from"lexical";var Qs=/^\|(.+)\|\s?$/,uh=/^(\| ?:?-*:? ?)+\|\s?$/,ea=({allTransformers:t})=>({type:"element",dependencies:[ih,sh,lh],export:e=>{if(!Ir(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!vr(r))continue;let l=!1;for(let i of r.getChildren())Ys(i)&&(n.push(Gt(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===To.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
59
- `)},regExp:Qs,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(uh.test(n)){let a=e.getPreviousSibling();if(!a||!Ir(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!vr(p))return;p.getChildren().forEach(f=>{Ys(f)&&f.setHeaderStyles(To.ROW,To.ROW)}),e.remove();return}let l=qs(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),d=l.length;for(;s&&!(!ah(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!ch(a))break;let m=qs(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=rh();for(let a of i){let m=nh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ta("",t))}let u=e.getPreviousSibling();Ir(u)&&dh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function dh(t){let e=t.getFirstChild();return vr(e)?e.getChildrenSize():0}var ta=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=oh(To.NO_STATUS);return Wt(t,e,o),o},qs=(t,e)=>{let o=t.match(Qs);return!o||!o[1]?null:o[1].split("|").map(r=>ta(r,e))};import{c as ph}from"react/compiler-runtime";import{jsx as P,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as fh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ra,$deleteTableColumnAtSelection as hh,$deleteTableRowAtSelection as gh,$getNodeTriplet as xh,$getTableCellNodeFromLexicalNode as na,$getTableColumnIndexFromTableCellNode as Ch,$getTableNodeFromLexicalNodeOrThrow as ve,$getTableRowIndexFromTableCellNode as bh,$insertTableColumnAtSelection as kh,$insertTableRowAtSelection as _h,$isTableCellNode as sa,$isTableSelection as At,$mergeCells as Th,$unmergeCell as wh,getTableElement as Dr,getTableObserverFromTableElement as $r,TableCellHeaderStates as Ie,TableCellNode as Eh}from"@lexical/table";import{mergeRegister as Sh}from"@lexical/utils";import{useScrollInfo as Nh}from"@payloadcms/ui";import{$getSelection as Eo,$isElementNode as Lh,$isRangeSelection as Ar,$isTextNode as yh,$setSelection as Rh,COMMAND_PRIORITY_CRITICAL as Ih,getDOMSelection as vh,isDOMNode as Mh,SELECTION_CHANGE_COMMAND as Dh}from"lexical";import*as Or from"react";import{useCallback as ae,useEffect as nt,useRef as wo,useState as lt}from"react";import{createPortal as aa}from"react-dom";import{jsx as Mr,jsxs as mh}from"react/jsx-runtime";import"react";var oa=()=>mh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Mr("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"}),Mr("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"}),Mr("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 la(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function $h(){let t=Eo();if(Ar(t)&&!t.isCollapsed()||At(t)&&!t.anchor.is(t.focus)||!Ar(t)&&!At(t))return!1;let[e]=xh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Ah(t){let e=t.getLastDescendant();yh(e)?e.select():Lh(e)?e.selectEnd():e!==null&&e.selectNext()}function Oh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=ia(),i=wo(null),[s,d]=lt(n),[c,u]=lt({columns:1,rows:1}),[a,m]=lt(!1),[p,f]=lt(!1),{y:h}=Nh();nt(()=>l.registerMutationListener(Eh,T=>{T.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{d(s.getLatest())})},{skipInitialization:!0}),[l,s]),nt(()=>{l.getEditorState().read(()=>{let T=Eo();if(At(T)){let S=la(T);u(la(T)),m(S.columns>1||S.rows>1)}f($h())})},[l]),nt(()=>{let T=e.current,S=i.current,I=l.getRootElement();if(T!=null&&S!=null&&I!=null){let A=I.getBoundingClientRect(),v=T.getBoundingClientRect();S.style.opacity="1";let O=S.getBoundingClientRect(),D=5,G=v.right+D;if(G+O.width>window.innerWidth||G+O.width>A.right){let z=v.left-O.width-D;G=(z<0?D:z)+window.pageXOffset}S.style.left=`${G+window.pageXOffset}px`;let q=v.top;if(q+O.height>window.innerHeight){let z=v.bottom-O.height;q=z<0?D:z}S.style.top=`${q}px`}},[e,i,l,h]),nt(()=>{function T(S){i.current!=null&&e.current!=null&&Mh(S.target)&&!i.current.contains(S.target)&&!e.current.contains(S.target)&&r(!1)}return window.addEventListener("click",T),()=>window.removeEventListener("click",T)},[r,e]);let x=ae(()=>{l.update(()=>{if(s.isAttached()){let T=ve(s),S=Dr(T,l.getElementByKey(T.getKey()));if(S===null)throw new Error("Expected to find tableElement in DOM");let I=$r(S);I!==null&&I.$clearHighlight(),T.markDirty(),d(s.getLatest())}Rh(null)})},[l,s]),w=()=>{l.update(()=>{let T=Eo();if(!At(T))return;let I=T.getNodes().filter(sa),A=Th(I);A&&(Ah(A),o())})},E=()=>{l.update(()=>{wh()})},N=ae(T=>{l.update(()=>{for(let S=0;S<c.rows;S++)_h(T);o()})},[l,o,c.rows]),_=ae(T=>{l.update(()=>{for(let S=0;S<c.columns;S++)kh(T);o()})},[l,o,c.columns]),C=ae(()=>{l.update(()=>{gh(),o()})},[l,o]),g=ae(()=>{l.update(()=>{ve(s).remove(),x(),o()})},[l,s,x,o]),b=ae(()=>{l.update(()=>{hh(),o()})},[l,o]),k=ae(()=>{l.update(()=>{let T=ve(s),S=bh(s),[I]=ra(T,null,null),A=new Set,v=s.getHeaderStyles()^Ie.ROW;if(I[S])for(let O=0;O<I[S].length;O++){let D=I[S][O];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Ie.ROW)))}x(),o()})},[l,s,x,o]),y=ae(()=>{l.update(()=>{let T=ve(s),S=Ch(s),[I]=ra(T,null,null),A=new Set,v=s.getHeaderStyles()^Ie.COLUMN;if(I)for(let O=0;O<I.length;O++){let D=I?.[O]?.[S];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Ie.COLUMN)))}x(),o()})},[l,s,x,o]),R=ae(()=>{l.update(()=>{if(s.isAttached()){let T=ve(s);T&&T.setRowStriping(!T.getRowStriping())}x(),o()})},[l,s,x,o]),M=ae(()=>{l.update(()=>{if(s.isAttached()){let T=ve(s);T&&T.setFrozenColumns(T.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:()=>w(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(L=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),aa(Se("div",{className:"table-action-menu-dropdown",onClick:T=>{T.stopPropagation()},ref:i,children:[L?Se(Or.Fragment,{children:[L,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>M(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>N(!1),type:"button",children: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:()=>N(!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:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>k(),type:"button",children: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 Fh({anchorElem:t,cellMerge:e}){let[o]=ia(),r=wo(null),n=wo(null),[l,i]=lt(!1),[s,d]=lt(null),c=ae(()=>{let a=r.current,m=Eo(),p=vh(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return h();let x=o.getRootElement(),w=null,E=null;if(Ar(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=na(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return h();let C=ve(_),g=Dr(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=$r(g),d(_)}else if(At(m)){let _=na(m.anchor.getNode());if(!sa(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=ve(_),g=Dr(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=$r(g),E=o.getElementByKey(_.getKey())}else if(!f)return h();if(w===null||E===null)return h();let N=!w||!w.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",N),a.classList.toggle("table-cell-action-button-container--inactive",!N),N){let _=E.getBoundingClientRect(),C=t.getBoundingClientRect(),g=_.top-C.top,b=_.right-C.left;a.style.transform=`translate(${b}px, ${g}px)`}},[o,t]);nt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Sh(o.registerUpdateListener(p),o.registerCommand(Dh,p,Ih),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(Or.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(oa,{})}),l&&P(Oh,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var ca=t=>{let e=ph(3),{anchorElem:o}=t,r=fh(),n;return e[0]!==o||e[1]!==r?(n=aa(r?P(Fh,{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 Ph}from"react/compiler-runtime";import{jsx as No,jsxs as Bh}from"react/jsx-runtime";import{useLexicalComposerContext as jh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Hh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Uh,$getTableNodeFromLexicalNodeOrThrow as Fr,$getTableRowIndexFromTableCellNode as Wh,$isTableCellNode as ua,$isTableRowNode as Gh,getDOMCellFromTarget as Vh,getTableElement as Kh,TableNode as da}from"@lexical/table";import{calculateZoomLevel as ma,mergeRegister as Jh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Pr,isHTMLElement as zh,SKIP_SCROLL_INTO_VIEW_TAG as pa}from"lexical";import*as ha from"react";import{useCallback as Ot,useEffect as Br,useRef as So,useState as it}from"react";import{createPortal as Xh}from"react-dom";var Zh=33,fa=92;function Yh({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},[]),w=M=>(M.buttons&1)===1;Br(()=>{let M=new Set;return Jh(t.registerMutationListener(da,L=>{for(let[T,S]of L)S==="destroyed"?M.delete(T):M.add(T);l(M.size>0)}),t.registerNodeTransform(da,L=>{if(L.getColWidths())return L;let T=L.getColumnCount(),S=fa;return L.setColWidths(Array(T).fill(S)),L}))},[t]),Br(()=>{if(!n)return;let M=I=>{let A=I.target;if(zh(A)){if(f){c({x:I.clientX,y:I.clientY});return}if(p(w(I)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let v=Vh(A);v&&u!==v?t.getEditorState().read(()=>{let O=Pr(v.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let D=Fr(O),G=Kh(D,t.getElementByKey(D.getKey()));if(!G)throw new Error("TableCellResizer: Table element not found.");e.current=A,r.current=G.getBoundingClientRect(),a(v)},{editor:t}):v==null&&x()}}},L=I=>{p(!0)},T=I=>{p(!1)},S=t.registerRootListener((I,A)=>{A?.removeEventListener("mousemove",M),A?.removeEventListener("mousedown",L),A?.removeEventListener("mouseup",T),I?.addEventListener("mousemove",M),I?.addEventListener("mousedown",L),I?.addEventListener("mouseup",T)});return()=>{S()}},[u,f,t,n,x]);let E=M=>M==="bottom",N=Ot(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Pr(u.elem);if(!ua(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Fr(L),S=Wh(L),I=T.getChildren(),v=L.getColSpan()===T.getColumnCount()?S:S+L.getRowSpan()-1;if(v>=I.length||v<0)throw new Error("Expected table cell to be inside of table row.");let O=I[v];if(!Gh(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,Zh);O.setHeight(G)},{tag:pa})},[u,t]),_=(M,L)=>L.getElementByKey(M.getKey())?.clientHeight,C=(M,L)=>{let T;return L.forEach(S=>{S.forEach((I,A)=>{I.cell===M&&(T=A)})}),T},g=Ot(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Pr(u.elem);if(!ua(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Fr(L),[S]=Uh(T,null,null),I=C(L,S);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let A=T.getColWidths();if(!A)return;let v=A[I];if(v===void 0)return;let O=[...A],D=Math.max(v+M,fa);O[I]=D,T.setColWidths(O)},{tag:pa})},[u,t]),b=Ot(M=>{let L=T=>{if(T.preventDefault(),T.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:S,y:I}=s.current;if(u===null)return;let A=ma(T.target);if(E(M)){let v=(T.clientY-I)/A;N(v)}else{let v=(T.clientX-S)/A;g(v)}x(),document.removeEventListener("mouseup",L)}};return L},[u,x,g,N]),k=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",b(M))},[u,b]),[y,R]=it({bottom:null,left:null,right:null,top:null});return Br(()=>{if(u){let{height:M,left:L,top:T,width:S}=u.elem.getBoundingClientRect(),I=ma(u.elem),A=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${A}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+T+M-A/2}px`,width:`${S}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${M}px`,left:`${window.scrollX+L+S-A/2}px`,top:`${window.scrollY+T}px`,width:`${A}px`}},O=r.current;f&&d&&O&&(E(f)?(v[f].left=`${window.scrollX+O.left}px`,v[f].top=`${window.scrollY+d.y/I}px`,v[f].height="3px",v[f].width=`${O.width}px`):(v[f].top=`${window.scrollY+O.top}px`,v[f].left=`${window.scrollX+d.x/I}px`,v[f].width="3px",v[f].height=`${O.height}px`),v[f].backgroundColor="#adf"),R(v)}else R({bottom:null,left:null,right:null,top:null})},[u,f,d]),No("div",{ref:o,children:u!=null&&!m&&Bh(ha.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 ga=()=>{let t=Ph(3),[e]=jh(),o=Hh(),r;return t[0]!==e||t[1]!==o?(r=o?Xh(No(Yh,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as lg}from"react/compiler-runtime";import{jsx as jr,jsxs as ig,Fragment as sg}from"react/jsx-runtime";import{useLexicalComposerContext as ag}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ea}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as cg,$getTableColumnIndexFromTableCellNode as ug,$getTableRowIndexFromTableCellNode as dg,$insertTableColumnAtSelection as mg,$insertTableRowAtSelection as pg,$isTableCellNode as fg,$isTableNode as ba,getTableElement as hg,TableNode as gg}from"@lexical/table";import{$findMatchingParent as xg,mergeRegister as Cg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ka,isHTMLElement as bg}from"lexical";import{useEffect as _a,useMemo as kg,useRef as Ta,useState as Lo}from"react";import"react";import{createPortal as _g}from"react-dom";import{c as og}from"react/compiler-runtime";import{useEffect as rg,useRef as ng}from"react";var qh="Expected a function",Qh=Math.max,eg=Math.min;function tg(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(qh);e=e||0,typeof o=="object"&&(s=!!o.leading,d="maxWait"in o,c=d?Qh(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let b=r,k=i;return r=i=void 0,l=g,u=t.apply(k,b),u}function f(g){return l=g,a=setTimeout(w,e),s?p(g):u}function h(g){let b=g-n,k=g-l,y=e-b;return d?eg(y,c-k):y}function x(g){let b=g-n,k=g-l;return n===void 0||b>=e||b<0||d&&k>=c}function w(){let g=Date.now();if(x(g))return E(g);a=setTimeout(w,h(g))}function E(g){return a=void 0,m&&r?p(g):(r=i=void 0,u)}function N(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function _(){return a===void 0?u:E(Date.now())}function C(){let g=Date.now(),b=x(g);if(r=arguments,i=this,n=g,b){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(w,e),p(n)}return a===void 0&&(a=setTimeout(w,e)),u}return C.cancel=N,C.flush=_,C}var xa=tg;function Ca(t,e,o){let r=og(6),n=ng(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=xa(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]),rg(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 wa=20;function Tg({anchorElem:t}){let[e]=ag(),o=Ea(),r=H(),[n,l]=Lo(!1),[i,s]=Lo(!1),[d,c]=Lo(!1),[u,a]=Lo({}),m=Ta(new Set),p=Ta(null),f=Ca(w=>{let{isOutside:E,tableDOMNode:N}=wg(w,r.editorConfig?.lexical);if(E){l(!1),s(!1);return}if(!N)return;p.current=N;let _=null,C=null,g=null;if(e.getEditorState().read(()=>{let v=ka(N);if(fg(v)){let O=xg(v,D=>ba(D));if(!ba(O))return;if(g=hg(O,e.getElementByKey(O.getKey())),g){let D=O.getChildrenSize(),G=O.getChildAtIndex(0)?.getChildrenSize(),q=dg(v),z=ug(v);q===D-1?_=v:z===G-1&&(C=v)}}},{editor:e}),!g)return;let b=g.parentElement;if(!b)return;let{bottom:k,height:y,left:R,right:M,width:L,y:T}=g.getBoundingClientRect(),S=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(S=b.scrollWidth>b.clientWidth);let{left:I,y:A}=t.getBoundingClientRect();_?(s(!1),l(!0),a({height:wa,left:S&&b?b.offsetLeft:R-I,top:k-A+5,width:S&&b?b.offsetWidth:L})):C&&(s(!0),l(!1),a({height:y,left:M-I+5,top:T-A,width:wa}))},50,250),h=kg(()=>new ResizeObserver(()=>{l(!1),s(!1)}),[]);_a(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),s(!1),document.removeEventListener("mousemove",f)}},[d,f]),_a(()=>Cg(e.registerMutationListener(gg,w=>{e.getEditorState().read(()=>{let E=!1;for(let[N,_]of w)switch(_){case"created":{m.current.add(N),E=!0;break}case"destroyed":{m.current.delete(N),E=!0;break}default:break}if(E){h.disconnect();for(let N of m.current){let{tableElement:_}=cg(N);h.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=w=>{e.update(()=>{p.current&&(ka(p.current)?.selectEnd(),w?(pg(),l(!1)):(mg(),s(!1)))})};return o?ig(sg,{children:[n&&jr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),i&&jr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function wg(t,e){let o=t.target;if(bg(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 Sa(t){let e=lg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Ea())return null;let l;return e[0]!==r?(l=_g(jr(Tg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Eg}from"react/compiler-runtime";import{jsx as Hr,jsxs as Sg}from"react/jsx-runtime";import{useLexicalComposerContext as Ng}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Lg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as yg,TableCellNode as Rg,TableNode as Ig,TableRowNode as vg}from"@lexical/table";import{mergeRegister as Mg}from"@lexical/utils";import{formatDrawerSlug as Dg,useEditDepth as $g}from"@payloadcms/ui";import{$getSelection as Ag,$isRangeSelection as Og,COMMAND_PRIORITY_EDITOR as Fg,createCommand as Pg}from"lexical";import{createContext as Bg,use as jg,useEffect as Hg,useMemo as Ug,useState as Wg}from"react";import*as Na from"react";var yo=Pg("OPEN_EMBED_DRAWER_COMMAND"),La=Bg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ya({children:t}){let[e,o]=Wg({cellEditorConfig:null,cellEditorPlugins:null});return Hr(La,{value:Ug(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ra=()=>{let t=Eg(16),[e]=Ng(),o=jg(La),r=$g(),{fieldProps:n,uuid:l}=H(),{schemaPath:i}=n,s="lexical-table-create-"+l,d;t[0]!==r||t[1]!==s?(d=Dg({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([Ig,vg,Rg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Mg(e.registerCommand(yo,()=>{let h=null;return e.getEditorState().read(()=>{let x=Ag();Og(x)&&(h=x)}),h&&u(),!0},Fg))},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],Hg(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(yg,{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=Sg(Na.Fragment,{children:[Hr(mt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Hr(Lg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var Jg=$({markdownTransformers:[ea],nodes:[Vg,Gg,Kg],plugins:[{Component:Ra,position:"normal"},{Component:ga,position:"normal"},{Component:ca,position:"floatingAnchorElem"},{Component:Sa,position:"floatingAnchorElem"}],providers:[ya],slashMenu:{groups:[Z([{Icon:Rr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Rr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]}});import{$isNodeSelection as Rx}from"lexical";import{jsx as Ur,jsxs as zg}from"react/jsx-runtime";import"react";var Wr=()=>zg("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:[Ur("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"}),Ur("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"}),Ur("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 $a}from"react/jsx-runtime";import Aa from"bson-objectid";import{$applyNodeReplacement as ex}from"lexical";import*as Oa from"react";import Xg 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 Xg.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as Zg}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Yg}from"@lexical/utils";import va from"bson-objectid";import{$applyNodeReplacement as qg}from"lexical";var Ft=class extends Zg{__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,Ia),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new va.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ia({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Yg(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 Ia({data:t}){return t?.id||(t.id=new va.default().toHexString()),qg(new Ft({data:t}))}import{jsx as Ma}from"react/jsx-runtime";import{ShimmerEffect as Qg}from"@payloadcms/ui";var Da=()=>Ma("div",{className:"lexical-upload",children:Ma(Qg,{height:"95px",width:"203px"})});var tx=Oa.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 Aa.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?$a(Da,{}):$a(tx,{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 Aa.default().toHexString()),ex(new de({data:t}))}function st(t){return t instanceof de}import{c as cx}from"react/compiler-runtime";import{jsx as ux}from"react/jsx-runtime";import{useLexicalComposerContext as dx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ja,$insertNodeToNearestRoot as Kr,mergeRegister as mx}from"@lexical/utils";import{useBulkUpload as px,useEffectEvent as fx,useModal as hx}from"@payloadcms/ui";import Jr from"bson-objectid";import{$createRangeSelection as gx,$getPreviousSelection as Ua,$getSelection as Wa,$isParagraphNode as zr,$isRangeSelection as Ga,$setSelection as xx,COMMAND_PRIORITY_EDITOR as Cx,COMMAND_PRIORITY_LOW as Va,createCommand as bx,DROP_COMMAND as kx,getDOMSelectionFromTarget as _x,isHTMLElement as Ka,PASTE_COMMAND as Tx}from"lexical";import{useEffect as wx}from"react";import{c as Fa}from"react/compiler-runtime";import{jsx as Gr}from"react/jsx-runtime";import{useLexicalComposerContext as Pa}from"@lexical/react/LexicalComposerContext.js";import{toast as ox}from"@payloadcms/ui";import{$getNodeByKey as rx,COMMAND_PRIORITY_EDITOR as Ba}from"lexical";import{useEffect as ja,useState as nx}from"react";var lx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=rx(o);n&&n.replace(me({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Vr,{fields:null,relationTo:e,value:r})},ix=t=>{let e=Fa(13),{enabledCollectionSlugs:o}=t,[r]=Pa(),[n,l]=nx(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),Ba),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),ja(u,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:w}=h;s(),lx({editor:r,relationTo:x,replaceNodeKey:n,value:w.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=Gr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},sx=()=>{let t=Fa(3),[e]=Pa(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,ax,Ba),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ja(o,r),null},Ha=({enabledCollectionSlugs:t})=>t?.length?Gr(ix,{enabledCollectionSlugs:t}):Gr(sx,{});function ax(){return ox.error("No upload collections enabled"),!0}function Ex(t){let e=t.target;return!!(Ka(e)&&!e.closest("code, span.editor-image")&&Ka(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Sx(t){let e,o=_x(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Vr=bx("INSERT_UPLOAD_COMMAND"),za=t=>{let e=cx(21),{clientProps:o}=t,[r]=dx(),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}=px(),{isModalOpen:f,openModal:h}=hx(),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=C=>{let{files:g}=C;if(g?.length!==0&&(u(b=>[...b??[],...g.map(Nx)]),!f(d))){if(!s.length||!s[0])return;c(s[0]),p(s),a(()=>{r.update(Lx)}),m(b=>{let k=new Map(b.map(yx));r.update(()=>{for(let y of Ja()){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 Jr.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 w=fx(x),E;e[14]!==r||e[15]!==w?(E=()=>{if(!r.hasNodes([de]))throw new Error("UploadPlugin: UploadNode not registered on editor");return mx(r.registerNodeTransform(de,C=>{let g=C.getData();if(!g?.pending)return;(async function(){let y=null,R=g?.pending?.src,M=g?.pending?.formID;if(R?.startsWith("data:")){let L=R.match(/data:(image\/[a-zA-Z]+);base64,/),T=L?L[1]:"image/png",S=R.replace(/^data:image\/[a-zA-Z]+;base64,/,""),I=atob(S),A=new Array(I.length);for(let D=0;D<I.length;D++)A[D]=I.charCodeAt(D);let v=new Uint8Array(A);y={alt:void 0,file:new File([v],"pasted-image."+T?.split("/",2)[1],{type:T}),formID:M}}else if(R?.startsWith("http")||R?.startsWith("https")){let T=await(await fetch(R)).blob(),S=R.split("/").pop()||"pasted-image"+T.type.split("/",2)[1];y={alt:void 0,file:new File([T],S,{type:T.type}),formID:M}}y&&w({files:[y]})})()}),r.registerCommand(Vr,C=>(r.update(()=>{let g=Wa()||Ua();if(Ga(g)){let b=me({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:k}=g,y=k.getNode();Kr(b),zr(y)&&!y.__first&&y.remove()}}),!0),Cx),r.registerCommand(Tx,C=>{if(!(C instanceof ClipboardEvent))return!1;let g=C.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Jr.default().toHexString()})}),b.length?(r.update(()=>{let k=Wa()||Ua();if(Ga(k))for(let y of b){let R=me({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:M}=k,L=M.getNode();Kr(R),zr(L)&&!L.__first&&L.remove()}}),w({files:b}),!0):!1},Va),r.registerCommand(kx,C=>{if(!(C instanceof DragEvent))return!1;let g=C.dataTransfer;if(!g?.types?.length)return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Jr.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),r.update(()=>{if(Ex(C)){let k=Sx(C),y=gx();k!=null&&y.applyDOMRange(k),xx(y);for(let R of b){let M=me({data:{pending:{formID:R.formID,src:URL.createObjectURL(R.file)}}}),{focus:L}=y,T=L.getNode();Kr(M),zr(T)&&!T.__first&&T.remove()}}}),w({files:b}),!0):!1},Va))},e[14]=r,e[15]=w,e[16]=E):E=e[16];let N;e[17]!==r?(N=[r],e[17]=r,e[18]=N):N=e[18],wx(E,N);let _;return e[19]!==s?(_=ux(Ha,{enabledCollectionSlugs:s}),e[19]=s,e[20]=_):_=e[20],_};function Nx(t){return{file:t.file,formID:t.formID}}function Lx(){for(let t of Ja()){let e=t.node;st(e)&&e.getData()?.pending&&e.remove()}}function yx(t){return[t.formID,t]}var Ix=$({nodes:[de],plugins:[{Component:za,position:"normal"}],slashMenu:{groups:[Z([{Icon:Wr,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:Wr,isActive:({selection:t})=>{if(!Rx(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 Mx}from"react/compiler-runtime";import{jsx as Yr}from"react/jsx-runtime";import{ShimmerEffect as Dx,useConfig as $x}from"@payloadcms/ui";import{lazy as Ax,Suspense as Ox,useEffect as Fx,useState as Px}from"react";var Xa={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 Xr={namespace:"lexical",theme:Xa};function Za({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 vx}from"payload/shared";var Ya=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?vx(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 Zr(t,e,o){return{admin:o,features:Ya(t),lexical:e,resolvedFeatureMap:t}}var Bx=Ax(()=>import("./Field-QUXIGJRC.js").then(t=>({default:t.RichText}))),jx=t=>{let e=Mx(18),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let u=c,a;e[2]!==n?(a=n===void 0?{}:n,e[2]=n,e[3]=a):a=e[3];let m=a,p=s===void 0?Xr:s,{config:f}=$x(),[h,x]=Px(null),w,E;e[4]!==u||e[5]!==r||e[6]!==f||e[7]!==m||e[8]!==l||e[9]!==i||e[10]!==h||e[11]!==p||e[12]!==d?(w=()=>{if(h)return;let _=[];for(let g of Object.values(r))g.clientFeatureProvider&&_.push(g.clientFeatureProvider(g.clientFeatureProps));let C=Za({config:f,featureClientImportMap:m,featureClientSchemaMap:l,field:i,schemaPath:d??i.name,unSanitizedEditorConfig:{features:_,lexical:p}});x(Zr(C,p,u))},E=[u,r,f,m,l,i,h,p,d],e[4]=u,e[5]=r,e[6]=f,e[7]=m,e[8]=l,e[9]=i,e[10]=h,e[11]=p,e[12]=d,e[13]=w,e[14]=E):(w=e[13],E=e[14]),Fx(w,E);let N;return e[15]!==h||e[16]!==t?(N=Yr(Ox,{fallback:Yr(Dx,{height:"35vh"}),children:h&&Yr(Bx,{...t,editorConfig:h})}),e[15]=h,e[16]=t,e[17]=N):N=e[17],N};function Hx(t){return t instanceof HTMLElement}function Ux(...t){return t.filter(Boolean).join(" ")}var Io=new WeakMap;function qa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function vo(t,e){let o=Io.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=qa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let d=qa(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},Io.set(t,o)}return o.listeners.add(e),()=>{Wx(t,e)}}function Wx(t,e){let o=Io.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Io.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Gx(t,e){return vo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Vx(t,e){return vo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Kx(t,e){return vo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Jx(t,e){return vo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as zx}from"react/compiler-runtime";import{jsx as Xx}from"react/jsx-runtime";import"react";var Zx=()=>{let t=zx(2),{EditButton:e}=he(),o;return t[0]!==e?(o=e?Xx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Yx}from"react/compiler-runtime";import{jsx as qx}from"react/jsx-runtime";import"react";var Qx=()=>{let t=Yx(2),{RemoveButton:e}=he(),o;return t[0]!==e?(o=e?qx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as eC}from"react/compiler-runtime";import{jsx as tC}from"react/jsx-runtime";import"react";var oC=()=>{let t=eC(2),{Label: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=t=>{let e=rC(3),{children:o}=t,{InlineBlockContainer:r}=he(),n;return e[0]!==r||e[1]!==o?(n=r?nC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as iC}from"react/jsx-runtime";import"react";var sC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=ge();return r?iC(r,{...o,children:e}):null};import{c as aC}from"react/compiler-runtime";import{jsx as cC}from"react/jsx-runtime";import"react";var uC=()=>{let t=aC(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?cC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as dC}from"react/compiler-runtime";import{jsx as mC}from"react/jsx-runtime";import"react";var pC=()=>{let t=dC(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?mC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as fC}from"qs-esm";var hC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let d=fC({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 Qa={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
58
+ `,us="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ds="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",h0=new RegExp("^[^"+ds+"]*["+us+"]"),g0=new RegExp("^[^"+us+"]*["+ds+"]"),x0={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},b0={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},k0={[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"},_0={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},T0={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};var ms={text:({node:t})=>{let e=t.text;return t.format&F.IS_BOLD&&(e=je("strong",{children:e})),t.format&F.IS_ITALIC&&(e=je("em",{children:e})),t.format&F.IS_STRIKETHROUGH&&(e=je("span",{style:{textDecoration:"line-through"},children:e})),t.format&F.IS_UNDERLINE&&(e=je("span",{style:{textDecoration:"underline"},children:e})),t.format&F.IS_CODE&&(e=je("code",{children:e})),t.format&F.IS_SUBSCRIPT&&(e=je("sub",{children:e})),t.format&F.IS_SUPERSCRIPT&&(e=je("sup",{children:e})),e}};import{jsx as Dt}from"react/jsx-runtime";var ps={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Dt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Dt("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(Dt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Dt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Dt("picture",{children:n})}};var nt={...ss,...ms,...rs,...es,...cs,...ts,...os,...is,...ls({}),...ps,...as};import{jsx as hs,Fragment as w0}from"react/jsx-runtime";import _r from"react";function fs(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function gs({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return fs(e)?xs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):hs(w0,{})}function xs({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=>xs({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=hs("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`),_r.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return _r.cloneElement(u,{key:d,style:m})}return _r.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",s),null}}).filter(Boolean)}var Tr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:nt}):i=e:i=nt;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&gs({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?Cs(E0,{children:s}):Cs("div",{className:t??"payload-richtext",children:s})};function ks(){let t=S0(7),[e]=N0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=y0(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]),L0(l,i);let s;return t[5]!==r?(s=bs("div",{className:"debug-jsx-converter",children:bs(Tr,{converters:nt,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var R0=$({plugins:[{Component:ks,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},I0={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 C1}from"lexical";import{jsx as $t,jsxs as v0}from"react/jsx-runtime";import"react";var wr=()=>v0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$t("g",{clipPath:"url(#clip0_4397_10817)",children:$t("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),$t("defs",{children:$t("clipPath",{id:"clip0_4397_10817",children:$t("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as O0}from"react/jsx-runtime";import{$applyNodeReplacement as F0}from"lexical";import*as Ts from"react";import{DecoratorBlockNode as M0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as D0}from"@lexical/utils";import{$applyNodeReplacement as $0}from"lexical";function A0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:_s({relationTo:o,value:e})}:null}var At=class extends M0{__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:A0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=_s(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return D0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function _s(t){return $0(new At({data:t}))}var P0=Ts.lazy(()=>import("./RelationshipComponent-UCIWIEVD.js").then(t=>({default:t.RelationshipComponent})));function B0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:He({relationTo:o,value:e})}:null}var Se=class extends At{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:B0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=He(o);return r.setFormat(e.format),r}decorate(e,o){return O0(P0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function He(t){return F0(new Se({data:t}))}function Er(t){return t instanceof Se}import{c as i1}from"react/compiler-runtime";import{jsx as s1}from"react/jsx-runtime";import{useLexicalComposerContext as a1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as c1}from"@lexical/utils";import{$getPreviousSelection as u1,$getSelection as d1,$isParagraphNode as m1,$isRangeSelection as p1,COMMAND_PRIORITY_EDITOR as f1,createCommand as h1}from"lexical";import{useEffect as g1}from"react";import{c as Ss}from"react/compiler-runtime";import{jsx as Sr}from"react/jsx-runtime";import{useLexicalComposerContext as Ns}from"@lexical/react/LexicalComposerContext.js";import{toast as Y0}from"@payloadcms/ui";import{$getNodeByKey as q0,COMMAND_PRIORITY_EDITOR as Ls}from"lexical";import{useEffect as ys,useState as Q0}from"react";import{c as j0}from"react/compiler-runtime";import{jsx as H0}from"react/jsx-runtime";import{useLexicalComposerContext as U0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as W0,useModal as G0}from"@payloadcms/ui";import{$getNodeByKey as ws,$getPreviousSelection as V0,$getRoot as K0,$getSelection as J0,$isRangeSelection as z0,$setSelection as X0}from"lexical";import{useEffect as Z0,useState as Es}from"react";var Ot=t=>{let e=j0(23),[o]=U0(),[r,n]=Es(null),[l,i]=Es(!1),[s,d,c]=W0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=G0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let R=J0()??V0();n(R)},e[0]=h):h=e[0];let x=h,w;e[1]!==o||e[2]!==r?(w=()=>{r&&o.update(()=>{if(z0(r)){let{anchor:R,focus:M}=r;ws(R.key)&&ws(M.key)&&X0(r.clone())}else K0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=w):w=e[3];let E=w,N;e[4]!==u?(N=()=>{u()},e[4]=u,e[5]=N):N=e[5];let _=N,C,g;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(C=()=>{if(!l)return;let R=f[a];R&&!R?.isOpen&&(i(!1),setTimeout(()=>{E()},1))},g=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=C,e[11]=g):(C=e[10],g=e[11]),Z0(C,g);let b;e[12]!==d?(b=R=>H0(d,{...R,onClick:()=>{x()}}),e[12]=d,e[13]=b):b=e[13];let k;e[14]!==p?(k=()=>{x(),p(),i(!0)},e[14]=p,e[15]=k):k=e[15];let y;return e[16]!==s||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==b||e[21]!==k?(y={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:b,openListDrawer:k},e[16]=s,e[17]=_,e[18]=m,e[19]=a,e[20]=b,e[21]=k,e[22]=y):y=e[22],y};var e1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=q0(o);n&&n.replace(He({relationTo:e,value:r}))}):t.dispatchCommand(Nr,{relationTo:e,value:r})},t1=t=>{let e=Ss(14),{enabledCollectionSlugs:o}=t,[r]=Ns(),[n,l]=Q0(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}=Ot(s),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Je,x=>(l(x?.replace?x?.replace.nodeKey:null),u(),!0),Ls),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),ys(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=x=>{let{collectionSlug:w,doc:E}=x;e1({editor:r,relationTo:w,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let f=p,h;return e[11]!==c||e[12]!==f?(h=Sr(c,{onSelect:f}),e[11]=c,e[12]=f,e[13]=h):h=e[13],h},o1=()=>{let t=Ss(3),[e]=Ns(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Je,r1,Ls),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ys(o,r),null},Rs=({enabledCollectionSlugs:t})=>t?.length?Sr(t1,{enabledCollectionSlugs:t}):Sr(o1,{});function r1(){return Y0.error("No relationship collections enabled"),!0}import{useConfig as n1,useEntityVisibility as l1}from"@payloadcms/ui";import*as Is from"react";var Co=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=n1(),{visibleEntities:l}=l1();return Is.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 Nr=h1("INSERT_RELATIONSHIP_COMMAND"),vs=t=>{let e=i1(8),{clientProps:o}=t,[r]=a1(),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}=Co(i),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([Se]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Nr,x1,f1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),g1(d,c);let u;return e[6]!==s?(u=s1(Rs,{enabledCollectionSlugs:s}),e[6]=s,e[7]=u):u=e[7],u};function x1(t){let e=d1()||u1();if(p1(e)){let o=He(t),{focus:r}=e,n=r.getNode();c1(o),m1(n)&&!n.__first&&n.remove()}return!0}var b1=$({nodes:[Se],plugins:[{Component:vs,position:"normal"}],slashMenu:{groups:[Z([{Icon:wr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:wr,isActive:({selection:t})=>{if(!C1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Er(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]}});import{c as js}from"react/compiler-runtime";import{jsx as se,jsxs as K1}from"react/jsx-runtime";import{useLexicalComposerContext as J1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Hs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as z1,useThrottledEffect as X1,useTranslation as Z1}from"@payloadcms/ui";import*as Ne from"react";import{useMemo as Y1}from"react";import{c as k1}from"react/compiler-runtime";import{jsx as _1}from"react/jsx-runtime";import{mergeRegister as T1}from"@lexical/utils";import{$addUpdateTag as w1,$getSelection as E1}from"lexical";import{useDeferredValue as S1,useEffect as N1,useState as L1}from"react";var Ms="toolbar-popup__button",Ft=t=>{let e=k1(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]=L1(l),d=S1(i),c=H(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Ms}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Ms,u,a,m].filter(Boolean),e[1]=u,e[2]=a,e[3]=m,e[4]=p):p=e[4];let f=p.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let k=E1();if(!k)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:k}):!1,R=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:k}):!0;s(M=>M.active===y&&M.enabled===R?M:{active:y,enabled:R})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,w=Xt(),E,N;e[9]!==r||e[10]!==w||e[11]!==x?(E=()=>{w(x);let k=()=>w(x),y=T1(r.registerUpdateListener(k));return document.addEventListener("mouseup",k),()=>{y(),document.removeEventListener("mouseup",k)}},N=[r,w,x],e[9]=r,e[10]=w,e[11]=x,e[12]=E,e[13]=N):(E=e[12],N=e[13]),N1(E,N);let _;e[14]!==i||e[15]!==r||e[16]!==n?(_=()=>{i.enabled&&r.focus(()=>{r.update(y1),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=_):_=e[17];let C=_,g=R1,b;return e[18]!==o||e[19]!==f||e[20]!==C||e[21]!==n.key?(b=_1("button",{className:f,"data-button-key":n.key,onClick:C,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=C,e[21]=n.key,e[22]=b):b=e[22],b};function y1(){w1("toolbar")}function R1(t){t.preventDefault()}import{c as O1}from"react/compiler-runtime";import{jsx as lt}from"react/jsx-runtime";import Bs,{useCallback as F1,useDeferredValue as P1,useEffect as B1,useMemo as j1}from"react";import{mergeRegister as H1}from"@lexical/utils";import{useTranslation as U1}from"@payloadcms/ui";import{$getSelection as W1}from"lexical";import{jsx as ve,jsxs as Ds}from"react/jsx-runtime";import{Button as I1}from"@payloadcms/ui";import{$addUpdateTag as v1,isDOMNode as M1}from"lexical";import bo,{useCallback as D1,useEffect as ko,useMemo as As,useRef as Lr,useState as yr}from"react";import{createPortal as $1}from"react-dom";var $s="toolbar-popup__dropdown-item",Os=bo.createContext(null);function Fs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let d=As(()=>[$s,r===!1?"disabled":"",t?"active":"",l?.key?`${$s}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Lr(null),u=bo.use(Os);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return ko(()=>{c?.current!=null&&a(c)},[c,a]),ve(I1,{"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(()=>{v1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function A1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=yr(),[i,s]=yr(),d=D1(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=As(()=>({registerItem:d}),[d]);return ko(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),ve(Os,{value:u,children:ve("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Ps({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:d}){let c=Lr(null),u=Lr(null),[a,m]=yr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};ko(()=>{let h=u.current,x=c.current;if(a&&h!==null&&x!==null){let{left:w,top:E}=h.getBoundingClientRect(),N=window.scrollY||document.documentElement.scrollTop;x.style.top=`${E+N+h.offsetHeight+5}px`,x.style.left=`${Math.min(w-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),ko(()=>{let h=u.current;if(h!==null&&a){let x=w=>{let E=w.target;M1(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=$1(ve(A1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return Ds(bo.Fragment,{children:[Ds("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:u,type:"button",children:[l&&ve(l,{}),s&&ve("span",{className:"toolbar-popup__dropdown-label",children:s}),ve("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&ve(bo.Fragment,{children:f})]})}var Rr="toolbar-popup__dropdown",G1=t=>{let e=O1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=U1(),{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&&lt(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=lt(Fs,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?lt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:lt("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},V1=Bs.memo(G1),Ue=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:d})=>{let[c,u]=Bs.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=P1(c),m=H(),{items:p,key:f}=r,h=Xt(),x=F1(()=>{o.getEditorState().read(()=>{let E=W1();if(!E)return;let N=[],_=[],C=[];for(let g of p)g.isActive&&(!s||N.length<s)&&g.isActive({editor:o,editorConfigContext:m,selection:E})&&(N.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:E})&&C.push(g.key):C.push(g.key);u({activeItemKeys:N,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:E}):!0,enabledItemKeys:C}),d&&d({activeItems:_})})},[o,m,r,p,s,d]);B1(()=>(h(x),H1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let w=j1(()=>p?.length?p.map(E=>lt(V1,{active:a.activeItemKeys.includes(E.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(E.key),item:E},E.key)):null,[p,a,t,o]);return lt(Ps,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[Rr,`${Rr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${Rr}-items`,...l||[]],label:i,children:w},f)};function q1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(Ft,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function Q1(t){let e=js(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=Z1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Ne.useState(void 0),[p,f]=Ne.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Ne.useEffect(h,x);let w;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==u?(w=C=>{let{activeItems:g}=C;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let b=g[0],k=b.key;b.label&&(k=typeof b.label=="function"?b.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):b.label),k.length>25&&(k=k.substring(0,25)+"..."),g.length===1?(m(k),f(()=>b.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=u,e[12]=w):w=e[12];let E=w,N=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==E||e[21]!==N?(_=K1("div",{className:N,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?se(Ue,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):se(Ue,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):null,l.type==="buttons"&&l.items.length?l.items.map(C=>se(q1,{anchorElem:o,editor:r,item:C},C.key)):null,i<n.features.toolbarFixed?.groups.length-1&&se("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=E,e[21]=N,e[22]=_):_=e[22],_}function eh({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ne.useRef(null),i=Hs(),{y:s}=z1(),d=Y1(()=>{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 X1(()=>{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(Ne.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>se(Q1,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Us=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Us(t.parentEditor)}return!1},Ws=t=>{let e=js(6),{clientProps:o}=t,[r]=J1(),n=H();if(!Hs())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=Us(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=se(eh,{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 th=$({plugins:[{Component:Ws,position:"aboveContainer"}]});import{c as Ks}from"react/compiler-runtime";import{jsx as de,jsxs as Js}from"react/jsx-runtime";import{useLexicalComposerContext as oh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as rh}from"@lexical/react/useLexicalEditable";import{mergeRegister as zs}from"@lexical/utils";import{$getSelection as Xs,$isRangeSelection as Gs,$isTextNode as nh,COMMAND_PRIORITY_LOW as lh,getDOMSelection as Zs,SELECTION_CHANGE_COMMAND as ih}from"lexical";import{useCallback as To,useEffect as Pt,useRef as Vs,useState as sh}from"react";import*as wo from"react";import{createPortal as ah}from"react-dom";function Ir(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function _o(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition: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 ch({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&de(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?de(Ft,{editor:e,item:o,children:de(o.ChildComponent,{})},o.key):null}function uh(t){let e=Ks(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=H(),[s,d]=wo.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],wo.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let w=x[0];d(()=>w?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==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=Js("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?de(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):de(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>de(ch,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&de("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 dh({anchorElem:t,editor:e}){let o=Vs(null),r=Vs(null),{editorConfig:n}=H(),l=To(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),i=To(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),s=To(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Pt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let d=To(()=>{let c=Xs(),u=Zs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let f=Ir(u,p),h=_o({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&_o({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Pt(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),Pt(()=>(e.getEditorState().read(()=>{d()}),zs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(ih,()=>(d(),!1),lh))),[e,d]),Js("div",{className:"inline-toolbar-popup",ref:o,children:[de("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>de(uh,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function mh(t,e){let o=Ks(12),[r,n]=sh(!1),l=rh(),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Xs(),f=Zs(t._window),h=t.getRootElement();if(f!==null&&(!Gs(p)||h===null||!h.contains(f.anchorNode))){n(!1);return}if(!Gs(p))return;if(p.getTextContent()!==""){let w=p.getNodes(),E=!1;for(let N of w)if(nh(N)){n(!0),E=!0;break}E||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let s=i,d,c;o[2]!==s?(d=()=>(document.addEventListener("selectionchange",s),document.addEventListener("mouseup",s),()=>{document.removeEventListener("selectionchange",s),document.removeEventListener("mouseup",s)}),c=[s],o[2]=s,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Pt(d,c);let u,a;if(o[5]!==t||o[6]!==s?(u=()=>zs(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]),Pt(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=ah(de(dh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Ys=t=>{let{anchorElem:e}=t,[o]=oh();return mh(o,e)};var ph=$({plugins:[{Component:Ys,position:"floatingAnchorElem"}]});import{TableCellNode as ox,TableNode as rx,TableRowNode as nx}from"@lexical/table";import{jsx as qs}from"react/jsx-runtime";import"react";var vr=()=>qs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:qs("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as fh,$createTableNode as hh,$createTableRowNode as gh,$isTableCellNode as Qs,$isTableNode as Mr,$isTableRowNode as Dr,TableCellHeaderStates as Eo,TableCellNode as xh,TableNode as Ch,TableRowNode as bh}from"@lexical/table";import{$isParagraphNode as kh,$isTextNode as _h}from"lexical";var ta=/^\|(.+)\|\s?$/,Th=/^(\| ?:?-*:? ?)+\|\s?$/,oa=({allTransformers:t})=>({type:"element",dependencies:[Ch,bh,xh],export:e=>{if(!Mr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Dr(r))continue;let l=!1;for(let i of r.getChildren())Qs(i)&&(n.push(zt(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===Eo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
59
+ `)},regExp:ta,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(Th.test(n)){let a=e.getPreviousSibling();if(!a||!Mr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Dr(p))return;p.getChildren().forEach(f=>{Qs(f)&&f.setHeaderStyles(Eo.ROW,Eo.ROW)}),e.remove();return}let l=ea(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),d=l.length;for(;s&&!(!kh(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!_h(a))break;let m=ea(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=hh();for(let a of i){let m=gh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ra("",t))}let u=e.getPreviousSibling();Mr(u)&&wh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function wh(t){let e=t.getFirstChild();return Dr(e)?e.getChildrenSize():0}var ra=(t,e)=>{t=t.replace(/\\n/g,`
60
+ `);let o=fh(Eo.NO_STATUS);return Jt(t,e,o),o},ea=(t,e)=>{let o=t.match(ta);return!o||!o[1]?null:o[1].split("|").map(r=>ra(r,e))};import{c as Sh}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as aa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Nh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as la,$deleteTableColumnAtSelection as Lh,$deleteTableRowAtSelection as yh,$getNodeTriplet as Rh,$getTableCellNodeFromLexicalNode as ia,$getTableColumnIndexFromTableCellNode as Ih,$getTableNodeFromLexicalNodeOrThrow as De,$getTableRowIndexFromTableCellNode as vh,$insertTableColumnAtSelection as Mh,$insertTableRowAtSelection as Dh,$isTableCellNode as ca,$isTableSelection as Bt,$mergeCells as $h,$unmergeCell as Ah,getTableElement as Ar,getTableObserverFromTableElement as Or,TableCellHeaderStates as Me,TableCellNode as Oh}from"@lexical/table";import{mergeRegister as Fh}from"@lexical/utils";import{useScrollInfo as Ph}from"@payloadcms/ui";import{$getSelection as No,$isElementNode as Bh,$isRangeSelection as Fr,$isTextNode as jh,$setSelection as Hh,COMMAND_PRIORITY_CRITICAL as Uh,getDOMSelection as Wh,isDOMNode as Gh,SELECTION_CHANGE_COMMAND as Vh}from"lexical";import*as Pr from"react";import{useCallback as ae,useEffect as it,useRef as So,useState as st}from"react";import{createPortal as ua}from"react-dom";import{jsx as $r,jsxs as Eh}from"react/jsx-runtime";import"react";var na=()=>Eh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[$r("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),$r("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),$r("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function sa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Kh(){let t=No();if(Fr(t)&&!t.isCollapsed()||Bt(t)&&!t.anchor.is(t.focus)||!Fr(t)&&!Bt(t))return!1;let[e]=Rh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Jh(t){let e=t.getLastDescendant();jh(e)?e.select():Bh(e)?e.selectEnd():e!==null&&e.selectNext()}function zh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=aa(),i=So(null),[s,d]=st(n),[c,u]=st({columns:1,rows:1}),[a,m]=st(!1),[p,f]=st(!1),{y:h}=Ph();it(()=>l.registerMutationListener(Oh,T=>{T.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{d(s.getLatest())})},{skipInitialization:!0}),[l,s]),it(()=>{l.getEditorState().read(()=>{let T=No();if(Bt(T)){let S=sa(T);u(sa(T)),m(S.columns>1||S.rows>1)}f(Kh())})},[l]),it(()=>{let T=e.current,S=i.current,I=l.getRootElement();if(T!=null&&S!=null&&I!=null){let A=I.getBoundingClientRect(),v=T.getBoundingClientRect();S.style.opacity="1";let O=S.getBoundingClientRect(),D=5,G=v.right+D;if(G+O.width>window.innerWidth||G+O.width>A.right){let z=v.left-O.width-D;G=(z<0?D:z)+window.pageXOffset}S.style.left=`${G+window.pageXOffset}px`;let q=v.top;if(q+O.height>window.innerHeight){let z=v.bottom-O.height;q=z<0?D:z}S.style.top=`${q}px`}},[e,i,l,h]),it(()=>{function T(S){i.current!=null&&e.current!=null&&Gh(S.target)&&!i.current.contains(S.target)&&!e.current.contains(S.target)&&r(!1)}return window.addEventListener("click",T),()=>window.removeEventListener("click",T)},[r,e]);let x=ae(()=>{l.update(()=>{if(s.isAttached()){let T=De(s),S=Ar(T,l.getElementByKey(T.getKey()));if(S===null)throw new Error("Expected to find tableElement in DOM");let I=Or(S);I!==null&&I.$clearHighlight(),T.markDirty(),d(s.getLatest())}Hh(null)})},[l,s]),w=()=>{l.update(()=>{let T=No();if(!Bt(T))return;let I=T.getNodes().filter(ca),A=$h(I);A&&(Jh(A),o())})},E=()=>{l.update(()=>{Ah()})},N=ae(T=>{l.update(()=>{for(let S=0;S<c.rows;S++)Dh(T);o()})},[l,o,c.rows]),_=ae(T=>{l.update(()=>{for(let S=0;S<c.columns;S++)Mh(T);o()})},[l,o,c.columns]),C=ae(()=>{l.update(()=>{yh(),o()})},[l,o]),g=ae(()=>{l.update(()=>{De(s).remove(),x(),o()})},[l,s,x,o]),b=ae(()=>{l.update(()=>{Lh(),o()})},[l,o]),k=ae(()=>{l.update(()=>{let T=De(s),S=vh(s),[I]=la(T,null,null),A=new Set,v=s.getHeaderStyles()^Me.ROW;if(I[S])for(let O=0;O<I[S].length;O++){let D=I[S][O];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Me.ROW)))}x(),o()})},[l,s,x,o]),y=ae(()=>{l.update(()=>{let T=De(s),S=Ih(s),[I]=la(T,null,null),A=new Set,v=s.getHeaderStyles()^Me.COLUMN;if(I)for(let O=0;O<I.length;O++){let D=I?.[O]?.[S];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Me.COLUMN)))}x(),o()})},[l,s,x,o]),R=ae(()=>{l.update(()=>{if(s.isAttached()){let T=De(s);T&&T.setRowStriping(!T.getRowStriping())}x(),o()})},[l,s,x,o]),M=ae(()=>{l.update(()=>{if(s.isAttached()){let T=De(s);T&&T.setFrozenColumns(T.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:()=>w(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(L=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),ua(Le("div",{className:"table-action-menu-dropdown",onClick:T=>{T.stopPropagation()},ref:i,children:[L?Le(Pr.Fragment,{children:[L,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>M(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>N(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>N(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>_(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>_(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>k(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&Me.ROW)===Me.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&Me.COLUMN)===Me.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Xh({anchorElem:t,cellMerge:e}){let[o]=aa(),r=So(null),n=So(null),[l,i]=st(!1),[s,d]=st(null),c=ae(()=>{let a=r.current,m=No(),p=Wh(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return h();let x=o.getRootElement(),w=null,E=null;if(Fr(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=ia(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return h();let C=De(_),g=Ar(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=Or(g),d(_)}else if(Bt(m)){let _=ia(m.anchor.getNode());if(!ca(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=De(_),g=Ar(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=Or(g),E=o.getElementByKey(_.getKey())}else if(!f)return h();if(w===null||E===null)return h();let N=!w||!w.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",N),a.classList.toggle("table-cell-action-button-container--inactive",!N),N){let _=E.getBoundingClientRect(),C=t.getBoundingClientRect(),g=_.top-C.top,b=_.right-C.left;a.style.transform=`translate(${b}px, ${g}px)`}},[o,t]);it(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Fh(o.registerUpdateListener(p),o.registerCommand(Vh,p,Uh),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=So(s);return it(()=>{u.current!==s&&i(!1),u.current=s},[u,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Le(Pr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(na,{})}),l&&P(zh,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var da=t=>{let e=Sh(3),{anchorElem:o}=t,r=Nh(),n;return e[0]!==o||e[1]!==r?(n=ua(r?P(Xh,{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 Zh}from"react/compiler-runtime";import{jsx as yo,jsxs as Yh}from"react/jsx-runtime";import{useLexicalComposerContext as qh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Qh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as eg,$getTableNodeFromLexicalNodeOrThrow as Br,$getTableRowIndexFromTableCellNode as tg,$isTableCellNode as ma,$isTableRowNode as og,getDOMCellFromTarget as rg,getTableElement as ng,TableNode as pa}from"@lexical/table";import{calculateZoomLevel as fa,mergeRegister as lg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as jr,isHTMLElement as ig,SKIP_SCROLL_INTO_VIEW_TAG as ha}from"lexical";import*as xa from"react";import{useCallback as jt,useEffect as Hr,useRef as Lo,useState as at}from"react";import{createPortal as sg}from"react-dom";var ag=33,ga=92;function cg({editor:t}){let e=Lo(null),o=Lo(null),r=Lo(null),[n,l]=at(!1),i=H(),s=Lo(null),[d,c]=at(null),[u,a]=at(null),[m,p]=at(!1),[f,h]=at(null),x=jt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),w=M=>(M.buttons&1)===1;Hr(()=>{let M=new Set;return lg(t.registerMutationListener(pa,L=>{for(let[T,S]of L)S==="destroyed"?M.delete(T):M.add(T);l(M.size>0)}),t.registerNodeTransform(pa,L=>{if(L.getColWidths())return L;let T=L.getColumnCount(),S=ga;return L.setColWidths(Array(T).fill(S)),L}))},[t]),Hr(()=>{if(!n)return;let M=I=>{let A=I.target;if(ig(A)){if(f){c({x:I.clientX,y:I.clientY});return}if(p(w(I)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let v=rg(A);v&&u!==v?t.getEditorState().read(()=>{let O=jr(v.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let D=Br(O),G=ng(D,t.getElementByKey(D.getKey()));if(!G)throw new Error("TableCellResizer: Table element not found.");e.current=A,r.current=G.getBoundingClientRect(),a(v)},{editor:t}):v==null&&x()}}},L=I=>{p(!0)},T=I=>{p(!1)},S=t.registerRootListener((I,A)=>{A?.removeEventListener("mousemove",M),A?.removeEventListener("mousedown",L),A?.removeEventListener("mouseup",T),I?.addEventListener("mousemove",M),I?.addEventListener("mousedown",L),I?.addEventListener("mouseup",T)});return()=>{S()}},[u,f,t,n,x]);let E=M=>M==="bottom",N=jt(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=jr(u.elem);if(!ma(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Br(L),S=tg(L),I=T.getChildren(),v=L.getColSpan()===T.getColumnCount()?S:S+L.getRowSpan()-1;if(v>=I.length||v<0)throw new Error("Expected table cell to be inside of table row.");let O=I[v];if(!og(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,ag);O.setHeight(G)},{tag:ha})},[u,t]),_=(M,L)=>L.getElementByKey(M.getKey())?.clientHeight,C=(M,L)=>{let T;return L.forEach(S=>{S.forEach((I,A)=>{I.cell===M&&(T=A)})}),T},g=jt(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=jr(u.elem);if(!ma(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Br(L),[S]=eg(T,null,null),I=C(L,S);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let A=T.getColWidths();if(!A)return;let v=A[I];if(v===void 0)return;let O=[...A],D=Math.max(v+M,ga);O[I]=D,T.setColWidths(O)},{tag:ha})},[u,t]),b=jt(M=>{let L=T=>{if(T.preventDefault(),T.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:S,y:I}=s.current;if(u===null)return;let A=fa(T.target);if(E(M)){let v=(T.clientY-I)/A;N(v)}else{let v=(T.clientX-S)/A;g(v)}x(),document.removeEventListener("mouseup",L)}};return L},[u,x,g,N]),k=jt(M=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");s.current={x:L.clientX,y:L.clientY},c(s.current),h(M),document.addEventListener("mouseup",b(M))},[u,b]),[y,R]=at({bottom:null,left:null,right:null,top:null});return Hr(()=>{if(u){let{height:M,left:L,top:T,width:S}=u.elem.getBoundingClientRect(),I=fa(u.elem),A=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${A}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+T+M-A/2}px`,width:`${S}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${M}px`,left:`${window.scrollX+L+S-A/2}px`,top:`${window.scrollY+T}px`,width:`${A}px`}},O=r.current;f&&d&&O&&(E(f)?(v[f].left=`${window.scrollX+O.left}px`,v[f].top=`${window.scrollY+d.y/I}px`,v[f].height="3px",v[f].width=`${O.width}px`):(v[f].top=`${window.scrollY+O.top}px`,v[f].left=`${window.scrollX+d.x/I}px`,v[f].width="3px",v[f].height=`${O.height}px`),v[f].backgroundColor="#adf"),R(v)}else R({bottom:null,left:null,right:null,top:null})},[u,f,d]),yo("div",{ref:o,children:u!=null&&!m&&Yh(xa.Fragment,{children:[yo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("right"),style:y.right||void 0}),yo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("bottom"),style:y.bottom||void 0})]})})}var Ca=()=>{let t=Zh(3),[e]=qh(),o=Qh(),r;return t[0]!==e||t[1]!==o?(r=o?sg(yo(cg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as xg}from"react/compiler-runtime";import{jsx as Ur,jsxs as Cg,Fragment as bg}from"react/jsx-runtime";import{useLexicalComposerContext as kg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Na}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as _g,$getTableColumnIndexFromTableCellNode as Tg,$getTableRowIndexFromTableCellNode as wg,$insertTableColumnAtSelection as Eg,$insertTableRowAtSelection as Sg,$isTableCellNode as Ng,$isTableNode as _a,getTableElement as Lg,TableNode as yg}from"@lexical/table";import{$findMatchingParent as Rg,mergeRegister as Ig}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ta,isHTMLElement as vg}from"lexical";import{useEffect as wa,useMemo as Mg,useRef as Ea,useState as Ro}from"react";import"react";import{createPortal as Dg}from"react-dom";import{c as fg}from"react/compiler-runtime";import{useEffect as hg,useRef as gg}from"react";var ug="Expected a function",dg=Math.max,mg=Math.min;function pg(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(ug);e=e||0,typeof o=="object"&&(s=!!o.leading,d="maxWait"in o,c=d?dg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let b=r,k=i;return r=i=void 0,l=g,u=t.apply(k,b),u}function f(g){return l=g,a=setTimeout(w,e),s?p(g):u}function h(g){let b=g-n,k=g-l,y=e-b;return d?mg(y,c-k):y}function x(g){let b=g-n,k=g-l;return n===void 0||b>=e||b<0||d&&k>=c}function w(){let g=Date.now();if(x(g))return E(g);a=setTimeout(w,h(g))}function E(g){return a=void 0,m&&r?p(g):(r=i=void 0,u)}function N(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function _(){return a===void 0?u:E(Date.now())}function C(){let g=Date.now(),b=x(g);if(r=arguments,i=this,n=g,b){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(w,e),p(n)}return a===void 0&&(a=setTimeout(w,e)),u}return C.cancel=N,C.flush=_,C}var ba=pg;function ka(t,e,o){let r=fg(6),n=gg(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ba(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]),hg(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 Sa=20;function $g({anchorElem:t}){let[e]=kg(),o=Na(),r=H(),[n,l]=Ro(!1),[i,s]=Ro(!1),[d,c]=Ro(!1),[u,a]=Ro({}),m=Ea(new Set),p=Ea(null),f=ka(w=>{let{isOutside:E,tableDOMNode:N}=Ag(w,r.editorConfig?.lexical);if(E){l(!1),s(!1);return}if(!N)return;p.current=N;let _=null,C=null,g=null;if(e.getEditorState().read(()=>{let v=Ta(N);if(Ng(v)){let O=Rg(v,D=>_a(D));if(!_a(O))return;if(g=Lg(O,e.getElementByKey(O.getKey())),g){let D=O.getChildrenSize(),G=O.getChildAtIndex(0)?.getChildrenSize(),q=wg(v),z=Tg(v);q===D-1?_=v:z===G-1&&(C=v)}}},{editor:e}),!g)return;let b=g.parentElement;if(!b)return;let{bottom:k,height:y,left:R,right:M,width:L,y:T}=g.getBoundingClientRect(),S=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(S=b.scrollWidth>b.clientWidth);let{left:I,y:A}=t.getBoundingClientRect();_?(s(!1),l(!0),a({height:Sa,left:S&&b?b.offsetLeft:R-I,top:k-A+5,width:S&&b?b.offsetWidth:L})):C&&(s(!0),l(!1),a({height:y,left:M-I+5,top:T-A,width:Sa}))},50,250),h=Mg(()=>new ResizeObserver(()=>{l(!1),s(!1)}),[]);wa(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),s(!1),document.removeEventListener("mousemove",f)}},[d,f]),wa(()=>Ig(e.registerMutationListener(yg,w=>{e.getEditorState().read(()=>{let E=!1;for(let[N,_]of w)switch(_){case"created":{m.current.add(N),E=!0;break}case"destroyed":{m.current.delete(N),E=!0;break}default:break}if(E){h.disconnect();for(let N of m.current){let{tableElement:_}=_g(N);h.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=w=>{e.update(()=>{p.current&&(Ta(p.current)?.selectEnd(),w?(Sg(),l(!1)):(Eg(),s(!1)))})};return o?Cg(bg,{children:[n&&Ur("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),i&&Ur("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function Ag(t,e){let o=t.target;if(vg(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function La(t){let e=xg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Na())return null;let l;return e[0]!==r?(l=Dg(Ur($g,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Og}from"react/compiler-runtime";import{jsx as Wr,jsxs as Fg}from"react/jsx-runtime";import{useLexicalComposerContext as Pg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Bg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as jg,TableCellNode as Hg,TableNode as Ug,TableRowNode as Wg}from"@lexical/table";import{mergeRegister as Gg}from"@lexical/utils";import{formatDrawerSlug as Vg,useEditDepth as Kg}from"@payloadcms/ui";import{$getSelection as Jg,$isRangeSelection as zg,COMMAND_PRIORITY_EDITOR as Xg,createCommand as Zg}from"lexical";import{createContext as Yg,use as qg,useEffect as Qg,useMemo as ex,useState as tx}from"react";import*as ya from"react";var Io=Zg("OPEN_EMBED_DRAWER_COMMAND"),Ra=Yg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Ia({children:t}){let[e,o]=tx({cellEditorConfig:null,cellEditorPlugins:null});return Wr(Ra,{value:ex(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var va=()=>{let t=Og(16),[e]=Pg(),o=qg(Ra),r=Kg(),{fieldProps:n,uuid:l}=H(),{schemaPath:i}=n,s="lexical-table-create-"+l,d;t[0]!==r||t[1]!==s?(d=Vg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=he(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([Ug,Wg,Hg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Gg(e.registerCommand(Io,()=>{let h=null;return e.getEditorState().read(()=>{let x=Jg();zg(x)&&(h=x)}),h&&u(),!0},Xg))},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],Qg(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(jg,{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=Fg(ya.Fragment,{children:[Wr(ft,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Wr(Bg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var lx=$({markdownTransformers:[oa],nodes:[rx,ox,nx],plugins:[{Component:va,position:"normal"},{Component:Ca,position:"normal"},{Component:da,position:"floatingAnchorElem"},{Component:La,position:"floatingAnchorElem"}],providers:[Ia],slashMenu:{groups:[Z([{Icon:vr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Io,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:vr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Io,{})}}])]}});import{$isNodeSelection as Hx}from"lexical";import{jsx as Gr,jsxs as ix}from"react/jsx-runtime";import"react";var Vr=()=>ix("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gr("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Gr("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Gr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Oa}from"react/jsx-runtime";import Fa from"bson-objectid";import{$applyNodeReplacement as mx}from"lexical";import*as Pa from"react";import sx from"bson-objectid";function vo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new sx.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as ax}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as cx}from"@lexical/utils";import Da from"bson-objectid";import{$applyNodeReplacement as ux}from"lexical";var Ht=class extends ax{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>vo(o,Ma),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Da.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ma({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return cx(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function Ma({data:t}){return t?.id||(t.id=new Da.default().toHexString()),ux(new Ht({data:t}))}import{jsx as $a}from"react/jsx-runtime";import{ShimmerEffect as dx}from"@payloadcms/ui";var Aa=()=>$a("div",{className:"lexical-upload",children:$a(dx,{height:"95px",width:"203px"})});var px=Pa.lazy(()=>import("./component-5IW2M4GH.js").then(t=>({default:t.UploadComponent}))),me=class extends Ht{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>vo(o,pe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Fa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=pe({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?Oa(Aa,{}):Oa(px,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function pe({data:t}){return t?.id||(t.id=new Fa.default().toHexString()),mx(new me({data:t}))}function ct(t){return t instanceof me}import{c as _x}from"react/compiler-runtime";import{jsx as Tx}from"react/jsx-runtime";import{useLexicalComposerContext as wx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Xa,$insertNodeToNearestRoot as zr,mergeRegister as Ex}from"@lexical/utils";import{useBulkUpload as Sx,useEffectEvent as Nx,useModal as Lx}from"@payloadcms/ui";import Xr from"bson-objectid";import{$createRangeSelection as yx,$getPreviousSelection as Ga,$getSelection as Va,$isParagraphNode as Zr,$isRangeSelection as Ka,$setSelection as Rx,COMMAND_PRIORITY_EDITOR as Ix,COMMAND_PRIORITY_LOW as Ja,createCommand as vx,DROP_COMMAND as Mx,getDOMSelectionFromTarget as Dx,isHTMLElement as za,PASTE_COMMAND as $x}from"lexical";import{useEffect as Ax}from"react";import{c as Ba}from"react/compiler-runtime";import{jsx as Kr}from"react/jsx-runtime";import{useLexicalComposerContext as ja}from"@lexical/react/LexicalComposerContext.js";import{toast as fx}from"@payloadcms/ui";import{$getNodeByKey as hx,COMMAND_PRIORITY_EDITOR as Ha}from"lexical";import{useEffect as Ua,useState as gx}from"react";var xx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=hx(o);n&&n.replace(pe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Jr,{fields:null,relationTo:e,value:r})},Cx=t=>{let e=Ba(13),{enabledCollectionSlugs:o}=t,[r]=ja(),[n,l]=gx(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}=Ot(i),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(ze,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Ha),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Ua(u,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:w}=h;s(),xx({editor:r,relationTo:x,replaceNodeKey:n,value:w.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=Kr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},bx=()=>{let t=Ba(3),[e]=ja(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ze,kx,Ha),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ua(o,r),null},Wa=({enabledCollectionSlugs:t})=>t?.length?Kr(Cx,{enabledCollectionSlugs:t}):Kr(bx,{});function kx(){return fx.error("No upload collections enabled"),!0}function Ox(t){let e=t.target;return!!(za(e)&&!e.closest("code, span.editor-image")&&za(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Fx(t){let e,o=Dx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Jr=vx("INSERT_UPLOAD_COMMAND"),Za=t=>{let e=_x(21),{clientProps:o}=t,[r]=wx(),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}=Co(i),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=Sx(),{isModalOpen:f,openModal:h}=Lx(),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=C=>{let{files:g}=C;if(g?.length!==0&&(u(b=>[...b??[],...g.map(Px)]),!f(d))){if(!s.length||!s[0])return;c(s[0]),p(s),a(()=>{r.update(Bx)}),m(b=>{let k=new Map(b.map(jx));r.update(()=>{for(let y of Xa()){let R=y.node;if(ct(R)){let M=R.getData();if(M?.pending){let L=k.get(M.pending?.formID);L&&R.replace(pe({data:{id:new Xr.default().toHexString(),fields:{},relationTo:L.collectionSlug,value:L.doc.id}}))}}}})}),h(d)}},e[3]=d,e[4]=r,e[5]=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 w=Nx(x),E;e[14]!==r||e[15]!==w?(E=()=>{if(!r.hasNodes([me]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Ex(r.registerNodeTransform(me,C=>{let g=C.getData();if(!g?.pending)return;(async function(){let y=null,R=g?.pending?.src,M=g?.pending?.formID;if(R?.startsWith("data:")){let L=R.match(/data:(image\/[a-zA-Z]+);base64,/),T=L?L[1]:"image/png",S=R.replace(/^data:image\/[a-zA-Z]+;base64,/,""),I=atob(S),A=new Array(I.length);for(let D=0;D<I.length;D++)A[D]=I.charCodeAt(D);let v=new Uint8Array(A);y={alt:void 0,file:new File([v],"pasted-image."+T?.split("/",2)[1],{type:T}),formID:M}}else if(R?.startsWith("http")||R?.startsWith("https")){let T=await(await fetch(R)).blob(),S=R.split("/").pop()||"pasted-image"+T.type.split("/",2)[1];y={alt:void 0,file:new File([T],S,{type:T.type}),formID:M}}y&&w({files:[y]})})()}),r.registerCommand(Jr,C=>(r.update(()=>{let g=Va()||Ga();if(Ka(g)){let b=pe({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:k}=g,y=k.getNode();zr(b),Zr(y)&&!y.__first&&y.remove()}}),!0),Ix),r.registerCommand($x,C=>{if(!(C instanceof ClipboardEvent))return!1;let g=C.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Xr.default().toHexString()})}),b.length?(r.update(()=>{let k=Va()||Ga();if(Ka(k))for(let y of b){let R=pe({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:M}=k,L=M.getNode();zr(R),Zr(L)&&!L.__first&&L.remove()}}),w({files:b}),!0):!1},Ja),r.registerCommand(Mx,C=>{if(!(C instanceof DragEvent))return!1;let g=C.dataTransfer;if(!g?.types?.length)return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Xr.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),r.update(()=>{if(Ox(C)){let k=Fx(C),y=yx();k!=null&&y.applyDOMRange(k),Rx(y);for(let R of b){let M=pe({data:{pending:{formID:R.formID,src:URL.createObjectURL(R.file)}}}),{focus:L}=y,T=L.getNode();zr(M),Zr(T)&&!T.__first&&T.remove()}}}),w({files:b}),!0):!1},Ja))},e[14]=r,e[15]=w,e[16]=E):E=e[16];let N;e[17]!==r?(N=[r],e[17]=r,e[18]=N):N=e[18],Ax(E,N);let _;return e[19]!==s?(_=Tx(Wa,{enabledCollectionSlugs:s}),e[19]=s,e[20]=_):_=e[20],_};function Px(t){return{file:t.file,formID:t.formID}}function Bx(){for(let t of Xa()){let e=t.node;ct(e)&&e.getData()?.pending&&e.remove()}}function jx(t){return[t.formID,t]}var Ux=$({nodes:[me],plugins:[{Component:Za,position:"normal"}],slashMenu:{groups:[Z([{Icon:Vr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Vr,isActive:({selection:t})=>{if(!Hx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ct(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]}});import{c as Gx}from"react/compiler-runtime";import{jsx as Qr}from"react/jsx-runtime";import{ShimmerEffect as Vx,useConfig as Kx}from"@payloadcms/ui";import{lazy as Jx,Suspense as zx,useEffect as Xx,useState as Zx}from"react";var Ya={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var Yr={namespace:"lexical",theme:Ya};function qa({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let 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 Wx}from"payload/shared";var Qa=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(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?Wx(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function qr(t,e,o){return{admin:o,features:Qa(t),lexical:e,resolvedFeatureMap:t}}var Yx=Jx(()=>import("./Field-QUXIGJRC.js").then(t=>({default:t.RichText}))),qx=t=>{let e=Gx(18),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let u=c,a;e[2]!==n?(a=n===void 0?{}:n,e[2]=n,e[3]=a):a=e[3];let m=a,p=s===void 0?Yr:s,{config:f}=Kx(),[h,x]=Zx(null),w,E;e[4]!==u||e[5]!==r||e[6]!==f||e[7]!==m||e[8]!==l||e[9]!==i||e[10]!==h||e[11]!==p||e[12]!==d?(w=()=>{if(h)return;let _=[];for(let g of Object.values(r))g.clientFeatureProvider&&_.push(g.clientFeatureProvider(g.clientFeatureProps));let C=qa({config:f,featureClientImportMap:m,featureClientSchemaMap:l,field:i,schemaPath:d??i.name,unSanitizedEditorConfig:{features:_,lexical:p}});x(qr(C,p,u))},E=[u,r,f,m,l,i,h,p,d],e[4]=u,e[5]=r,e[6]=f,e[7]=m,e[8]=l,e[9]=i,e[10]=h,e[11]=p,e[12]=d,e[13]=w,e[14]=E):(w=e[13],E=e[14]),Xx(w,E);let N;return e[15]!==h||e[16]!==t?(N=Qr(zx,{fallback:Qr(Vx,{height:"35vh"}),children:h&&Qr(Yx,{...t,editorConfig:h})}),e[15]=h,e[16]=t,e[17]=N):N=e[17],N};function Qx(t){return t instanceof HTMLElement}function eC(...t){return t.filter(Boolean).join(" ")}var Mo=new WeakMap;function ec(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Do(t,e){let o=Mo.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=ec(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let d=ec(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},Mo.set(t,o)}return o.listeners.add(e),()=>{tC(t,e)}}function tC(t,e){let o=Mo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Mo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function oC(t,e){return Do(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function rC(t,e){return Do(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function nC(t,e){return Do(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function lC(t,e){return Do(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as iC}from"react/compiler-runtime";import{jsx as sC}from"react/jsx-runtime";import"react";var aC=()=>{let t=iC(2),{EditButton:e}=ge(),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=()=>{let t=cC(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?uC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as mC}from"react/compiler-runtime";import{jsx as pC}from"react/jsx-runtime";import"react";var fC=()=>{let t=mC(2),{Label:e}=ge(),o;return t[0]!==e?(o=e?pC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as hC}from"react/compiler-runtime";import{jsx as gC}from"react/jsx-runtime";import"react";var xC=t=>{let e=hC(3),{children:o}=t,{InlineBlockContainer:r}=ge(),n;return e[0]!==r||e[1]!==o?(n=r?gC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as CC}from"react/jsx-runtime";import"react";var bC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=Ce();return r?CC(r,{...o,children:e}):null};import{c as kC}from"react/compiler-runtime";import{jsx as _C}from"react/jsx-runtime";import"react";var TC=()=>{let t=kC(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?_C(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as wC}from"react/compiler-runtime";import{jsx as EC}from"react/jsx-runtime";import"react";var SC=()=>{let t=wC(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?EC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as NC}from"qs-esm";var LC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let d=NC({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 tc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
61
61
  `)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
62
62
  `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let r=o?.[1];return t.startsWith(`
63
63
  `)&&(t=t.slice(1)),t.endsWith(`
64
64
  `)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
65
- `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as gC}from"react/jsx-runtime";import{CodeField as xC,useFormFields as CC}from"@payloadcms/ui";import{useId as bC,useMemo as kC}from"react";var Mo={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var _C=({autoComplete:t,field:e,forceRender:o,languages:r=Mo,path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,typescript:c,validate:u})=>{let a=CC(([w])=>w.language),m=a?.value||a?.initialValue||"typescript",p=bC(),f=r[m],h=kC(()=>({...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&&gC(xC,{autoComplete:t,field:h,forceRender:o,onMount:(w,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),E.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>{c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async _=>{let g=await(await fetch(_.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(g,_.filePath)}))})()},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,validate:u},x)};import{jsx as re,jsxs as sc}from"react/jsx-runtime";import{useLexicalEditable as yC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as RC,Combobox as IC,CopyToClipboard as vC,PopupList as MC,RenderFields as DC,useForm as $C,useFormFields as ac,useTranslation as AC}from"@payloadcms/ui";import OC from"react";import{jsx as ec}from"react/jsx-runtime";import"react";var tc=()=>ec("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:ec("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 rc}from"react/jsx-runtime";import"react";import{useCollapsible as wC}from"@payloadcms/ui";import{jsx as oc}from"react/jsx-runtime";import"react";var Do=()=>oc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:oc("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 TC="code-block-collapse-button",nc=()=>{let{toggle:t}=wC();return rc("button",{className:TC,onClick:t,type:"button",children:rc(Do,{})})};import{jsx as lc,jsxs as EC}from"react/jsx-runtime";import"react";import{useCollapsible as NC,useTranslation as LC}from"@payloadcms/ui";var SC="code-block-floating-collapse-button",ic=()=>{let{isCollapsed:t,toggle:e}=NC(),{t:o}=LC();return t?EC("button",{className:SC,onClick:e,type:"button",children:[lc("span",{children:o("general:collapse")}),lc(Do,{})]}):null};var He="payload-richtext-code-block",FC=t=>{let{languages:e}=t,o=e||Mo,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=ge(),{setModified:i}=$C(),{t:s}=AC(),{codeField:d}=ac(([f])=>({codeField:f?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=ac(([f,h])=>({selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),i(!0)}})),a=o[c?.value],m=yC(),p=OC.useMemo(()=>Object.entries(o).map(([f,h])=>({name:`${f} ${h}`,Component:re(MC.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:sc("div",{className:`${He}__actions`,children:[re(IC,{button:sc("div",{className:`${He}__language-selector-button`,"data-selected-language":c?.value,children:[re("span",{children:a}),re(RC,{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(vC,{value:d?.value??""}),re(nc,{}),m&&re(l,{})]}),className:He,collapsibleProps:{AfterCollapsible:re(ic,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${He}__pill`,children:re(tc,{})}),children:re(DC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as PC}from"react/compiler-runtime";import{jsx as at}from"react/jsx-runtime";import{FieldContext as BC,FieldPathContext as cc,ServerFunctionsContext as uc,ShimmerEffect as jC,useServerFunctions as HC}from"@payloadcms/ui";import UC,{useEffect as WC,useRef as GC}from"react";var VC=t=>{let e=PC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:d}=t,[c,u]=UC.useState(null),a=HC(),{_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 w=x,E=GC(!1),N,_;if(e[6]!==w?(N=()=>{E.current||(E.current=!0,w())},_=[w],e[6]=w,e[7]=N,e[8]=_):(N=e[7],_=e[8]),WC(N,_),!c)return typeof n<"u"?n:at(jC,{});let C={...a,getFormState:async b=>a.getFormState({...b,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof d>"u"&&!s)return at(uc,{value:{...C},children:at(cc,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:h,setValue:s??KC,showError:!1,value:d};return at(uc,{value:{...C},children:at(cc,{value:h,children:at(BC,{value:g,children:c})},h)})};function KC(){}function dc({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 JC=dc;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,Tr as $isRelationshipNode,st as $isUploadNode,Sc as AlignFeatureClient,ke as AutoLinkNode,sC as BlockCollapsible,uC as BlockEditButton,ie as BlockNode,pC as BlockRemoveButton,Ic as BlockquoteFeatureClient,ju as BlocksFeatureClient,cd as BoldFeatureClient,le as CAN_USE_DOM,ff as ChecklistFeatureClient,FC as CodeBlockBlockComponent,_C as CodeComponent,i0 as DETAIL_TYPE_TO_DETAIL,o0 as DOUBLE_LINE_BREAK,x0 as DebugJsxConverterFeatureClient,a0 as ELEMENT_FORMAT_TO_TYPE,s0 as ELEMENT_TYPE_TO_FORMAT,Cc as ENABLE_SLASH_MENU_COMMAND,fc as EditorConfigProvider,mt as FieldsDrawer,W1 as FixedToolbarFeatureClient,nm as HeadingFeatureClient,Tm as HorizontalRuleFeatureClient,Ce as HorizontalRuleNode,Je as INSERT_BLOCK_COMMAND,ze as INSERT_INLINE_BLOCK_COMMAND,e0 as IS_ALL_FORMATTING,Pm as IndentFeatureClient,lC as InlineBlockContainer,Zx as InlineBlockEditButton,oC as InlineBlockLabel,ct as InlineBlockNode,Qx as InlineBlockRemoveButton,fd as InlineCodeFeatureClient,th as InlineToolbarFeatureClient,Cd as ItalicFeatureClient,n0 as LTR_REGEX,Ff as LexicalPluginToLexicalFeatureClient,qp as LinkFeatureClient,oe as LinkNode,t0 as NON_BREAKING_SPACE,F as NodeFormat,Tf as OrderedListFeatureClient,Kf as ParagraphFeatureClient,gc as Point,r0 as RTL_REGEX,bc as Rect,s1 as RelationshipFeatureClient,we as RelationshipNode,VC as RenderLexical,jx as RichTextField,Gf as SlateToLexicalFeatureClient,wd as StrikethroughFeatureClient,Ld as SubscriptFeatureClient,vd as SuperscriptFeatureClient,c0 as TEXT_MODE_TO_TYPE,l0 as TEXT_TYPE_TO_FORMAT,u0 as TEXT_TYPE_TO_MODE,ce as TOGGLE_LINK_COMMAND,Jg as TableFeatureClient,ed as TestRecorderFeatureClient,Jd as TextStateFeatureClient,Dt as ToolbarButton,je as ToolbarDropdown,ld as TreeViewFeatureClient,Od as UnderlineFeatureClient,If as UnorderedListFeatureClient,Ix as UploadFeatureClient,de as UploadNode,Jx as addSwipeDownListener,Gx as addSwipeLeftListener,Vx as addSwipeRightListener,Kx as addSwipeUpListener,JC as buildDefaultEditorState,dc as buildEditorState,Qa as codeConverterClient,er as createBlockNode,$ as createClientFeature,C0 as defaultColors,Xr as defaultEditorLexicalConfig,yr as getDOMRangeRect,kc as getEnabledNodes,hC as getRestPopulateFn,Ze as getSelectedNode,Hx as isHTMLElement,xc as isPoint,Ux as joinClasses,Zr as sanitizeClientEditorConfig,Ya as sanitizeClientFeatures,bo as setFloatingElemPosition,mo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,xe as toolbarAddDropdownGroupWithItems,or as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,ge as useBlockComponentContext,H as useEditorConfigContext,he as useInlineBlockComponentContext,hc as useLexicalDocumentDrawer,fe as useLexicalDrawer,Mt as useLexicalListDrawer};
65
+ `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as yC}from"react/jsx-runtime";import{CodeField as RC,useFormFields as IC}from"@payloadcms/ui";import{useId as vC,useMemo as MC}from"react";var $o={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var DC=({autoComplete:t,field:e,forceRender:o,languages:r=$o,path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,typescript:c,validate:u})=>{let a=IC(([w])=>w.language),m=a?.value||a?.initialValue||"typescript",p=vC(),f=r[m],h=MC(()=>({...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&&yC(RC,{autoComplete:t,field:h,forceRender:o,onMount:(w,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),E.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>{c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async _=>{let g=await(await fetch(_.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(g,_.filePath)}))})()},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,validate:u},x)};import{jsx as re,jsxs as cc}from"react/jsx-runtime";import{useLexicalEditable as jC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as HC,Combobox as UC,CopyToClipboard as WC,PopupList as GC,RenderFields as VC,useForm as KC,useFormFields as uc,useTranslation as JC}from"@payloadcms/ui";import zC from"react";import{jsx as oc}from"react/jsx-runtime";import"react";var rc=()=>oc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:oc("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as lc}from"react/jsx-runtime";import"react";import{useCollapsible as AC}from"@payloadcms/ui";import{jsx as nc}from"react/jsx-runtime";import"react";var Ao=()=>nc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:nc("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var $C="code-block-collapse-button",ic=()=>{let{toggle:t}=AC();return lc("button",{className:$C,onClick:t,type:"button",children:lc(Ao,{})})};import{jsx as sc,jsxs as OC}from"react/jsx-runtime";import"react";import{useCollapsible as PC,useTranslation as BC}from"@payloadcms/ui";var FC="code-block-floating-collapse-button",ac=()=>{let{isCollapsed:t,toggle:e}=PC(),{t:o}=BC();return t?OC("button",{className:FC,onClick:e,type:"button",children:[sc("span",{children:o("general:collapse")}),sc(Ao,{})]}):null};var We="payload-richtext-code-block",XC=t=>{let{languages:e}=t,o=e||$o,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=Ce(),{setModified:i}=KC(),{t:s}=JC(),{codeField:d}=uc(([f])=>({codeField:f?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=uc(([f,h])=>({selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),i(!0)}})),a=o[c?.value],m=jC(),p=zC.useMemo(()=>Object.entries(o).map(([f,h])=>({name:`${f} ${h}`,Component:re(GC.Button,{active:!1,disabled:!1,onClick:()=>{u(f)},children:re("span",{className:`${We}__language-code`,"data-language":f,children:h})})})),[o,u]);return re(r,{Actions:cc("div",{className:`${We}__actions`,children:[re(UC,{button:cc("div",{className:`${We}__language-selector-button`,"data-selected-language":c?.value,children:[re("span",{children:a}),re(HC,{className:`${We}__chevron`})]}),buttonType:"custom",className:`${We}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:s("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),re(WC,{value:d?.value??""}),re(ic,{}),m&&re(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:re(ac,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:re("div",{className:`${We}__pill`,children:re(rc,{})}),children:re(VC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as ZC}from"react/compiler-runtime";import{jsx as ut}from"react/jsx-runtime";import{FieldContext as YC,FieldPathContext as dc,ServerFunctionsContext as mc,ShimmerEffect as qC,useServerFunctions as QC}from"@payloadcms/ui";import e2,{useEffect as t2,useRef as o2}from"react";var r2=t=>{let e=ZC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:d}=t,[c,u]=e2.useState(null),a=QC(),{_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 w=x,E=o2(!1),N,_;if(e[6]!==w?(N=()=>{E.current||(E.current=!0,w())},_=[w],e[6]=w,e[7]=N,e[8]=_):(N=e[7],_=e[8]),t2(N,_),!c)return typeof n<"u"?n:ut(qC,{});let C={...a,getFormState:async b=>a.getFormState({...b,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof d>"u"&&!s)return ut(mc,{value:{...C},children:ut(dc,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:h,setValue:s??n2,showError:!1,value:d};return ut(mc,{value:{...C},children:ut(dc,{value:h,children:ut(YC,{value:g,children:c})},h)})};function n2(){}function pc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}var l2=pc;export{Nt as $createAutoLinkNode,Ae as $createBlockNode,Ye as $createHorizontalRuleNode,mt as $createInlineBlockNode,_e as $createLinkNode,He as $createRelationshipNode,pe as $createUploadNode,we as $isAutoLinkNode,$e as $isBlockNode,St as $isHorizontalRuleNode,pt as $isInlineBlockNode,J as $isLinkNode,Er as $isRelationshipNode,ct as $isUploadNode,Ac as AlignFeatureClient,Te as AutoLinkNode,bC as BlockCollapsible,TC as BlockEditButton,ie as BlockNode,SC as BlockRemoveButton,Uc as BlockquoteFeatureClient,qu as BlocksFeatureClient,_d as BoldFeatureClient,le as CAN_USE_DOM,Nf as ChecklistFeatureClient,XC as CodeBlockBlockComponent,DC as CodeComponent,C0 as DETAIL_TYPE_TO_DETAIL,f0 as DOUBLE_LINE_BREAK,R0 as DebugJsxConverterFeatureClient,k0 as ELEMENT_FORMAT_TO_TYPE,b0 as ELEMENT_TYPE_TO_FORMAT,kc as ENABLE_SLASH_MENU_COMMAND,gc as EditorConfigProvider,ft as FieldsDrawer,th as FixedToolbarFeatureClient,gm as HeadingFeatureClient,$m as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,Xe as INSERT_BLOCK_COMMAND,Ze as INSERT_INLINE_BLOCK_COMMAND,m0 as IS_ALL_FORMATTING,Zm as IndentFeatureClient,xC as InlineBlockContainer,aC as InlineBlockEditButton,fC as InlineBlockLabel,dt as InlineBlockNode,dC as InlineBlockRemoveButton,Nd as InlineCodeFeatureClient,ph as InlineToolbarFeatureClient,Id as ItalicFeatureClient,g0 as LTR_REGEX,Xf as LexicalPluginToLexicalFeatureClient,df as LinkFeatureClient,oe as LinkNode,p0 as NON_BREAKING_SPACE,F as NodeFormat,$f as OrderedListFeatureClient,n0 as ParagraphFeatureClient,Cc as Point,h0 as RTL_REGEX,_c as Rect,b1 as RelationshipFeatureClient,Se as RelationshipNode,r2 as RenderLexical,qx as RichTextField,o0 as SlateToLexicalFeatureClient,Ad as StrikethroughFeatureClient,Bd as SubscriptFeatureClient,Wd as SuperscriptFeatureClient,_0 as TEXT_MODE_TO_TYPE,x0 as TEXT_TYPE_TO_FORMAT,T0 as TEXT_TYPE_TO_MODE,ue as TOGGLE_LINK_COMMAND,lx as TableFeatureClient,md as TestRecorderFeatureClient,lm as TextStateFeatureClient,Ft as ToolbarButton,Ue as ToolbarDropdown,xd as TreeViewFeatureClient,zd as UnderlineFeatureClient,Uf as UnorderedListFeatureClient,Ux as UploadFeatureClient,me as UploadNode,lC as addSwipeDownListener,oC as addSwipeLeftListener,rC as addSwipeRightListener,nC as addSwipeUpListener,l2 as buildDefaultEditorState,pc as buildEditorState,tc as codeConverterClient,or as createBlockNode,$ as createClientFeature,I0 as defaultColors,Yr as defaultEditorLexicalConfig,Ir as getDOMRangeRect,Tc as getEnabledNodes,LC as getRestPopulateFn,qe as getSelectedNode,Qx as isHTMLElement,bc as isPoint,eC as joinClasses,qr as sanitizeClientEditorConfig,Qa as sanitizeClientFeatures,_o as setFloatingElemPosition,fo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,nr as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,te as toolbarTextDropdownGroupWithItems,Ce as useBlockComponentContext,H as useEditorConfigContext,ge as useInlineBlockComponentContext,xc as useLexicalDocumentDrawer,he as useLexicalDrawer,Ot as useLexicalListDrawer};
66
66
  //# sourceMappingURL=index.js.map