@payloadcms/richtext-lexical 3.86.0 → 3.87.1

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 Ce,c as ht,d as gt,e as xt}from"./chunk-XFA5M7FY.js";import{a as Xe}from"./chunk-DBWINSQN.js";import{a as Ct,b as ze}from"./chunk-QJ5EETIB.js";import{a as xe}from"./chunk-INBEEENE.js";import{a as Lc}from"./chunk-F26IQ5RE.js";import{b as Xt,c as zt,d as le,e as gn,f as Uo,g as Wo,h as yc,i as Rc,k as Ic,m as vc,p as Mc}from"./chunk-QAW5QKEM.js";import{a as Nc,b as U}from"./chunk-BZZVLW4U.js";function X(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Fc}from"react/compiler-runtime";import{useLexicalComposerContext as Pc}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as be}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Bc}from"@lexical/utils";import{$getSelection as jc,$isElementNode as ue,$isNodeSelection as Hc,$isRangeSelection as bt,COMMAND_PRIORITY_LOW as Uc,FORMAT_ELEMENT_COMMAND as kt}from"lexical";import{useEffect as Wc}from"react";import{jsx as Go,jsxs as Dc}from"react/jsx-runtime";import"react";var xn=()=>Dc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Go("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Go("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Go("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Vo,jsxs as $c}from"react/jsx-runtime";import"react";var Cn=()=>$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:[Vo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Vo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Vo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Jo,jsxs as Oc}from"react/jsx-runtime";import"react";var Zt=()=>Oc("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 Ko,jsxs as Ac}from"react/jsx-runtime";import"react";var bn=()=>Ac("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:[Ko("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var M=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var kn=t=>({type:"dropdown",ChildComponent:Zt,items:t,key:"align",order:30});var ve=t=>ue(t)?t.getFormatType():t.__format,_n=[kn([{ChildComponent:Zt,isActive:({selection:t})=>{if(!bt(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&ve(e)==="left")continue;let o=e.getParent();if(!((ue(o)||be(o))&&ve(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(kt,"left")},order:1},{ChildComponent:xn,isActive:({selection:t})=>{if(!bt(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&ve(e)==="center")continue;let o=e.getParent();if(!((ue(o)||be(o))&&ve(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(kt,"center")},order:2},{ChildComponent:bn,isActive:({selection:t})=>{if(!bt(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&ve(e)==="right")continue;let o=e.getParent();if(!((ue(o)||be(o))&&ve(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(kt,"right")},order:3},{ChildComponent:Cn,isActive:({selection:t})=>{if(!bt(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&ve(e)==="justify")continue;let o=e.getParent();if(!((ue(o)||be(o))&&ve(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(kt,"justify")},order:4}])],Gc=()=>{let t=Fc(3),[e]=Pc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(kt,Kc,Uc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Wc(o,r),null},Vc=M({plugins:[{Component:Gc,position:"normal"}],toolbarFixed:{groups:_n},toolbarInline:{groups:_n}});function Jc(t){return(ue(t)||be(t))&&!t.isInline()}function Kc(t){let e=jc();if(!bt(e)&&!Hc(e))return!1;let o=e.getNodes();for(let r of o){let n=Bc(r,Jc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as yn,$isQuoteNode as Nn,QuoteNode as Zc}from"@lexical/rich-text";import{$setBlocksType as Rn}from"@lexical/selection";import{$getSelection as In,$isRangeSelection as Yc}from"lexical";import{jsx as Tn}from"react/jsx-runtime";import"react";var Xo=()=>Tn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tn("path",{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 wn}from"react/jsx-runtime";import"react";var _t=()=>wn("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:wn("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 ee=t=>({type:"dropdown",ChildComponent:_t,items:t,key:"text",order:25});import{$createQuoteNode as Xc,$isQuoteNode as Sn,QuoteNode as zc}from"@lexical/rich-text";var En={type:"element",dependencies:[zc],export:(t,e)=>{if(!Sn(t))return null;let o=e(t).split(`
1
+ "use client";import{a as xe,c as xt,d as Ct,e as bt}from"./chunk-XFA5M7FY.js";import{a as ze}from"./chunk-DBWINSQN.js";import{a as kt,b as Ze}from"./chunk-FWFDJAJ5.js";import{a as ge}from"./chunk-INBEEENE.js";import{a as Lc}from"./chunk-F26IQ5RE.js";import{b as Zt,c as Yt,d as ne,e as xn,f as Go,g as Vo,h as yc,i as Rc,k as Ic,m as vc,p as Mc}from"./chunk-QAW5QKEM.js";import{a as Nc,b as W}from"./chunk-BZZVLW4U.js";function z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Fc}from"react/compiler-runtime";import{useLexicalComposerContext as Pc}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as Ce}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Bc}from"@lexical/utils";import{$getSelection as jc,$isElementNode as ce,$isNodeSelection as Hc,$isRangeSelection as _t,COMMAND_PRIORITY_LOW as Uc,FORMAT_ELEMENT_COMMAND as Tt}from"lexical";import{useEffect as Wc}from"react";import{jsx as Jo,jsxs as Dc}from"react/jsx-runtime";import"react";var Cn=()=>Dc("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:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ko,jsxs as $c}from"react/jsx-runtime";import"react";var bn=()=>$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:[Ko("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Xo,jsxs as Oc}from"react/jsx-runtime";import"react";var qt=()=>Oc("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:[Xo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Xo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Xo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as zo,jsxs as Ac}from"react/jsx-runtime";import"react";var kn=()=>Ac("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:[zo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var M=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var _n=t=>({type:"dropdown",ChildComponent:qt,items:t,key:"align",order:30});var De=t=>ce(t)?t.getFormatType():t.__format,Tn=[_n([{ChildComponent:qt,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&De(e)==="left")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&De(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"left")},order:1},{ChildComponent:Cn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&De(e)==="center")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&De(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"center")},order:2},{ChildComponent:kn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&De(e)==="right")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&De(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"right")},order:3},{ChildComponent:bn,isActive:({selection:t})=>{if(!_t(t))return!1;for(let e of t.getNodes()){if((ce(e)||Ce(e))&&De(e)==="justify")continue;let o=e.getParent();if(!((ce(o)||Ce(o))&&De(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,"justify")},order:4}])],Gc=()=>{let t=Fc(3),[e]=Pc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Tt,Kc,Uc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Wc(o,r),null},Vc=M({plugins:[{Component:Gc,position:"normal"}],toolbarFixed:{groups:Tn},toolbarInline:{groups:Tn}});function Jc(t){return(ce(t)||Ce(t))&&!t.isInline()}function Kc(t){let e=jc();if(!_t(e)&&!Hc(e))return!1;let o=e.getNodes();for(let r of o){let n=Bc(r,Jc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as Rn,$isQuoteNode as Ln,QuoteNode as Zc}from"@lexical/rich-text";import{$setBlocksType as In}from"@lexical/selection";import{$getSelection as vn,$isRangeSelection as Yc}from"lexical";import{jsx as wn}from"react/jsx-runtime";import"react";var Zo=()=>wn("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:wn("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 Sn}from"react/jsx-runtime";import"react";var wt=()=>Sn("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:Sn("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 ee=t=>({type:"dropdown",ChildComponent:wt,items:t,key:"text",order:25});import{$createQuoteNode as Xc,$isQuoteNode as En,QuoteNode as zc}from"@lexical/rich-text";var Nn={type:"element",dependencies:[zc],export:(t,e)=>{if(!En(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(Sn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Xc();n.append(...e),t.replace(n),n.select(0,0)}};var Ln=[ee([{ChildComponent:Xo,isActive:({selection:t})=>{if(!Yc(t))return!1;for(let e of t.getNodes())if(!Nn(e)&&!Nn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=In();Rn(e,()=>yn())})},order:20}])],qc=M({markdownTransformers:[En],nodes:[Zc],slashMenu:{groups:[X([{Icon:Xo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=In();Rn(e,()=>yn())})}}])]},toolbarFixed:{groups:Ln},toolbarInline:{groups:Ln}});import{getTranslation as io}from"@payloadcms/translations";import{jsx as zo,jsxs as Qc}from"react/jsx-runtime";import"react";var Yt=()=>Qc("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:[zo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),zo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),zo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as vn}from"react/jsx-runtime";import"react";var qt=()=>vn("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:vn("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 eu}from"react/jsx-runtime";import"react";function Qt(t,e){let{admin:o,imageAltText:r,imageURL:n}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=n,i=r),!s)return e;let d=i??"Block Image";return()=>eu("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Un}from"lexical";import{JSOX as Zo}from"jsox";function eo({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let s=tu(t,n);e[o]=s.value,n=s.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function tu(t,e){let o=t[e];return o==='"'?Mn(t,e):o==="'"?Mn(t,e,!0):o==="{"?ru(t,e):o==="["?ou(t,e):lu(t,e)}function ou(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:Zo.parse(`[${r}]`)}}function Mn(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 ru(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:nu(r)}}function nu(t){return t[0]!=="{"?Zo.parse(t):Zo.parse(t.replace(/(\w+):/g,'"$1":'))}function lu(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function Tt({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${iu(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,Dn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,Dn)}}`));return e.join(" ")}function iu(t){return t.replace(/"/g,"&quot;")}function Dn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function to({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let s="",i="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,h=0,f=d[0].slice(0,n.index),g=0,k=r;e:for(let[R,T]of d.entries()){let C=l?T.trim():T,x=0;if(l)for(let _=0;_<T.length&&T[_]===" ";_++)x++;let b=0;for(R===0&&(b=(n.index??0)+n[0].length-x);b<C.length;){let _=C[b],D=C[b+1];if(c){if(_==="`"&&h++,h%2===0)if(_==="<"&&D==="/"){if(u--,u<0){i[i.length-1]===`
4
- `&&(i=i.slice(0,-1)),k=R;for(let I=b;I<C.length;I++)if(C[I]===">"){g=I+1;break}break e}}else if(_==="/"&&D===">"){if(u--,u<0){i[i.length-1]===`
5
- `&&(i=i.slice(0,-1)),k=R,g=b+2;break e}}else _==="<"&&D!=="/"&&u++;i+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&D===">"&&a===0&&!m){p=!0,k=R,g=b+2;break e}else if(_===">"&&a===0&&!m){c=!0,b++;continue}s+=_}b++}if(c?i?.length>0&&R>0&&(i+=`
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(En(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Xc();n.append(...e),t.replace(n),n.select(0,0)}};var yn=[ee([{ChildComponent:Zo,isActive:({selection:t})=>{if(!Yc(t))return!1;for(let e of t.getNodes())if(!Ln(e)&&!Ln(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=vn();In(e,()=>Rn())})},order:20}])],qc=M({markdownTransformers:[Nn],nodes:[Zc],slashMenu:{groups:[z([{Icon:Zo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=vn();In(e,()=>Rn())})}}])]},toolbarFixed:{groups:yn},toolbarInline:{groups:yn}});import{getTranslation as ao}from"@payloadcms/translations";import{jsx as Yo,jsxs as Qc}from"react/jsx-runtime";import"react";var Qt=()=>Qc("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:[Yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Mn}from"react/jsx-runtime";import"react";var eo=()=>Mn("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:Mn("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 eu}from"react/jsx-runtime";import"react";function to(t,e){let{admin:o,imageAltText:r,imageURL:n}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=n,i=r),!s)return e;let d=i??"Block Image";return()=>eu("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Wn}from"lexical";import{JSOX as qo}from"jsox";function oo({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let s=tu(t,n);e[o]=s.value,n=s.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function tu(t,e){let o=t[e];return o==='"'?Dn(t,e):o==="'"?Dn(t,e,!0):o==="{"?ru(t,e):o==="["?ou(t,e):lu(t,e)}function ou(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:qo.parse(`[${r}]`)}}function Dn(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 ru(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:nu(r)}}function nu(t){return t[0]!=="{"?qo.parse(t):qo.parse(t.replace(/(\w+):/g,'"$1":'))}function lu(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function St({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${iu(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,$n)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,$n)}}`));return e.join(" ")}function iu(t){return t.replace(/"/g,"&quot;")}function $n(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function ro({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let s="",i="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,h=0,f=d[0].slice(0,n.index),g=0,k=r;e:for(let[y,T]of d.entries()){let C=l?T.trim():T,x=0;if(l)for(let _=0;_<T.length&&T[_]===" ";_++)x++;let b=0;for(y===0&&(b=(n.index??0)+n[0].length-x);b<C.length;){let _=C[b],D=C[b+1];if(c){if(_==="`"&&h++,h%2===0)if(_==="<"&&D==="/"){if(u--,u<0){i[i.length-1]===`
4
+ `&&(i=i.slice(0,-1)),k=y;for(let v=b;v<C.length;v++)if(C[v]===">"){g=v+1;break}break e}}else if(_==="/"&&D===">"){if(u--,u<0){i[i.length-1]===`
5
+ `&&(i=i.slice(0,-1)),k=y,g=b+2;break e}}else _==="<"&&D!=="/"&&u++;i+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&D===">"&&a===0&&!m){p=!0,k=y,g=b+2;break e}else if(_===">"&&a===0&&!m){c=!0,b++;continue}s+=_}b++}if(c?i?.length>0&&y>0&&(i+=`
6
6
  `):s+=`
7
- `,o&&u<0){let _=C.match(o);if(_?.index!==void 0){k=R,g=_.index+_[0].length-1;break}}if(R===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
7
+ `,o&&u<0){let _=C.match(o);if(_?.index!==void 0){k=y,g=_.index+_[0].length-1;break}}if(y===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[k].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:r+k,endlineLastCharIndex:g,propsString:s}}import{jsx as Bu}from"react/jsx-runtime";import ju from"bson-objectid";import{$applyNodeReplacement as Hu}from"lexical";import"react";import{DecoratorBlockNode as su}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as au}from"@lexical/utils";import cu from"bson-objectid";import{$applyNodeReplacement as uu}from"lexical";var wt=class extends su{__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=du(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return au(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 du(t){return uu(new wt({fields:{...t,id:t?.id||new cu.default().toHexString()}}))}import{jsx as G,jsxs as St,Fragment as Fn}from"react/jsx-runtime";import{useLexicalComposerContext as bu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ku}from"@lexical/react/useLexicalEditable";import{getTranslation as _u}from"@payloadcms/translations";import{Button as Pn,Collapsible as Tu,Drawer as wu,EditDepthProvider as Su,ErrorPill as Eu,Form as Nu,formatDrawerSlug as Lu,FormSubmit as yu,Pill as Ru,RenderFields as Iu,SectionTitle as vu,useConfig as Mu,useDocumentForm as Du,useDocumentInfo as Bn,useEditDepth as $u,useFormSubmitted as Ou,useServerFunctions as Au,useTranslation as Fu}from"@payloadcms/ui";import{abortAndIgnore as Yo}from"@payloadcms/ui/shared";import{$getNodeByKey as ro,SKIP_DOM_SELECTION_TAG as qo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as no,reduceFieldsToValues as jn}from"payload/shared";import Ze,{useCallback as Qo,useEffect as er,useMemo as Oe,useRef as tr}from"react";import{v4 as Pu}from"uuid";import{c as mu}from"react/compiler-runtime";import{jsx as oo,jsxs as pu}from"react/jsx-runtime";import{useLexicalEditable as fu}from"@lexical/react/useLexicalEditable";import{RenderFields as hu,useFormSubmitted as gu}from"@payloadcms/ui";import xu,{createContext as Cu}from"react";var $n=Cu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ie=()=>xu.use($n),On=t=>{let e=mu(4),{Collapsible:o,CustomBlock:r,CustomLabel:n,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=gu()&&i>0,a=fu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,...k}=f;return oo(o,{errorCount:i,fieldHasErrors:u,...k,children:g})},e[0]=o,e[1]=i,e[2]=u,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return r?pu($n,{value:h,children:[r,oo(s,{})]}):oo(p,{children:oo(hu,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function An({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Hn=t=>{let{cacheBuster:e,className:o,CustomBlock:r,CustomLabel:n,formData:l,nodeKey:s}=t,i=Ou(),{id:d,collectionSlug:c,globalSlug:u}=Bn(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=U(),{fields:g}=Du(),k=tr(new AbortController),N=$u(),[R,T]=Ze.useState(0),{config:C}=Mu(),x=Lu({slug:`lexical-blocks-create-${f}-${l.id}`,depth:N}),{toggleDrawer:b}=xe(x),{getDocPreferences:_,setDocFieldPreferences:D}=Bn(),[I]=bu(),y=ku(),S=l.blockType,{getFormState:w}=Au(),L=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}.fields`,[E,v]=Ze.useState(()=>{let H=p?.[l.id]?.formState;if(!H)return!1;let Q=Object.fromEntries(Object.entries(H).map(([W,V])=>[W,W in l?{...V,initialValue:l[W],value:l[W]}:V]));return Q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},Q}),$=tr(!1),O=tr(e);er(()=>{$.current?(O.current!==e&&v(!1),O.current=e):$.current=!0},[e]);let[F]=Ze.useState(()=>Pu()),[P,Z]=Ze.useState(()=>{if(!n)return E?._components?.customComponents?.BlockLabel??void 0}),[K,Ve]=Ze.useState(()=>{if(!r)return E?._components?.customComponents?.Block??void 0}),Re=Oe(()=>r?G(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ie}):K,[r,o,l,s,K]),he=Oe(()=>n?G(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ie}):P,[n,o,l,s,P]);er(()=>{let H=new AbortController;return l&&!E&&(async()=>{let{state:W}=await w({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:no(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!y,renderAllFields:!0,schemaPath:L,signal:H.signal});if(W){W.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let V=jn(no(W,{excludeFiles:!0}),!0);I.update(()=>{let Y=ro(s);if(Y&&Ae(Y)){let ne=V;ne.blockType=S,Y.setFields(ne,!0)}},{tag:qo}),v(W),n||Z(W._components?.customComponents?.BlockLabel??void 0),r||Ve(W._components?.customComponents?.Block??void 0)}})(),()=>{Yo(H)}},[w,L,y,d,n,r,l,I,s,E,c,u,_,g,S]);let[re,ge]=Ze.useState(p?.[l.id]?.collapsed??!1),Vt=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}`,se=a.blocks?.[Vt]?.[0],q=se.blockReferences?typeof se?.blockReferences?.[0]=="string"?C.blocksMap[se?.blockReferences?.[0]]:se?.blockReferences?.[0]:se?.blocks?.[0],{i18n:pt,t:Ie}=Fu(),ft=Qo(async({formState:H,submit:Q})=>{Yo(k.current);let W=new AbortController;k.current=W;let{state:V}=await w({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:no(g,{excludeFiles:!0}),formState:H,globalSlug:u,initialBlockFormState:H,operation:"update",readOnly:!y,renderAllFields:!!Q,schemaPath:L,signal:W.signal});if(!V)return H;H.blockName&&(V.blockName=H.blockName);let Y=jn(An({fields:no(V,{excludeFiles:!0})}),!0);if(setTimeout(()=>{I.update(()=>{let ne=ro(s);if(ne&&Ae(ne)){let Ke=Y;Ke.blockType=S,ne.setFields(Ke,!0)}},{tag:qo})},0),Q){n||Z(V._components?.customComponents?.BlockLabel??void 0),r||Ve(V._components?.customComponents?.Block??void 0);let ne=0;for(let Ke of Object.values(V))Ke?.valid===!1&&ne++;T(ne)}return V},[w,d,c,_,u,L,S,g,y,I,s,r,n]);er(()=>()=>{Yo(k.current)},[]);let cn=Qo(()=>{I.update(()=>{ro(s)?.remove()})},[I,s]),Je=q?.labels?.singular?_u(q.labels.singular,pt):q?.slug,un=Qo(H=>{_().then(Q=>{let V=Q?.fields?.[m.name]?.collapsed,Y=V&&V?.length?V:[];H?Y.includes(l.id)||Y.push(l.id):Y.includes(l.id)&&Y.splice(Y.indexOf(l.id),1),D(m.name,{collapsed:Y,hello:"hi"})})},[_,m.name,D,l.id]),Jt=Oe(()=>()=>G(Pn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!y,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),b(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"small",tooltip:Ie("lexical:blocks:inlineBlocks:edit",{label:Je})}),[o,y,Ie,Je,b]),Kt=Oe(()=>()=>G(Pn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!y,icon:"x",onClick:H=>{H.preventDefault(),cn()},round:!0,tooltip:"Remove Block"}),[o,y,cn]),jo=Oe(()=>({Actions:H,children:Q,className:W,collapsibleProps:V,disableBlockName:Y,editButton:ne,errorCount:Ke,fieldHasErrors:Ho,Label:pn,Pill:fn,removeButton:Ec})=>G("div",{className:`${o}__container ${o}-${S}`,children:G(Tu,{className:[`${o}__row`,Ho?`${o}__row--has-errors`:`${o}__row--no-errors`,W].filter(Boolean).join(" "),collapsibleStyle:Ho?"error":"default",header:St("div",{className:`${o}__block-header`,children:[typeof pn<"u"?pn:typeof he<"u"?he:St("div",{className:`${o}__block-label`,children:[typeof fn<"u"?fn:G(Ru,{className:`${o}__block-pill ${o}__block-pill-${S}`,pillStyle:"white",size:"small",children:Je??S}),!Y&&!q?.admin?.disableBlockName&&G(vu,{path:"blockName",readOnly:!y}),Ho&&G(Eu,{count:Ke??0,i18n:pt,withMessage:!0})]}),G("div",{className:`${o}__block-actions`,children:typeof H<"u"?H:St(Fn,{children:[Re&&ne!==!1||!Re&&ne?G(Jt,{}):null,Ec!==!1&&y?G(Kt,{}):null]})})]}),isCollapsed:re,onToggle:hn=>{un(hn),ge(hn)},...V||{},children:Q},0)}),[Re,he,Jt,Kt,Je,o,q?.admin?.disableBlockName,S,pt,re,un,y]),dn=l?.id,mn=Oe(()=>()=>G(Su,{children:G(wu,{className:"",slug:x,title:Ie(`lexical:blocks:inlineBlocks:${dn?"edit":"create"}`,{label:Je??Ie("lexical:blocks:inlineBlocks:label")}),children:E?St(Fn,{children:[G(Iu,{fields:q?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:L,permissions:!0,readOnly:!y}),G(yu,{programmaticSubmit:!0,children:Ie("fields:saveChanges")})]}):null})}),[E,x,dn,Je,Ie,y,q?.fields,L]),Sc=Oe(()=>E?G("div",{"data-block-drawer-slug":x,style:{display:"contents"},children:G(Nu,{beforeSubmit:[async({formState:H})=>await ft({formState:H,submit:!0})],el:"div",fields:q?.fields??[],initialState:E,onChange:[ft],onSubmit:(H,Q)=>{Q.blockType=S,I.update(()=>{let W=ro(s);W&&Ae(W)&&W.setFields(Q,!0)},{tag:qo}),b()},submitted:i,uuid:F,children:G(On,{baseClass:o,BlockDrawer:mn,Collapsible:jo,CustomBlock:Re,CustomLabel:he,EditButton:Jt,errorCount:R,formSchema:q?.fields??[],initialState:E,nodeKey:s,RemoveButton:Kt})})}):null,[jo,mn,Re,he,S,x,Kt,Jt,o,I,R,b,q?.fields,F,E,s,ft,i]);return q?Sc:G(jo,{disableBlockName:!0,fieldHasErrors:!0,children:St("div",{className:`${o}-not-found`,children:["Error: Block '",S,"' not found in the config but exists in the lexical data"]})})};var ae=class extends wt{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=Fe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,r,n]){return Bu(Hn,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:r,CustomLabel:n,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Fe(t){return Hu(new ae({fields:{...t,id:t?.id||new ju.default().toHexString()}}))}function Ae(t){return t instanceof ae}import{createHeadlessEditor as Uu}from"@lexical/headless";function or(t,e){return({editorState:r})=>{let n=Uu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return n.getEditorState().read(()=>{l=zt(e)}),l}}import{createHeadlessEditor as Wu}from"@lexical/headless";function lo(t,e){return({markdown:r})=>{let n=Wu({nodes:t});return n.update(()=>{Xt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Gu(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Gn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Wn(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Wn(r,!0);n&&(o=o.concat(n))}return o};function Wn(t,e){if(!t.jsx)return null;let o=Gu(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[ht],export:s=>{if(!xt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=or(n,l),c=t.jsx.export({fields:i,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?`<${i.blockType}${u?" "+Tt({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+Tt({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=to({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:d,propsString:c}=to({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,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:i,props:c?eo({propsString:c}):{}});if(a===!1)return;let m=gt({blockType:t.slug,...a});s.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[ae],export:s=>{if(!Ae(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=or(n,l),c=t.jsx.export({fields:i,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[k].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:r+k,endlineLastCharIndex:g,propsString:s}}import{jsx as Bu}from"react/jsx-runtime";import ju from"bson-objectid";import{$applyNodeReplacement as Hu}from"lexical";import"react";import{DecoratorBlockNode as su}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as au}from"@lexical/utils";import cu from"bson-objectid";import{$applyNodeReplacement as uu}from"lexical";var Et=class extends su{__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=du(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return au(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 du(t){return uu(new Et({fields:{...t,id:t?.id||new cu.default().toHexString()}}))}import{jsx as V,jsxs as Nt,Fragment as Pn}from"react/jsx-runtime";import{useLexicalComposerContext as bu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ku}from"@lexical/react/useLexicalEditable";import{getTranslation as _u}from"@payloadcms/translations";import{Button as Bn,Collapsible as Tu,Drawer as wu,EditDepthProvider as Su,ErrorPill as Eu,Form as Nu,formatDrawerSlug as Lu,FormSubmit as yu,Pill as Ru,RenderFields as Iu,SectionTitle as vu,useConfig as Mu,useDocumentForm as Du,useDocumentInfo as jn,useEditDepth as $u,useFormSubmitted as Ou,useServerFunctions as Au,useTranslation as Fu}from"@payloadcms/ui";import{abortAndIgnore as Qo}from"@payloadcms/ui/shared";import{$getNodeByKey as lo,SKIP_DOM_SELECTION_TAG as er}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as io,reduceFieldsToValues as Hn}from"payload/shared";import Ye,{useCallback as tr,useEffect as or,useMemo as Fe,useRef as rr}from"react";import{v4 as Pu}from"uuid";import{c as mu}from"react/compiler-runtime";import{jsx as no,jsxs as pu}from"react/jsx-runtime";import{useLexicalEditable as fu}from"@lexical/react/useLexicalEditable";import{RenderFields as hu,useFormSubmitted as gu}from"@payloadcms/ui";import xu,{createContext as Cu}from"react";var On=Cu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),le=()=>xu.use(On),An=t=>{let e=mu(4),{Collapsible:o,CustomBlock:r,CustomLabel:n,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=gu()&&i>0,a=fu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,...k}=f;return no(o,{errorCount:i,fieldHasErrors:u,...k,children:g})},e[0]=o,e[1]=i,e[2]=u,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return r?pu(On,{value:h,children:[r,no(s,{})]}):no(p,{children:no(hu,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function Fn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Un=t=>{let{cacheBuster:e,className:o,CustomBlock:r,CustomLabel:n,formData:l,nodeKey:s}=t,i=Ou(),{id:d,collectionSlug:c,globalSlug:u}=jn(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=W(),{fields:g}=Du(),k=rr(new AbortController),E=$u(),[y,T]=Ye.useState(0),{config:C}=Mu(),x=Lu({slug:`lexical-blocks-create-${f}-${l.id}`,depth:E}),{toggleDrawer:b}=ge(x),{getDocPreferences:_,setDocFieldPreferences:D}=jn(),[v]=bu(),L=ku(),S=l.blockType,{getFormState:w}=Au(),N=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}.fields`,[I,$]=Ye.useState(()=>{let U=p?.[l.id]?.formState;if(!U)return!1;let Q=Object.fromEntries(Object.entries(U).map(([G,J])=>[G,G in l?{...J,initialValue:l[G],value:l[G]}:J]));return Q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},Q}),R=rr(!1),O=rr(e);or(()=>{R.current?(O.current!==e&&$(!1),O.current=e):R.current=!0},[e]);let[F]=Ye.useState(()=>Pu()),[j,X]=Ye.useState(()=>{if(!n)return I?._components?.customComponents?.BlockLabel??void 0}),[P,Ke]=Ye.useState(()=>{if(!r)return I?._components?.customComponents?.Block??void 0}),ye=Fe(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:le}):P,[r,o,l,s,P]),fe=Fe(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:le}):j,[n,o,l,s,j]);or(()=>{let U=new AbortController;return l&&!I&&(async()=>{let{state:G}=await w({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:io(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!L,renderAllFields:!0,schemaPath:N,signal:U.signal});if(G){G.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let J=Hn(io(G,{excludeFiles:!0}),!0);v.update(()=>{let Y=lo(s);if(Y&&Pe(Y)){let re=J;re.blockType=S,Y.setFields(re,!0)}},{tag:er}),$(G),n||X(G._components?.customComponents?.BlockLabel??void 0),r||Ke(G._components?.customComponents?.Block??void 0)}})(),()=>{Qo(U)}},[w,N,L,d,n,r,l,v,s,I,c,u,_,g,S]);let[ft,ht]=Ye.useState(p?.[l.id]?.collapsed??!1),ie=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}`,Ie=a.blocks?.[ie]?.[0],q=Ie.blockReferences?typeof Ie?.blockReferences?.[0]=="string"?C.blocksMap[Ie?.blockReferences?.[0]]:Ie?.blockReferences?.[0]:Ie?.blocks?.[0],{i18n:he,t:ve}=Fu(),gt=tr(async({formState:U,submit:Q})=>{Qo(k.current);let G=new AbortController;k.current=G;let{state:J}=await w({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:io(g,{excludeFiles:!0}),formState:U,globalSlug:u,initialBlockFormState:U,operation:"update",readOnly:!L,renderAllFields:!!Q,schemaPath:N,signal:G.signal});if(!J)return U;U.blockName&&(J.blockName=U.blockName);let Y=Hn(Fn({fields:io(J,{excludeFiles:!0})}),!0);if(setTimeout(()=>{v.update(()=>{let re=lo(s);if(re&&Pe(re)){let Xe=Y;Xe.blockType=S,re.setFields(Xe,!0)}},{tag:er})},0),Q){n||X(J._components?.customComponents?.BlockLabel??void 0),r||Ke(J._components?.customComponents?.Block??void 0);let re=0;for(let Xe of Object.values(J))Xe?.valid===!1&&re++;T(re)}return J},[w,d,c,_,u,N,S,g,L,v,s,r,n]);or(()=>()=>{Qo(k.current)},[]);let Kt=tr(()=>{v.update(()=>{lo(s)?.remove()})},[v,s]),Me=q?.labels?.singular?_u(q.labels.singular,he):q?.slug,dn=tr(U=>{_().then(Q=>{let J=Q?.fields?.[m.name]?.collapsed,Y=J&&J?.length?J:[];U?Y.includes(l.id)||Y.push(l.id):Y.includes(l.id)&&Y.splice(Y.indexOf(l.id),1),D(m.name,{collapsed:Y,hello:"hi"})})},[_,m.name,D,l.id]),Xt=Fe(()=>()=>V(Bn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!L,el:"button",icon:"edit",onClick:U=>(U.preventDefault(),U.stopPropagation(),b(),!1),onMouseDown:U=>{U.preventDefault()},round:!0,size:"small",tooltip:ve("lexical:blocks:inlineBlocks:edit",{label:Me})}),[o,L,ve,Me,b]),zt=Fe(()=>()=>V(Bn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!L,icon:"x",onClick:U=>{U.preventDefault(),Kt()},round:!0,tooltip:"Remove Block"}),[o,L,Kt]),Uo=Fe(()=>({Actions:U,children:Q,className:G,collapsibleProps:J,disableBlockName:Y,editButton:re,errorCount:Xe,fieldHasErrors:Wo,Label:fn,Pill:hn,removeButton:Ec})=>V("div",{className:`${o}__container ${o}-${S}`,children:V(Tu,{className:[`${o}__row`,Wo?`${o}__row--has-errors`:`${o}__row--no-errors`,G].filter(Boolean).join(" "),collapsibleStyle:Wo?"error":"default",header:Nt("div",{className:`${o}__block-header`,children:[typeof fn<"u"?fn:typeof fe<"u"?fe:Nt("div",{className:`${o}__block-label`,children:[typeof hn<"u"?hn:V(Ru,{className:`${o}__block-pill ${o}__block-pill-${S}`,pillStyle:"white",size:"small",children:Me??S}),!Y&&!q?.admin?.disableBlockName&&V(vu,{path:"blockName",readOnly:!L}),Wo&&V(Eu,{count:Xe??0,i18n:he,withMessage:!0})]}),V("div",{className:`${o}__block-actions`,children:typeof U<"u"?U:Nt(Pn,{children:[ye&&re!==!1||!ye&&re?V(Xt,{}):null,Ec!==!1&&L?V(zt,{}):null]})})]}),isCollapsed:ft,onToggle:gn=>{dn(gn),ht(gn)},...J||{},children:Q},0)}),[ye,fe,Xt,zt,Me,o,q?.admin?.disableBlockName,S,he,ft,dn,L]),mn=l?.id,pn=Fe(()=>()=>V(Su,{children:V(wu,{className:"",slug:x,title:ve(`lexical:blocks:inlineBlocks:${mn?"edit":"create"}`,{label:Me??ve("lexical:blocks:inlineBlocks:label")}),children:I?Nt(Pn,{children:[V(Iu,{fields:q?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:!0,readOnly:!L}),V(yu,{programmaticSubmit:!0,children:ve("fields:saveChanges")})]}):null})}),[I,x,mn,Me,ve,L,q?.fields,N]),Sc=Fe(()=>I?V("div",{"data-block-drawer-slug":x,style:{display:"contents"},children:V(Nu,{beforeSubmit:[async({formState:U})=>await gt({formState:U,submit:!0})],el:"div",fields:q?.fields??[],initialState:I,onChange:[gt],onSubmit:(U,Q)=>{Q.blockType=S,v.update(()=>{let G=lo(s);G&&Pe(G)&&G.setFields(Q,!0)},{tag:er}),b()},submitted:i,uuid:F,children:V(An,{baseClass:o,BlockDrawer:pn,Collapsible:Uo,CustomBlock:ye,CustomLabel:fe,EditButton:Xt,errorCount:y,formSchema:q?.fields??[],initialState:I,nodeKey:s,RemoveButton:zt})})}):null,[Uo,pn,ye,fe,S,x,zt,Xt,o,v,y,b,q?.fields,F,I,s,gt,i]);return q?Sc:V(Uo,{disableBlockName:!0,fieldHasErrors:!0,children:Nt("div",{className:`${o}-not-found`,children:["Error: Block '",S,"' not found in the config but exists in the lexical data"]})})};var se=class extends Et{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=Be(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,r,n]){return Bu(Un,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:r,CustomLabel:n,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return Hu(new se({fields:{...t,id:t?.id||new ju.default().toHexString()}}))}function Pe(t){return t instanceof se}import{createHeadlessEditor as Uu}from"@lexical/headless";function nr(t,e){return({editorState:r})=>{let n=Uu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return n.getEditorState().read(()=>{l=Yt(e)}),l}}import{createHeadlessEditor as Wu}from"@lexical/headless";function so(t,e){return({markdown:r})=>{let n=Wu({nodes:t});return n.update(()=>{Zt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Gu(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=Gn(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Gn(r,!0);n&&(o=o.concat(n))}return o};function Gn(t,e){if(!t.jsx)return null;let o=Gu(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[xt],export:s=>{if(!bt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=nr(n,l),c=t.jsx.export({fields:i,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?`<${i.blockType}${u?" "+St({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+St({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=ro({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:d,propsString:c}=ro({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=so(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?oo({propsString:c}):{}});if(a===!1)return;let m=Ct({blockType:t.slug,...a});s.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[se],export:s=>{if(!Pe(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=nr(n,l),c=t.jsx.export({fields:i,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 h of m.split(`
12
12
  `)){let f="";!t?.jsx?.doNotTrimChildren&&h!==""&&(f=" "),f+=h+`
13
13
  `,p+=f}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
- `;return`<${i.blockType}${u?" "+Tt({props:a}):""}>
15
- ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+Tt({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,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:h,content:f,endLineIndex:g,propsString:k}=to({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),N="";if(t?.jsx?.doNotTrimChildren)N=f.endsWith(`
14
+ `;return`<${i.blockType}${u?" "+St({props:a}):""}>
15
+ ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+St({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,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:h,content:f,endLineIndex:g,propsString:k}=ro({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=f.endsWith(`
16
16
  `)?f.slice(0,-1):f;else if(f.includes(`
17
17
  `)){let x=f.split(`
18
- `),b=0;for(let _ of x){if(b++,_.startsWith(" "))N+=_.slice(2);else if(_==="")N+=_;else{N=f.endsWith(`
19
- `)?f.slice(0,-1):f;break}N+=b===x.length?"":`
20
- `}}else N=(f.startsWith(" ")?f.slice(2):f)+`
21
- `;if(!t?.jsx?.import)return[!1,d];let R=lo(n,l),T=t.jsx.import({children:N,closeMatch:null,htmlToLexical:null,markdownToLexical:R,openMatch:c,props:k?eo({propsString:k}):{}});if(T===!1)return[!1,d];let C=Fe({blockType:t.slug,...T});if(C){let x=null,b=null;if(h?.length){x=R({markdown:h})?.root?.children??[];let _=x?.[0];_&&i.append(Un(_))}if(i.append(C),p?.length){b=R({markdown:p})?.root?.children;let _=i.getChildren()[i.getChildren().length-1],D=Un(b[0])?.getChildren();if(D?.length)for(let I of D)_.append(I)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,d,c,u)=>{if(t?.jsx?.import){if(!u){let g="";if(i)for(let k of i)g+=k.getTextContent();u=[g]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
18
+ `),b=0;for(let _ of x){if(b++,_.startsWith(" "))E+=_.slice(2);else if(_==="")E+=_;else{E=f.endsWith(`
19
+ `)?f.slice(0,-1):f;break}E+=b===x.length?"":`
20
+ `}}else E=(f.startsWith(" ")?f.slice(2):f)+`
21
+ `;if(!t?.jsx?.import)return[!1,d];let y=so(n,l),T=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:y,openMatch:c,props:k?oo({propsString:k}):{}});if(T===!1)return[!1,d];let C=Be({blockType:t.slug,...T});if(C){let x=null,b=null;if(h?.length){x=y({markdown:h})?.root?.children??[];let _=x?.[0];_&&i.append(Wn(_))}if(i.append(C),p?.length){b=y({markdown:p})?.root?.children;let _=i.getChildren()[i.getChildren().length-1],D=Wn(b[0])?.getChildren();if(D?.length)for(let v of D)_.append(v)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,d,c,u)=>{if(t?.jsx?.import){if(!u){let g="";if(i)for(let k of i)g+=k.getTextContent();u=[g]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
22
22
  `):a=u.join(`
23
- `).trim();let m=d[1]?.trim(),p=lo(n,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?eo({propsString:m}):{}});if(h===!1)return!1;let f=Fe({blockType:t.slug,...h});f&&s.append(f);return}return!1}})),r)}import{createCommand as Vn}from"lexical";var Ye=Vn("INSERT_BLOCK_COMMAND"),qe=Vn("INSERT_INLINE_BLOCK_COMMAND");import{c as Vu}from"react/compiler-runtime";import{useLexicalComposerContext as Ju}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ku,$wrapNodeInElement as Xu,mergeRegister as zu}from"@lexical/utils";import{formatDrawerSlug as Zu,useEditDepth as Yu}from"@payloadcms/ui";import{$createParagraphNode as qu,$getNodeByKey as Qu,$getPreviousSelection as ed,$getSelection as td,$insertNodes as od,$isParagraphNode as rd,$isRangeSelection as nd,$isRootOrShadowRoot as ld,COMMAND_PRIORITY_EDITOR as Jn}from"lexical";import{useEffect as id,useState as sd}from"react";var Kn=()=>{let t=Vu(12),[e]=Ju(),[o,r]=sd(null),{setCreatedInlineBlock:n,uuid:l}=U(),s=Yu(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=Zu({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=xe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([ae]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return zu(e.registerCommand(Ye,p=>(e.update(()=>{let h=td()||ed();if(nd(h)){let f=Fe(p),{focus:g}=h,k=g.getNode();Ku(f),rd(k)&&!k.__first&&k.remove()}}),!0),Jn),e.registerCommand(qe,p=>{if(o){let f=Qu(o);return!f||!xt(f)?!1:(f.setFields(p),r(null),!0)}let h=gt(p);return n?.(h),od([h]),ld(h.getParentOrThrow())&&Xu(h,qu).selectEnd(),!0},Jn))},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],id(a,m),null};var ad=M(({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`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=i.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:Gn({blocks:c,inlineBlocks:u}),nodes:[ae,ht],plugins:[{Component:Kn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Qt(a,Yt),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(Ye,{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(qe,{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,Yt),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(Ye,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:qt,items:u.map((a,m)=>({ChildComponent:Qt(a,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(qe,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as dd}from"react/compiler-runtime";import{jsx as Be,jsxs as ir}from"react/jsx-runtime";import{useLexicalComposerContext as md}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as pd,$createTextNode as fd,$getRoot as hd,getDOMSelection as rr}from"lexical";import*as qn from"react";import{useCallback as Pe,useEffect as nr,useLayoutEffect as zn,useRef as lr,useState as so}from"react";var cd=le&&"documentMode"in document?document.documentMode:null,Xn=le&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),c6=le&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),u6=le&&"InputEvent"in window&&!cd?"getTargetRanges"in new window.InputEvent("input"):!1,d6=le&&/Version\/[\d.].*Safari/.test(navigator.userAgent),m6=le&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,p6=le&&/Android/.test(navigator.userAgent),f6=le&&/Win/.test(navigator.platform),ud=le&&/^(?=.*Chrome).*/i.test(navigator.userAgent),h6=le&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ud;var gd=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)},xd=(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)},Cd=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=so(n,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?oo({propsString:m}):{}});if(h===!1)return!1;let f=Be({blockType:t.slug,...h});f&&s.append(f);return}return!1}})),r)}import{createCommand as Jn}from"lexical";var qe=Jn("INSERT_BLOCK_COMMAND"),Qe=Jn("INSERT_INLINE_BLOCK_COMMAND");import{c as Vu}from"react/compiler-runtime";import{useLexicalComposerContext as Ju}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ku,$wrapNodeInElement as Xu,mergeRegister as zu}from"@lexical/utils";import{formatDrawerSlug as Zu,useEditDepth as Yu}from"@payloadcms/ui";import{$createParagraphNode as qu,$getNodeByKey as Qu,$getPreviousSelection as ed,$getSelection as td,$insertNodes as od,$isParagraphNode as rd,$isRangeSelection as nd,$isRootOrShadowRoot as ld,COMMAND_PRIORITY_EDITOR as Kn}from"lexical";import{useEffect as id,useState as sd}from"react";var Xn=()=>{let t=Vu(12),[e]=Ju(),[o,r]=sd(null),{setCreatedInlineBlock:n,uuid:l}=W(),s=Yu(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=Zu({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=ge(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([se]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return zu(e.registerCommand(qe,p=>(e.update(()=>{let h=td()||ed();if(nd(h)){let f=Be(p),{focus:g}=h,k=g.getNode();Ku(f),rd(k)&&!k.__first&&k.remove()}}),!0),Kn),e.registerCommand(Qe,p=>{if(o){let f=Qu(o);return!f||!bt(f)?!1:(f.setFields(p),r(null),!0)}let h=Ct(p);return n?.(h),od([h]),ld(h.getParentOrThrow())&&Xu(h,qu).selectEnd(),!0},Kn))},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],id(a,m),null};var ad=M(({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`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=i.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:[se,xt],plugins:[{Component:Xn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:to(a,Qt),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?ao(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:eo,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?ao(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Qe,{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:Qt,items:c.map((a,m)=>({ChildComponent:to(a,Qt),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?ao(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(qe,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:eo,items:u.map((a,m)=>({ChildComponent:to(a,eo),isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?ao(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Qe,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as dd}from"react/compiler-runtime";import{jsx as He,jsxs as ar}from"react/jsx-runtime";import{useLexicalComposerContext as md}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as pd,$createTextNode as fd,$getRoot as hd,getDOMSelection as lr}from"lexical";import*as Qn from"react";import{useCallback as je,useEffect as ir,useLayoutEffect as Zn,useRef as sr,useState as co}from"react";var cd=ne&&"documentMode"in document?document.documentMode:null,zn=ne&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),u6=ne&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),d6=ne&&"InputEvent"in window&&!cd?"getTargetRanges"in new window.InputEvent("input"):!1,m6=ne&&/Version\/[\d.].*Safari/.test(navigator.userAgent),p6=ne&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,f6=ne&&/Android/.test(navigator.userAgent),h6=ne&&/Win/.test(navigator.platform),ud=ne&&/^(?=.*Chrome).*/i.test(navigator.userAgent),g6=ne&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ud;var gd=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)},xd=(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)},Cd=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}</${i.blockType}>`}return`<${i.blockType}${u?" "+Tt({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 bd(t){return t.key.toLowerCase()==="a"&&(Xn?t.metaKey:t.ctrlKey)}function kd(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 Zn(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 Yn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function _d(t){let[e,o]=so([]),[r,n]=so(!1),[,l]=so(""),[s,i]=so(""),d=lr(null),c=lr(!1),u=lr(null),a=Pe(()=>t,[t]),m=Pe(()=>{let T=t.getRootElement(),C=rr(t._window);return T==null||C==null||C.anchorNode==null||C.focusNode==null||!T.contains(C.anchorNode)||!T.contains(C.focusNode)?null:`
33
+ );`}};function bd(t){return t.key.toLowerCase()==="a"&&(zn?t.metaKey:t.ctrlKey)}function kd(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 Yn(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 qn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function _d(t){let[e,o]=co([]),[r,n]=co(!1),[,l]=co(""),[s,i]=co(""),d=sr(null),c=sr(!1),u=sr(null),a=je(()=>t,[t]),m=je(()=>{let T=t.getRootElement(),C=lr(t._window);return T==null||C==null||C.anchorNode==null||C.focusNode==null||!T.contains(C.anchorNode)||!T.contains(C.focusNode)?null:`
34
34
  import {
35
35
  initializeE2E,
36
36
  assertHTMLSnapshot,
@@ -51,16 +51,16 @@ ${e.map(Cd).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=Pe((T,C)=>{o(x=>{let b=e.length-1,_=e[b];if(_&&_.name===T){if(T==="type")return[...e.slice(0,b),{..._,value:_.value+C}];if(_.value===C)return[...e.slice(0,b),{..._,count:_.count+1}]}return[...x,{name:T,count:1,value:C}]})},[e,o]);zn(()=>{let T=x=>{if(!r)return;let b=x.key;bd(x)?p("selectAll",""):Yn.has(b)?p("press",x.key):[...b].length>1?p("keydown",x.key):p("type",x.key)},C=x=>{if(!r)return;let b=x.key;!Yn.has(b)&&[...b].length>1&&p("keyup",x.key)};return t.registerRootListener((x,b)=>{b!==null&&(b.removeEventListener("keydown",T),b.removeEventListener("keyup",C)),x!==null&&(x.addEventListener("keydown",T),x.addEventListener("keyup",C))})},[t,r,p]),zn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),nr(()=>{if(e){let T=m();T!==null&&i(T),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),nr(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:x,editorState:b})=>{if(!r)return;let _=b._selection,D=d.current,I=c.current;if(D!==_){if(x.size===0&&C.size===0&&!I){let S=rr(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}d.current=_}c.current=!1;let y=m();y!==null&&i(y)}),[t,m,r,p]),nr(()=>r?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,r]);let h=Pe(T=>{r||(T.update(()=>{let C=hd();C.clear();let x=fd();C.append(pd().append(x)),x.select()}),o([])),n(C=>!C)},[r]),f=Pe(()=>{if(!r)return;let T=rr(t._window);if(T===null||T.anchorNode==null||T.focusNode==null)return;let{anchorNode:C,anchorOffset:x,focusNode:b,focusOffset:_}=kd(T),D=a().getRootElement(),I;C!==null&&(I=Zn(C,D));let y;b!==null&&(y=Zn(b,D)),p("snapshot",{anchorNode:C,anchorOffset:x,anchorPath:I,focusNode:b,focusOffset:_,focusPath:y})},[p,r,a]),g=Pe(()=>{gd(m())},[m]),k=Pe(()=>{xd("test.js",m())},[m]);return[Be("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:T=>{h(a()),T.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?ir("div",{className:"test-recorder-output",children:[ir("div",{className:"test-recorder-toolbar",children:[Be("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:T=>{f(),T.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:T=>{g(),T.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:T=>{k(),T.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Be("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var Qn=()=>{let t=dd(3),[e]=md(),[o,r]=_d(e),n;return t[0]!==o||t[1]!==r?(n=ir(qn.Fragment,{children:[Be("p",{children:"HI"}),o,r,Be("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Td=M({plugins:[{Component:Qn,position:"bottom"}]});import{c as wd}from"react/compiler-runtime";import{jsx as Sd}from"react/jsx-runtime";import{useLexicalComposerContext as Ed}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Nd}from"@lexical/react/LexicalTreeView.js";import"react";var el=()=>{let t=wd(2),[e]=Ed(),o;return t[0]!==e?(o=Sd(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=M({plugins:[{Component:el,position:"bottom"}]});import{$isTableSelection as yd}from"@lexical/table";import{$isRangeSelection as Rd,FORMAT_TEXT_COMMAND as Id}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:"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 z=t=>({type:"buttons",items:t,key:"format",order:40});var rl={type:"text-format",format:["bold","italic"],tag:"***"},nl={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},ll={type:"text-format",format:["bold"],tag:"**"},il={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var sl=[z([{ChildComponent:ol,isActive:({selection:t})=>Rd(t)||yd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Id,"bold")},order:1}])],vd=M(({featureProviderMap:t})=>{let e=[ll,il];return t.get("italic")&&e.push(nl,rl),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:sl},toolbarInline:{groups:sl}}});import{$isTableSelection as Dd}from"@lexical/table";import{$isRangeSelection as $d,FORMAT_TEXT_COMMAND as Od}from"lexical";import{jsx as al,jsxs as Md}from"react/jsx-runtime";import"react";var cl=()=>Md("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:[al("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),al("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var ul={type:"text-format",format:["code"],tag:"`"};var dl=[z([{ChildComponent:cl,isActive:({selection:t})=>$d(t)||Dd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Od,"code")},order:7}])],Ad=M({enableFormats:["code"],markdownTransformers:[ul],toolbarFixed:{groups:dl},toolbarInline:{groups:dl}});import{$isTableSelection as Fd}from"@lexical/table";import{$isRangeSelection as Pd,FORMAT_TEXT_COMMAND as Bd}from"lexical";import{jsx as ml}from"react/jsx-runtime";import"react";var pl=()=>ml("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ml("path",{d:"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 fl={type:"text-format",format:["italic"],tag:"*"},hl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var gl=[z([{ChildComponent:pl,isActive:({selection:t})=>Pd(t)||Fd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Bd,"italic")},order:2}])],jd=M({enableFormats:["italic"],markdownTransformers:[fl,hl],toolbarFixed:{groups:gl},toolbarInline:{groups:gl}});import{$isTableSelection as Ud}from"@lexical/table";import{$isRangeSelection as Wd,FORMAT_TEXT_COMMAND as Gd}from"lexical";import{jsx as xl,jsxs as Hd}from"react/jsx-runtime";import"react";var Cl=()=>Hd("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:[xl("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"}),xl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var bl={type:"text-format",format:["strikethrough"],tag:"~~"};var kl=[z([{ChildComponent:Cl,isActive:({selection:t})=>Wd(t)||Ud(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Gd,"strikethrough")},order:4}])],Vd=M({enableFormats:["strikethrough"],markdownTransformers:[bl],toolbarFixed:{groups:kl},toolbarInline:{groups:kl}});import{$isTableSelection as Jd}from"@lexical/table";import{$isRangeSelection as Kd,FORMAT_TEXT_COMMAND as Xd}from"lexical";import{jsx as _l}from"react/jsx-runtime";import"react";var Tl=()=>_l("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:_l("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 wl=[z([{ChildComponent:Tl,isActive:({selection:t})=>Kd(t)||Jd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Xd,"subscript")},order:5}])],zd=M({enableFormats:["subscript"],toolbarFixed:{groups:wl},toolbarInline:{groups:wl}});import{$isTableSelection as Zd}from"@lexical/table";import{$isRangeSelection as Yd,FORMAT_TEXT_COMMAND as qd}from"lexical";import{jsx as Sl}from"react/jsx-runtime";import"react";var El=()=>Sl("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:Sl("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 Nl=[z([{ChildComponent:El,isActive:({selection:t})=>Yd(t)||Zd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(qd,"superscript")},order:6}])],Qd=M({enableFormats:["superscript"],toolbarFixed:{groups:Nl},toolbarInline:{groups:Nl}});import{$isTableSelection as tm}from"@lexical/table";import{$isRangeSelection as om,FORMAT_TEXT_COMMAND as rm}from"lexical";import{jsx as Ll,jsxs as em}from"react/jsx-runtime";import"react";var yl=()=>em("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:[Ll("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"}),Ll("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Rl=[z([{ChildComponent:yl,isActive:({selection:t})=>om(t)||tm(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(rm,"underline")},order:3}])],nm=M({enableFormats:["underline"],toolbarFixed:{groups:Rl},toolbarInline:{groups:Rl}});import{jsx as ar}from"react/jsx-runtime";import{jsx as lm}from"react/jsx-runtime";function im(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])=>[im(o),r])):{};return lm("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as sm}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as am}from"@lexical/selection";import{$getNodeByKey as cm,$getState as um,$setState as dm,createState as mm,TextNode as pm}from"lexical";import{useEffect as fm}from"react";function Il(t){let e=new Map;for(let o in t){let r=t[o],n=mm(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function sr(t,e,o,r){t.update(()=>{am(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);dm(n,l.stateConfig,r)})})}function vl({stateMap:t}){let[e]=sm();return fm(()=>e.registerMutationListener(pm,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=cm(r),s=e.getElementByKey(r);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=um(l,d.stateConfig);if(!u){delete s.dataset[c];return}s.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var Ml=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let s in l){let i=l[s];o.push({ChildComponent:()=>ar(ao,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{sr(d,e,n,s)}})}}return[{type:"dropdown",ChildComponent:()=>ar(ao,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>ar(ao,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)sr(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},hm=M(({props:t})=>{let e=Il(t.state);return{plugins:[{Component:()=>vl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Ml(t,e)},toolbarInline:{groups:Ml(t,e)}}});import{c as bm}from"react/compiler-runtime";import{useLexicalComposerContext as km}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as _m,$isHeadingNode as Jl,HeadingNode as zl}from"@lexical/rich-text";import{$setBlocksType as Tm}from"@lexical/selection";import{$getSelection as wm,$isRangeSelection as Sm}from"lexical";import{useEffect as Em}from"react";import{jsx as Dl}from"react/jsx-runtime";import"react";var $l=()=>Dl("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:Dl("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 Ol}from"react/jsx-runtime";import"react";var Al=()=>Ol("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:Ol("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 Fl}from"react/jsx-runtime";import"react";var Pl=()=>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("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 Bl}from"react/jsx-runtime";import"react";var jl=()=>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("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 Hl}from"react/jsx-runtime";import"react";var Ul=()=>Hl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Hl("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 Wl}from"react/jsx-runtime";import"react";var Gl=()=>Wl("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:Wl("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 gm,$isHeadingNode as xm,HeadingNode as Cm}from"@lexical/rich-text";var cr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Vl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Cm],export:(n,l)=>{if(!xm(n))return null;let s=Number(n.getTag().slice(1));return"#".repeat(s)+" "+l(n)},regExp:r,replace:cr(n=>{let l="h"+n[1]?.length;return gm(l)})}};var Kl=t=>{let e=wm();Tm(e,()=>_m(t))},Xl={h1:$l,h2:Al,h3:Pl,h4:jl,h5:Ul,h6:Gl},Nm=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((r,n)=>({ChildComponent:Xl[r],isActive:({selection:l})=>{if(!Sm(l))return!1;for(let s of l.getNodes()){if(Jl(s)&&s.getTag()===r)continue;let i=s.getParent();if(!(Jl(i)&&i.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(()=>{Kl(r)})},order:n+2})))];return{markdownTransformers:[Vl(e)],nodes:[zl],plugins:[{Component:Lm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[X(e.map(r=>({Icon:Xl[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(()=>{Kl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),Lm=t=>{let e=bm(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,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[d]=km(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(zl,a=>{l.includes(a.getTag())||a.setTag(i)})},u=[d,l,i],e[4]=d,e[5]=l,e[6]=i,e[7]=c,e[8]=u):(c=e[7],u=e[8]),Em(c,u),null};import{$isNodeSelection as Wm}from"lexical";import{jsx as Zl}from"react/jsx-runtime";import"react";var ur=()=>Zl("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:Zl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Yl,jsxs as ym}from"react/jsx-runtime";import"react";var ql=()=>ym("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Yl("path",{d:"M5 10h10",stroke:"currentColor"}),Yl("path",{d:"M10 15V5",stroke:"currentColor"})]});var ke=t=>({type:"dropdown",ChildComponent:ql,items:t,key:"add",order:10});import{addClassNamesToElement as Rm}from"@lexical/utils";import{$applyNodeReplacement as Im,createCommand as vm,DecoratorNode as Mm}from"lexical";var Nt=vm("INSERT_HORIZONTAL_RULE_COMMAND"),Et=class extends Mm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Dm,priority:0})}}static importJSON(e){return Ql()}createDOM(e){let o=document.createElement("hr");return Rm(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:Ql()}}function Ql(){return Im(new Et)}import{$applyNodeReplacement as $m}from"lexical";import"react";var _e=class extends Et{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Qe()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Qe(){return $m(new _e)}function Lt(t){return t instanceof _e}var ei={type:"element",dependencies:[_e],export:(t,e)=>Lt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Qe();e&&t.replace(e)}};import{c as Om}from"react/compiler-runtime";import{useLexicalComposerContext as Am}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Fm}from"@lexical/utils";import{$getSelection as Pm,$isRangeSelection as Bm,COMMAND_PRIORITY_EDITOR as jm}from"lexical";import{useEffect as Hm}from"react";var ti=()=>{let t=Om(3),[e]=Am(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Nt,Um,jm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Hm(o,r),null};function Um(t){let e=Pm();if(!Bm(e))return!1;if(e.focus.getNode()!==null){let r=Qe();Fm(r)}return!0}var Gm=M({markdownTransformers:[ei],nodes:[_e],plugins:[{Component:ti,position:"normal"}],slashMenu:{groups:[X([{Icon:ur,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Nt,void 0)}}])]},toolbarFixed:{groups:[ke([{ChildComponent:ur,isActive:({selection:t})=>{if(!Wm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Lt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Nt,void 0)}}])]}});import{$findMatchingParent as di}from"@lexical/utils";import{$isElementNode as rp,INDENT_CONTENT_COMMAND as np,OUTDENT_CONTENT_COMMAND as lp}from"lexical";import{jsx as co,jsxs as Vm}from"react/jsx-runtime";import"react";var oi=()=>Vm("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 Jm}from"react/jsx-runtime";import"react";var ri=()=>Jm("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 Km}from"react/jsx-runtime";import{useLexicalComposerContext as Xm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as zm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Zm,mergeRegister as ni}from"@lexical/utils";import{$getSelection as Ym,$isElementNode as ai,$isRangeSelection as qm,COMMAND_PRIORITY_LOW as li,INDENT_CONTENT_COMMAND as ii,KEY_TAB_COMMAND as Qm,OUTDENT_CONTENT_COMMAND as ep,TabNode as tp}from"lexical";import{useEffect as si}from"react";var ci=({clientProps:t})=>{let[e]=Xm(),{disabledNodes:o,disableTabNode:r}=t;return si(()=>{if(!(!e||!o?.length))return ni(e.registerCommand(ii,()=>op(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),li),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[s]of n){let i=l._nodeMap.get(s);ai(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),si(()=>{if(!(!e||!r))return ni(e.registerCommand(Qm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?ep:ii,void 0)),li),e.registerNodeTransform(tp,n=>{n.remove()}))},[e,r]),Km(zm,{})};function op(t){let e=Ym();if(!qm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],s=l.getKey();if(o.has(s))continue;let i=Zm(l,c=>ai(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),t(i))}return o.size>0}var ui=t=>({type:"buttons",items:t,key:"indent",order:35});var mi=({disabledNodes:t})=>[ui([{ChildComponent:oi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>pi(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!di(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(lp,void 0)},order:1},{ChildComponent:ri,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>pi(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!di(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(np,void 0)},order:2}])],ip=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ci,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:mi({disabledNodes:e})},toolbarInline:{groups:mi({disabledNodes:e})}}}),pi=t=>rp(t)&&t.canIndent();import{$findMatchingParent as wf}from"@lexical/utils";import{$getSelection as kr,$isRangeSelection as Vi}from"lexical";import{jsx as fi}from"react/jsx-runtime";import"react";var hi=()=>fi("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:fi("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 gi}from"@lexical/selection";function et(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?gi(o)?r:n:gi(e)?r:n}var dr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as bp}from"lexical";function mr(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var sp=/^(?:[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+)?$/,ap=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function xi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||sp.test(t)||ap.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as cp,isHTMLAnchorElement as up}from"@lexical/utils";import hr from"bson-objectid";import{$applyNodeReplacement as dp,$createTextNode as Ci,$getSelection as mp,$isElementNode as bi,$isRangeSelection as fr,createCommand as pp,ElementNode as fp}from"lexical";var hp=new Set(["http:","https:","mailto:","sms:","tel:"]),te=class extends fp{__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:gp,priority:1})}}static importJSON(e){let o=Te({}).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 hr.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=pr(o.rel,"add","noopener")),cp(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(!fr(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(bi(r)){let n=Te({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!hp.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=pr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=pr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function gp(t){let e=null;if(up(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new hr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Te({id:t,fields:e}){return dp(new te({id:t??new hr.default().toHexString(),fields:e}))}function J(t){return t instanceof te}var de=pp("TOGGLE_LINK_COMMAND");function gr(t){let e=mp();if(!fr(e)&&(t===null||!t.selectedNodes?.length))return;let o=fr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();J(s)&&(s.getChildren().forEach(d=>{s.insertBefore(d)}),s.remove())});return}if(o?.length===1){let l=o[0],s=J(l)?l:xp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ci(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let s=l.getParent();if(!(s===n||s===null||bi(l)&&!l.isInline())){if(J(s)){n=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ci(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(r)||(r=s,n=Te({fields:t.fields}),J(s)?l.getPreviousSibling()===null?s.insertBefore(n):s.insertAfter(n):l.insertBefore(n)),J(l)){if(l.is(n))return;if(n!==null){let i=l.getChildren();n.append(...i)}l.remove();return}n!==null&&n.append(l)}})}function xp(t){return Cp(t,e=>J(e))}function Cp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function pr(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 kp=(t,e)=>{let[,o,r]=e,n=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=bp(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},_p=t=>({type:"text-match",dependencies:[te],export:(e,o)=>{if(!J(e))return null;let r=e,n=r.getFields(),l;return n.linkType==="internal"?t?.internalDocToHref?l=mr(t.internalDocToHref({linkNode:r.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=mr(n.url??""),`[${o(r)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:kp,trigger:")"}),ki=_p();import{$applyNodeReplacement as Tp,$isElementNode as wp}from"lexical";var we=class extends te{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=yt({}).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(wp(r)){let n=yt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function yt({fields:t}){return Tp(new we({id:"",fields:t}))}function Se(t){return t instanceof we}import{c as Sp}from"react/compiler-runtime";import{useLexicalComposerContext as Ep}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Np}from"@lexical/utils";import{$createTextNode as _i,$getSelection as Lp,$isElementNode as wi,$isLineBreakNode as Si,$isNodeSelection as yp,$isRangeSelection as Rp,$isTextNode as Rt,TextNode as Ip}from"lexical";import{useEffect as vp}from"react";function Ti(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 Ei(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Mp=/[.,;\s]/;function po(t){return t!==void 0&&Mp.test(t)}function Ni(t){return po(t[t.length-1])}function Cr(t){return po(t[0])}function Dp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Li(t){let e=t.getPreviousSibling();return wi(e)&&(e=e.getLastDescendant()),e===null||Si(e)||Rt(e)&&Ni(e.getTextContent())}function yi(t){let e=t.getNextSibling();return wi(e)&&(e=e.getFirstDescendant()),e===null||Si(e)||Rt(e)&&Cr(e.getTextContent())}function $p(t,e,o,r){return(t>0?po(o[t-1]):Li(r[0]))?e<o.length?po(o[e]):yi(r[r.length-1]):!1}function Op(t,e,o){let r=[],n=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=i;i+a<=e?(r.push(c),s+=a):m>=o?l.push(c):n.push(c),i+=a,d.shift()}return[s,r,n,l]}function Ap(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=yt({fields:n});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let d=_i(r.text);d.setFormat(i.getFormat()),d.setDetail(i.getDetail()),d.setStyle(i.getStyle()),l.append(d),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,d;e===0?d=s:[,d]=s.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,h=i,f=i+p;if(h<o)if(f<=o)c.push(a);else{let[g,k]=a.splitText(o-h);g&&c.push(g),u=k}i+=p}),d){let a=Lp(),m=a?a.getNodes().find(Rt):void 0,p=_i(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):yp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function Fp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,s,i=0;for(;(s=Ei(l,e))!=null&&s!==null;){let d=s.index,c=s.length,u=d+c;if($p(i+d,i+u,n,r)){let[m,,p,h]=Op(r,i+d,i+u),f=i+d-m,g=i+u-m,k=Ap(p,f,g,s);r=k?[k,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function xr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!Rt(c)||!c.isSimpleText()){mo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Ei(l,e);if(s===null||s.text!==l){mo(t),o(null,t.getFields()?.url??null);return}if(!Li(t)||!yi(t)){mo(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let d=t.getFields();d.url=s?.url,t.setFields(d),o(s.url,i??null)}}function Pp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(Se(r)){let s=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Cr(l)||Dp(l,s))&&(r.append(t),xr(r,e,o),o(null,r.getFields()?.url??null))}Se(n)&&!Ni(l)&&(mo(n),xr(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 Bp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&Rt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function jp(t,e,o){let r=Sp(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([we]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return Np(t.registerNodeTransform(Ip,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(Se(d))xr(d,e,s);else if(!J(d)){if(i.isSimpleText()&&(Cr(i.getTextContent())||!Se(c))){let u=Bp(i);Fp(u,e,s)}Pp(i,e,s)}}))},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]),vp(n,l)}var Hp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Up=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Wp=[Ti(Hp,t=>t.startsWith("http")?t:`https://${t}`),Ti(Up,t=>`mailto:${t}`)],Ri=()=>{let[t]=Ep();return jp(t,Wp),null};import{jsx as Gp}from"react/jsx-runtime";import{ClickableLinkPlugin as Vp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ii=()=>Gp(Vp,{});import{jsx as mf}from"react/jsx-runtime";import"react";import{createPortal as pf}from"react-dom";import{jsx as Ee,jsxs as It,Fragment as Kp}from"react/jsx-runtime";import{useLexicalComposerContext as Xp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as zp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as vi,mergeRegister as Mi}from"@lexical/utils";import{getTranslation as br}from"@payloadcms/translations";import{CloseMenuIcon as Zp,EditIcon as Yp,ExternalLinkIcon as Di,formatDrawerSlug as qp,useConfig as Qp,useEditDepth as ef,useLocale as tf,useTranslation as of}from"@payloadcms/ui";import{requests as rf}from"@payloadcms/ui/shared";import{$getSelection as $i,$isLineBreakNode as nf,$isRangeSelection as Oi,COMMAND_PRIORITY_HIGH as lf,COMMAND_PRIORITY_LOW as Ai,getDOMSelection as sf,KEY_ESCAPE_COMMAND as af,SELECTION_CHANGE_COMMAND as cf}from"lexical";import{formatAdminURL as uf}from"payload/shared";import Fi,{useCallback as Pi,useEffect as go,useLayoutEffect as df,useRef as Bi,useState as je}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 s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),d=t.top-r,c=t.left-n;e.style.width="max-content",e.style.maxWidth="none";let u=e.scrollWidth,a=i.right-c,m=c-i.left,p;if(u<=a)p=e.getBoundingClientRect();else{let h=m+t.width,f=m>a,k=Math.min(u,f?h:a);k<u&&(e.style.width=`${k}px`,e.style.maxWidth=`${k}px`,e.offsetHeight),f&&(c=t.right-k),p=e.getBoundingClientRect()}d<i.top&&(d+=p.height+t.height+r*2),c+p.width>i.right&&(c=i.right-p.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Jp}from"lexical";var ho=Jp("TOGGLE_LINK_WITH_MODAL_COMMAND");function ji(t){t.preventDefault()}function Hi({anchorElem:t}){let[e]=Xp(),[o,r]=je(),n=Bi(null),l=Bi(null),[s,i]=je(null),[d,c]=je(null),{fieldProps:{schemaPath:u},uuid:a}=U(),m=zp(),{config:p,getEntityConfig:h}=Qp(),{i18n:f,t:g}=of(),[k,N]=je(),R=ef(),[T,C]=je(!1),[x,b]=je([]),_=tf(),[D,I]=je(!1),y=qp({slug:"lexical-rich-text-link-"+a,depth:R}),{toggleDrawer:S}=xe(y),w=Pi(()=>{C(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),I(!1),i(null),c(null),b([]),N(void 0)},[C,i,c,b]),L=Pi(()=>{let E=$i(),v;if(!Oi(E)||!E){w();return}let $=et(E);v=e.getElementByKey($.getKey())?.getBoundingClientRect();let O=vi($,J),F=E.getNodes().filter(re=>!nf(re)).find(re=>{let ge=vi(re,J);return O&&!O.is(ge)||ge&&!ge.is(O)});if(O==null||F){w();return}r(O);let P=O.getFields(),Z={...P,id:O.getID(),text:O.getTextContent()};if(P?.linkType==="custom")i(P?.url??null),c(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${P?.doc?.relationTo}/${P?.doc?.value}`);let re=P?.doc?.relationTo?h({collectionSlug:P?.doc?.relationTo}):void 0;if(!re)c(P?.label?String(P?.label):null),i(P?.url?String(P?.url):null);else{let ge=typeof P.doc?.value=="object"?P.doc.value.id:P.doc?.value,Vt=P.doc?.relationTo;if(!ge||!Vt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let an=g("fields:linkedTo",{label:`${br(re.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(an),rf.get(uf({apiRoute:p.routes.api,path:`/${Vt}/${ge}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:_?.code}}).then(async se=>{if(!se.ok)throw new Error(`HTTP error! Status: ${se.status}`);let q=await se.json(),pt=re?.admin?.useAsTitle||"id",Ie=q[pt],ft=g("fields:linkedTo",{label:`${br(re.labels.singular,f)} - ${Ie}`}).replace(/<[^>]*>?/g,"");c(ft)}).catch(()=>{let se=g("fields:linkedTo",{label:`${br(re.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${ge}`}).replace(/<[^>]*>?/g,"");c(se)})}}N(Z),C(!0),b(E?E?.getNodes():[]),Se(O)?I(!0):I(!1);let K=n.current,Ve=sf(e._window),{activeElement:Re}=document;if(K===null)return;let he=e.getRootElement();return Ve!==null&&he!==null&&he.contains(Ve.anchorNode)?(v||(v=Ve.getRangeAt(0).getBoundingClientRect()),v!=null&&(v.y+=40,l.current=v)):(Re==null||Re.className!=="link-input")&&(he!==null&&fo(null,K,t),i(null),c(null)),!0},[e,w,p.routes.admin,p.routes.api,p.serverURL,h,g,f,_?.code,t]);return go(()=>Mi(e.registerCommand(ho,E=>(e.dispatchCommand(de,E),L(),S(),!0),Ai)),[e,L,S,y]),go(()=>{let E=t.parentElement,v=()=>{e.getEditorState().read(()=>{L()})};return window.addEventListener("resize",v),E?.addEventListener("scroll",v),()=>{window.removeEventListener("resize",v),E?.removeEventListener("scroll",v)}},[t.parentElement,e,L]),go(()=>Mi(e.registerUpdateListener(({editorState:E})=>{E.read(()=>{L()})}),e.registerCommand(cf,()=>(L(),!0),Ai),e.registerCommand(af,()=>T?(w(),!0):!1,lf)),[e,L,T,w]),go(()=>{e.getEditorState().read(()=>{L()})},[e,L]),df(()=>{!T||!n.current||!t||!l.current||fo(l.current,n.current,t)},[s,d,T,t,o]),It(Fi.Fragment,{children:[Ee("div",{className:"link-editor",ref:n,children:It("div",{className:"link-input",children:[s&&s.length>0?It("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Ee(Di,{}):null,d!=null&&d.length>0?d:s]}):d!=null&&d.length>0?It(Kp,{children:[o?.__fields.newTab?Ee(Di,{}):null,Ee("span",{className:"link-input__label-pure",children:d})]}):null,m&&It(Fi.Fragment,{children:[Ee("button",{"aria-label":"Edit link",className:"link-edit",onClick:E=>{E.preventDefault(),S()},onMouseDown:ji,tabIndex:0,type:"button",children:Ee(Yp,{})}),!D&&Ee("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(de,null)},onMouseDown:ji,tabIndex:0,type:"button",children:Ee(Zp,{})})]})]})}),Ee(Ct,{className:"lexical-link-edit-drawer",data:k,drawerSlug:y,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(E,v)=>{let $=v,O={...$};delete O.text,e.update(()=>{let F=$i(),P=null;if(Oi(F)?P=et(F).getParent():x.length&&(P=x[0]?.getParent()??null),P&&Se(P)){let Z=Te({fields:O});P.replace(Z,!0)}}),e.dispatchCommand(de,{fields:O,selectedNodes:x,text:$.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Ui=t=>{let{anchorElem:e=document.body}=t;return pf(mf(Hi,{anchorElem:e}),e)};import{c as ff}from"react/compiler-runtime";import{useLexicalComposerContext as hf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as gf}from"@lexical/utils";import{$getSelection as xf,$isElementNode as Cf,$isRangeSelection as bf,COMMAND_PRIORITY_LOW as Wi,PASTE_COMMAND as kf}from"lexical";import{useEffect as _f}from"react";var Gi=t=>{let e=ff(5),{clientProps:o}=t,[r]=hf(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([te]))throw new Error("LinkPlugin: LinkNode not registered on editor");return gf(r.registerCommand(de,s=>s===null?(gr(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),gr(s),!0),Wi),r.registerCommand(kf,s=>{let i=xf();if(!bf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!xi(d))return!1;if(!i.getNodes().some(Tf)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(de,{fields:c,text:null}),s.preventDefault(),!0}return!1},Wi))},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]),_f(n,l),null};function Tf(t){return Cf(t)}var Ji=[dr([{ChildComponent:hi,isActive:({selection:t})=>{if(Vi(t)){let e=et(t);return wf(e,J)!=null}return!1},isEnabled:({selection:t})=>!!(Vi(t)&&kr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(de,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=kr()?.getTextContent(),r=kr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(ho,{fields:n,selectedNodes:r,text:o})}},order:1}])],Sf=M(({props:t})=>({markdownTransformers:[ki],nodes:[te,t?.disableAutoLinks===!0?null:we].filter(Boolean),plugins:[{Component:Gi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Ri,position:"normal"},{Component:Ii,position:"normal"},{Component:Ui,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ji},toolbarInline:{groups:Ji}}));import{$isListNode as wr,INSERT_CHECK_LIST_COMMAND as qi,ListItemNode as Af,ListNode as Ff}from"@lexical/list";import{$isRangeSelection as Pf}from"lexical";import{jsx as Ki,jsxs as Ef}from"react/jsx-runtime";import"react";var _r=()=>Ef("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:[Ki("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ki("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Nf}from"react/jsx-runtime";import{ListPlugin as Lf}from"@lexical/react/LexicalListPlugin.js";import"react";var tt=()=>Nf(Lf,{});function xo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function ot(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as vf,ListItemNode as Mf,ListNode as Df}from"@lexical/list";import{$createListItemNode as yf,$createListNode as Rf,$isListItemNode as If,$isListNode as Tr}from"@lexical/list";var Xi=4,rt=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),s=yf(t==="check"?r[3]==="x":void 0);if(Tr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(Tr(n)&&n.getListType()===t)n.append(s),e.remove();else{let d=Rf(t,t==="number"?Number(r[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(r[1].length/Xi);i&&s.setIndent(i)},He=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let s of n)if(If(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(Tr(u)){r.push(He(u,e,o+1));continue}}let i=" ".repeat(o*Xi),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";r.push(i+c+e(s)),l++}return r.join(`
56
- `)};var zi={type:"element",dependencies:[Df,Mf],export:(t,e)=>vf(t)?He(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:rt("check")};import{jsx as $f}from"react/jsx-runtime";import{CheckListPlugin as Of}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Zi=()=>$f(Of,{});var Yi=[ee([{ChildComponent:_r,isActive:({selection:t})=>{if(!Pf(t))return!1;for(let e of t.getNodes()){if(wr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(wr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(wr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(qi,void 0)},order:12}])],Bf=M(({featureProviderMap:t})=>{let e=[{Component:Zi,position:"normal"}],o=xo("checklist",t);return o&&e.push({Component:tt,position:"normal"}),{markdownTransformers:[zi],nodes:o?[Ff,Af]:[],plugins:e,slashMenu:{groups:[ot([{Icon:_r,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(qi,void 0)}}])]},toolbarFixed:{groups:Yi},toolbarInline:{groups:Yi}}});import{$isListNode as Er,INSERT_ORDERED_LIST_COMMAND as ts,ListItemNode as Gf,ListNode as Vf}from"@lexical/list";import{$isRangeSelection as Jf}from"lexical";import{jsx as vt,jsxs as jf}from"react/jsx-runtime";import"react";var Sr=()=>jf("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:[vt("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"}),vt("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"}),vt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Hf,ListItemNode as Uf,ListNode as Wf}from"@lexical/list";var Qi={type:"element",dependencies:[Wf,Uf],export:(t,e)=>Hf(t)?He(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:rt("number")};var es=[ee([{ChildComponent:Sr,isActive:({selection:t})=>{if(!Jf(t))return!1;for(let e of t.getNodes()){if(Er(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Er(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Er(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ts,void 0)},order:10}])],Kf=M(({featureProviderMap:t})=>{let e=xo("ordered",t);return{markdownTransformers:[Qi],nodes:e?[Vf,Gf]:[],plugins:e?[{Component:tt,position:"normal"}]:[],slashMenu:{groups:[ot([{Icon:Sr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(ts,void 0)}}])]},toolbarFixed:{groups:es},toolbarInline:{groups:es}}});import{$isListNode as Lr,INSERT_UNORDERED_LIST_COMMAND as ns,ListItemNode as qf,ListNode as Qf}from"@lexical/list";import{$isRangeSelection as e0}from"lexical";import{jsx as nt,jsxs as Xf}from"react/jsx-runtime";import"react";var Nr=()=>Xf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[nt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),nt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),nt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),nt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),nt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),nt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as zf,ListItemNode as Zf,ListNode as Yf}from"@lexical/list";var os={type:"element",dependencies:[Yf,Zf],export:(t,e)=>zf(t)?He(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:rt("bullet")};var rs=[ee([{ChildComponent:Nr,isActive:({selection:t})=>{if(!e0(t))return!1;for(let e of t.getNodes()){if(Lr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Lr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Lr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ns,void 0)},order:11}])],t0=M({markdownTransformers:[os],nodes:[Qf,qf],plugins:[{Component:tt,position:"normal"}],slashMenu:{groups:[ot([{Icon:Nr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ns,void 0)}}])]},toolbarFixed:{groups:rs},toolbarInline:{groups:rs}});import{jsx as o0}from"react/jsx-runtime";import{addClassNamesToElement as r0}from"@lexical/utils";import{$applyNodeReplacement as n0,DecoratorNode as l0}from"lexical";import*as ls from"react";var i0=ls.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Mt=class extends l0{__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 s0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return r0(o,"unknownConverted"),o}decorate(){return o0(i0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function s0({data:t}){return n0(new Mt({data:t}))}var a0=M(()=>({nodes:[Mt]}));import{jsx as c0}from"react/jsx-runtime";import{addClassNamesToElement as u0}from"@lexical/utils";import{$applyNodeReplacement as d0,DecoratorNode as m0}from"lexical";import*as is from"react";var p0=is.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Dt=class extends m0{__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 f0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return u0(o,"unknownConverted"),o}decorate(){return c0(p0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function f0({data:t}){return d0(new Dt({data:t}))}var h0=M(()=>({nodes:[Dt]}));import{$setBlocksType as cs}from"@lexical/selection";import{$createParagraphNode as us,$getSelection as ds,$isParagraphNode as ss,$isRangeSelection as g0}from"lexical";var as=[ee([{ChildComponent:_t,isActive:({selection:t})=>{if(!g0(t))return!1;for(let e of t.getNodes())if(!ss(e)&&!ss(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ds();cs(e,()=>us())})},order:1}])],x0=M({slashMenu:{groups:[X([{Icon:_t,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ds();cs(e,()=>us())})}}])]},toolbarFixed:{groups:as},toolbarInline:{groups:as}});import{c as j0}from"react/compiler-runtime";import{jsx as vs}from"react/jsx-runtime";import{useLexicalComposerContext as H0}from"@lexical/react/LexicalComposerContext";import{useEffect as U0,useState as W0}from"react";import{jsx as Is,Fragment as B0}from"react/jsx-runtime";import"react";import{jsx as C0}from"react/jsx-runtime";var ms={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return C0("blockquote",{children:o})}};import{jsx as b0}from"react/jsx-runtime";var ps={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return b0(r,{children:o})}};import{jsx as k0}from"react/jsx-runtime";var fs={horizontalrule:k0("hr",{})};import{jsx as _0}from"react/jsx-runtime";var hs={linebreak:_0("br",{})};import{jsx as gs}from"react/jsx-runtime";var xs=({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 gs("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,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),gs("a",{href:s,rel:n,target:l,children:r})}});import{jsx as lt,jsxs as T0,Fragment as w0}from"react/jsx-runtime";import{v4 as S0}from"uuid";var Cs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return lt(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=S0();return lt("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:T0(w0,{children:[lt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),lt("label",{htmlFor:l,children:n}),lt("br",{})]})})}else return lt("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as yr}from"react/jsx-runtime";var bs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?yr("p",{children:o}):yr("p",{children:yr("br",{})})}};var ks={tab:" "};import{jsx as $t}from"react/jsx-runtime";var _s={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return $t("div",{className:"lexical-table-container",children:$t("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:$t("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"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return $t(r,{className:`lexical-table-cell ${n}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return $t("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ue}from"react/jsx-runtime";import"react";var A={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=A.IS_BOLD|A.IS_ITALIC|A.IS_STRIKETHROUGH|A.IS_UNDERLINE|A.IS_CODE|A.IS_SUBSCRIPT|A.IS_SUPERSCRIPT|A.IS_HIGHLIGHT,N0="\xA0",L0=`
54
+ `},[t,e]),p=je((T,C)=>{o(x=>{let b=e.length-1,_=e[b];if(_&&_.name===T){if(T==="type")return[...e.slice(0,b),{..._,value:_.value+C}];if(_.value===C)return[...e.slice(0,b),{..._,count:_.count+1}]}return[...x,{name:T,count:1,value:C}]})},[e,o]);Zn(()=>{let T=x=>{if(!r)return;let b=x.key;bd(x)?p("selectAll",""):qn.has(b)?p("press",x.key):[...b].length>1?p("keydown",x.key):p("type",x.key)},C=x=>{if(!r)return;let b=x.key;!qn.has(b)&&[...b].length>1&&p("keyup",x.key)};return t.registerRootListener((x,b)=>{b!==null&&(b.removeEventListener("keydown",T),b.removeEventListener("keyup",C)),x!==null&&(x.addEventListener("keydown",T),x.addEventListener("keyup",C))})},[t,r,p]),Zn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),ir(()=>{if(e){let T=m();T!==null&&i(T),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),ir(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:x,editorState:b})=>{if(!r)return;let _=b._selection,D=d.current,v=c.current;if(D!==_){if(x.size===0&&C.size===0&&!v){let S=lr(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}d.current=_}c.current=!1;let L=m();L!==null&&i(L)}),[t,m,r,p]),ir(()=>r?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,r]);let h=je(T=>{r||(T.update(()=>{let C=hd();C.clear();let x=fd();C.append(pd().append(x)),x.select()}),o([])),n(C=>!C)},[r]),f=je(()=>{if(!r)return;let T=lr(t._window);if(T===null||T.anchorNode==null||T.focusNode==null)return;let{anchorNode:C,anchorOffset:x,focusNode:b,focusOffset:_}=kd(T),D=a().getRootElement(),v;C!==null&&(v=Yn(C,D));let L;b!==null&&(L=Yn(b,D)),p("snapshot",{anchorNode:C,anchorOffset:x,anchorPath:v,focusNode:b,focusOffset:_,focusPath:L})},[p,r,a]),g=je(()=>{gd(m())},[m]),k=je(()=>{xd("test.js",m())},[m]);return[He("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:T=>{h(a()),T.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?ar("div",{className:"test-recorder-output",children:[ar("div",{className:"test-recorder-toolbar",children:[He("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:T=>{f(),T.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),He("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:T=>{g(),T.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),He("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:T=>{k(),T.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),He("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var el=()=>{let t=dd(3),[e]=md(),[o,r]=_d(e),n;return t[0]!==o||t[1]!==r?(n=ar(Qn.Fragment,{children:[He("p",{children:"HI"}),o,r,He("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Td=M({plugins:[{Component:el,position:"bottom"}]});import{c as wd}from"react/compiler-runtime";import{jsx as Sd}from"react/jsx-runtime";import{useLexicalComposerContext as Ed}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Nd}from"@lexical/react/LexicalTreeView.js";import"react";var tl=()=>{let t=wd(2),[e]=Ed(),o;return t[0]!==e?(o=Sd(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=M({plugins:[{Component:tl,position:"bottom"}]});import{$isTableSelection as yd}from"@lexical/table";import{$isRangeSelection as Rd,FORMAT_TEXT_COMMAND as Id}from"lexical";import{jsx as ol}from"react/jsx-runtime";import"react";var rl=()=>ol("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:ol("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 Z=t=>({type:"buttons",items:t,key:"format",order:40});var nl={type:"text-format",format:["bold","italic"],tag:"***"},ll={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},il={type:"text-format",format:["bold"],tag:"**"},sl={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var al=[Z([{ChildComponent:rl,isActive:({selection:t})=>Rd(t)||yd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Id,"bold")},order:1}])],vd=M(({featureProviderMap:t})=>{let e=[il,sl];return t.get("italic")&&e.push(ll,nl),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:al},toolbarInline:{groups:al}}});import{$isTableSelection as Dd}from"@lexical/table";import{$isRangeSelection as $d,FORMAT_TEXT_COMMAND as Od}from"lexical";import{jsx as cl,jsxs as Md}from"react/jsx-runtime";import"react";var ul=()=>Md("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:[cl("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),cl("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var dl={type:"text-format",format:["code"],tag:"`"};var ml=[Z([{ChildComponent:ul,isActive:({selection:t})=>$d(t)||Dd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Od,"code")},order:7}])],Ad=M({enableFormats:["code"],markdownTransformers:[dl],toolbarFixed:{groups:ml},toolbarInline:{groups:ml}});import{$isTableSelection as Fd}from"@lexical/table";import{$isRangeSelection as Pd,FORMAT_TEXT_COMMAND as Bd}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:"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 hl={type:"text-format",format:["italic"],tag:"*"},gl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var xl=[Z([{ChildComponent:fl,isActive:({selection:t})=>Pd(t)||Fd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Bd,"italic")},order:2}])],jd=M({enableFormats:["italic"],markdownTransformers:[hl,gl],toolbarFixed:{groups:xl},toolbarInline:{groups:xl}});import{$isTableSelection as Ud}from"@lexical/table";import{$isRangeSelection as Wd,FORMAT_TEXT_COMMAND as Gd}from"lexical";import{jsx as Cl,jsxs as Hd}from"react/jsx-runtime";import"react";var bl=()=>Hd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Cl("path",{d:"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"}),Cl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var kl={type:"text-format",format:["strikethrough"],tag:"~~"};var _l=[Z([{ChildComponent:bl,isActive:({selection:t})=>Wd(t)||Ud(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Gd,"strikethrough")},order:4}])],Vd=M({enableFormats:["strikethrough"],markdownTransformers:[kl],toolbarFixed:{groups:_l},toolbarInline:{groups:_l}});import{$isTableSelection as Jd}from"@lexical/table";import{$isRangeSelection as Kd,FORMAT_TEXT_COMMAND as Xd}from"lexical";import{jsx as Tl}from"react/jsx-runtime";import"react";var wl=()=>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:"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 Sl=[Z([{ChildComponent:wl,isActive:({selection:t})=>Kd(t)||Jd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Xd,"subscript")},order:5}])],zd=M({enableFormats:["subscript"],toolbarFixed:{groups:Sl},toolbarInline:{groups:Sl}});import{$isTableSelection as Zd}from"@lexical/table";import{$isRangeSelection as Yd,FORMAT_TEXT_COMMAND as qd}from"lexical";import{jsx as El}from"react/jsx-runtime";import"react";var Nl=()=>El("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:El("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 Ll=[Z([{ChildComponent:Nl,isActive:({selection:t})=>Yd(t)||Zd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(qd,"superscript")},order:6}])],Qd=M({enableFormats:["superscript"],toolbarFixed:{groups:Ll},toolbarInline:{groups:Ll}});import{$isTableSelection as tm}from"@lexical/table";import{$isRangeSelection as om,FORMAT_TEXT_COMMAND as rm}from"lexical";import{jsx as yl,jsxs as em}from"react/jsx-runtime";import"react";var Rl=()=>em("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:[yl("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"}),yl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Il=[Z([{ChildComponent:Rl,isActive:({selection:t})=>om(t)||tm(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(rm,"underline")},order:3}])],nm=M({enableFormats:["underline"],toolbarFixed:{groups:Il},toolbarInline:{groups:Il}});import{jsx as ur}from"react/jsx-runtime";import{jsx as lm}from"react/jsx-runtime";function im(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var uo=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[im(o),r])):{};return lm("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as sm}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as am}from"@lexical/selection";import{$getNodeByKey as cm,$getState as um,$setState as dm,createState as mm,TextNode as pm}from"lexical";import{useEffect as fm}from"react";function vl(t){let e=new Map;for(let o in t){let r=t[o],n=mm(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function cr(t,e,o,r){t.update(()=>{am(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);dm(n,l.stateConfig,r)})})}function Ml({stateMap:t}){let[e]=sm();return fm(()=>e.registerMutationListener(pm,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=cm(r),s=e.getElementByKey(r);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=um(l,d.stateConfig);if(!u){delete s.dataset[c];return}s.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var Dl=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let s in l){let i=l[s];o.push({ChildComponent:()=>ur(uo,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{cr(d,e,n,s)}})}}return[{type:"dropdown",ChildComponent:()=>ur(uo,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>ur(uo,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)cr(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},hm=M(({props:t})=>{let e=vl(t.state);return{plugins:[{Component:()=>Ml({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Dl(t,e)},toolbarInline:{groups:Dl(t,e)}}});import{c as bm}from"react/compiler-runtime";import{useLexicalComposerContext as km}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as _m,$isHeadingNode as Kl,HeadingNode as Zl}from"@lexical/rich-text";import{$setBlocksType as Tm}from"@lexical/selection";import{$getSelection as wm,$isRangeSelection as Sm}from"lexical";import{useEffect as Em}from"react";import{jsx as $l}from"react/jsx-runtime";import"react";var Ol=()=>$l("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$l("path",{d:"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 Al}from"react/jsx-runtime";import"react";var Fl=()=>Al("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:Al("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 Pl}from"react/jsx-runtime";import"react";var Bl=()=>Pl("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:Pl("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 jl}from"react/jsx-runtime";import"react";var Hl=()=>jl("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:jl("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 Ul}from"react/jsx-runtime";import"react";var Wl=()=>Ul("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:Ul("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 Gl}from"react/jsx-runtime";import"react";var Vl=()=>Gl("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:Gl("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 gm,$isHeadingNode as xm,HeadingNode as Cm}from"@lexical/rich-text";var dr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Jl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Cm],export:(n,l)=>{if(!xm(n))return null;let s=Number(n.getTag().slice(1));return"#".repeat(s)+" "+l(n)},regExp:r,replace:dr(n=>{let l="h"+n[1]?.length;return gm(l)})}};var Xl=t=>{let e=wm();Tm(e,()=>_m(t))},zl={h1:Ol,h2:Fl,h3:Bl,h4:Hl,h5:Wl,h6:Vl},Nm=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((r,n)=>({ChildComponent:zl[r],isActive:({selection:l})=>{if(!Sm(l))return!1;for(let s of l.getNodes()){if(Kl(s)&&s.getTag()===r)continue;let i=s.getParent();if(!(Kl(i)&&i.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(()=>{Xl(r)})},order:n+2})))];return{markdownTransformers:[Jl(e)],nodes:[Zl],plugins:[{Component:Lm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:zl[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(()=>{Xl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),Lm=t=>{let e=bm(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,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[d]=km(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(Zl,a=>{l.includes(a.getTag())||a.setTag(i)})},u=[d,l,i],e[4]=d,e[5]=l,e[6]=i,e[7]=c,e[8]=u):(c=e[7],u=e[8]),Em(c,u),null};import{$isNodeSelection as Wm}from"lexical";import{jsx as Yl}from"react/jsx-runtime";import"react";var mr=()=>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("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as ql,jsxs as ym}from"react/jsx-runtime";import"react";var Ql=()=>ym("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ql("path",{d:"M5 10h10",stroke:"currentColor"}),ql("path",{d:"M10 15V5",stroke:"currentColor"})]});var be=t=>({type:"dropdown",ChildComponent:Ql,items:t,key:"add",order:10});import{addClassNamesToElement as Rm}from"@lexical/utils";import{$applyNodeReplacement as Im,createCommand as vm,DecoratorNode as Mm}from"lexical";var yt=vm("INSERT_HORIZONTAL_RULE_COMMAND"),Lt=class extends Mm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Dm,priority:0})}}static importJSON(e){return ei()}createDOM(e){let o=document.createElement("hr");return Rm(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:ei()}}function ei(){return Im(new Lt)}import{$applyNodeReplacement as $m}from"lexical";import"react";var ke=class extends Lt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return et()}decorate(){return null}exportJSON(){return super.exportJSON()}};function et(){return $m(new ke)}function Rt(t){return t instanceof ke}var ti={type:"element",dependencies:[ke],export:(t,e)=>Rt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=et();e&&t.replace(e)}};import{c as Om}from"react/compiler-runtime";import{useLexicalComposerContext as Am}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Fm}from"@lexical/utils";import{$getSelection as Pm,$isRangeSelection as Bm,COMMAND_PRIORITY_EDITOR as jm}from"lexical";import{useEffect as Hm}from"react";var oi=()=>{let t=Om(3),[e]=Am(),o,r;return t[0]!==e?(o=()=>e.registerCommand(yt,Um,jm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Hm(o,r),null};function Um(t){let e=Pm();if(!Bm(e))return!1;if(e.focus.getNode()!==null){let r=et();Fm(r)}return!0}var Gm=M({markdownTransformers:[ti],nodes:[ke],plugins:[{Component:oi,position:"normal"}],slashMenu:{groups:[z([{Icon:mr,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:mr,isActive:({selection:t})=>{if(!Wm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Rt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(yt,void 0)}}])]}});import{$findMatchingParent as mi}from"@lexical/utils";import{$isElementNode as rp,INDENT_CONTENT_COMMAND as np,OUTDENT_CONTENT_COMMAND as lp}from"lexical";import{jsx as mo,jsxs as Vm}from"react/jsx-runtime";import"react";var ri=()=>Vm("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:[mo("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),mo("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as po,jsxs as Jm}from"react/jsx-runtime";import"react";var ni=()=>Jm("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:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),po("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),po("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),po("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Km}from"react/jsx-runtime";import{useLexicalComposerContext as Xm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as zm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Zm,mergeRegister as li}from"@lexical/utils";import{$getSelection as Ym,$isElementNode as ci,$isRangeSelection as qm,COMMAND_PRIORITY_LOW as ii,INDENT_CONTENT_COMMAND as si,KEY_TAB_COMMAND as Qm,OUTDENT_CONTENT_COMMAND as ep,TabNode as tp}from"lexical";import{useEffect as ai}from"react";var ui=({clientProps:t})=>{let[e]=Xm(),{disabledNodes:o,disableTabNode:r}=t;return ai(()=>{if(!(!e||!o?.length))return li(e.registerCommand(si,()=>op(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),ii),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[s]of n){let i=l._nodeMap.get(s);ci(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),ai(()=>{if(!(!e||!r))return li(e.registerCommand(Qm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?ep:si,void 0)),ii),e.registerNodeTransform(tp,n=>{n.remove()}))},[e,r]),Km(zm,{})};function op(t){let e=Ym();if(!qm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],s=l.getKey();if(o.has(s))continue;let i=Zm(l,c=>ci(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),t(i))}return o.size>0}var di=t=>({type:"buttons",items:t,key:"indent",order:35});var pi=({disabledNodes:t})=>[di([{ChildComponent:ri,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>fi(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!mi(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(lp,void 0)},order:1},{ChildComponent:ni,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>fi(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!mi(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(np,void 0)},order:2}])],ip=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ui,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:pi({disabledNodes:e})},toolbarInline:{groups:pi({disabledNodes:e})}}}),fi=t=>rp(t)&&t.canIndent();import{$findMatchingParent as Sf}from"@lexical/utils";import{$getSelection as wr,$isRangeSelection as Vi}from"lexical";import{jsx as hi}from"react/jsx-runtime";import"react";var gi=()=>hi("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:hi("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 xi}from"@lexical/selection";function tt(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?xi(o)?r:n:xi(e)?r:n}var pr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as bp}from"lexical";function fr(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var sp=/^(?:[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+)?$/,ap=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Ci(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||sp.test(t)||ap.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as cp,isHTMLAnchorElement as up}from"@lexical/utils";import xr from"bson-objectid";import{$applyNodeReplacement as dp,$createTextNode as bi,$getSelection as mp,$isElementNode as ki,$isRangeSelection as gr,createCommand as pp,ElementNode as fp}from"lexical";var hp=new Set(["http:","https:","mailto:","sms:","tel:"]),te=class extends fp{__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:gp,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 xr.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=hr(o.rel,"add","noopener")),cp(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(!gr(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(ki(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(!hp.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=hr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=hr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function gp(t){let e=null;if(up(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new xr.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 dp(new te({id:t??new xr.default().toHexString(),fields:e}))}function K(t){return t instanceof te}var ue=pp("TOGGLE_LINK_COMMAND");function Cr(t){let e=mp();if(!gr(e)&&(t===null||!t.selectedNodes?.length))return;let o=gr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();K(s)&&(s.getChildren().forEach(d=>{s.insertBefore(d)}),s.remove())});return}if(o?.length===1){let l=o[0],s=K(l)?l:xp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(bi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let s=l.getParent();if(!(s===n||s===null||ki(l)&&!l.isInline())){if(K(s)){n=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(bi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(r)||(r=s,n=_e({fields:t.fields}),K(s)?l.getPreviousSibling()===null?s.insertBefore(n):s.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let i=l.getChildren();n.append(...i)}l.remove();return}n!==null&&n.append(l)}})}function xp(t){return Cp(t,e=>K(e))}function Cp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function hr(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 kp=(t,e)=>{let[,o,r]=e,n=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=bp(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},_p=t=>({type:"text-match",dependencies:[te],export:(e,o)=>{if(!K(e))return null;let r=e,n=r.getFields(),l;return n.linkType==="internal"?t?.internalDocToHref?l=fr(t.internalDocToHref({linkNode:r.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=fr(n.url??""),`[${o(r)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:kp,trigger:")"}),_i=_p();import{$applyNodeReplacement as Tp,$isElementNode as wp}from"lexical";var Te=class extends te{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=It({}).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(wp(r)){let n=It({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function It({fields:t}){return Tp(new Te({id:"",fields:t}))}function we(t){return t instanceof Te}import{c as Sp}from"react/compiler-runtime";import{useLexicalComposerContext as Ep}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Np}from"@lexical/utils";import{$createTextNode as Ti,$getSelection as Lp,$isElementNode as Si,$isLineBreakNode as Ei,$isNodeSelection as yp,$isRangeSelection as Rp,$isTextNode as vt,TextNode as Ip}from"lexical";import{useEffect as vp}from"react";function wi(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 Ni(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Mp=/[.,;\s]/;function ho(t){return t!==void 0&&Mp.test(t)}function Li(t){return ho(t[t.length-1])}function kr(t){return ho(t[0])}function Dp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function yi(t){let e=t.getPreviousSibling();return Si(e)&&(e=e.getLastDescendant()),e===null||Ei(e)||vt(e)&&Li(e.getTextContent())}function Ri(t){let e=t.getNextSibling();return Si(e)&&(e=e.getFirstDescendant()),e===null||Ei(e)||vt(e)&&kr(e.getTextContent())}function $p(t,e,o,r){return(t>0?ho(o[t-1]):yi(r[0]))?e<o.length?ho(o[e]):Ri(r[r.length-1]):!1}function Op(t,e,o){let r=[],n=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=i;i+a<=e?(r.push(c),s+=a):m>=o?l.push(c):n.push(c),i+=a,d.shift()}return[s,r,n,l]}function Ap(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=It({fields:n});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let d=Ti(r.text);d.setFormat(i.getFormat()),d.setDetail(i.getDetail()),d.setStyle(i.getStyle()),l.append(d),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,d;e===0?d=s:[,d]=s.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,h=i,f=i+p;if(h<o)if(f<=o)c.push(a);else{let[g,k]=a.splitText(o-h);g&&c.push(g),u=k}i+=p}),d){let a=Lp(),m=a?a.getNodes().find(vt):void 0,p=Ti(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):yp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function Fp(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,s,i=0;for(;(s=Ni(l,e))!=null&&s!==null;){let d=s.index,c=s.length,u=d+c;if($p(i+d,i+u,n,r)){let[m,,p,h]=Op(r,i+d,i+u),f=i+d-m,g=i+u-m,k=Ap(p,f,g,s);r=k?[k,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function br(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!vt(c)||!c.isSimpleText()){fo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Ni(l,e);if(s===null||s.text!==l){fo(t),o(null,t.getFields()?.url??null);return}if(!yi(t)||!Ri(t)){fo(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let d=t.getFields();d.url=s?.url,t.setFields(d),o(s.url,i??null)}}function Pp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(we(r)){let s=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!kr(l)||Dp(l,s))&&(r.append(t),br(r,e,o),o(null,r.getFields()?.url??null))}we(n)&&!Li(l)&&(fo(n),br(n,e,o),o(null,n.getFields()?.url??null))}function fo(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 Bp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&vt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function jp(t,e,o){let r=Sp(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 s=(i,d)=>{o?.(i,d)};return Np(t.registerNodeTransform(Ip,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(we(d))br(d,e,s);else if(!K(d)){if(i.isSimpleText()&&(kr(i.getTextContent())||!we(c))){let u=Bp(i);Fp(u,e,s)}Pp(i,e,s)}}))},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]),vp(n,l)}var Hp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Up=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Wp=[wi(Hp,t=>t.startsWith("http")?t:`https://${t}`),wi(Up,t=>`mailto:${t}`)],Ii=()=>{let[t]=Ep();return jp(t,Wp),null};import{jsx as Gp}from"react/jsx-runtime";import{ClickableLinkPlugin as Vp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var vi=()=>Gp(Vp,{});import{jsx as pf}from"react/jsx-runtime";import"react";import{createPortal as ff}from"react-dom";import{jsx as Se,jsxs as Mt,Fragment as Kp}from"react/jsx-runtime";import{useLexicalComposerContext as Xp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as zp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Mi,mergeRegister as Di}from"@lexical/utils";import{getTranslation as _r}from"@payloadcms/translations";import{CloseMenuIcon as Zp,EditIcon as Yp,ExternalLinkIcon as $i,formatDrawerSlug as qp,useConfig as Qp,useEditDepth as ef,useLocale as tf,useModal as of,useTranslation as rf}from"@payloadcms/ui";import{requests as nf}from"@payloadcms/ui/shared";import{$getSelection as Oi,$isLineBreakNode as lf,$isRangeSelection as Ai,COMMAND_PRIORITY_HIGH as sf,COMMAND_PRIORITY_LOW as Fi,getDOMSelection as af,KEY_ESCAPE_COMMAND as cf,SELECTION_CHANGE_COMMAND as uf}from"lexical";import{formatAdminURL as df}from"payload/shared";import Pi,{useCallback as Bi,useEffect as Co,useLayoutEffect as mf,useRef as Tr,useState as Ue}from"react";function go(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 s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),d=t.top-r,c=t.left-n;e.style.width="max-content",e.style.maxWidth="none";let u=e.scrollWidth,a=i.right-c,m=c-i.left,p;if(u<=a)p=e.getBoundingClientRect();else{let h=m+t.width,f=m>a,k=Math.min(u,f?h:a);k<u&&(e.style.width=`${k}px`,e.style.maxWidth=`${k}px`,e.offsetHeight),f&&(c=t.right-k),p=e.getBoundingClientRect()}d<i.top&&(d+=p.height+t.height+r*2),c+p.width>i.right&&(c=i.right-p.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Jp}from"lexical";var xo=Jp("TOGGLE_LINK_WITH_MODAL_COMMAND");function ji(t){t.preventDefault()}function Hi({anchorElem:t}){let[e]=Xp(),[o,r]=Ue(),n=Tr(null),l=Tr(null),[s,i]=Ue(null),[d,c]=Ue(null),{fieldProps:{schemaPath:u},uuid:a}=W(),m=zp(),{config:p,getEntityConfig:h}=Qp(),{i18n:f,t:g}=rf(),[k,E]=Ue(),y=ef(),[T,C]=Ue(!1),[x,b]=Ue([]),_=tf(),[D,v]=Ue(!1),L=qp({slug:"lexical-rich-text-link-"+a,depth:y}),{modalState:S}=of(),w=Tr(!1);w.current=!!S[L]?.isOpen;let{toggleDrawer:N}=ge(L),I=Bi(()=>{C(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),v(!1),w.current||(i(null),c(null),b([]),E(void 0))},[]),$=Bi(()=>{let R=Oi(),O;if(!Ai(R)||!R){I();return}let F=tt(R);O=e.getElementByKey(F.getKey())?.getBoundingClientRect();let j=Mi(F,K),X=R.getNodes().filter(ie=>!lf(ie)).find(ie=>{let Re=Mi(ie,K);return j&&!j.is(Re)||Re&&!Re.is(j)});if(j==null||X){I();return}r(j);let P=j.getFields(),Ke={...P,id:j.getID(),text:j.getTextContent()};if(P?.linkType==="custom")i(P?.url??null),c(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${P?.doc?.relationTo}/${P?.doc?.value}`);let ie=P?.doc?.relationTo?h({collectionSlug:P?.doc?.relationTo}):void 0;if(!ie)c(P?.label?String(P?.label):null),i(P?.url?String(P?.url):null);else{let Re=typeof P.doc?.value=="object"?P.doc.value.id:P.doc?.value,Ie=P.doc?.relationTo;if(!Re||!Ie)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let q=g("fields:linkedTo",{label:`${_r(ie.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(q),nf.get(df({apiRoute:p.routes.api,path:`/${Ie}/${Re}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:_?.code}}).then(async he=>{if(!he.ok)throw new Error(`HTTP error! Status: ${he.status}`);let ve=await he.json(),gt=ie?.admin?.useAsTitle||"id",Kt=ve[gt],Me=g("fields:linkedTo",{label:`${_r(ie.labels.singular,f)} - ${Kt}`}).replace(/<[^>]*>?/g,"");c(Me)}).catch(()=>{let he=g("fields:linkedTo",{label:`${_r(ie.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${Re}`}).replace(/<[^>]*>?/g,"");c(he)})}}C(!0),w.current||(E(Ke),b(R?R?.getNodes():[])),we(j)?v(!0):v(!1);let ye=n.current,fe=af(e._window),{activeElement:ft}=document;if(ye===null)return;let ht=e.getRootElement();return fe!==null&&ht!==null&&ht.contains(fe.anchorNode)?(O||(O=fe.getRangeAt(0).getBoundingClientRect()),O!=null&&(O.y+=40,l.current=O)):(ft==null||ft.className!=="link-input")&&(ht!==null&&go(null,ye,t),i(null),c(null)),!0},[e,I,p.routes.admin,p.routes.api,p.serverURL,h,g,f,_?.code,t]);return Co(()=>Di(e.registerCommand(xo,R=>(e.dispatchCommand(ue,R),$(),N(),!0),Fi)),[e,$,N,L]),Co(()=>{let R=t.parentElement,O=()=>{e.getEditorState().read(()=>{$()})};return window.addEventListener("resize",O),R?.addEventListener("scroll",O),()=>{window.removeEventListener("resize",O),R?.removeEventListener("scroll",O)}},[t.parentElement,e,$]),Co(()=>Di(e.registerUpdateListener(({editorState:R})=>{R.read(()=>{$()})}),e.registerCommand(uf,()=>($(),!0),Fi),e.registerCommand(cf,()=>T?(I(),!0):!1,sf)),[e,$,T,I]),Co(()=>{e.getEditorState().read(()=>{$()})},[e,$]),mf(()=>{!T||!n.current||!t||!l.current||go(l.current,n.current,t)},[s,d,T,t,o]),Mt(Pi.Fragment,{children:[Se("div",{className:"link-editor",ref:n,children:Mt("div",{className:"link-input",children:[s&&s.length>0?Mt("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Se($i,{}):null,d!=null&&d.length>0?d:s]}):d!=null&&d.length>0?Mt(Kp,{children:[o?.__fields.newTab?Se($i,{}):null,Se("span",{className:"link-input__label-pure",children:d})]}):null,m&&Mt(Pi.Fragment,{children:[Se("button",{"aria-label":"Edit link",className:"link-edit",onClick:R=>{R.preventDefault(),N()},onMouseDown:ji,tabIndex:0,type:"button",children:Se(Yp,{})}),!D&&Se("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ue,null)},onMouseDown:ji,tabIndex:0,type:"button",children:Se(Zp,{})})]})]})}),Se(kt,{className:"lexical-link-edit-drawer",data:k,drawerSlug:L,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(R,O)=>{let F=O,j={...F};delete j.text,e.update(()=>{let X=Oi(),P=null;if(Ai(X)?P=tt(X).getParent():x.length&&(P=x[0]?.getParent()??null),P&&we(P)){let Ke=_e({fields:j});P.replace(Ke,!0)}}),e.dispatchCommand(ue,{fields:j,selectedNodes:x,text:F.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Ui=t=>{let{anchorElem:e=document.body}=t;return ff(pf(Hi,{anchorElem:e}),e)};import{c as hf}from"react/compiler-runtime";import{useLexicalComposerContext as gf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as xf}from"@lexical/utils";import{$getSelection as Cf,$isElementNode as bf,$isRangeSelection as kf,COMMAND_PRIORITY_LOW as Wi,PASTE_COMMAND as _f}from"lexical";import{useEffect as Tf}from"react";var Gi=t=>{let e=hf(5),{clientProps:o}=t,[r]=gf(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([te]))throw new Error("LinkPlugin: LinkNode not registered on editor");return xf(r.registerCommand(ue,s=>s===null?(Cr(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),Cr(s),!0),Wi),r.registerCommand(_f,s=>{let i=Cf();if(!kf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!Ci(d))return!1;if(!i.getNodes().some(wf)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(ue,{fields:c,text:null}),s.preventDefault(),!0}return!1},Wi))},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]),Tf(n,l),null};function wf(t){return bf(t)}var Ji=[pr([{ChildComponent:gi,isActive:({selection:t})=>{if(Vi(t)){let e=tt(t);return Sf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(Vi(t)&&wr()?.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=wr()?.getTextContent(),r=wr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(xo,{fields:n,selectedNodes:r,text:o})}},order:1}])],Ef=M(({props:t})=>({markdownTransformers:[_i],nodes:[te,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:Gi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Ii,position:"normal"},{Component:vi,position:"normal"},{Component:Ui,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ji},toolbarInline:{groups:Ji}}));import{$isListNode as Nr,INSERT_CHECK_LIST_COMMAND as qi,ListItemNode as Ff,ListNode as Pf}from"@lexical/list";import{$isRangeSelection as Bf}from"lexical";import{jsx as Ki,jsxs as Nf}from"react/jsx-runtime";import"react";var Sr=()=>Nf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ki("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ki("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lf}from"react/jsx-runtime";import{ListPlugin as yf}from"@lexical/react/LexicalListPlugin.js";import"react";var ot=()=>Lf(yf,{});function bo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function rt(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Mf,ListItemNode as Df,ListNode as $f}from"@lexical/list";import{$createListItemNode as Rf,$createListNode as If,$isListItemNode as vf,$isListNode as Er}from"@lexical/list";var Xi=4,nt=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),s=Rf(t==="check"?r[3]==="x":void 0);if(Er(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(Er(n)&&n.getListType()===t)n.append(s),e.remove();else{let d=If(t,t==="number"?Number(r[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(r[1].length/Xi);i&&s.setIndent(i)},We=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let s of n)if(vf(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(Er(u)){r.push(We(u,e,o+1));continue}}let i=" ".repeat(o*Xi),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";r.push(i+c+e(s)),l++}return r.join(`
56
+ `)};var zi={type:"element",dependencies:[$f,Df],export:(t,e)=>Mf(t)?We(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:nt("check")};import{jsx as Of}from"react/jsx-runtime";import{CheckListPlugin as Af}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Zi=()=>Of(Af,{});var Yi=[ee([{ChildComponent:Sr,isActive:({selection:t})=>{if(!Bf(t))return!1;for(let e of t.getNodes()){if(Nr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Nr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Nr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(qi,void 0)},order:12}])],jf=M(({featureProviderMap:t})=>{let e=[{Component:Zi,position:"normal"}],o=bo("checklist",t);return o&&e.push({Component:ot,position:"normal"}),{markdownTransformers:[zi],nodes:o?[Pf,Ff]:[],plugins:e,slashMenu:{groups:[rt([{Icon:Sr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(qi,void 0)}}])]},toolbarFixed:{groups:Yi},toolbarInline:{groups:Yi}}});import{$isListNode as yr,INSERT_ORDERED_LIST_COMMAND as ts,ListItemNode as Vf,ListNode as Jf}from"@lexical/list";import{$isRangeSelection as Kf}from"lexical";import{jsx as Dt,jsxs as Hf}from"react/jsx-runtime";import"react";var Lr=()=>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:[Dt("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"}),Dt("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"}),Dt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Dt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Dt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Uf,ListItemNode as Wf,ListNode as Gf}from"@lexical/list";var Qi={type:"element",dependencies:[Gf,Wf],export:(t,e)=>Uf(t)?We(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:nt("number")};var es=[ee([{ChildComponent:Lr,isActive:({selection:t})=>{if(!Kf(t))return!1;for(let e of t.getNodes()){if(yr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(yr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(yr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ts,void 0)},order:10}])],Xf=M(({featureProviderMap:t})=>{let e=bo("ordered",t);return{markdownTransformers:[Qi],nodes:e?[Jf,Vf]:[],plugins:e?[{Component:ot,position:"normal"}]:[],slashMenu:{groups:[rt([{Icon:Lr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(ts,void 0)}}])]},toolbarFixed:{groups:es},toolbarInline:{groups:es}}});import{$isListNode as Ir,INSERT_UNORDERED_LIST_COMMAND as ns,ListItemNode as Qf,ListNode as e0}from"@lexical/list";import{$isRangeSelection as t0}from"lexical";import{jsx as lt,jsxs as zf}from"react/jsx-runtime";import"react";var Rr=()=>zf("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:[lt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),lt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),lt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),lt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Zf,ListItemNode as Yf,ListNode as qf}from"@lexical/list";var os={type:"element",dependencies:[qf,Yf],export:(t,e)=>Zf(t)?We(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:nt("bullet")};var rs=[ee([{ChildComponent:Rr,isActive:({selection:t})=>{if(!t0(t))return!1;for(let e of t.getNodes()){if(Ir(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Ir(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Ir(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ns,void 0)},order:11}])],o0=M({markdownTransformers:[os],nodes:[e0,Qf],plugins:[{Component:ot,position:"normal"}],slashMenu:{groups:[rt([{Icon:Rr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ns,void 0)}}])]},toolbarFixed:{groups:rs},toolbarInline:{groups:rs}});import{jsx as r0}from"react/jsx-runtime";import{addClassNamesToElement as n0}from"@lexical/utils";import{$applyNodeReplacement as l0,DecoratorNode as i0}from"lexical";import*as ls from"react";var s0=ls.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),$t=class extends i0{__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 a0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return n0(o,"unknownConverted"),o}decorate(){return r0(s0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function a0({data:t}){return l0(new $t({data:t}))}var c0=M(()=>({nodes:[$t]}));import{jsx as u0}from"react/jsx-runtime";import{addClassNamesToElement as d0}from"@lexical/utils";import{$applyNodeReplacement as m0,DecoratorNode as p0}from"lexical";import*as is from"react";var f0=is.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Ot=class extends p0{__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 h0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return d0(o,"unknownConverted"),o}decorate(){return u0(f0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function h0({data:t}){return m0(new Ot({data:t}))}var g0=M(()=>({nodes:[Ot]}));import{$setBlocksType as cs}from"@lexical/selection";import{$createParagraphNode as us,$getSelection as ds,$isParagraphNode as ss,$isRangeSelection as x0}from"lexical";var as=[ee([{ChildComponent:wt,isActive:({selection:t})=>{if(!x0(t))return!1;for(let e of t.getNodes())if(!ss(e)&&!ss(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ds();cs(e,()=>us())})},order:1}])],C0=M({slashMenu:{groups:[z([{Icon:wt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ds();cs(e,()=>us())})}}])]},toolbarFixed:{groups:as},toolbarInline:{groups:as}});import{c as H0}from"react/compiler-runtime";import{jsx as vs}from"react/jsx-runtime";import{useLexicalComposerContext as U0}from"@lexical/react/LexicalComposerContext";import{useEffect as W0,useState as G0}from"react";import{jsx as Is,Fragment as j0}from"react/jsx-runtime";import"react";import{jsx as b0}from"react/jsx-runtime";var ms={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return b0("blockquote",{children:o})}};import{jsx as k0}from"react/jsx-runtime";var ps={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return k0(r,{children:o})}};import{jsx as _0}from"react/jsx-runtime";var fs={horizontalrule:_0("hr",{})};import{jsx as T0}from"react/jsx-runtime";var hs={linebreak:T0("br",{})};import{jsx as gs}from"react/jsx-runtime";var xs=({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 gs("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,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),gs("a",{href:s,rel:n,target:l,children:r})}});import{jsx as it,jsxs as w0,Fragment as S0}from"react/jsx-runtime";import{v4 as E0}from"uuid";var Cs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return it(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=E0();return it("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:w0(S0,{children:[it("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),it("label",{htmlFor:l,children:n}),it("br",{})]})})}else return it("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as vr}from"react/jsx-runtime";var bs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?vr("p",{children:o}):vr("p",{children:vr("br",{})})}};var ks={tab:" "};import{jsx as At}from"react/jsx-runtime";var _s={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return At("div",{className:"lexical-table-container",children:At("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:At("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"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return At(r,{className:`lexical-table-cell ${n}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return At("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ge}from"react/jsx-runtime";import"react";var A={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},N0=A.IS_BOLD|A.IS_ITALIC|A.IS_STRIKETHROUGH|A.IS_UNDERLINE|A.IS_CODE|A.IS_SUBSCRIPT|A.IS_SUPERSCRIPT|A.IS_HIGHLIGHT,L0="\xA0",y0=`
57
57
 
58
- `,Ts="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ws="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",y0=new RegExp("^[^"+ws+"]*["+Ts+"]"),R0=new RegExp("^[^"+Ts+"]*["+ws+"]"),I0={bold:A.IS_BOLD,code:A.IS_CODE,highlight:A.IS_HIGHLIGHT,italic:A.IS_ITALIC,strikethrough:A.IS_STRIKETHROUGH,subscript:A.IS_SUBSCRIPT,superscript:A.IS_SUPERSCRIPT,underline:A.IS_UNDERLINE},v0={directionless:A.IS_DIRECTIONLESS,unmergeable:A.IS_UNMERGEABLE},M0={center:A.IS_ALIGN_CENTER,end:A.IS_ALIGN_END,justify:A.IS_ALIGN_JUSTIFY,left:A.IS_ALIGN_LEFT,right:A.IS_ALIGN_RIGHT,start:A.IS_ALIGN_START},D0={[A.IS_ALIGN_CENTER]:"center",[A.IS_ALIGN_END]:"end",[A.IS_ALIGN_JUSTIFY]:"justify",[A.IS_ALIGN_LEFT]:"left",[A.IS_ALIGN_RIGHT]:"right",[A.IS_ALIGN_START]:"start"},$0={normal:A.IS_NORMAL,segmented:A.IS_SEGMENTED,token:A.IS_TOKEN},O0={[A.IS_NORMAL]:"normal",[A.IS_SEGMENTED]:"segmented",[A.IS_TOKEN]:"token"};var Ss={text:({node:t})=>{let e=t.text;return t.format&A.IS_BOLD&&(e=Ue("strong",{children:e})),t.format&A.IS_ITALIC&&(e=Ue("em",{children:e})),t.format&A.IS_STRIKETHROUGH&&(e=Ue("span",{style:{textDecoration:"line-through"},children:e})),t.format&A.IS_UNDERLINE&&(e=Ue("span",{style:{textDecoration:"underline"},children:e})),t.format&A.IS_CODE&&(e=Ue("code",{children:e})),t.format&A.IS_SUBSCRIPT&&(e=Ue("sub",{children:e})),t.format&A.IS_SUPERSCRIPT&&(e=Ue("sup",{children:e})),e}};import{jsx as Ot}from"react/jsx-runtime";var Es={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=e.fields?.alt||o?.alt||"",n=o.url;if(!o.mimeType.startsWith("image"))return Ot("a",{href:n,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Ot("img",{alt:r,height:o.height,src:n,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let d=i?.url;l.push(Ot("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(Ot("img",{alt:r,height:o?.height,src:n,width:o?.width},"image")),Ot("picture",{children:l})}};var it={...bs,...Ss,...hs,...ms,..._s,...ps,...fs,...Cs,...xs({}),...Es,...ks};import{jsx as bo,Fragment as A0}from"react/jsx-runtime";import Co from"react";function Ns(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!o}function F0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let r=typeof t.html=="function"?t.html(o):t.html;return bo("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function Ls(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,r={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return Co.createElement(t.Block,r)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},r=typeof t.html=="function"?t.html(o):t.html;return bo("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function P0(t){let e={};for(let[o,r]of Object.entries(t)){if(!r||typeof r!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Ls(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Ls(i))}continue}let n=r;(n.Component||n.html)&&(e[o]=F0(n))}return e}function ys({converters:t,data:e,disableIndent:o,disableTextAlign:r,nodeMap:n}){if(Ns(e)){let l=n?P0(n):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Rs({converters:s,disableIndent:o,disableTextAlign:r,nodes:e.root.children,parent:e.root})}return bo(A0,{})}function Rs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((i,d)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:i,nodesToJSX:p=>Rs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:n}}),parent:n}):c:u=bo("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),Co.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return Co.cloneElement(u,{key:d,style:m})}return Co.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function Rr({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:it}):i=e:i=it;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ys({converters:i,data:o,disableIndent:n,disableTextAlign:l,nodeMap:s});return r?Is(B0,{children:d}):Is("div",{className:t??"payload-richtext",children:d})}function Ms(){let t=j0(7),[e]=H0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=W0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),U0(l,s);let i;return t[5]!==r?(i=vs("div",{className:"debug-jsx-converter",children:vs(Rr,{converters:it,data:r})}),t[5]=r,t[6]=i):i=t[6],i}var G0=M({plugins:[{Component:Ms,position:"bottom"}]});var j={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},V0={text:{"text-red":{css:{color:`light-dark(${j.red[600]}, ${j.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${j.orange[600]}, ${j.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${j.yellow[700]}, ${j.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${j.green[700]}, ${j.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${j.blue[600]}, ${j.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${j.purple[600]}, ${j.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${j.pink[600]}, ${j.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${j.red[400]}, ${j.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${j.orange[400]}, ${j.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${j.yellow[300]}, ${j.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${j.green[400]}, ${j.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${j.blue[400]}, ${j.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${j.purple[400]}, ${j.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${j.pink[400]}, ${j.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as D1}from"lexical";import{jsx as At,jsxs as J0}from"react/jsx-runtime";import"react";var Ir=()=>J0("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:[At("g",{clipPath:"url(#clip0_4397_10817)",children:At("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"})}),At("defs",{children:At("clipPath",{id:"clip0_4397_10817",children:At("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Y0}from"react/jsx-runtime";import{$applyNodeReplacement as q0}from"lexical";import*as $s from"react";import{DecoratorBlockNode as K0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as X0}from"@lexical/utils";import{$applyNodeReplacement as z0}from"lexical";function Z0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ds({relationTo:o,value:e})}:null}var Ft=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:Z0,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=Ds(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return X0(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 Ds(t){return z0(new Ft({data:t}))}var Q0=$s.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function e1(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:We({relationTo:o,value:e})}:null}var Ne=class extends Ft{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:e1,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=We(o);return r.setFormat(e.format),r}decorate(e,o){return Y0(Q0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function We(t){return q0(new Ne({data:t}))}function vr(t){return t instanceof Ne}import{c as _1}from"react/compiler-runtime";import{jsx as T1}from"react/jsx-runtime";import{useLexicalComposerContext as w1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as S1}from"@lexical/utils";import{$getPreviousSelection as E1,$getSelection as N1,$isParagraphNode as L1,$isRangeSelection as y1,COMMAND_PRIORITY_EDITOR as R1,createCommand as I1}from"lexical";import{useEffect as v1}from"react";import{c as Fs}from"react/compiler-runtime";import{jsx as Mr}from"react/jsx-runtime";import{useLexicalComposerContext as Ps}from"@lexical/react/LexicalComposerContext.js";import{toast as m1}from"@payloadcms/ui";import{$getNodeByKey as p1,COMMAND_PRIORITY_EDITOR as Bs}from"lexical";import{useEffect as js,useState as f1}from"react";import{c as t1}from"react/compiler-runtime";import{jsx as o1}from"react/jsx-runtime";import{useLexicalComposerContext as r1}from"@lexical/react/LexicalComposerContext";import{useListDrawer as n1,useModal as l1}from"@payloadcms/ui";import{$getNodeByKey as Os,$getPreviousSelection as i1,$getRoot as s1,$getSelection as a1,$isRangeSelection as c1,$setSelection as u1}from"lexical";import{useEffect as d1,useState as As}from"react";var Pt=t=>{let e=t1(23),[o]=r1(),[r,n]=As(null),[l,s]=As(!1),[i,d,c]=n1(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=l1(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let I=a1()??i1();n(I)},e[0]=f):f=e[0];let g=f,k;e[1]!==o||e[2]!==r?(k=()=>{r&&o.update(()=>{if(c1(r)){let{anchor:I,focus:y}=r;Os(I.key)&&Os(y.key)&&u1(r.clone())}else s1().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=k):k=e[3];let N=k,R;e[4]!==u?(R=()=>{u()},e[4]=u,e[5]=R):R=e[5];let T=R,C,x;e[6]!==a||e[7]!==h||e[8]!==N||e[9]!==l?(C=()=>{if(!l)return;let I=h[a];I&&!I?.isOpen&&(s(!1),setTimeout(()=>{N()},1))},x=[h,a,N,l],e[6]=a,e[7]=h,e[8]=N,e[9]=l,e[10]=C,e[11]=x):(C=e[10],x=e[11]),d1(C,x);let b;e[12]!==d?(b=I=>o1(d,{...I,onClick:()=>{g()}}),e[12]=d,e[13]=b):b=e[13];let _;e[14]!==p?(_=()=>{g(),p(),s(!0)},e[14]=p,e[15]=_):_=e[15];let D;return e[16]!==i||e[17]!==T||e[18]!==m||e[19]!==a||e[20]!==b||e[21]!==_?(D={closeListDrawer:T,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:b,openListDrawer:_},e[16]=i,e[17]=T,e[18]=m,e[19]=a,e[20]=b,e[21]=_,e[22]=D):D=e[22],D};var h1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=p1(o);n&&n.replace(We({relationTo:e,value:r}))}):t.dispatchCommand(Dr,{relationTo:e,value:r})},g1=t=>{let e=Fs(14),{enabledCollectionSlugs:o}=t,[r]=Ps(),[n,l]=f1(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Pt(i),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Xe,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),Bs),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),js(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=g=>{let{collectionSlug:k,doc:N}=g;h1({editor:r,relationTo:k,replaceNodeKey:n,value:N.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=Mr(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},x1=()=>{let t=Fs(3),[e]=Ps(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Xe,C1,Bs),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),js(o,r),null},Hs=({enabledCollectionSlugs:t})=>t?.length?Mr(g1,{enabledCollectionSlugs:t}):Mr(x1,{});function C1(){return m1.error("No relationship collections enabled"),!0}import{useConfig as b1,useEntityVisibility as k1}from"@payloadcms/ui";import*as Us from"react";var ko=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=b1(),{visibleEntities:l}=k1();return Us.useMemo(()=>{let i=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:h}=a;if(l?.collections.includes(m)){if(r){if(!p||!h)continue}else if(h||!p)continue;c&&!c.has(m)||u&&u.has(m)||(i.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:i}},[n,l,r,o,e])};var Dr=I1("INSERT_RELATIONSHIP_COMMAND"),Ws=t=>{let e=_1(8),{clientProps:o}=t,[r]=w1(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=ko(s),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Dr,M1,R1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),v1(d,c);let u;return e[6]!==i?(u=T1(Hs,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function M1(t){let e=N1()||E1();if(y1(e)){let o=We(t),{focus:r}=e,n=r.getNode();S1(o),L1(n)&&!n.__first&&n.remove()}return!0}var $1=M({nodes:[Ne],plugins:[{Component:Ws,position:"normal"}],slashMenu:{groups:[X([{Icon:Ir,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Ir,isActive:({selection:t})=>{if(!D1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]}});import{c as lh}from"react/compiler-runtime";import{jsx as me,jsxs as ih}from"react/jsx-runtime";import{useLexicalComposerContext as sh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as qs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as ah,useThrottledEffect as ch,useTranslation as uh}from"@payloadcms/ui";import*as So from"react";import{useMemo as Fr}from"react";import{c as O1}from"react/compiler-runtime";import{jsx as A1}from"react/jsx-runtime";import{$addUpdateTag as F1}from"lexical";import"react";var Gs="toolbar-popup__button",Bt=t=>{let e=O1(14),{active:o,children:r,editor:n,enabled:l,item:s}=t,i=o===void 0?!1:o,d=l===void 0?!0:l,c=d?"":"disabled",u=i?"active":"",a=s.key?`${Gs}-${s.key}`:"",m;e[0]!==c||e[1]!==u||e[2]!==a?(m=[Gs,c,u,a].filter(Boolean),e[0]=c,e[1]=u,e[2]=a,e[3]=m):m=e[3];let p=m.join(" "),h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==s?(h=()=>{d&&n.focus(()=>{n.update(P1),s.onSelect?.({editor:n,isActive:i})})},e[4]=i,e[5]=n,e[6]=d,e[7]=s,e[8]=h):h=e[8];let f=h,g=B1,k;return e[9]!==r||e[10]!==p||e[11]!==f||e[12]!==s.key?(k=A1("button",{className:p,"data-button-key":s.key,onClick:f,onMouseDown:g,type:"button",children:r}),e[9]=r,e[10]=p,e[11]=f,e[12]=s.key,e[13]=k):k=e[13],k};function P1(){F1("toolbar")}function B1(t){t.preventDefault()}import{c as J1}from"react/compiler-runtime";import{jsx as st}from"react/jsx-runtime";import K1,{useMemo as X1}from"react";import{useTranslation as z1}from"@payloadcms/ui";import{jsx as Me,jsxs as Vs}from"react/jsx-runtime";import{Button as j1}from"@payloadcms/ui";import{$addUpdateTag as H1,isDOMNode as U1}from"lexical";import _o,{useCallback as W1,useEffect as To,useMemo as Ks,useRef as $r,useState as Or}from"react";import{createPortal as G1}from"react-dom";var Js="toolbar-popup__dropdown-item",Xs=_o.createContext(null);function zs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:s,tooltip:i}){let d=Ks(()=>[Js,r===!1?"disabled":"",t?"active":"",l?.key?`${Js}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=$r(null),u=_o.use(Xs);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return To(()=>{c?.current!=null&&a(c)},[c,a]),Me(j1,{"aria-label":i,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":s},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{H1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function V1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Or(),[s,i]=Or(),d=W1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?i(p=>{if(p==null)return n[0];let h=n.indexOf(p)-1;return n[h===-1?n.length-1:h]}):m==="ArrowDown"&&i(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=Ks(()=>({registerItem:d}),[d]);return To(()=>{n!=null&&s==null&&i(n[0]),s!=null&&s?.current!=null&&s.current.focus()},[n,s]),Me(Xs,{value:u,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Zs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=$r(null),u=$r(null),[a,m]=Or(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};To(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:k,top:N}=f.getBoundingClientRect(),R=window.scrollY||document.documentElement.scrollTop;g.style.top=`${N+R+f.offsetHeight+5}px`,g.style.left=`${Math.min(k-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),To(()=>{let f=u.current;if(f!==null&&a){let g=k=>{let N=k.target;U1(N)&&(d&&c.current&&c.current.contains(N)||f.contains(N)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=G1(Me(V1,{dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return Vs(_o.Fragment,{children:[Vs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[l&&Me(l,{}),i&&Me("span",{className:"toolbar-popup__dropdown-label",children:i}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Me(_o.Fragment,{children:h})]})}var Ar="toolbar-popup__dropdown",Z1=t=>{let e=J1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:s}=t,{i18n:i}=z1(),{fieldProps:d}=U(),{featureClientSchemaMap:c,schemaPath:u}=d;if(s.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==s?(m=s?.Component&&st(s.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:s},s.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==i||e[11]!==s||e[12]!==u){let m=s.key,p;s.label&&(m=typeof s.label=="function"?s.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):s.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=st(zs,{active:o,editor:n,enabled:l,Icon:s?.ChildComponent?st(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:st("span",{className:"text",children:p})},s.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=i,e[11]=s,e[12]=u,e[13]=a}else a=e[13];return a},Y1=K1.memo(Z1),jt=({anchorElem:t,classNames:e,editor:o,group:r,groupState:n,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=r,u=X1(()=>d?.length?d.map(a=>st(Y1,{active:n.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:n.enabledItemKeys.includes(a.key),item:a},a.key)):null,[d,n.activeItemKeys,n.enabledItemKeys,t,o]);return st(Zs,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Ar,`${Ar}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!n.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Ar}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as q1}from"@lexical/utils";import{$getSelection as Q1}from"lexical";import{useCallback as eh,useDeferredValue as th,useEffect as oh,useRef as Ys,useState as rh}from"react";function nh(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let r of t){let n=[];for(let l of r.items)e.set(l.key,{active:!1,enabled:!0}),n.push(l.key);o.set(r.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:n})}return{groupStates:o,itemStates:e}}function wo(t,e){let[o,r]=rh(()=>nh(e)),n=th(o),l=U(),s=Ys(l);s.current=l;let i=Ys(e);i.current=e;let d=gn(),c=eh(()=>{t.getEditorState().read(()=>{let u=Q1();if(!u)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,h=new Map;for(let f of a){let g=[],k=[],N=[],R=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let C of f.items){let x=C.isActive?(!R||g.length<R)&&C.isActive({editor:t,editorConfigContext:m,selection:u}):!1,b=C.isEnabled?C.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;x&&(g.push(C.key),k.push(C)),b&&N.push(C.key),p.set(C.key,{active:x,enabled:b})}let T=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(f.key,{activeItemKeys:g,activeItems:k,enabledGroup:T,enabledItemKeys:N})}r({groupStates:h,itemStates:p})})},[t]);return oh(()=>{d(c);let u=()=>d(c),a=q1(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),n}function dh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&me(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?me(Bt,{active:t,editor:o,enabled:r,item:n,children:me(n.ChildComponent,{})},n.key):null}function mh({anchorElem:t,editor:e,editorConfig:o,group:r,index:n,toolbarStates:l}){let{i18n:s}=uh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=U(),c=l.groupStates.get(r.key),u=Fr(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:r.ChildComponent},[r,c?.activeItems]),a=Fr(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:d}):p.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[r,c?.activeItems,s,i,d]);return ih("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,"data-toolbar-group-key":r.key,children:[r.type==="dropdown"&&r.items.length&&c?me(jt,{anchorElem:t,editor:e,group:r,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,r.type==="buttons"&&r.items.length?r.items.map(m=>{let p=l.itemStates.get(m.key);return me(dh,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,n<o.features.toolbarFixed?.groups.length-1&&me("div",{className:"divider"})]},r.key)}function ph({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=So.useRef(null),s=qs(),{y:i}=ah(),d=wo(o,r?.features?.toolbarFixed?.groups),c=Fr(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let a=n.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return ch(()=>{if(!c)return;let u=l.current;if(!u)return;let a=u.getBoundingClientRect(),m=c.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),c.classList.remove("fixed-toolbar--hide"),c.classList.add("fixed-toolbar")}},50,[l,c,i]),me("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&me(So.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,a)=>me(mh,{anchorElem:t,editor:o,editorConfig:r,group:u,index:a,toolbarStates:d},u.key))})})}var Qs=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Qs(t.parentEditor)}return!1},ea=t=>{let e=lh(6),{clientProps:o}=t,[r]=sh(),n=U();if(!qs())return null;let{editorConfig:s}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=Qs(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=me(ph,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var fh=M({plugins:[{Component:ea,position:"aboveContainer"}]});import{c as hh}from"react/compiler-runtime";import{jsx as Le,jsxs as ra}from"react/jsx-runtime";import{useLexicalComposerContext as gh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as xh}from"@lexical/react/useLexicalEditable";import{mergeRegister as na}from"@lexical/utils";import{$getSelection as la,$isRangeSelection as ta,$isTextNode as Ch,COMMAND_PRIORITY_LOW as bh,getDOMSelection as ia,SELECTION_CHANGE_COMMAND as kh}from"lexical";import{useCallback as No,useEffect as Ht,useMemo as _h,useRef as oa,useState as Th}from"react";import"react";import{createPortal as wh}from"react-dom";function Pr(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 Eo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),h=d.top-a.height-c,f=d.left-l;s==="center"&&(f=d.left+d.width/2-a.width/2);let g=0;return!e&&h<p.top&&!i&&(g=a.height+d.height+c*2,h+=g),s==="center"?f+a.width>p.right?f=p.right-a.width-l:f<p.left&&(f=p.left+l):f+a.width>p.right&&(f=p.right-a.width-l),f-=m.left,n.style.opacity="1",i&&r!==0?(h-=m.bottom-r+a.height-3,n.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,n.style.transform=`translate(${f}px, ${h}px)`),g}function Sh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&Le(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?Le(Bt,{active:t,editor:o,enabled:r,item:n,children:Le(n.ChildComponent,{})},n.key):null}function Eh({anchorElem:t,editor:e,group:o,index:r,toolbarStates:n}){let{editorConfig:l}=U(),s=n.groupStates.get(o.key),i=_h(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return ra("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Le(jt,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=n.itemStates.get(d.key);return Le(Sh,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,r<l.features.toolbarInline?.groups.length-1&&Le("div",{className:"divider"})]},o.key)}function Nh({anchorElem:t,editor:e}){let o=oa(null),r=oa(null),{editorConfig:n}=U(),l=wo(e,n?.features?.toolbarInline?.groups),s=No(()=>{if(o?.current){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=No(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=u.clientX,h=u.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),d=No(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ht(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=No(()=>{let u=la(),a=ia(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(u!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Pr(a,h),g=Eo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Eo({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Ht(()=>{let u=t.parentElement,a=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",a),u&&u.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),u&&u.removeEventListener("scroll",a)}},[e,c,t]),Ht(()=>(e.getEditorState().read(()=>{c()}),na(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(kh,()=>(c(),!1),bh))),[e,c]),ra("div",{className:"inline-toolbar-popup",ref:o,children:[Le("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,a)=>Le(Eh,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function Lh(t,e){let o=hh(12),[r,n]=Th(!1),l=xh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=la(),h=ia(t._window),f=t.getRootElement();if(h!==null&&(!ta(p)||f===null||!f.contains(h.anchorNode))){n(!1);return}if(!ta(p))return;if(p.getTextContent()!==""){let k=p.getNodes(),N=!1;for(let R of k)if(Ch(R)){n(!0),N=!0;break}N||n(!1)}else n(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){n(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,d,c;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Ht(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>na(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Ht(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=wh(Le(Nh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var sa=t=>{let{anchorElem:e}=t,[o]=gh();return Lh(o,e)};var yh=M({plugins:[{Component:sa,position:"floatingAnchorElem"}]});import{TableCellNode as xx,TableNode as Cx,TableRowNode as bx}from"@lexical/table";import{jsx as aa}from"react/jsx-runtime";import"react";var Br=()=>aa("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:aa("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 Rh,$createTableNode as Ih,$createTableRowNode as vh,$isTableCellNode as ca,$isTableNode as jr,$isTableRowNode as Hr,TableCellHeaderStates as Lo,TableCellNode as Mh,TableNode as Dh,TableRowNode as $h}from"@lexical/table";import{$isParagraphNode as Oh,$isTextNode as Ah}from"lexical";var da=/^\|(.+)\|\s?$/,Fh=/^(\| ?:?-*:? ?)+\|\s?$/,ma=({allTransformers:t})=>({type:"element",dependencies:[Dh,$h,Mh],export:e=>{if(!jr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Hr(r))continue;let l=!1;for(let s of r.getChildren())ca(s)&&(n.push(zt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===Lo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(s=>"---").join(" | ")} |`)}return o.join(`
59
- `)},regExp:da,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(Fh.test(n)){let a=e.getPreviousSibling();if(!a||!jr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Hr(p))return;p.getChildren().forEach(h=>{ca(h)&&h.setHeaderStyles(Lo.ROW,Lo.ROW)}),e.remove();return}let l=ua(n,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!Oh(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!Ah(a))break;let m=ua(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),s.unshift(m);let p=i.getPreviousSibling();i.remove(),i=p}let c=Ih();for(let a of s){let m=vh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:pa("",t))}let u=e.getPreviousSibling();jr(u)&&Ph(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function Ph(t){let e=t.getFirstChild();return Hr(e)?e.getChildrenSize():0}var pa=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=Rh(Lo.NO_STATUS);return Xt(t,e,o),o},ua=(t,e)=>{let o=t.match(da);return!o||!o[1]?null:o[1].split("|").map(r=>pa(r,e))};import{c as jh}from"react/compiler-runtime";import{jsx as B,jsxs as ye}from"react/jsx-runtime";import{useLexicalComposerContext as Ca}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Hh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ha,$deleteTableColumnAtSelection as Uh,$deleteTableRowAtSelection as Wh,$getNodeTriplet as Gh,$getTableCellNodeFromLexicalNode as ga,$getTableColumnIndexFromTableCellNode as Vh,$getTableNodeFromLexicalNodeOrThrow as $e,$getTableRowIndexFromTableCellNode as Jh,$insertTableColumnAtSelection as Kh,$insertTableRowAtSelection as Xh,$isTableCellNode as ba,$isTableSelection as Ut,$mergeCells as zh,$unmergeCell as Zh,getTableElement as Wr,getTableObserverFromTableElement as Gr,TableCellHeaderStates as De,TableCellNode as Yh}from"@lexical/table";import{mergeRegister as qh}from"@lexical/utils";import{useScrollInfo as Qh}from"@payloadcms/ui";import{$getSelection as Ro,$isElementNode as eg,$isRangeSelection as Vr,$isTextNode as tg,$setSelection as og,COMMAND_PRIORITY_CRITICAL as rg,getDOMSelection as ng,isDOMNode as lg,SELECTION_CHANGE_COMMAND as ig}from"lexical";import*as Jr from"react";import{useCallback as ce,useEffect as at,useRef as yo,useState as ct}from"react";import{createPortal as ka}from"react-dom";import{jsx as Ur,jsxs as Bh}from"react/jsx-runtime";import"react";var fa=()=>Bh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Ur("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"}),Ur("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"}),Ur("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 xa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function sg(){let t=Ro();if(Vr(t)&&!t.isCollapsed()||Ut(t)&&!t.anchor.is(t.focus)||!Vr(t)&&!Ut(t))return!1;let[e]=Gh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function ag(t){let e=t.getLastDescendant();tg(e)?e.select():eg(e)?e.selectEnd():e!==null&&e.selectNext()}function cg({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Ca(),s=yo(null),[i,d]=ct(n),[c,u]=ct({columns:1,rows:1}),[a,m]=ct(!1),[p,h]=ct(!1),{y:f}=Qh();at(()=>l.registerMutationListener(Yh,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),at(()=>{l.getEditorState().read(()=>{let w=Ro();if(Ut(w)){let L=xa(w);u(xa(w)),m(L.columns>1||L.rows>1)}h(sg())})},[l]),at(()=>{let w=e.current,L=s.current,E=l.getRootElement();if(w!=null&&L!=null&&E!=null){let v=E.getBoundingClientRect(),$=w.getBoundingClientRect();L.style.opacity="1";let O=L.getBoundingClientRect(),F=5,P=$.right+F;if(P+O.width>window.innerWidth||P+O.width>v.right){let K=$.left-O.width-F;P=(K<0?F:K)+window.pageXOffset}L.style.left=`${P+window.pageXOffset}px`;let Z=$.top;if(Z+O.height>window.innerHeight){let K=$.bottom-O.height;Z=K<0?F:K}L.style.top=`${Z}px`}},[e,s,l,f]),at(()=>{function w(L){s.current!=null&&e.current!=null&&lg(L.target)&&!s.current.contains(L.target)&&!e.current.contains(L.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let g=ce(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i),L=Wr(w,l.getElementByKey(w.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let E=Gr(L);E!==null&&E.$clearHighlight(),w.markDirty(),d(i.getLatest())}og(null)})},[l,i]),k=()=>{l.update(()=>{let w=Ro();if(!Ut(w))return;let E=w.getNodes().filter(ba),v=zh(E);v&&(ag(v),o())})},N=()=>{l.update(()=>{Zh()})},R=ce(w=>{l.update(()=>{for(let L=0;L<c.rows;L++)Xh(w);o()})},[l,o,c.rows]),T=ce(w=>{l.update(()=>{for(let L=0;L<c.columns;L++)Kh(w);o()})},[l,o,c.columns]),C=ce(()=>{l.update(()=>{Wh(),o()})},[l,o]),x=ce(()=>{l.update(()=>{$e(i).remove(),g(),o()})},[l,i,g,o]),b=ce(()=>{l.update(()=>{Uh(),o()})},[l,o]),_=ce(()=>{l.update(()=>{let w=$e(i),L=Jh(i),[E]=ha(w,null,null),v=new Set,$=i.getHeaderStyles()^De.ROW;if(E[L])for(let O=0;O<E[L].length;O++){let F=E[L][O];F?.cell&&(v.has(F.cell)||(v.add(F.cell),F.cell.setHeaderStyles($,De.ROW)))}g(),o()})},[l,i,g,o]),D=ce(()=>{l.update(()=>{let w=$e(i),L=Vh(i),[E]=ha(w,null,null),v=new Set,$=i.getHeaderStyles()^De.COLUMN;if(E)for(let O=0;O<E.length;O++){let F=E?.[O]?.[L];F?.cell&&(v.has(F.cell)||(v.add(F.cell),F.cell.setHeaderStyles($,De.COLUMN)))}g(),o()})},[l,i,g,o]),I=ce(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),y=ce(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),S=null;return t&&(a?S=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):p&&(S=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>N(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),ka(ye("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[S?ye(Jr.Fragment,{children:[S,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>y(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>R(!1),type:"button",children:ye("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>R(!0),type:"button",children:ye("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>T(!1),type:"button",children:ye("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>T(!0),type:"button",children:ye("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>b(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>_(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function ug({anchorElem:t,cellMerge:e}){let[o]=Ca(),r=yo(null),n=yo(null),[l,s]=ct(!1),[i,d]=ct(null),c=ce(()=>{let a=r.current,m=Ro(),p=ng(o._window),h=document.activeElement;function f(){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 f();let g=o.getRootElement(),k=null,N=null;if(Vr(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let T=ga(m.anchor.getNode());if(T==null||(N=o.getElementByKey(T.getKey()),N==null||!T.isAttached()))return f();let C=$e(T),x=Wr(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Gr(x),d(T)}else if(Ut(m)){let T=ga(m.anchor.getNode());if(!ba(T))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=$e(T),x=Wr(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Gr(x),N=o.getElementByKey(T.getKey())}else if(!h)return f();if(k===null||N===null)return f();let R=!k||!k.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",R),a.classList.toggle("table-cell-action-button-container--inactive",!R),R){let T=N.getBoundingClientRect(),C=t.getBoundingClientRect(),x=T.top-C.top,b=T.right-C.left;a.style.transform=`translate(${b}px, ${x}px)`}},[o,t]);at(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return qh(o.registerUpdateListener(p),o.registerCommand(ig,p,rg),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=yo(i);return at(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),B("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&ye(Jr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:B(fa,{})}),l&&B(cg,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var _a=t=>{let e=jh(3),{anchorElem:o}=t,r=Hh(),n;return e[0]!==o||e[1]!==r?(n=ka(r?B(ug,{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 dg}from"react/compiler-runtime";import{jsx as vo,jsxs as mg}from"react/jsx-runtime";import{useLexicalComposerContext as pg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as fg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as hg,$getTableNodeFromLexicalNodeOrThrow as Kr,$getTableRowIndexFromTableCellNode as gg,$isTableCellNode as Ta,$isTableRowNode as xg,getDOMCellFromTarget as Cg,getTableElement as bg,TableNode as wa}from"@lexical/table";import{calculateZoomLevel as Sa,mergeRegister as kg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Xr,isHTMLElement as _g,SKIP_SCROLL_INTO_VIEW_TAG as Ea}from"lexical";import*as La from"react";import{useCallback as Wt,useEffect as zr,useRef as Io,useState as ut}from"react";import{createPortal as Tg}from"react-dom";var wg=33,Na=92;function Sg({editor:t}){let e=Io(null),o=Io(null),r=Io(null),[n,l]=ut(!1),s=U(),i=Io(null),[d,c]=ut(null),[u,a]=ut(null),[m,p]=ut(!1),[h,f]=ut(null),g=Wt(()=>{a(null),e.current=null,f(null),i.current=null,r.current=null},[]),k=y=>(y.buttons&1)===1;zr(()=>{let y=new Set;return kg(t.registerMutationListener(wa,S=>{for(let[w,L]of S)L==="destroyed"?y.delete(w):y.add(w);l(y.size>0)}),t.registerNodeTransform(wa,S=>{if(S.getColWidths())return S;let w=S.getColumnCount(),L=Na;return S.setColWidths(Array(w).fill(L)),S}))},[t]),zr(()=>{if(!n)return;let y=E=>{let v=E.target;if(_g(v)){if(h){c({x:E.clientX,y:E.clientY});return}if(p(k(E)),!(o.current&&o.current.contains(v))&&e.current!==v){e.current=v;let $=Cg(v);$&&u!==$?t.getEditorState().read(()=>{let O=Xr($.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let F=Kr(O),P=bg(F,t.getElementByKey(F.getKey()));if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=v,r.current=P.getBoundingClientRect(),a($)},{editor:t}):$==null&&g()}}},S=E=>{p(!0)},w=E=>{p(!1)},L=t.registerRootListener((E,v)=>{v?.removeEventListener("mousemove",y),v?.removeEventListener("mousedown",S),v?.removeEventListener("mouseup",w),E?.addEventListener("mousemove",y),E?.addEventListener("mousedown",S),E?.addEventListener("mouseup",w)});return()=>{L()}},[u,h,t,n,g]);let N=y=>y==="bottom",R=Wt(y=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Xr(u.elem);if(!Ta(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Kr(S),L=gg(S),E=w.getChildren(),$=S.getColSpan()===w.getColumnCount()?L:L+S.getRowSpan()-1;if($>=E.length||$<0)throw new Error("Expected table cell to be inside of table row.");let O=E[$];if(!xg(O))throw new Error("Expected table row");let F=O.getHeight();if(F===void 0){let Z=O.getChildren();F=Math.min(...Z.map(K=>T(K,t)??1/0))}let P=Math.max(F+y,wg);O.setHeight(P)},{tag:Ea})},[u,t]),T=(y,S)=>S.getElementByKey(y.getKey())?.clientHeight,C=(y,S)=>{let w;return S.forEach(L=>{L.forEach((E,v)=>{E.cell===y&&(w=v)})}),w},x=Wt(y=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Xr(u.elem);if(!Ta(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Kr(S),[L]=hg(w,null,null),E=C(S,L);if(E===void 0)throw new Error("TableCellResizer: Table column not found.");let v=w.getColWidths();if(!v)return;let $=v[E];if($===void 0)return;let O=[...v],F=Math.max($+y,Na);O[E]=F,w.setColWidths(O)},{tag:Ea})},[u,t]),b=Wt(y=>{let S=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:L,y:E}=i.current;if(u===null)return;let v=Sa(w.target);if(N(y)){let $=(w.clientY-E)/v;R($)}else{let $=(w.clientX-L)/v;x($)}g(),document.removeEventListener("mouseup",S)}};return S},[u,g,x,R]),_=Wt(y=>S=>{if(S.preventDefault(),S.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},c(i.current),f(y),document.addEventListener("mouseup",b(y))},[u,b]),[D,I]=ut({bottom:null,left:null,right:null,top:null});return zr(()=>{if(u){let{height:y,left:S,top:w,width:L}=u.elem.getBoundingClientRect(),E=Sa(u.elem),v=10,$={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${v}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+w+y-v/2}px`,width:`${L}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${y}px`,left:`${window.scrollX+S+L-v/2}px`,top:`${window.scrollY+w}px`,width:`${v}px`}},O=r.current;h&&d&&O&&(N(h)?($[h].left=`${window.scrollX+O.left}px`,$[h].top=`${window.scrollY+d.y/E}px`,$[h].height="3px",$[h].width=`${O.width}px`):($[h].top=`${window.scrollY+O.top}px`,$[h].left=`${window.scrollX+d.x/E}px`,$[h].width="3px",$[h].height=`${O.height}px`),$[h].backgroundColor="#adf"),I($)}else I({bottom:null,left:null,right:null,top:null})},[u,h,d]),vo("div",{ref:o,children:u!=null&&!m&&mg(La.Fragment,{children:[vo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:D.right||void 0}),vo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:D.bottom||void 0})]})})}var ya=()=>{let t=dg(3),[e]=pg(),o=fg(),r;return t[0]!==e||t[1]!==o?(r=o?Tg(vo(Sg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Mg}from"react/compiler-runtime";import{jsx as Zr,jsxs as Dg,Fragment as $g}from"react/jsx-runtime";import{useLexicalComposerContext as Og}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Aa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Ag,$getTableColumnIndexFromTableCellNode as Fg,$getTableRowIndexFromTableCellNode as Pg,$insertTableColumnAtSelection as Bg,$insertTableRowAtSelection as jg,$isTableCellNode as Hg,$isTableNode as va,getTableElement as Ug,TableNode as Wg}from"@lexical/table";import{$findMatchingParent as Gg,mergeRegister as Vg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ma,isHTMLElement as Jg}from"lexical";import{useEffect as Da,useMemo as Kg,useRef as $a,useState as Mo}from"react";import"react";import{createPortal as Xg}from"react-dom";import{c as Rg}from"react/compiler-runtime";import{useEffect as Ig,useRef as vg}from"react";var Eg="Expected a function",Ng=Math.max,Lg=Math.min;function yg(t,e,o){let r,n,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(Eg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?Ng(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(x){let b=r,_=s;return r=s=void 0,l=x,u=t.apply(_,b),u}function h(x){return l=x,a=setTimeout(k,e),i?p(x):u}function f(x){let b=x-n,_=x-l,D=e-b;return d?Lg(D,c-_):D}function g(x){let b=x-n,_=x-l;return n===void 0||b>=e||b<0||d&&_>=c}function k(){let x=Date.now();if(g(x))return N(x);a=setTimeout(k,f(x))}function N(x){return a=void 0,m&&r?p(x):(r=s=void 0,u)}function R(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function T(){return a===void 0?u:N(Date.now())}function C(){let x=Date.now(),b=g(x);if(r=arguments,s=this,n=x,b){if(a===void 0)return h(n);if(d)return clearTimeout(a),a=setTimeout(k,e),p(n)}return a===void 0&&(a=setTimeout(k,e)),u}return C.cancel=R,C.flush=T,C}var Ra=yg;function Ia(t,e,o){let r=Rg(6),n=vg(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Ra(t,e,{maxWait:o}),()=>{n.current?.cancel()}),s=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=s):(l=r[3],s=r[4]),Ig(l,s);let i;return r[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=i):i=r[5],i}var Oa=20;function zg({anchorElem:t}){let[e]=Og(),o=Aa(),r=U(),[n,l]=Mo(!1),[s,i]=Mo(!1),[d,c]=Mo(!1),[u,a]=Mo({}),m=$a(new Set),p=$a(null),h=Ia(k=>{let{isOutside:N,tableDOMNode:R}=Zg(k,r.editorConfig?.lexical);if(N){l(!1),i(!1);return}if(!R)return;p.current=R;let T=null,C=null,x=null;if(e.getEditorState().read(()=>{let $=Ma(R);if(Hg($)){let O=Gg($,F=>va(F));if(!va(O))return;if(x=Ug(O,e.getElementByKey(O.getKey())),x){let F=O.getChildrenSize(),P=O.getChildAtIndex(0)?.getChildrenSize(),Z=Pg($),K=Fg($);Z===F-1?T=$:K===P-1&&(C=$)}}},{editor:e}),!x)return;let b=x.parentElement;if(!b)return;let{bottom:_,height:D,left:I,right:y,width:S,y:w}=x.getBoundingClientRect(),L=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(L=b.scrollWidth>b.clientWidth);let{left:E,y:v}=t.getBoundingClientRect();T?(i(!1),l(!0),a({height:Oa,left:L&&b?b.offsetLeft:I-E,top:_-v+5,width:L&&b?b.offsetWidth:S})):C&&(i(!0),l(!1),a({height:D,left:y-E+5,top:w-v,width:Oa}))},50,250),f=Kg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Da(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Da(()=>Vg(e.registerMutationListener(Wg,k=>{e.getEditorState().read(()=>{let N=!1;for(let[R,T]of k)switch(T){case"created":{m.current.add(R),N=!0;break}case"destroyed":{m.current.delete(R),N=!0;break}default:break}if(N){f.disconnect();for(let R of m.current){let{tableElement:T}=Ag(R);f.observe(T)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=k=>{e.update(()=>{p.current&&(Ma(p.current)?.selectEnd(),k?(jg(),l(!1)):(Bg(),i(!1)))})};return o?Dg($g,{children:[n&&Zr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Zr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function Zg(t,e){let o=t.target;if(Jg(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 Fa(t){let e=Mg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Aa())return null;let l;return e[0]!==r?(l=Xg(Zr(zg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Yg}from"react/compiler-runtime";import{jsx as Yr,jsxs as qg}from"react/jsx-runtime";import{useLexicalComposerContext as Qg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as ex}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as tx,TableCellNode as ox,TableNode as rx,TableRowNode as nx}from"@lexical/table";import{mergeRegister as lx}from"@lexical/utils";import{formatDrawerSlug as ix,useEditDepth as sx}from"@payloadcms/ui";import{$getSelection as ax,$isRangeSelection as cx,COMMAND_PRIORITY_EDITOR as ux,createCommand as dx}from"lexical";import{createContext as mx,use as px,useEffect as fx,useMemo as hx,useState as gx}from"react";import*as Pa from"react";var Do=dx("OPEN_EMBED_DRAWER_COMMAND"),Ba=mx({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ja({children:t}){let[e,o]=gx({cellEditorConfig:null,cellEditorPlugins:null});return Yr(Ba,{value:hx(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ha=()=>{let t=Yg(16),[e]=Qg(),o=px(Ba),r=sx(),{fieldProps:n,uuid:l}=U(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=ix({slug:i,depth:r}),t[0]=r,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=xe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([rx,nx,ox]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return lx(e.registerCommand(Do,()=>{let f=null;return e.getEditorState().read(()=>{let g=ax();cx(g)&&(f=g)}),f&&u(),!0},ux))},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],fx(a,m);let p;t[10]!==e?(p=(f,g)=>{!g.columns||!g.rows||e.dispatchCommand(tx,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let h;return t[12]!==c||t[13]!==s||t[14]!==p?(h=qg(Pa.Fragment,{children:[Yr(Ct,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),Yr(ex,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=h):h=t[15],h};var kx=M({markdownTransformers:[ma],nodes:[Cx,xx,bx],plugins:[{Component:Ha,position:"normal"},{Component:ya,position:"normal"},{Component:_a,position:"floatingAnchorElem"},{Component:Fa,position:"floatingAnchorElem"}],providers:[ja],slashMenu:{groups:[X([{Icon:Br,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Br,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]}});import{$isNodeSelection as oC}from"lexical";import{jsx as qr,jsxs as _x}from"react/jsx-runtime";import"react";var Qr=()=>_x("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:[qr("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"}),qr("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"}),qr("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 Ja}from"react/jsx-runtime";import Ka from"bson-objectid";import{$applyNodeReplacement as Lx}from"lexical";import*as Xa from"react";import Tx from"bson-objectid";function $o(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 Tx.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as wx}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Sx}from"@lexical/utils";import Wa from"bson-objectid";import{$applyNodeReplacement as Ex}from"lexical";var Gt=class extends wx{__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=>$o(o,Ua),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Wa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ua({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Sx(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 Ua({data:t}){return t?.id||(t.id=new Wa.default().toHexString()),Ex(new Gt({data:t}))}import{jsx as Ga}from"react/jsx-runtime";import{ShimmerEffect as Nx}from"@payloadcms/ui";var Va=()=>Ga("div",{className:"lexical-upload",children:Ga(Nx,{height:"95px",width:"203px"})});var yx=Xa.lazy(()=>import("./component-XIHC3W6W.js").then(t=>({default:t.UploadComponent}))),pe=class extends Gt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>$o(o,fe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ka.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=fe({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?Ja(Va,{}):Ja(yx,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function fe({data:t}){return t?.id||(t.id=new Ka.default().toHexString()),Lx(new pe({data:t}))}function dt(t){return t instanceof pe}import{c as Ax}from"react/compiler-runtime";import{jsx as Fx}from"react/jsx-runtime";import{useLexicalComposerContext as Px}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as lc,$insertNodeToNearestRoot as on,mergeRegister as Bx}from"@lexical/utils";import{useBulkUpload as jx,useEffectEvent as Hx,useModal as Ux}from"@payloadcms/ui";import rn from"bson-objectid";import{$createRangeSelection as Wx,$getPreviousSelection as ec,$getSelection as tc,$isParagraphNode as nn,$isRangeSelection as oc,$setSelection as Gx,COMMAND_PRIORITY_EDITOR as Vx,COMMAND_PRIORITY_LOW as rc,createCommand as Jx,DROP_COMMAND as Kx,getDOMSelectionFromTarget as Xx,isHTMLElement as nc,PASTE_COMMAND as zx}from"lexical";import{useEffect as Zx}from"react";import{c as za}from"react/compiler-runtime";import{jsx as en}from"react/jsx-runtime";import{useLexicalComposerContext as Za}from"@lexical/react/LexicalComposerContext.js";import{toast as Rx}from"@payloadcms/ui";import{$getNodeByKey as Ix,COMMAND_PRIORITY_EDITOR as Ya}from"lexical";import{useEffect as qa,useState as vx}from"react";var Mx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Ix(o);n&&n.replace(fe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(tn,{fields:null,relationTo:e,value:r})},Dx=t=>{let e=za(13),{enabledCollectionSlugs:o}=t,[r]=Za(),[n,l]=vx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=Pt(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(ze,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Ya),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),qa(u,a);let m;e[6]!==i||e[7]!==r||e[8]!==n?(m=f=>{let{collectionSlug:g,doc:k}=f;i(),Mx({editor:r,relationTo:g,replaceNodeKey:n,value:k.id})},e[6]=i,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,h;return e[10]!==d||e[11]!==p?(h=en(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},$x=()=>{let t=za(3),[e]=Za(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ze,Ox,Ya),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),qa(o,r),null},Qa=({enabledCollectionSlugs:t})=>t?.length?en(Dx,{enabledCollectionSlugs:t}):en($x,{});function Ox(){return Rx.error("No upload collections enabled"),!0}function Yx(t){let e=t.target;return!!(nc(e)&&!e.closest("code, span.editor-image")&&nc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function qx(t){let e,o=Xx(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 tn=Jx("INSERT_UPLOAD_COMMAND"),ic=t=>{let e=Ax(21),{clientProps:o}=t,[r]=Px(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=ko(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=jx(),{isModalOpen:h,openModal:f}=Ux(),g;e[3]!==d||e[4]!==r||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(g=C=>{let{files:x}=C;if(x?.length!==0&&(u(b=>[...b??[],...x.map(Qx)]),!h(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{r.update(eC)}),m(b=>{let _=new Map(b.map(tC));r.update(()=>{for(let D of lc()){let I=D.node;if(dt(I)){let y=I.getData();if(y?.pending){let S=_.get(y.pending?.formID);S&&I.replace(fe({data:{id:new rn.default().toHexString(),fields:{},relationTo:S.collectionSlug,value:S.doc.id}}))}}}})}),f(d)}},e[3]=d,e[4]=r,e[5]=i,e[6]=h,e[7]=f,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=g):g=e[13];let k=Hx(g),N;e[14]!==r||e[15]!==k?(N=()=>{if(!r.hasNodes([pe]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Bx(r.registerNodeTransform(pe,C=>{let x=C.getData();if(!x?.pending)return;(async function(){let D=null,I=x?.pending?.src,y=x?.pending?.formID;if(I?.startsWith("data:")){let S=I.match(/data:(image\/[a-zA-Z]+);base64,/),w=S?S[1]:"image/png",L=I.replace(/^data:image\/[a-zA-Z]+;base64,/,""),E=atob(L),v=new Array(E.length);for(let F=0;F<E.length;F++)v[F]=E.charCodeAt(F);let $=new Uint8Array(v);D={alt:void 0,file:new File([$],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:y}}else if(I?.startsWith("http")||I?.startsWith("https")){let w=await(await fetch(I)).blob(),L=I.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];D={alt:void 0,file:new File([w],L,{type:w.type}),formID:y}}D&&k({files:[D]})})()}),r.registerCommand(tn,C=>(r.update(()=>{let x=tc()||ec();if(oc(x)){let b=fe({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:_}=x,D=_.getNode();on(b),nn(D)&&!D.__first&&D.remove()}}),!0),Vx),r.registerCommand(zx,C=>{if(!(C instanceof ClipboardEvent))return!1;let x=C.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(_=>{b.push({alt:"",file:_,formID:new rn.default().toHexString()})}),b.length?(r.update(()=>{let _=tc()||ec();if(oc(_))for(let D of b){let I=fe({data:{pending:{formID:D.formID,src:URL.createObjectURL(D.file)}}}),{focus:y}=_,S=y.getNode();on(I),nn(S)&&!S.__first&&S.remove()}}),k({files:b}),!0):!1},rc),r.registerCommand(Kx,C=>{if(!(C instanceof DragEvent))return!1;let x=C.dataTransfer;if(!x?.types?.length)return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(_=>{b.push({alt:"",file:_,formID:new rn.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),r.update(()=>{if(Yx(C)){let _=qx(C),D=Wx();_!=null&&D.applyDOMRange(_),Gx(D);for(let I of b){let y=fe({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:S}=D,w=S.getNode();on(y),nn(w)&&!w.__first&&w.remove()}}}),k({files:b}),!0):!1},rc))},e[14]=r,e[15]=k,e[16]=N):N=e[16];let R;e[17]!==r?(R=[r],e[17]=r,e[18]=R):R=e[18],Zx(N,R);let T;return e[19]!==i?(T=Fx(Qa,{enabledCollectionSlugs:i}),e[19]=i,e[20]=T):T=e[20],T};function Qx(t){return{file:t.file,formID:t.formID}}function eC(){for(let t of lc()){let e=t.node;dt(e)&&e.getData()?.pending&&e.remove()}}function tC(t){return[t.formID,t]}var rC=M({nodes:[pe],plugins:[{Component:ic,position:"normal"}],slashMenu:{groups:[X([{Icon:Qr,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:[ke([{ChildComponent:Qr,isActive:({selection:t})=>{if(!oC(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return dt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]}});import{c as lC}from"react/compiler-runtime";import{jsx as Oo}from"react/jsx-runtime";import{createElement as iC}from"react";import{ShimmerEffect as sC,useConfig as aC}from"@payloadcms/ui";import{lazy as cC,Suspense as uC,useEffect as dC,useState as mC}from"react";var sc={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 ln={namespace:"lexical",theme:sc};function ac({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let s=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:r,resolvedFeatures:i,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as nC}from"payload/shared";var cc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?nC(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 sn(t,e,o,r){return{admin:o,features:cc(t),lexical:e,resolvedFeatureMap:t,view:r}}var pC=cC(()=>import("./Field-J6MIUIWP.js").then(t=>({default:t.RichText}))),fC=t=>Oo(Uo,{inheritable:!0,views:t.views,children:Oo(hC,{...t})}),hC=t=>{let e=lC(23),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==n?(m=n===void 0?{}:n,e[2]=n,e[3]=m):m=e[3];let p=m,h=i===void 0?ln:i,{currentView:f}=Wo(),g=c?.[f]?.admin??a,k=c?.[f]?.lexical,N;e[4]!==h||e[5]!==k?(N=typeof k=="function"?k(h):k??h,e[4]=h,e[5]=k,e[6]=N):N=e[6];let R=N,{config:T}=aC(),[C,x]=mC(null),b,_;e[7]!==r||e[8]!==T||e[9]!==f||e[10]!==g||e[11]!==R||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==C||e[16]!==d||e[17]!==c?(b=()=>{if(C&&C.view===f)return;let I=c?.[f],y=I?.filterFeatures?I.filterFeatures(r):r,S=[];for(let L of Object.values(y))L.clientFeatureProvider&&S.push(L.clientFeatureProvider(L.clientFeatureProps));let w=ac({config:T,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:S,lexical:R}});x(sn(w,R,g,f))},_=[g,r,T,p,l,s,C,R,d,f,c],e[7]=r,e[8]=T,e[9]=f,e[10]=g,e[11]=R,e[12]=p,e[13]=l,e[14]=s,e[15]=C,e[16]=d,e[17]=c,e[18]=b,e[19]=_):(b=e[18],_=e[19]),dC(b,_);let D;return e[20]!==C||e[21]!==t?(D=Oo(uC,{fallback:Oo(sC,{height:"35vh"}),children:C&&iC(pC,{...t,editorConfig:C,key:C.view})}),e[20]=C,e[21]=t,e[22]=D):D=e[22],D};function gC(t){return t instanceof HTMLElement}function xC(...t){return t.filter(Boolean).join(" ")}var Ao=new WeakMap;function uc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Fo(t,e){let o=Ao.get(t);if(o===void 0){let r=new Set,n=s=>{o!==void 0&&(o.start=uc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=uc(s);for(let c of r)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Ao.set(t,o)}return o.listeners.add(e),()=>{CC(t,e)}}function CC(t,e){let o=Ao.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Ao.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function bC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function kC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function _C(t,e){return Fo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function TC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as wC}from"react/compiler-runtime";import{jsx as SC}from"react/jsx-runtime";import"react";var EC=()=>{let t=wC(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?SC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as NC}from"react/compiler-runtime";import{jsx as LC}from"react/jsx-runtime";import"react";var yC=()=>{let t=NC(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?LC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as RC}from"react/compiler-runtime";import{jsx as IC}from"react/jsx-runtime";import"react";var vC=()=>{let t=RC(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?IC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as MC}from"react/compiler-runtime";import{jsx as DC}from"react/jsx-runtime";import"react";var $C=t=>{let e=MC(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?DC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as OC}from"react/jsx-runtime";import"react";var AC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=ie();return r?OC(r,{...o,children:e}):null};import{c as FC}from"react/compiler-runtime";import{jsx as PC}from"react/jsx-runtime";import"react";var BC=()=>{let t=FC(2),{EditButton:e}=ie(),o;return t[0]!==e?(o=e?PC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as jC}from"react/compiler-runtime";import{jsx as HC}from"react/jsx-runtime";import"react";var UC=()=>{let t=jC(2),{RemoveButton:e}=ie(),o;return t[0]!==e?(o=e?HC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as WC}from"qs-esm";var GC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=WC({depth:e??0,draft:o??!1,locale:r,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var dc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
58
+ `,Ts="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ws="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",R0=new RegExp("^[^"+ws+"]*["+Ts+"]"),I0=new RegExp("^[^"+Ts+"]*["+ws+"]"),v0={bold:A.IS_BOLD,code:A.IS_CODE,highlight:A.IS_HIGHLIGHT,italic:A.IS_ITALIC,strikethrough:A.IS_STRIKETHROUGH,subscript:A.IS_SUBSCRIPT,superscript:A.IS_SUPERSCRIPT,underline:A.IS_UNDERLINE},M0={directionless:A.IS_DIRECTIONLESS,unmergeable:A.IS_UNMERGEABLE},D0={center:A.IS_ALIGN_CENTER,end:A.IS_ALIGN_END,justify:A.IS_ALIGN_JUSTIFY,left:A.IS_ALIGN_LEFT,right:A.IS_ALIGN_RIGHT,start:A.IS_ALIGN_START},$0={[A.IS_ALIGN_CENTER]:"center",[A.IS_ALIGN_END]:"end",[A.IS_ALIGN_JUSTIFY]:"justify",[A.IS_ALIGN_LEFT]:"left",[A.IS_ALIGN_RIGHT]:"right",[A.IS_ALIGN_START]:"start"},O0={normal:A.IS_NORMAL,segmented:A.IS_SEGMENTED,token:A.IS_TOKEN},A0={[A.IS_NORMAL]:"normal",[A.IS_SEGMENTED]:"segmented",[A.IS_TOKEN]:"token"};var Ss={text:({node:t})=>{let e=t.text;return t.format&A.IS_BOLD&&(e=Ge("strong",{children:e})),t.format&A.IS_ITALIC&&(e=Ge("em",{children:e})),t.format&A.IS_STRIKETHROUGH&&(e=Ge("span",{style:{textDecoration:"line-through"},children:e})),t.format&A.IS_UNDERLINE&&(e=Ge("span",{style:{textDecoration:"underline"},children:e})),t.format&A.IS_CODE&&(e=Ge("code",{children:e})),t.format&A.IS_SUBSCRIPT&&(e=Ge("sub",{children:e})),t.format&A.IS_SUPERSCRIPT&&(e=Ge("sup",{children:e})),e}};import{jsx as Ft}from"react/jsx-runtime";var Es={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=e.fields?.alt||o?.alt||"",n=o.url;if(!o.mimeType.startsWith("image"))return Ft("a",{href:n,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Ft("img",{alt:r,height:o.height,src:n,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let d=i?.url;l.push(Ft("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(Ft("img",{alt:r,height:o?.height,src:n,width:o?.width},"image")),Ft("picture",{children:l})}};var st={...bs,...Ss,...hs,...ms,..._s,...ps,...fs,...Cs,...xs({}),...Es,...ks};import{jsx as _o,Fragment as F0}from"react/jsx-runtime";import ko from"react";function Ns(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!o}function P0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let r=typeof t.html=="function"?t.html(o):t.html;return _o("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function Ls(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,r={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return ko.createElement(t.Block,r)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},r=typeof t.html=="function"?t.html(o):t.html;return _o("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function B0(t){let e={};for(let[o,r]of Object.entries(t)){if(!r||typeof r!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Ls(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Ls(i))}continue}let n=r;(n.Component||n.html)&&(e[o]=P0(n))}return e}function ys({converters:t,data:e,disableIndent:o,disableTextAlign:r,nodeMap:n}){if(Ns(e)){let l=n?B0(n):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Rs({converters:s,disableIndent:o,disableTextAlign:r,nodes:e.root.children,parent:e.root})}return _o(F0,{})}function Rs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((i,d)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:i,nodesToJSX:p=>Rs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:n}}),parent:n}):c:u=_o("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),ko.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return ko.cloneElement(u,{key:d,style:m})}return ko.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function Mr({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:st}):i=e:i=st;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ys({converters:i,data:o,disableIndent:n,disableTextAlign:l,nodeMap:s});return r?Is(j0,{children:d}):Is("div",{className:t??"payload-richtext",children:d})}function Ms(){let t=H0(7),[e]=U0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=G0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),W0(l,s);let i;return t[5]!==r?(i=vs("div",{className:"debug-jsx-converter",children:vs(Mr,{converters:st,data:r})}),t[5]=r,t[6]=i):i=t[6],i}var V0=M({plugins:[{Component:Ms,position:"bottom"}]});var H={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)"}},J0={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as $1}from"lexical";import{jsx as Pt,jsxs as K0}from"react/jsx-runtime";import"react";var Dr=()=>K0("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:[Pt("g",{clipPath:"url(#clip0_4397_10817)",children:Pt("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"})}),Pt("defs",{children:Pt("clipPath",{id:"clip0_4397_10817",children:Pt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as q0}from"react/jsx-runtime";import{$applyNodeReplacement as Q0}from"lexical";import*as $s from"react";import{DecoratorBlockNode as X0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as z0}from"@lexical/utils";import{$applyNodeReplacement as Z0}from"lexical";function Y0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ds({relationTo:o,value:e})}:null}var Bt=class extends X0{__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:Y0,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=Ds(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return z0(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 Ds(t){return Z0(new Bt({data:t}))}var e1=$s.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function t1(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ve({relationTo:o,value:e})}:null}var Ee=class extends Bt{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:t1,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=Ve(o);return r.setFormat(e.format),r}decorate(e,o){return q0(e1,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ve(t){return Q0(new Ee({data:t}))}function $r(t){return t instanceof Ee}import{c as T1}from"react/compiler-runtime";import{jsx as w1}from"react/jsx-runtime";import{useLexicalComposerContext as S1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as E1}from"@lexical/utils";import{$getPreviousSelection as N1,$getSelection as L1,$isParagraphNode as y1,$isRangeSelection as R1,COMMAND_PRIORITY_EDITOR as I1,createCommand as v1}from"lexical";import{useEffect as M1}from"react";import{c as Fs}from"react/compiler-runtime";import{jsx as Or}from"react/jsx-runtime";import{useLexicalComposerContext as Ps}from"@lexical/react/LexicalComposerContext.js";import{toast as p1}from"@payloadcms/ui";import{$getNodeByKey as f1,COMMAND_PRIORITY_EDITOR as Bs}from"lexical";import{useEffect as js,useState as h1}from"react";import{c as o1}from"react/compiler-runtime";import{jsx as r1}from"react/jsx-runtime";import{useLexicalComposerContext as n1}from"@lexical/react/LexicalComposerContext";import{useListDrawer as l1,useModal as i1}from"@payloadcms/ui";import{$getNodeByKey as Os,$getPreviousSelection as s1,$getRoot as a1,$getSelection as c1,$isRangeSelection as u1,$setSelection as d1}from"lexical";import{useEffect as m1,useState as As}from"react";var jt=t=>{let e=o1(23),[o]=n1(),[r,n]=As(null),[l,s]=As(!1),[i,d,c]=l1(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=i1(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let v=c1()??s1();n(v)},e[0]=f):f=e[0];let g=f,k;e[1]!==o||e[2]!==r?(k=()=>{r&&o.update(()=>{if(u1(r)){let{anchor:v,focus:L}=r;Os(v.key)&&Os(L.key)&&d1(r.clone())}else a1().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=k):k=e[3];let E=k,y;e[4]!==u?(y=()=>{u()},e[4]=u,e[5]=y):y=e[5];let T=y,C,x;e[6]!==a||e[7]!==h||e[8]!==E||e[9]!==l?(C=()=>{if(!l)return;let v=h[a];v&&!v?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},x=[h,a,E,l],e[6]=a,e[7]=h,e[8]=E,e[9]=l,e[10]=C,e[11]=x):(C=e[10],x=e[11]),m1(C,x);let b;e[12]!==d?(b=v=>r1(d,{...v,onClick:()=>{g()}}),e[12]=d,e[13]=b):b=e[13];let _;e[14]!==p?(_=()=>{g(),p(),s(!0)},e[14]=p,e[15]=_):_=e[15];let D;return e[16]!==i||e[17]!==T||e[18]!==m||e[19]!==a||e[20]!==b||e[21]!==_?(D={closeListDrawer:T,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:b,openListDrawer:_},e[16]=i,e[17]=T,e[18]=m,e[19]=a,e[20]=b,e[21]=_,e[22]=D):D=e[22],D};var g1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=f1(o);n&&n.replace(Ve({relationTo:e,value:r}))}):t.dispatchCommand(Ar,{relationTo:e,value:r})},x1=t=>{let e=Fs(14),{enabledCollectionSlugs:o}=t,[r]=Ps(),[n,l]=h1(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=jt(i),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(ze,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),Bs),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),js(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=g=>{let{collectionSlug:k,doc:E}=g;g1({editor:r,relationTo:k,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=Or(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},C1=()=>{let t=Fs(3),[e]=Ps(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ze,b1,Bs),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),js(o,r),null},Hs=({enabledCollectionSlugs:t})=>t?.length?Or(x1,{enabledCollectionSlugs:t}):Or(C1,{});function b1(){return p1.error("No relationship collections enabled"),!0}import{useConfig as k1,useEntityVisibility as _1}from"@payloadcms/ui";import*as Us from"react";var To=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=k1(),{visibleEntities:l}=_1();return Us.useMemo(()=>{let i=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:h}=a;if(l?.collections.includes(m)){if(r){if(!p||!h)continue}else if(h||!p)continue;c&&!c.has(m)||u&&u.has(m)||(i.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:i}},[n,l,r,o,e])};var Ar=v1("INSERT_RELATIONSHIP_COMMAND"),Ws=t=>{let e=T1(8),{clientProps:o}=t,[r]=S1(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=To(s),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([Ee]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Ar,D1,I1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),M1(d,c);let u;return e[6]!==i?(u=w1(Hs,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function D1(t){let e=L1()||N1();if(R1(e)){let o=Ve(t),{focus:r}=e,n=r.getNode();E1(o),y1(n)&&!n.__first&&n.remove()}return!0}var O1=M({nodes:[Ee],plugins:[{Component:Ws,position:"normal"}],slashMenu:{groups:[z([{Icon:Dr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Dr,isActive:({selection:t})=>{if(!$1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return $r(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]}});import{c as ih}from"react/compiler-runtime";import{jsx as de,jsxs as sh}from"react/jsx-runtime";import{useLexicalComposerContext as ah}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as qs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as ch,useThrottledEffect as uh,useTranslation as dh}from"@payloadcms/ui";import*as No from"react";import{useMemo as jr}from"react";import{c as A1}from"react/compiler-runtime";import{jsx as F1}from"react/jsx-runtime";import{$addUpdateTag as P1}from"lexical";import"react";var Gs="toolbar-popup__button",Ht=t=>{let e=A1(14),{active:o,children:r,editor:n,enabled:l,item:s}=t,i=o===void 0?!1:o,d=l===void 0?!0:l,c=d?"":"disabled",u=i?"active":"",a=s.key?`${Gs}-${s.key}`:"",m;e[0]!==c||e[1]!==u||e[2]!==a?(m=[Gs,c,u,a].filter(Boolean),e[0]=c,e[1]=u,e[2]=a,e[3]=m):m=e[3];let p=m.join(" "),h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==s?(h=()=>{d&&n.focus(()=>{n.update(B1),s.onSelect?.({editor:n,isActive:i})})},e[4]=i,e[5]=n,e[6]=d,e[7]=s,e[8]=h):h=e[8];let f=h,g=j1,k;return e[9]!==r||e[10]!==p||e[11]!==f||e[12]!==s.key?(k=F1("button",{className:p,"data-button-key":s.key,onClick:f,onMouseDown:g,type:"button",children:r}),e[9]=r,e[10]=p,e[11]=f,e[12]=s.key,e[13]=k):k=e[13],k};function B1(){P1("toolbar")}function j1(t){t.preventDefault()}import{c as K1}from"react/compiler-runtime";import{jsx as at}from"react/jsx-runtime";import X1,{useMemo as z1}from"react";import{useTranslation as Z1}from"@payloadcms/ui";import{jsx as $e,jsxs as Vs}from"react/jsx-runtime";import{Button as H1}from"@payloadcms/ui";import{$addUpdateTag as U1,isDOMNode as W1}from"lexical";import wo,{useCallback as G1,useEffect as So,useMemo as Ks,useRef as Fr,useState as Pr}from"react";import{createPortal as V1}from"react-dom";var Js="toolbar-popup__dropdown-item",Xs=wo.createContext(null);function zs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:s,tooltip:i}){let d=Ks(()=>[Js,r===!1?"disabled":"",t?"active":"",l?.key?`${Js}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Fr(null),u=wo.use(Xs);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return So(()=>{c?.current!=null&&a(c)},[c,a]),$e(H1,{"aria-label":i,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":s},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{U1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function J1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Pr(),[s,i]=Pr(),d=G1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?i(p=>{if(p==null)return n[0];let h=n.indexOf(p)-1;return n[h===-1?n.length-1:h]}):m==="ArrowDown"&&i(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=Ks(()=>({registerItem:d}),[d]);return So(()=>{n!=null&&s==null&&i(n[0]),s!=null&&s?.current!=null&&s.current.focus()},[n,s]),$e(Xs,{value:u,children:$e("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Zs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=Fr(null),u=Fr(null),[a,m]=Pr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};So(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:k,top:E}=f.getBoundingClientRect(),y=window.scrollY||document.documentElement.scrollTop;g.style.top=`${E+y+f.offsetHeight+5}px`,g.style.left=`${Math.min(k-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),So(()=>{let f=u.current;if(f!==null&&a){let g=k=>{let E=k.target;W1(E)&&(d&&c.current&&c.current.contains(E)||f.contains(E)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=V1($e(J1,{dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return Vs(wo.Fragment,{children:[Vs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[l&&$e(l,{}),i&&$e("span",{className:"toolbar-popup__dropdown-label",children:i}),$e("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&$e(wo.Fragment,{children:h})]})}var Br="toolbar-popup__dropdown",Y1=t=>{let e=K1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:s}=t,{i18n:i}=Z1(),{fieldProps:d}=W(),{featureClientSchemaMap:c,schemaPath:u}=d;if(s.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==s?(m=s?.Component&&at(s.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:s},s.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==i||e[11]!==s||e[12]!==u){let m=s.key,p;s.label&&(m=typeof s.label=="function"?s.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):s.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=at(zs,{active:o,editor:n,enabled:l,Icon:s?.ChildComponent?at(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:at("span",{className:"text",children:p})},s.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=i,e[11]=s,e[12]=u,e[13]=a}else a=e[13];return a},q1=X1.memo(Y1),Ut=({anchorElem:t,classNames:e,editor:o,group:r,groupState:n,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=r,u=z1(()=>d?.length?d.map(a=>at(q1,{active:n.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:n.enabledItemKeys.includes(a.key),item:a},a.key)):null,[d,n.activeItemKeys,n.enabledItemKeys,t,o]);return at(Zs,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Br,`${Br}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!n.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Br}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as Q1}from"@lexical/utils";import{$getSelection as eh}from"lexical";import{useCallback as th,useDeferredValue as oh,useEffect as rh,useRef as Ys,useState as nh}from"react";function lh(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let r of t){let n=[];for(let l of r.items)e.set(l.key,{active:!1,enabled:!0}),n.push(l.key);o.set(r.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:n})}return{groupStates:o,itemStates:e}}function Eo(t,e){let[o,r]=nh(()=>lh(e)),n=oh(o),l=W(),s=Ys(l);s.current=l;let i=Ys(e);i.current=e;let d=xn(),c=th(()=>{t.getEditorState().read(()=>{let u=eh();if(!u)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,h=new Map;for(let f of a){let g=[],k=[],E=[],y=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let C of f.items){let x=C.isActive?(!y||g.length<y)&&C.isActive({editor:t,editorConfigContext:m,selection:u}):!1,b=C.isEnabled?C.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;x&&(g.push(C.key),k.push(C)),b&&E.push(C.key),p.set(C.key,{active:x,enabled:b})}let T=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(f.key,{activeItemKeys:g,activeItems:k,enabledGroup:T,enabledItemKeys:E})}r({groupStates:h,itemStates:p})})},[t]);return rh(()=>{d(c);let u=()=>d(c),a=Q1(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),n}function mh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&de(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?de(Ht,{active:t,editor:o,enabled:r,item:n,children:de(n.ChildComponent,{})},n.key):null}function ph({anchorElem:t,editor:e,editorConfig:o,group:r,index:n,toolbarStates:l}){let{i18n:s}=dh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=W(),c=l.groupStates.get(r.key),u=jr(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:r.ChildComponent},[r,c?.activeItems]),a=jr(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:d}):p.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[r,c?.activeItems,s,i,d]);return sh("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,"data-toolbar-group-key":r.key,children:[r.type==="dropdown"&&r.items.length&&c?de(Ut,{anchorElem:t,editor:e,group:r,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,r.type==="buttons"&&r.items.length?r.items.map(m=>{let p=l.itemStates.get(m.key);return de(mh,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,n<o.features.toolbarFixed?.groups.length-1&&de("div",{className:"divider"})]},r.key)}function fh({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=No.useRef(null),s=qs(),{y:i}=ch(),d=Eo(o,r?.features?.toolbarFixed?.groups),c=jr(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let a=n.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return uh(()=>{if(!c)return;let u=l.current;if(!u)return;let a=u.getBoundingClientRect(),m=c.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),c.classList.remove("fixed-toolbar--hide"),c.classList.add("fixed-toolbar")}},50,[l,c,i]),de("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&de(No.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,a)=>de(ph,{anchorElem:t,editor:o,editorConfig:r,group:u,index:a,toolbarStates:d},u.key))})})}var Qs=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Qs(t.parentEditor)}return!1},ea=t=>{let e=ih(6),{clientProps:o}=t,[r]=ah(),n=W();if(!qs())return null;let{editorConfig:s}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=Qs(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=de(fh,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var hh=M({plugins:[{Component:ea,position:"aboveContainer"}]});import{c as gh}from"react/compiler-runtime";import{jsx as Ne,jsxs as ra}from"react/jsx-runtime";import{useLexicalComposerContext as xh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ch}from"@lexical/react/useLexicalEditable";import{mergeRegister as na}from"@lexical/utils";import{$getSelection as la,$isRangeSelection as ta,$isTextNode as bh,COMMAND_PRIORITY_LOW as kh,getDOMSelection as ia,SELECTION_CHANGE_COMMAND as _h}from"lexical";import{useCallback as yo,useEffect as Wt,useMemo as Th,useRef as oa,useState as wh}from"react";import"react";import{createPortal as Sh}from"react-dom";function Hr(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 Lo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),h=d.top-a.height-c,f=d.left-l;s==="center"&&(f=d.left+d.width/2-a.width/2);let g=0;return!e&&h<p.top&&!i&&(g=a.height+d.height+c*2,h+=g),s==="center"?f+a.width>p.right?f=p.right-a.width-l:f<p.left&&(f=p.left+l):f+a.width>p.right&&(f=p.right-a.width-l),f-=m.left,n.style.opacity="1",i&&r!==0?(h-=m.bottom-r+a.height-3,n.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,n.style.transform=`translate(${f}px, ${h}px)`),g}function Eh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&Ne(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?Ne(Ht,{active:t,editor:o,enabled:r,item:n,children:Ne(n.ChildComponent,{})},n.key):null}function Nh({anchorElem:t,editor:e,group:o,index:r,toolbarStates:n}){let{editorConfig:l}=W(),s=n.groupStates.get(o.key),i=Th(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return ra("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Ne(Ut,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=n.itemStates.get(d.key);return Ne(Eh,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,r<l.features.toolbarInline?.groups.length-1&&Ne("div",{className:"divider"})]},o.key)}function Lh({anchorElem:t,editor:e}){let o=oa(null),r=oa(null),{editorConfig:n}=W(),l=Eo(e,n?.features?.toolbarInline?.groups),s=yo(()=>{if(o?.current){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=yo(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=u.clientX,h=u.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),d=yo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Wt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=yo(()=>{let u=la(),a=ia(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(u!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Hr(a,h),g=Lo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Lo({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Wt(()=>{let u=t.parentElement,a=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",a),u&&u.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),u&&u.removeEventListener("scroll",a)}},[e,c,t]),Wt(()=>(e.getEditorState().read(()=>{c()}),na(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(_h,()=>(c(),!1),kh))),[e,c]),ra("div",{className:"inline-toolbar-popup",ref:o,children:[Ne("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,a)=>Ne(Nh,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function yh(t,e){let o=gh(12),[r,n]=wh(!1),l=Ch(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=la(),h=ia(t._window),f=t.getRootElement();if(h!==null&&(!ta(p)||f===null||!f.contains(h.anchorNode))){n(!1);return}if(!ta(p))return;if(p.getTextContent()!==""){let k=p.getNodes(),E=!1;for(let y of k)if(bh(y)){n(!0),E=!0;break}E||n(!1)}else n(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){n(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,d,c;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Wt(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>na(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Wt(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=Sh(Ne(Lh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var sa=t=>{let{anchorElem:e}=t,[o]=xh();return yh(o,e)};var Rh=M({plugins:[{Component:sa,position:"floatingAnchorElem"}]});import{TableCellNode as Cx,TableNode as bx,TableRowNode as kx}from"@lexical/table";import{jsx as aa}from"react/jsx-runtime";import"react";var Ur=()=>aa("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:aa("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as Ih,$createTableNode as vh,$createTableRowNode as Mh,$isTableCellNode as ca,$isTableNode as Wr,$isTableRowNode as Gr,TableCellHeaderStates as Ro,TableCellNode as Dh,TableNode as $h,TableRowNode as Oh}from"@lexical/table";import{$isParagraphNode as Ah,$isTextNode as Fh}from"lexical";var da=/^\|(.+)\|\s?$/,Ph=/^(\| ?:?-*:? ?)+\|\s?$/,ma=({allTransformers:t})=>({type:"element",dependencies:[$h,Oh,Dh],export:e=>{if(!Wr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Gr(r))continue;let l=!1;for(let s of r.getChildren())ca(s)&&(n.push(Yt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===Ro.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(s=>"---").join(" | ")} |`)}return o.join(`
59
+ `)},regExp:da,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(Ph.test(n)){let a=e.getPreviousSibling();if(!a||!Wr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Gr(p))return;p.getChildren().forEach(h=>{ca(h)&&h.setHeaderStyles(Ro.ROW,Ro.ROW)}),e.remove();return}let l=ua(n,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!Ah(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!Fh(a))break;let m=ua(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),s.unshift(m);let p=i.getPreviousSibling();i.remove(),i=p}let c=vh();for(let a of s){let m=Mh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:pa("",t))}let u=e.getPreviousSibling();Wr(u)&&Bh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function Bh(t){let e=t.getFirstChild();return Gr(e)?e.getChildrenSize():0}var pa=(t,e)=>{t=t.replace(/\\n/g,`
60
+ `);let o=Ih(Ro.NO_STATUS);return Zt(t,e,o),o},ua=(t,e)=>{let o=t.match(da);return!o||!o[1]?null:o[1].split("|").map(r=>pa(r,e))};import{c as Hh}from"react/compiler-runtime";import{jsx as B,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as Ca}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Uh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ha,$deleteTableColumnAtSelection as Wh,$deleteTableRowAtSelection as Gh,$getNodeTriplet as Vh,$getTableCellNodeFromLexicalNode as ga,$getTableColumnIndexFromTableCellNode as Jh,$getTableNodeFromLexicalNodeOrThrow as Ae,$getTableRowIndexFromTableCellNode as Kh,$insertTableColumnAtSelection as Xh,$insertTableRowAtSelection as zh,$isTableCellNode as ba,$isTableSelection as Gt,$mergeCells as Zh,$unmergeCell as Yh,getTableElement as Jr,getTableObserverFromTableElement as Kr,TableCellHeaderStates as Oe,TableCellNode as qh}from"@lexical/table";import{mergeRegister as Qh}from"@lexical/utils";import{useScrollInfo as eg}from"@payloadcms/ui";import{$getSelection as vo,$isElementNode as tg,$isRangeSelection as Xr,$isTextNode as og,$setSelection as rg,COMMAND_PRIORITY_CRITICAL as ng,getDOMSelection as lg,isDOMNode as ig,SELECTION_CHANGE_COMMAND as sg}from"lexical";import*as zr from"react";import{useCallback as ae,useEffect as ct,useRef as Io,useState as ut}from"react";import{createPortal as ka}from"react-dom";import{jsx as Vr,jsxs as jh}from"react/jsx-runtime";import"react";var fa=()=>jh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Vr("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"}),Vr("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"}),Vr("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 xa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function ag(){let t=vo();if(Xr(t)&&!t.isCollapsed()||Gt(t)&&!t.anchor.is(t.focus)||!Xr(t)&&!Gt(t))return!1;let[e]=Vh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function cg(t){let e=t.getLastDescendant();og(e)?e.select():tg(e)?e.selectEnd():e!==null&&e.selectNext()}function ug({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Ca(),s=Io(null),[i,d]=ut(n),[c,u]=ut({columns:1,rows:1}),[a,m]=ut(!1),[p,h]=ut(!1),{y:f}=eg();ct(()=>l.registerMutationListener(qh,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),ct(()=>{l.getEditorState().read(()=>{let w=vo();if(Gt(w)){let N=xa(w);u(xa(w)),m(N.columns>1||N.rows>1)}h(ag())})},[l]),ct(()=>{let w=e.current,N=s.current,I=l.getRootElement();if(w!=null&&N!=null&&I!=null){let $=I.getBoundingClientRect(),R=w.getBoundingClientRect();N.style.opacity="1";let O=N.getBoundingClientRect(),F=5,j=R.right+F;if(j+O.width>window.innerWidth||j+O.width>$.right){let P=R.left-O.width-F;j=(P<0?F:P)+window.pageXOffset}N.style.left=`${j+window.pageXOffset}px`;let X=R.top;if(X+O.height>window.innerHeight){let P=R.bottom-O.height;X=P<0?F:P}N.style.top=`${X}px`}},[e,s,l,f]),ct(()=>{function w(N){s.current!=null&&e.current!=null&&ig(N.target)&&!s.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let g=ae(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i),N=Jr(w,l.getElementByKey(w.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let I=Kr(N);I!==null&&I.$clearHighlight(),w.markDirty(),d(i.getLatest())}rg(null)})},[l,i]),k=()=>{l.update(()=>{let w=vo();if(!Gt(w))return;let I=w.getNodes().filter(ba),$=Zh(I);$&&(cg($),o())})},E=()=>{l.update(()=>{Yh()})},y=ae(w=>{l.update(()=>{for(let N=0;N<c.rows;N++)zh(w);o()})},[l,o,c.rows]),T=ae(w=>{l.update(()=>{for(let N=0;N<c.columns;N++)Xh(w);o()})},[l,o,c.columns]),C=ae(()=>{l.update(()=>{Gh(),o()})},[l,o]),x=ae(()=>{l.update(()=>{Ae(i).remove(),g(),o()})},[l,i,g,o]),b=ae(()=>{l.update(()=>{Wh(),o()})},[l,o]),_=ae(()=>{l.update(()=>{let w=Ae(i),N=Kh(i),[I]=ha(w,null,null),$=new Set,R=i.getHeaderStyles()^Oe.ROW;if(I[N])for(let O=0;O<I[N].length;O++){let F=I[N][O];F?.cell&&($.has(F.cell)||($.add(F.cell),F.cell.setHeaderStyles(R,Oe.ROW)))}g(),o()})},[l,i,g,o]),D=ae(()=>{l.update(()=>{let w=Ae(i),N=Jh(i),[I]=ha(w,null,null),$=new Set,R=i.getHeaderStyles()^Oe.COLUMN;if(I)for(let O=0;O<I.length;O++){let F=I?.[O]?.[N];F?.cell&&($.has(F.cell)||($.add(F.cell),F.cell.setHeaderStyles(R,Oe.COLUMN)))}g(),o()})},[l,i,g,o]),v=ae(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),L=ae(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),S=null;return t&&(a?S=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):p&&(S=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),ka(Le("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[S?Le(zr.Fragment,{children:[S,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>v(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>L(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>y(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>y(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>T(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>T(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>b(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>_(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&Oe.ROW)===Oe.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&Oe.COLUMN)===Oe.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function dg({anchorElem:t,cellMerge:e}){let[o]=Ca(),r=Io(null),n=Io(null),[l,s]=ut(!1),[i,d]=ut(null),c=ae(()=>{let a=r.current,m=vo(),p=lg(o._window),h=document.activeElement;function f(){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 f();let g=o.getRootElement(),k=null,E=null;if(Xr(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let T=ga(m.anchor.getNode());if(T==null||(E=o.getElementByKey(T.getKey()),E==null||!T.isAttached()))return f();let C=Ae(T),x=Jr(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Kr(x),d(T)}else if(Gt(m)){let T=ga(m.anchor.getNode());if(!ba(T))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=Ae(T),x=Jr(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Kr(x),E=o.getElementByKey(T.getKey())}else if(!h)return f();if(k===null||E===null)return f();let y=!k||!k.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",y),a.classList.toggle("table-cell-action-button-container--inactive",!y),y){let T=E.getBoundingClientRect(),C=t.getBoundingClientRect(),x=T.top-C.top,b=T.right-C.left;a.style.transform=`translate(${b}px, ${x}px)`}},[o,t]);ct(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Qh(o.registerUpdateListener(p),o.registerCommand(sg,p,ng),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=Io(i);return ct(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),B("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&Le(zr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:B(fa,{})}),l&&B(ug,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var _a=t=>{let e=Hh(3),{anchorElem:o}=t,r=Uh(),n;return e[0]!==o||e[1]!==r?(n=ka(r?B(dg,{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 mg}from"react/compiler-runtime";import{jsx as Do,jsxs as pg}from"react/jsx-runtime";import{useLexicalComposerContext as fg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as hg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as gg,$getTableNodeFromLexicalNodeOrThrow as Zr,$getTableRowIndexFromTableCellNode as xg,$isTableCellNode as Ta,$isTableRowNode as Cg,getDOMCellFromTarget as bg,getTableElement as kg,TableNode as wa}from"@lexical/table";import{calculateZoomLevel as Sa,mergeRegister as _g}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Yr,isHTMLElement as Tg,SKIP_SCROLL_INTO_VIEW_TAG as Ea}from"lexical";import*as La from"react";import{useCallback as Vt,useEffect as qr,useRef as Mo,useState as dt}from"react";import{createPortal as wg}from"react-dom";var Sg=33,Na=92;function Eg({editor:t}){let e=Mo(null),o=Mo(null),r=Mo(null),[n,l]=dt(!1),s=W(),i=Mo(null),[d,c]=dt(null),[u,a]=dt(null),[m,p]=dt(!1),[h,f]=dt(null),g=Vt(()=>{a(null),e.current=null,f(null),i.current=null,r.current=null},[]),k=L=>(L.buttons&1)===1;qr(()=>{let L=new Set;return _g(t.registerMutationListener(wa,S=>{for(let[w,N]of S)N==="destroyed"?L.delete(w):L.add(w);l(L.size>0)}),t.registerNodeTransform(wa,S=>{if(S.getColWidths())return S;let w=S.getColumnCount(),N=Na;return S.setColWidths(Array(w).fill(N)),S}))},[t]),qr(()=>{if(!n)return;let L=I=>{let $=I.target;if(Tg($)){if(h){c({x:I.clientX,y:I.clientY});return}if(p(k(I)),!(o.current&&o.current.contains($))&&e.current!==$){e.current=$;let R=bg($);R&&u!==R?t.getEditorState().read(()=>{let O=Yr(R.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let F=Zr(O),j=kg(F,t.getElementByKey(F.getKey()));if(!j)throw new Error("TableCellResizer: Table element not found.");e.current=$,r.current=j.getBoundingClientRect(),a(R)},{editor:t}):R==null&&g()}}},S=I=>{p(!0)},w=I=>{p(!1)},N=t.registerRootListener((I,$)=>{$?.removeEventListener("mousemove",L),$?.removeEventListener("mousedown",S),$?.removeEventListener("mouseup",w),I?.addEventListener("mousemove",L),I?.addEventListener("mousedown",S),I?.addEventListener("mouseup",w)});return()=>{N()}},[u,h,t,n,g]);let E=L=>L==="bottom",y=Vt(L=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Yr(u.elem);if(!Ta(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Zr(S),N=xg(S),I=w.getChildren(),R=S.getColSpan()===w.getColumnCount()?N:N+S.getRowSpan()-1;if(R>=I.length||R<0)throw new Error("Expected table cell to be inside of table row.");let O=I[R];if(!Cg(O))throw new Error("Expected table row");let F=O.getHeight();if(F===void 0){let X=O.getChildren();F=Math.min(...X.map(P=>T(P,t)??1/0))}let j=Math.max(F+L,Sg);O.setHeight(j)},{tag:Ea})},[u,t]),T=(L,S)=>S.getElementByKey(L.getKey())?.clientHeight,C=(L,S)=>{let w;return S.forEach(N=>{N.forEach((I,$)=>{I.cell===L&&(w=$)})}),w},x=Vt(L=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Yr(u.elem);if(!Ta(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Zr(S),[N]=gg(w,null,null),I=C(S,N);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let $=w.getColWidths();if(!$)return;let R=$[I];if(R===void 0)return;let O=[...$],F=Math.max(R+L,Na);O[I]=F,w.setColWidths(O)},{tag:Ea})},[u,t]),b=Vt(L=>{let S=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:N,y:I}=i.current;if(u===null)return;let $=Sa(w.target);if(E(L)){let R=(w.clientY-I)/$;y(R)}else{let R=(w.clientX-N)/$;x(R)}g(),document.removeEventListener("mouseup",S)}};return S},[u,g,x,y]),_=Vt(L=>S=>{if(S.preventDefault(),S.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},c(i.current),f(L),document.addEventListener("mouseup",b(L))},[u,b]),[D,v]=dt({bottom:null,left:null,right:null,top:null});return qr(()=>{if(u){let{height:L,left:S,top:w,width:N}=u.elem.getBoundingClientRect(),I=Sa(u.elem),$=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${$}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+w+L-$/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${L}px`,left:`${window.scrollX+S+N-$/2}px`,top:`${window.scrollY+w}px`,width:`${$}px`}},O=r.current;h&&d&&O&&(E(h)?(R[h].left=`${window.scrollX+O.left}px`,R[h].top=`${window.scrollY+d.y/I}px`,R[h].height="3px",R[h].width=`${O.width}px`):(R[h].top=`${window.scrollY+O.top}px`,R[h].left=`${window.scrollX+d.x/I}px`,R[h].width="3px",R[h].height=`${O.height}px`),R[h].backgroundColor="#adf"),v(R)}else v({bottom:null,left:null,right:null,top:null})},[u,h,d]),Do("div",{ref:o,children:u!=null&&!m&&pg(La.Fragment,{children:[Do("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:D.right||void 0}),Do("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:D.bottom||void 0})]})})}var ya=()=>{let t=mg(3),[e]=fg(),o=hg(),r;return t[0]!==e||t[1]!==o?(r=o?wg(Do(Eg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Dg}from"react/compiler-runtime";import{jsx as Qr,jsxs as $g,Fragment as Og}from"react/jsx-runtime";import{useLexicalComposerContext as Ag}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Aa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Fg,$getTableColumnIndexFromTableCellNode as Pg,$getTableRowIndexFromTableCellNode as Bg,$insertTableColumnAtSelection as jg,$insertTableRowAtSelection as Hg,$isTableCellNode as Ug,$isTableNode as va,getTableElement as Wg,TableNode as Gg}from"@lexical/table";import{$findMatchingParent as Vg,mergeRegister as Jg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ma,isHTMLElement as Kg}from"lexical";import{useEffect as Da,useMemo as Xg,useRef as $a,useState as $o}from"react";import"react";import{createPortal as zg}from"react-dom";import{c as Ig}from"react/compiler-runtime";import{useEffect as vg,useRef as Mg}from"react";var Ng="Expected a function",Lg=Math.max,yg=Math.min;function Rg(t,e,o){let r,n,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(Ng);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?Lg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(x){let b=r,_=s;return r=s=void 0,l=x,u=t.apply(_,b),u}function h(x){return l=x,a=setTimeout(k,e),i?p(x):u}function f(x){let b=x-n,_=x-l,D=e-b;return d?yg(D,c-_):D}function g(x){let b=x-n,_=x-l;return n===void 0||b>=e||b<0||d&&_>=c}function k(){let x=Date.now();if(g(x))return E(x);a=setTimeout(k,f(x))}function E(x){return a=void 0,m&&r?p(x):(r=s=void 0,u)}function y(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function T(){return a===void 0?u:E(Date.now())}function C(){let x=Date.now(),b=g(x);if(r=arguments,s=this,n=x,b){if(a===void 0)return h(n);if(d)return clearTimeout(a),a=setTimeout(k,e),p(n)}return a===void 0&&(a=setTimeout(k,e)),u}return C.cancel=y,C.flush=T,C}var Ra=Rg;function Ia(t,e,o){let r=Ig(6),n=Mg(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Ra(t,e,{maxWait:o}),()=>{n.current?.cancel()}),s=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=s):(l=r[3],s=r[4]),vg(l,s);let i;return r[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=i):i=r[5],i}var Oa=20;function Zg({anchorElem:t}){let[e]=Ag(),o=Aa(),r=W(),[n,l]=$o(!1),[s,i]=$o(!1),[d,c]=$o(!1),[u,a]=$o({}),m=$a(new Set),p=$a(null),h=Ia(k=>{let{isOutside:E,tableDOMNode:y}=Yg(k,r.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!y)return;p.current=y;let T=null,C=null,x=null;if(e.getEditorState().read(()=>{let R=Ma(y);if(Ug(R)){let O=Vg(R,F=>va(F));if(!va(O))return;if(x=Wg(O,e.getElementByKey(O.getKey())),x){let F=O.getChildrenSize(),j=O.getChildAtIndex(0)?.getChildrenSize(),X=Bg(R),P=Pg(R);X===F-1?T=R:P===j-1&&(C=R)}}},{editor:e}),!x)return;let b=x.parentElement;if(!b)return;let{bottom:_,height:D,left:v,right:L,width:S,y:w}=x.getBoundingClientRect(),N=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(N=b.scrollWidth>b.clientWidth);let{left:I,y:$}=t.getBoundingClientRect();T?(i(!1),l(!0),a({height:Oa,left:N&&b?b.offsetLeft:v-I,top:_-$+5,width:N&&b?b.offsetWidth:S})):C&&(i(!0),l(!1),a({height:D,left:L-I+5,top:w-$,width:Oa}))},50,250),f=Xg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Da(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Da(()=>Jg(e.registerMutationListener(Gg,k=>{e.getEditorState().read(()=>{let E=!1;for(let[y,T]of k)switch(T){case"created":{m.current.add(y),E=!0;break}case"destroyed":{m.current.delete(y),E=!0;break}default:break}if(E){f.disconnect();for(let y of m.current){let{tableElement:T}=Fg(y);f.observe(T)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=k=>{e.update(()=>{p.current&&(Ma(p.current)?.selectEnd(),k?(Hg(),l(!1)):(jg(),i(!1)))})};return o?$g(Og,{children:[n&&Qr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Qr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function Yg(t,e){let o=t.target;if(Kg(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 Fa(t){let e=Dg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Aa())return null;let l;return e[0]!==r?(l=zg(Qr(Zg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as qg}from"react/compiler-runtime";import{jsx as en,jsxs as Qg}from"react/jsx-runtime";import{useLexicalComposerContext as ex}from"@lexical/react/LexicalComposerContext";import{TablePlugin as tx}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ox,TableCellNode as rx,TableNode as nx,TableRowNode as lx}from"@lexical/table";import{mergeRegister as ix}from"@lexical/utils";import{formatDrawerSlug as sx,useEditDepth as ax}from"@payloadcms/ui";import{$getSelection as cx,$isRangeSelection as ux,COMMAND_PRIORITY_EDITOR as dx,createCommand as mx}from"lexical";import{createContext as px,use as fx,useEffect as hx,useMemo as gx,useState as xx}from"react";import*as Pa from"react";var Oo=mx("OPEN_EMBED_DRAWER_COMMAND"),Ba=px({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ja({children:t}){let[e,o]=xx({cellEditorConfig:null,cellEditorPlugins:null});return en(Ba,{value:gx(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ha=()=>{let t=qg(16),[e]=ex(),o=fx(Ba),r=ax(),{fieldProps:n,uuid:l}=W(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=sx({slug:i,depth:r}),t[0]=r,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=ge(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([nx,lx,rx]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return ix(e.registerCommand(Oo,()=>{let f=null;return e.getEditorState().read(()=>{let g=cx();ux(g)&&(f=g)}),f&&u(),!0},dx))},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],hx(a,m);let p;t[10]!==e?(p=(f,g)=>{!g.columns||!g.rows||e.dispatchCommand(ox,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let h;return t[12]!==c||t[13]!==s||t[14]!==p?(h=Qg(Pa.Fragment,{children:[en(kt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),en(tx,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=h):h=t[15],h};var _x=M({markdownTransformers:[ma],nodes:[bx,Cx,kx],plugins:[{Component:Ha,position:"normal"},{Component:ya,position:"normal"},{Component:_a,position:"floatingAnchorElem"},{Component:Fa,position:"floatingAnchorElem"}],providers:[ja],slashMenu:{groups:[z([{Icon:Ur,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Oo,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Ur,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Oo,{})}}])]}});import{$isNodeSelection as rC}from"lexical";import{jsx as tn,jsxs as Tx}from"react/jsx-runtime";import"react";var on=()=>Tx("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[tn("path",{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"}),tn("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"}),tn("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 Ja}from"react/jsx-runtime";import Ka from"bson-objectid";import{$applyNodeReplacement as yx}from"lexical";import*as Xa from"react";import wx from"bson-objectid";function Ao(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 wx.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as Sx}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Ex}from"@lexical/utils";import Wa from"bson-objectid";import{$applyNodeReplacement as Nx}from"lexical";var Jt=class extends Sx{__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=>Ao(o,Ua),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Wa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ua({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Ex(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 Ua({data:t}){return t?.id||(t.id=new Wa.default().toHexString()),Nx(new Jt({data:t}))}import{jsx as Ga}from"react/jsx-runtime";import{ShimmerEffect as Lx}from"@payloadcms/ui";var Va=()=>Ga("div",{className:"lexical-upload",children:Ga(Lx,{height:"95px",width:"203px"})});var Rx=Xa.lazy(()=>import("./component-BAAVC34S.js").then(t=>({default:t.UploadComponent}))),me=class extends Jt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Ao(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 Ka.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?Ja(Va,{}):Ja(Rx,{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 Ka.default().toHexString()),yx(new me({data:t}))}function mt(t){return t instanceof me}import{c as Fx}from"react/compiler-runtime";import{jsx as Px}from"react/jsx-runtime";import{useLexicalComposerContext as Bx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as lc,$insertNodeToNearestRoot as ln,mergeRegister as jx}from"@lexical/utils";import{useBulkUpload as Hx,useEffectEvent as Ux,useModal as Wx}from"@payloadcms/ui";import sn from"bson-objectid";import{$createRangeSelection as Gx,$getPreviousSelection as ec,$getSelection as tc,$isParagraphNode as an,$isRangeSelection as oc,$setSelection as Vx,COMMAND_PRIORITY_EDITOR as Jx,COMMAND_PRIORITY_LOW as rc,createCommand as Kx,DROP_COMMAND as Xx,getDOMSelectionFromTarget as zx,isHTMLElement as nc,PASTE_COMMAND as Zx}from"lexical";import{useEffect as Yx}from"react";import{c as za}from"react/compiler-runtime";import{jsx as rn}from"react/jsx-runtime";import{useLexicalComposerContext as Za}from"@lexical/react/LexicalComposerContext.js";import{toast as Ix}from"@payloadcms/ui";import{$getNodeByKey as vx,COMMAND_PRIORITY_EDITOR as Ya}from"lexical";import{useEffect as qa,useState as Mx}from"react";var Dx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=vx(o);n&&n.replace(pe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(nn,{fields:null,relationTo:e,value:r})},$x=t=>{let e=za(13),{enabledCollectionSlugs:o}=t,[r]=Za(),[n,l]=Mx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=jt(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Ze,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Ya),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),qa(u,a);let m;e[6]!==i||e[7]!==r||e[8]!==n?(m=f=>{let{collectionSlug:g,doc:k}=f;i(),Dx({editor:r,relationTo:g,replaceNodeKey:n,value:k.id})},e[6]=i,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,h;return e[10]!==d||e[11]!==p?(h=rn(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},Ox=()=>{let t=za(3),[e]=Za(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ze,Ax,Ya),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),qa(o,r),null},Qa=({enabledCollectionSlugs:t})=>t?.length?rn($x,{enabledCollectionSlugs:t}):rn(Ox,{});function Ax(){return Ix.error("No upload collections enabled"),!0}function qx(t){let e=t.target;return!!(nc(e)&&!e.closest("code, span.editor-image")&&nc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Qx(t){let e,o=zx(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 nn=Kx("INSERT_UPLOAD_COMMAND"),ic=t=>{let e=Fx(21),{clientProps:o}=t,[r]=Bx(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=To(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=Hx(),{isModalOpen:h,openModal:f}=Wx(),g;e[3]!==d||e[4]!==r||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(g=C=>{let{files:x}=C;if(x?.length!==0&&(u(b=>[...b??[],...x.map(eC)]),!h(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{r.update(tC)}),m(b=>{let _=new Map(b.map(oC));r.update(()=>{for(let D of lc()){let v=D.node;if(mt(v)){let L=v.getData();if(L?.pending){let S=_.get(L.pending?.formID);S&&v.replace(pe({data:{id:new sn.default().toHexString(),fields:{},relationTo:S.collectionSlug,value:S.doc.id}}))}}}})}),f(d)}},e[3]=d,e[4]=r,e[5]=i,e[6]=h,e[7]=f,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=g):g=e[13];let k=Ux(g),E;e[14]!==r||e[15]!==k?(E=()=>{if(!r.hasNodes([me]))throw new Error("UploadPlugin: UploadNode not registered on editor");return jx(r.registerNodeTransform(me,C=>{let x=C.getData();if(!x?.pending)return;(async function(){let D=null,v=x?.pending?.src,L=x?.pending?.formID;if(v?.startsWith("data:")){let S=v.match(/data:(image\/[a-zA-Z]+);base64,/),w=S?S[1]:"image/png",N=v.replace(/^data:image\/[a-zA-Z]+;base64,/,""),I=atob(N),$=new Array(I.length);for(let F=0;F<I.length;F++)$[F]=I.charCodeAt(F);let R=new Uint8Array($);D={alt:void 0,file:new File([R],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:L}}else if(v?.startsWith("http")||v?.startsWith("https")){let w=await(await fetch(v)).blob(),N=v.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];D={alt:void 0,file:new File([w],N,{type:w.type}),formID:L}}D&&k({files:[D]})})()}),r.registerCommand(nn,C=>(r.update(()=>{let x=tc()||ec();if(oc(x)){let b=pe({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:_}=x,D=_.getNode();ln(b),an(D)&&!D.__first&&D.remove()}}),!0),Jx),r.registerCommand(Zx,C=>{if(!(C instanceof ClipboardEvent))return!1;let x=C.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(_=>{b.push({alt:"",file:_,formID:new sn.default().toHexString()})}),b.length?(r.update(()=>{let _=tc()||ec();if(oc(_))for(let D of b){let v=pe({data:{pending:{formID:D.formID,src:URL.createObjectURL(D.file)}}}),{focus:L}=_,S=L.getNode();ln(v),an(S)&&!S.__first&&S.remove()}}),k({files:b}),!0):!1},rc),r.registerCommand(Xx,C=>{if(!(C instanceof DragEvent))return!1;let x=C.dataTransfer;if(!x?.types?.length)return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(_=>{b.push({alt:"",file:_,formID:new sn.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),r.update(()=>{if(qx(C)){let _=Qx(C),D=Gx();_!=null&&D.applyDOMRange(_),Vx(D);for(let v of b){let L=pe({data:{pending:{formID:v.formID,src:URL.createObjectURL(v.file)}}}),{focus:S}=D,w=S.getNode();ln(L),an(w)&&!w.__first&&w.remove()}}}),k({files:b}),!0):!1},rc))},e[14]=r,e[15]=k,e[16]=E):E=e[16];let y;e[17]!==r?(y=[r],e[17]=r,e[18]=y):y=e[18],Yx(E,y);let T;return e[19]!==i?(T=Px(Qa,{enabledCollectionSlugs:i}),e[19]=i,e[20]=T):T=e[20],T};function eC(t){return{file:t.file,formID:t.formID}}function tC(){for(let t of lc()){let e=t.node;mt(e)&&e.getData()?.pending&&e.remove()}}function oC(t){return[t.formID,t]}var nC=M({nodes:[me],plugins:[{Component:ic,position:"normal"}],slashMenu:{groups:[z([{Icon:on,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:on,isActive:({selection:t})=>{if(!rC(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return mt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ze,{replace:!1})}}])]}});import{c as iC}from"react/compiler-runtime";import{jsx as Fo}from"react/jsx-runtime";import{createElement as sC}from"react";import{ShimmerEffect as aC,useConfig as cC}from"@payloadcms/ui";import{lazy as uC,Suspense as dC,useEffect as mC,useState as pC}from"react";var sc={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 cn={namespace:"lexical",theme:sc};function ac({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let s=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:r,resolvedFeatures:i,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as lC}from"payload/shared";var cc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?lC(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 un(t,e,o,r){return{admin:o,features:cc(t),lexical:e,resolvedFeatureMap:t,view:r}}var fC=uC(()=>import("./Field-J6MIUIWP.js").then(t=>({default:t.RichText}))),hC=t=>Fo(Go,{inheritable:!0,views:t.views,children:Fo(gC,{...t})}),gC=t=>{let e=iC(23),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==n?(m=n===void 0?{}:n,e[2]=n,e[3]=m):m=e[3];let p=m,h=i===void 0?cn:i,{currentView:f}=Vo(),g=c?.[f]?.admin??a,k=c?.[f]?.lexical,E;e[4]!==h||e[5]!==k?(E=typeof k=="function"?k(h):k??h,e[4]=h,e[5]=k,e[6]=E):E=e[6];let y=E,{config:T}=cC(),[C,x]=pC(null),b,_;e[7]!==r||e[8]!==T||e[9]!==f||e[10]!==g||e[11]!==y||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==C||e[16]!==d||e[17]!==c?(b=()=>{if(C&&C.view===f)return;let v=c?.[f],L=v?.filterFeatures?v.filterFeatures(r):r,S=[];for(let N of Object.values(L))N.clientFeatureProvider&&S.push(N.clientFeatureProvider(N.clientFeatureProps));let w=ac({config:T,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:S,lexical:y}});x(un(w,y,g,f))},_=[g,r,T,p,l,s,C,y,d,f,c],e[7]=r,e[8]=T,e[9]=f,e[10]=g,e[11]=y,e[12]=p,e[13]=l,e[14]=s,e[15]=C,e[16]=d,e[17]=c,e[18]=b,e[19]=_):(b=e[18],_=e[19]),mC(b,_);let D;return e[20]!==C||e[21]!==t?(D=Fo(dC,{fallback:Fo(aC,{height:"35vh"}),children:C&&sC(fC,{...t,editorConfig:C,key:C.view})}),e[20]=C,e[21]=t,e[22]=D):D=e[22],D};function xC(t){return t instanceof HTMLElement}function CC(...t){return t.filter(Boolean).join(" ")}var Po=new WeakMap;function uc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Bo(t,e){let o=Po.get(t);if(o===void 0){let r=new Set,n=s=>{o!==void 0&&(o.start=uc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=uc(s);for(let c of r)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Po.set(t,o)}return o.listeners.add(e),()=>{bC(t,e)}}function bC(t,e){let o=Po.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Po.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function kC(t,e){return Bo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function _C(t,e){return Bo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function TC(t,e){return Bo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function wC(t,e){return Bo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as SC}from"react/compiler-runtime";import{jsx as EC}from"react/jsx-runtime";import"react";var NC=()=>{let t=SC(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?EC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as LC}from"react/compiler-runtime";import{jsx as yC}from"react/jsx-runtime";import"react";var RC=()=>{let t=LC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?yC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as IC}from"react/compiler-runtime";import{jsx as vC}from"react/jsx-runtime";import"react";var MC=()=>{let t=IC(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?vC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as DC}from"react/compiler-runtime";import{jsx as $C}from"react/jsx-runtime";import"react";var OC=t=>{let e=DC(3),{children:o}=t,{InlineBlockContainer:r}=xe(),n;return e[0]!==r||e[1]!==o?(n=r?$C(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as AC}from"react/jsx-runtime";import"react";var FC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=le();return r?AC(r,{...o,children:e}):null};import{c as PC}from"react/compiler-runtime";import{jsx as BC}from"react/jsx-runtime";import"react";var jC=()=>{let t=PC(2),{EditButton:e}=le(),o;return t[0]!==e?(o=e?BC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as HC}from"react/compiler-runtime";import{jsx as UC}from"react/jsx-runtime";import"react";var WC=()=>{let t=HC(2),{RemoveButton:e}=le(),o;return t[0]!==e?(o=e?UC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as GC}from"qs-esm";var VC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=GC({depth:e??0,draft:o??!1,locale:r,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var dc={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 VC}from"react/jsx-runtime";import{CodeField as JC,useFormFields as KC}from"@payloadcms/ui";import{useId as XC,useMemo as zC}from"react";var Po={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 ZC=({autoComplete:t,field:e,forceRender:o,languages:r=Po,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=KC(([k])=>k.language),m=a?.value||a?.initialValue||"typescript",p=XC(),h=r[m],f=zC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),g=`${e.name}-${m}-${h}`;return f&&VC(JC,{autoComplete:t,field:f,forceRender:o,onMount:(k,N)=>{N.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),N.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),N.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:N.languages.typescript.JsxEmit.React,moduleResolution:N.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:N.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),N.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 T=>{let x=await(await fetch(T.url)).text();N.languages.typescript.typescriptDefaults.addExtraLib(x,T.filePath)})))()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},g)};import{jsx as oe,jsxs as bc}from"react/jsx-runtime";import{useLexicalEditable as rb}from"@lexical/react/useLexicalEditable";import{ChevronIcon as nb,Combobox as lb,CopyToClipboard as ib,PopupList as sb,RenderFields as ab,useForm as cb,useFormFields as kc,useTranslation as ub}from"@payloadcms/ui";import db from"react";import{jsx as mc}from"react/jsx-runtime";import"react";var pc=()=>mc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:mc("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 hc}from"react/jsx-runtime";import"react";import{useCollapsible as qC}from"@payloadcms/ui";import{jsx as fc}from"react/jsx-runtime";import"react";var Bo=()=>fc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:fc("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var YC="code-block-collapse-button",gc=()=>{let{toggle:t}=qC();return hc("button",{className:YC,onClick:t,type:"button",children:hc(Bo,{})})};import{jsx as xc,jsxs as QC}from"react/jsx-runtime";import"react";import{useCollapsible as tb,useTranslation as ob}from"@payloadcms/ui";var eb="code-block-floating-collapse-button",Cc=()=>{let{isCollapsed:t,toggle:e}=tb(),{t:o}=ob();return t?QC("button",{className:eb,onClick:e,type:"button",children:[xc("span",{children:o("general:collapse")}),xc(Bo,{})]}):null};var Ge="payload-richtext-code-block",mb=t=>{let{languages:e}=t,o=e||Po,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=ie(),{setModified:s}=cb(),{t:i}=ub(),{codeField:d}=kc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=kc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=rb(),p=db.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:oe(sb.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:oe("span",{className:`${Ge}__language-code`,"data-language":h,children:f})})})),[o,u]);return oe(r,{Actions:bc("div",{className:`${Ge}__actions`,children:[oe(lb,{button:bc("div",{className:`${Ge}__language-selector-button`,"data-selected-language":c?.value,children:[oe("span",{children:a}),oe(nb,{className:`${Ge}__chevron`})]}),buttonType:"custom",className:`${Ge}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),oe(ib,{value:d?.value??""}),oe(gc,{}),m&&oe(l,{})]}),className:Ge,collapsibleProps:{AfterCollapsible:oe(Cc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:oe("div",{className:`${Ge}__pill`,children:oe(pc,{})}),children:oe(ab,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as pb}from"react/compiler-runtime";import{jsx as mt}from"react/jsx-runtime";import{FieldContext as fb,FieldPathContext as _c,ServerFunctionsContext as Tc,ShimmerEffect as hb,useServerFunctions as gb}from"@payloadcms/ui";import xb,{useEffect as Cb,useRef as bb}from"react";var kb=t=>{let e=pb(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:s,setValue:i,value:d}=t,[c,u]=xb.useState(null),a=gb(),{_internal_renderField:m}=a,[p,h]=s.split(".",2),f=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==s?(g=()=>{(async function(){let{Field:D}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:s});u(D)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=s,e[5]=g):g=e[5];let k=g,N=bb(!1),R,T;if(e[6]!==k?(R=()=>{N.current||(N.current=!0,k())},T=[k],e[6]=k,e[7]=R,e[8]=T):(R=e[7],T=e[8]),Cb(R,T),!c)return typeof n<"u"?n:mt(hb,{});let C={...a,getFormState:async b=>a.getFormState({...b,collectionSlug:p==="collection"?h:void 0,globalSlug:p==="global"?h:void 0})};if(typeof d>"u"&&!i)return mt(Tc,{value:{...C},children:mt(_c,{value:f,children:c},f)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:f,setValue:i??_b,showError:!1,value:d};return mt(Tc,{value:{...C},children:mt(_c,{value:f,children:mt(fb,{value:x,children:c})},f)})};function _b(){}function wc({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 Tb=wc;export{yt as $createAutoLinkNode,Fe as $createBlockNode,Qe as $createHorizontalRuleNode,gt as $createInlineBlockNode,Te as $createLinkNode,We as $createRelationshipNode,fe as $createUploadNode,Se as $isAutoLinkNode,Ae as $isBlockNode,Lt as $isHorizontalRuleNode,xt as $isInlineBlockNode,J as $isLinkNode,vr as $isRelationshipNode,dt as $isUploadNode,Vc as AlignFeatureClient,we as AutoLinkNode,AC as BlockCollapsible,BC as BlockEditButton,ae as BlockNode,UC as BlockRemoveButton,qc as BlockquoteFeatureClient,ad as BlocksFeatureClient,vd as BoldFeatureClient,le as CAN_USE_DOM,Bf as ChecklistFeatureClient,mb as CodeBlockBlockComponent,ZC as CodeComponent,v0 as DETAIL_TYPE_TO_DETAIL,L0 as DOUBLE_LINE_BREAK,G0 as DebugJsxConverterFeatureClient,D0 as ELEMENT_FORMAT_TO_TYPE,M0 as ELEMENT_TYPE_TO_FORMAT,Ic as ENABLE_SLASH_MENU_COMMAND,Nc as EditorConfigProvider,Ct as FieldsDrawer,fh as FixedToolbarFeatureClient,Nm as HeadingFeatureClient,Gm as HorizontalRuleFeatureClient,_e as HorizontalRuleNode,Ye as INSERT_BLOCK_COMMAND,qe as INSERT_INLINE_BLOCK_COMMAND,E0 as IS_ALL_FORMATTING,ip as IndentFeatureClient,$C as InlineBlockContainer,EC as InlineBlockEditButton,vC as InlineBlockLabel,ht as InlineBlockNode,yC as InlineBlockRemoveButton,Ad as InlineCodeFeatureClient,yh as InlineToolbarFeatureClient,jd as ItalicFeatureClient,R0 as LTR_REGEX,a0 as LexicalPluginToLexicalFeatureClient,Sf as LinkFeatureClient,te as LinkNode,N0 as NON_BREAKING_SPACE,A as NodeFormat,Kf as OrderedListFeatureClient,x0 as ParagraphFeatureClient,yc as Point,y0 as RTL_REGEX,vc as Rect,$1 as RelationshipFeatureClient,Ne as RelationshipNode,kb as RenderLexical,fC as RichTextField,Uo as RichTextViewProvider,h0 as SlateToLexicalFeatureClient,Vd as StrikethroughFeatureClient,zd as SubscriptFeatureClient,Qd as SuperscriptFeatureClient,$0 as TEXT_MODE_TO_TYPE,I0 as TEXT_TYPE_TO_FORMAT,O0 as TEXT_TYPE_TO_MODE,de as TOGGLE_LINK_COMMAND,kx as TableFeatureClient,Td as TestRecorderFeatureClient,hm as TextStateFeatureClient,Bt as ToolbarButton,jt as ToolbarDropdown,Ld as TreeViewFeatureClient,nm as UnderlineFeatureClient,t0 as UnorderedListFeatureClient,rC as UploadFeatureClient,pe as UploadNode,TC as addSwipeDownListener,bC as addSwipeLeftListener,kC as addSwipeRightListener,_C as addSwipeUpListener,Tb as buildDefaultEditorState,wc as buildEditorState,dc as codeConverterClient,cr as createBlockNode,M as createClientFeature,V0 as defaultColors,ln as defaultEditorLexicalConfig,Pr as getDOMRangeRect,Mc as getEnabledNodes,GC as getRestPopulateFn,et as getSelectedNode,gC as isHTMLElement,Rc as isPoint,xC as joinClasses,sn as sanitizeClientEditorConfig,cc as sanitizeClientFeatures,Eo as setFloatingElemPosition,fo as setFloatingElemPositionForLinkEditor,X as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,dr as toolbarFeatureButtonsGroupWithItems,z as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,ie as useBlockComponentContext,U as useEditorConfigContext,Ce as useInlineBlockComponentContext,Lc as useLexicalDocumentDrawer,xe as useLexicalDrawer,Pt as useLexicalListDrawer,Wo as useRichTextView};
65
+ `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as JC}from"react/jsx-runtime";import{CodeField as KC,useFormFields as XC}from"@payloadcms/ui";import{useId as zC,useMemo as ZC}from"react";var jo={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 YC=({autoComplete:t,field:e,forceRender:o,languages:r=jo,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=XC(([k])=>k.language),m=a?.value||a?.initialValue||"typescript",p=zC(),h=r[m],f=ZC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),g=`${e.name}-${m}-${h}`;return f&&JC(KC,{autoComplete:t,field:f,forceRender:o,onMount:(k,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 T=>{let x=await(await fetch(T.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(x,T.filePath)})))()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},g)};import{jsx as oe,jsxs as bc}from"react/jsx-runtime";import{useLexicalEditable as nb}from"@lexical/react/useLexicalEditable";import{ChevronIcon as lb,Combobox as ib,CopyToClipboard as sb,PopupList as ab,RenderFields as cb,useForm as ub,useFormFields as kc,useTranslation as db}from"@payloadcms/ui";import mb from"react";import{jsx as mc}from"react/jsx-runtime";import"react";var pc=()=>mc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:mc("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 hc}from"react/jsx-runtime";import"react";import{useCollapsible as QC}from"@payloadcms/ui";import{jsx as fc}from"react/jsx-runtime";import"react";var Ho=()=>fc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:fc("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 qC="code-block-collapse-button",gc=()=>{let{toggle:t}=QC();return hc("button",{className:qC,onClick:t,type:"button",children:hc(Ho,{})})};import{jsx as xc,jsxs as eb}from"react/jsx-runtime";import"react";import{useCollapsible as ob,useTranslation as rb}from"@payloadcms/ui";var tb="code-block-floating-collapse-button",Cc=()=>{let{isCollapsed:t,toggle:e}=ob(),{t:o}=rb();return t?eb("button",{className:tb,onClick:e,type:"button",children:[xc("span",{children:o("general:collapse")}),xc(Ho,{})]}):null};var Je="payload-richtext-code-block",pb=t=>{let{languages:e}=t,o=e||jo,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=le(),{setModified:s}=ub(),{t:i}=db(),{codeField:d}=kc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=kc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=nb(),p=mb.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:oe(ab.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:oe("span",{className:`${Je}__language-code`,"data-language":h,children:f})})})),[o,u]);return oe(r,{Actions:bc("div",{className:`${Je}__actions`,children:[oe(ib,{button:bc("div",{className:`${Je}__language-selector-button`,"data-selected-language":c?.value,children:[oe("span",{children:a}),oe(lb,{className:`${Je}__chevron`})]}),buttonType:"custom",className:`${Je}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),oe(sb,{value:d?.value??""}),oe(gc,{}),m&&oe(l,{})]}),className:Je,collapsibleProps:{AfterCollapsible:oe(Cc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:oe("div",{className:`${Je}__pill`,children:oe(pc,{})}),children:oe(cb,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as fb}from"react/compiler-runtime";import{jsx as pt}from"react/jsx-runtime";import{FieldContext as hb,FieldPathContext as _c,ServerFunctionsContext as Tc,ShimmerEffect as gb,useServerFunctions as xb}from"@payloadcms/ui";import Cb,{useEffect as bb,useRef as kb}from"react";var _b=t=>{let e=fb(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:s,setValue:i,value:d}=t,[c,u]=Cb.useState(null),a=xb(),{_internal_renderField:m}=a,[p,h]=s.split(".",2),f=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==s?(g=()=>{(async function(){let{Field:D}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:s});u(D)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=s,e[5]=g):g=e[5];let k=g,E=kb(!1),y,T;if(e[6]!==k?(y=()=>{E.current||(E.current=!0,k())},T=[k],e[6]=k,e[7]=y,e[8]=T):(y=e[7],T=e[8]),bb(y,T),!c)return typeof n<"u"?n:pt(gb,{});let C={...a,getFormState:async b=>a.getFormState({...b,collectionSlug:p==="collection"?h:void 0,globalSlug:p==="global"?h:void 0})};if(typeof d>"u"&&!i)return pt(Tc,{value:{...C},children:pt(_c,{value:f,children:c},f)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:f,setValue:i??Tb,showError:!1,value:d};return pt(Tc,{value:{...C},children:pt(_c,{value:f,children:pt(hb,{value:x,children:c})},f)})};function Tb(){}function wc({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 wb=wc;export{It as $createAutoLinkNode,Be as $createBlockNode,et as $createHorizontalRuleNode,Ct as $createInlineBlockNode,_e as $createLinkNode,Ve as $createRelationshipNode,pe as $createUploadNode,we as $isAutoLinkNode,Pe as $isBlockNode,Rt as $isHorizontalRuleNode,bt as $isInlineBlockNode,K as $isLinkNode,$r as $isRelationshipNode,mt as $isUploadNode,Vc as AlignFeatureClient,Te as AutoLinkNode,FC as BlockCollapsible,jC as BlockEditButton,se as BlockNode,WC as BlockRemoveButton,qc as BlockquoteFeatureClient,ad as BlocksFeatureClient,vd as BoldFeatureClient,ne as CAN_USE_DOM,jf as ChecklistFeatureClient,pb as CodeBlockBlockComponent,YC as CodeComponent,M0 as DETAIL_TYPE_TO_DETAIL,y0 as DOUBLE_LINE_BREAK,V0 as DebugJsxConverterFeatureClient,$0 as ELEMENT_FORMAT_TO_TYPE,D0 as ELEMENT_TYPE_TO_FORMAT,Ic as ENABLE_SLASH_MENU_COMMAND,Nc as EditorConfigProvider,kt as FieldsDrawer,hh as FixedToolbarFeatureClient,Nm as HeadingFeatureClient,Gm as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,qe as INSERT_BLOCK_COMMAND,Qe as INSERT_INLINE_BLOCK_COMMAND,N0 as IS_ALL_FORMATTING,ip as IndentFeatureClient,OC as InlineBlockContainer,NC as InlineBlockEditButton,MC as InlineBlockLabel,xt as InlineBlockNode,RC as InlineBlockRemoveButton,Ad as InlineCodeFeatureClient,Rh as InlineToolbarFeatureClient,jd as ItalicFeatureClient,I0 as LTR_REGEX,c0 as LexicalPluginToLexicalFeatureClient,Ef as LinkFeatureClient,te as LinkNode,L0 as NON_BREAKING_SPACE,A as NodeFormat,Xf as OrderedListFeatureClient,C0 as ParagraphFeatureClient,yc as Point,R0 as RTL_REGEX,vc as Rect,O1 as RelationshipFeatureClient,Ee as RelationshipNode,_b as RenderLexical,hC as RichTextField,Go as RichTextViewProvider,g0 as SlateToLexicalFeatureClient,Vd as StrikethroughFeatureClient,zd as SubscriptFeatureClient,Qd as SuperscriptFeatureClient,O0 as TEXT_MODE_TO_TYPE,v0 as TEXT_TYPE_TO_FORMAT,A0 as TEXT_TYPE_TO_MODE,ue as TOGGLE_LINK_COMMAND,_x as TableFeatureClient,Td as TestRecorderFeatureClient,hm as TextStateFeatureClient,Ht as ToolbarButton,Ut as ToolbarDropdown,Ld as TreeViewFeatureClient,nm as UnderlineFeatureClient,o0 as UnorderedListFeatureClient,nC as UploadFeatureClient,me as UploadNode,wC as addSwipeDownListener,kC as addSwipeLeftListener,_C as addSwipeRightListener,TC as addSwipeUpListener,wb as buildDefaultEditorState,wc as buildEditorState,dc as codeConverterClient,dr as createBlockNode,M as createClientFeature,J0 as defaultColors,cn as defaultEditorLexicalConfig,Hr as getDOMRangeRect,Mc as getEnabledNodes,VC as getRestPopulateFn,tt as getSelectedNode,xC as isHTMLElement,Rc as isPoint,CC as joinClasses,un as sanitizeClientEditorConfig,cc as sanitizeClientFeatures,Lo as setFloatingElemPosition,go as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,pr as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,le as useBlockComponentContext,W as useEditorConfigContext,xe as useInlineBlockComponentContext,Lc as useLexicalDocumentDrawer,ge as useLexicalDrawer,jt as useLexicalListDrawer,Vo as useRichTextView};
66
66
  //# sourceMappingURL=index.js.map