@payloadcms/richtext-lexical 3.27.0-canary.f0ea918 → 3.27.0

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,6 +1,6 @@
1
- "use client";import{a as ce,c as ho,d as go,e as Co}from"./chunk-QBDC3MVG.js";import{a as Xe}from"./chunk-DBWINSQN.js";import{a as ze,b as It,c as Pe}from"./chunk-PUXDVIHC.js";import{a as ae}from"./chunk-INBEEENE.js";import{a as Ds}from"./chunk-F26IQ5RE.js";import{a as Ms,b as yr,d as vr,e as Mr,f as As,g as Os,h as $s,j as Fs,l as Ps,m as Bs}from"./chunk-OZ6Q4DWN.js";import{a as vs,b as P}from"./chunk-3LGFOM34.js";function z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Ee,$isRangeSelection as vt,FORMAT_ELEMENT_COMMAND as Mt}from"lexical";import{jsx as xo,jsxs as Hs}from"react/jsx-runtime";import"react";var Dr=()=>Hs("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:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as bo,jsxs as js}from"react/jsx-runtime";import"react";var Ar=()=>js("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),bo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as _o,jsxs as Us}from"react/jsx-runtime";import"react";var yt=()=>Us("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:[_o("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),_o("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),_o("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as To,jsxs as Gs}from"react/jsx-runtime";import"react";var Or=()=>Gs("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:[To("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),To("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),To("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:a,field:c,resolvedFeatures:u,schemaPath:p,unSanitizedEditorConfig:s})=>{let d=t({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:a,field:c,props:o,resolvedFeatures:u,schemaPath:p,unSanitizedEditorConfig:s});return d.sanitizedClientFeatureProps===null&&(d.sanitizedClientFeatureProps=o),d};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var $r=t=>({type:"dropdown",ChildComponent:yt,items:t,key:"align",order:30});var Fr=[$r([{ChildComponent:yt,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Ee(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Ee(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"left")},order:1},{ChildComponent:Dr,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Ee(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Ee(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"center")},order:2},{ChildComponent:Or,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Ee(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Ee(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"right")},order:3},{ChildComponent:Ar,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Ee(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Ee(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"justify")},order:4}])],Ws=y({toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{$createQuoteNode as Wr,$isQuoteNode as Ur,QuoteNode as Ys}from"@lexical/rich-text";import{$setBlocksType as Vr}from"@lexical/selection";import{$getSelection as Kr,$isRangeSelection as zs}from"lexical";import{jsx as Pr}from"react/jsx-runtime";import"react";var Eo=()=>Pr("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:Pr("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 Br}from"react/jsx-runtime";import"react";var Je=()=>Br("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:Br("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 J=t=>({type:"dropdown",ChildComponent:Je,items:t,key:"text",order:25});import{$createQuoteNode as Vs,$isQuoteNode as Hr,QuoteNode as Ks}from"@lexical/rich-text";import{$createLineBreakNode as Zs}from"lexical";var jr={type:"element",dependencies:[Ks],export:(t,e)=>{if(!Hr(t))return null;let o=e(t).split(`
1
+ "use client";import{a as ce,c as ho,d as go,e as Co}from"./chunk-QBDC3MVG.js";import{a as Xe}from"./chunk-DBWINSQN.js";import{a as ze,b as It,c as Pe}from"./chunk-PUXDVIHC.js";import{a as ae}from"./chunk-INBEEENE.js";import{a as Ds}from"./chunk-F26IQ5RE.js";import{a as Ms,b as yr,d as vr,e as Mr,f as As,g as Os,h as $s,j as Fs,l as Ps,m as Bs}from"./chunk-OZ6Q4DWN.js";import{a as vs,b as P}from"./chunk-3LGFOM34.js";function z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Ee,$isRangeSelection as vt,FORMAT_ELEMENT_COMMAND as Mt}from"lexical";import{jsx as xo,jsxs as Hs}from"react/jsx-runtime";import"react";var Dr=()=>Hs("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:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as bo,jsxs as js}from"react/jsx-runtime";import"react";var Ar=()=>js("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),bo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as _o,jsxs as Us}from"react/jsx-runtime";import"react";var yt=()=>Us("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:[_o("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),_o("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),_o("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as To,jsxs as Gs}from"react/jsx-runtime";import"react";var Or=()=>Gs("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:[To("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),To("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),To("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:s,field:c,resolvedFeatures:u,schemaPath:p,unSanitizedEditorConfig:a})=>{let d=t({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:s,field:c,props:o,resolvedFeatures:u,schemaPath:p,unSanitizedEditorConfig:a});return d.sanitizedClientFeatureProps===null&&(d.sanitizedClientFeatureProps=o),d};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var $r=t=>({type:"dropdown",ChildComponent:yt,items:t,key:"align",order:30});var Fr=[$r([{ChildComponent:yt,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Ee(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Ee(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"left")},order:1},{ChildComponent:Dr,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Ee(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Ee(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"center")},order:2},{ChildComponent:Or,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Ee(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Ee(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"right")},order:3},{ChildComponent:Ar,isActive:({selection:t})=>{if(!vt(t))return!1;for(let e of t.getNodes()){if(Ee(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Ee(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,"justify")},order:4}])],Ws=y({toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{$createQuoteNode as Wr,$isQuoteNode as Ur,QuoteNode as Ys}from"@lexical/rich-text";import{$setBlocksType as Vr}from"@lexical/selection";import{$getSelection as Kr,$isRangeSelection as zs}from"lexical";import{jsx as Pr}from"react/jsx-runtime";import"react";var Eo=()=>Pr("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:Pr("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 Br}from"react/jsx-runtime";import"react";var Je=()=>Br("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:Br("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 J=t=>({type:"dropdown",ChildComponent:Je,items:t,key:"text",order:25});import{$createQuoteNode as Vs,$isQuoteNode as Hr,QuoteNode as Ks}from"@lexical/rich-text";import{$createLineBreakNode as Zs}from"lexical";var jr={type:"element",dependencies:[Ks],export:(t,e)=>{if(!Hr(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 i=t.getPreviousSibling();if(Hr(i)){i.splice(i.getChildrenSize(),0,[Zs(),...e]),i.select(0,0),t.remove();return}}let n=Vs();n.append(...e),t.replace(n),n.select(0,0)}};var Gr=[J([{ChildComponent:Eo,isActive:({selection:t})=>{if(!zs(t))return!1;for(let e of t.getNodes())if(!Ur(e)&&!Ur(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Kr();Vr(e,()=>Wr())})},order:20}])],Xs=y({markdownTransformers:[jr],nodes:[Ys],slashMenu:{groups:[z([{Icon:Eo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Kr();Vr(e,()=>Wr())})}}])]},toolbarFixed:{groups:Gr},toolbarInline:{groups:Gr}});import{getTranslation as Ht}from"@payloadcms/translations";import{jsx as wo,jsxs as Js}from"react/jsx-runtime";import"react";var Dt=()=>Js("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Zr}from"react/jsx-runtime";import"react";var At=()=>Zr("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:Zr("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 qs}from"react/jsx-runtime";import"react";function Ot(t,e){return t?()=>qs("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Dt}import{jsx as Sa}from"react/jsx-runtime";import Ia from"bson-objectid";import"react";import{DecoratorBlockNode as Qs}from"@lexical/react/LexicalDecoratorBlockNode.js";import ea from"bson-objectid";var qe=class extends Qs{__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=ta(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}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 ta(t){return new qe({fields:{...t,id:t?.id||new ea.default().toHexString()}})}import{jsx as W,jsxs as Qe,Fragment as aa}from"react/jsx-runtime";import{Button as Jr,Collapsible as ca,Drawer as ua,EditDepthProvider as da,ErrorPill as ma,Form as pa,formatDrawerSlug as fa,FormSubmit as ha,Pill as ga,RenderFields as Ca,SectionTitle as xa,useConfig as ba,useDocumentForm as _a,useDocumentInfo as qr,useEditDepth as Ta,useFormSubmitted as Ea,useServerFunctions as wa,useTranslation as ka}from"@payloadcms/ui";import{abortAndIgnore as ko}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Ft,reduceFieldsToValues as Qr}from"payload/shared";import et,{useCallback as Lo,useEffect as No,useMemo as tt,useRef as Ro}from"react";import{useLexicalComposerContext as La}from"@lexical/react/LexicalComposerContext";import{getTranslation as Na}from"@payloadcms/translations";import{$getNodeByKey as Pt}from"lexical";import{v4 as Ra}from"uuid";import{c as oa}from"react/compiler-runtime";import{jsx as $t,jsxs as ra}from"react/jsx-runtime";import{RenderFields as na,useFormSubmitted as ia}from"@payloadcms/ui";import la,{createContext as sa}from"react";var Yr=sa({initialState:!1}),Ne=()=>la.useContext(Yr),zr=t=>{let e=oa(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:a,initialState:c,nodeKey:u,RemoveButton:p}=t,d=ia()&&l>0,m,f;e[0]!==r||e[1]!==l||e[2]!==d?(f=x=>$t(r,{editButton:x.editButton,errorCount:l,fieldHasErrors:d,Label:x.Label,removeButton:x.removeButton,children:x.children}),e[0]=r,e[1]=l,e[2]=d,e[3]=f):f=e[3],m=f;let h=m,g;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==i||e[8]!==p||e[9]!==a||e[10]!==c||e[11]!==u?(g=n?ra(Yr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:c,nodeKey:u,RemoveButton:p},children:[n,$t(o,{})]}):$t(h,{children:$t(na,{fields:a,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=i,e[8]=p,e[9]=a,e[10]=c,e[11]=u,e[12]=g):g=e[12],g};function Xr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var te="lexical-block",en=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=Ea(),{id:i,collectionSlug:l,globalSlug:a}=qr(),{fieldProps:{featureClientSchemaMap:c,field:u,initialLexicalFormState:p,permissions:s,readOnly:d,schemaPath:m},uuid:f}=P(),{fields:h}=_a(),g=Ro(new AbortController),x=Ta(),[N,v]=et.useState(0),{config:b}=ba(),T=fa({slug:`lexical-blocks-create-${f}-${o.id}`,depth:x}),{toggleDrawer:C}=ae(T),{getDocPreferences:E,setDocFieldPreferences:M}=qr(),[k]=La(),{getFormState:S}=wa(),D=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[w,_]=et.useState(()=>p?.[o.id]?.formState?{...p?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),L=Ro(!1),R=Ro(e);No(()=>{L.current?(R.current!==e&&_(!1),R.current=e):L.current=!0},[e]);let[I,O]=et.useState(w?._components?.customComponents?.BlockLabel),[A,H]=et.useState(w?._components?.customComponents?.Block);No(()=>{let B=new AbortController;return o&&!w&&(async()=>{let{state:U}=await S({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await E(),documentFormState:Ft(h),globalSlug:a,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:D,signal:B.signal});if(U){U.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let Y=Qr(Ft(U),!0);k.update(()=>{let G=Pt(r);if(G&&ot(G)){let Q=Y;Q.blockType=o.blockType,G.setFields(Q,!0)}}),_(U),O(U._components?.customComponents?.BlockLabel),H(U._components?.customComponents?.Block)}})(),()=>{ko(B)}},[S,D,i,o,k,r,w,l,a,E,h]);let[j,ee]=et.useState(p?.[o.id]?.collapsed??!1),wt=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,K=c.blocks?.[wt]?.[0],Z=K.blockReferences?typeof K?.blockReferences?.[0]=="string"?b.blocksMap[K?.blockReferences?.[0]]:K?.blockReferences?.[0]:K?.blocks?.[0],{i18n:Oe,t:_e}=ka(),se=Lo(async({formState:B,submit:re})=>{ko(g.current);let U=new AbortController;g.current=U;let{state:Y}=await S({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await E(),documentFormState:Ft(h),formState:B,globalSlug:a,initialBlockFormState:B,operation:"update",renderAllFields:!!re,schemaPath:D,signal:U.signal});if(!Y)return B;B.blockName&&(Y.blockName=B.blockName);let G=Qr(Xr({fields:Ft(Y)}),!0);if(setTimeout(()=>{k.update(()=>{let Q=Pt(r);if(Q&&ot(Q)){let Fe=G;Fe.blockType=o.blockType,Q.setFields(Fe,!0)}})},0),re){O(Y._components?.customComponents?.BlockLabel),H(Y._components?.customComponents?.Block);let Q=0;for(let Fe of Object.values(Y))Fe?.valid===!1&&Q++;v(Q)}return Y},[S,i,l,E,a,D,o.blockType,h,k,r]);No(()=>()=>{ko(g.current)},[]);let Lt=Lo(()=>{k.update(()=>{Pt(r)?.remove()})},[k,r]),Te=Z?.labels?.singular?Na(Z.labels.singular,Oe):Z?.slug,Nt=Lo(B=>{E().then(re=>{let Y=re?.fields?.[u.name]?.collapsed,G=Y&&Y?.length?Y:[];B?G.includes(o.id)||G.push(o.id):G.includes(o.id)&&G.splice(G.indexOf(o.id),1),M(u.name,{collapsed:G,hello:"hi"})})},[E,u.name,M,o.id]),$e=tt(()=>()=>W(Jr,{buttonStyle:"icon-label",className:`${te}__editButton`,disabled:d,el:"button",icon:"edit",onClick:B=>(B.preventDefault(),B.stopPropagation(),C(),!1),onMouseDown:B=>{B.preventDefault()},round:!0,size:"small",tooltip:_e("lexical:blocks:inlineBlocks:edit",{label:Te})}),[Te,d,_e,C]),Rt=tt(()=>()=>W(Jr,{buttonStyle:"icon-label",className:`${te}__removeButton`,disabled:u?.admin?.readOnly||!1,icon:"x",onClick:B=>{B.preventDefault(),Lt()},round:!0,tooltip:"Remove Block"}),[u?.admin?.readOnly,Lt]),fo=tt(()=>({children:B,disableBlockName:re,editButton:U,errorCount:Y,fieldHasErrors:G,Label:Q,removeButton:Fe})=>W("div",{className:te+" "+te+"-"+o.blockType,children:W(ca,{className:[`${te}__row`,G?`${te}__row--has-errors`:`${te}__row--no-errors`].join(" "),collapsibleStyle:G?"error":"default",header:Qe("div",{className:`${te}__block-header`,children:[Q??I?Q??I:Qe("div",{children:[W(ga,{className:`${te}__block-pill ${te}__block-pill-${o?.blockType}`,pillStyle:"white",children:Te??o?.blockType}),!re&&W(xa,{path:"blockName",readOnly:u?.admin?.readOnly||!1}),G&&W(ma,{count:Y??0,i18n:Oe,withMessage:!0})]}),Qe("div",{children:[A&&U!==!1||!A&&U?W($e,{}):null,Fe!==!1&&k.isEditable()?W(Rt,{}):null]})]}),isCollapsed:j,onToggle:Ir=>{Nt(Ir),ee(Ir)},children:B},0)}),[A,I,$e,Rt,Te,k,o.blockType,Oe,j,Nt,u?.admin?.readOnly]),St=Z?.fields??[],Sr=tt(()=>()=>W(da,{children:W(ua,{className:"",slug:T,title:_e(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:Te??_e("lexical:blocks:inlineBlocks:label")}),children:w?Qe(aa,{children:[W(Ca,{fields:St,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:D,permissions:s,readOnly:!1}),W(ha,{programmaticSubmit:!0,children:_e("fields:saveChanges")})]}):null})}),[w,T,Te,_e,Z?.fields,D,s]),ys=tt(()=>w?W(pa,{beforeSubmit:[async({formState:B})=>await se({formState:B,submit:!0})],el:"div",fields:St,initialState:w,onChange:[se],onSubmit:(B,re)=>{re.blockType=o.blockType,k.update(()=>{let U=Pt(r);U&&ot(U)&&U.setFields(re,!0)}),C()},submitted:n,uuid:Ra(),children:W(zr,{baseClass:te,BlockDrawer:Sr,Collapsible:fo,CustomBlock:A,EditButton:$e,errorCount:N,formSchema:St,initialState:w,nodeKey:r,RemoveButton:Rt})}):null,[fo,Sr,A,St,Rt,$e,k,N,C,Z?.fields,w,r,se,n]);return Z?ys:W(fo,{disableBlockName:!0,fieldHasErrors:!0,children:Qe("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var ue=class extends qe{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=Bt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Sa(en,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Bt(t){return new ue({fields:{...t,id:t?.id||new Ia.default().toHexString()}})}function ot(t){return t instanceof ue}import{createCommand as tn}from"lexical";var Be=tn("INSERT_BLOCK_COMMAND"),He=tn("INSERT_INLINE_BLOCK_COMMAND");import{c as ya}from"react/compiler-runtime";import{useLexicalComposerContext as va}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ma,$wrapNodeInElement as Da,mergeRegister as Aa}from"@lexical/utils";import{formatDrawerSlug as Oa,useEditDepth as $a}from"@payloadcms/ui";import{$createParagraphNode as Fa,$getNodeByKey as Pa,$getPreviousSelection as Ba,$getSelection as Ha,$insertNodes as ja,$isParagraphNode as rn,$isRangeSelection as Ua,$isRootOrShadowRoot as Ga,COMMAND_PRIORITY_EDITOR as on}from"lexical";import{useEffect as Wa,useState as Va}from"react";var nn=()=>{let t=ya(12),[e]=va(),[o,r]=Va(null),{setCreatedInlineBlock:n,uuid:i}=P(),l=$a(),a="lexical-inlineBlocks-create-"+i,c;t[0]!==l||t[1]!==a?(c=Oa({slug:a,depth:l}),t[0]=l,t[1]=a,t[2]=c):c=t[2];let u=c,{toggleDrawer:p}=ae(u,!0),s;t[3]!==e||t[4]!==n||t[5]!==o?(s=()=>{if(!e.hasNodes([ue]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Aa(e.registerCommand(Be,m=>(e.update(()=>{let f=Ha()||Ba();if(Ua(f)){let h=Bt(m);Ma(h);let{focus:g}=f,x=g.getNode();rn(x)&&x.getTextContentSize()===0&&x.getParentOrThrow().getChildren().filter(Ka).length>1&&x.remove()}}),!0),on),e.registerCommand(He,m=>{if(o){let h=Pa(o);return!h||!Co(h)?!1:(h.setFields(m),r(null),!0)}let f=go(m);return n?.(f),ja([f]),Ga(f.getParentOrThrow())&&Da(f,Fa).selectEnd(),!0},on))},t[3]=e,t[4]=n,t[5]=o,t[6]=s):s=t[6];let d;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==p?(d=[e,n,o,p],t[7]=e,t[8]=n,t[9]=o,t[10]=p,t[11]=d):d=t[11],Wa(s,d),null};function Ka(t){return rn(t)}var Za=y(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,l=e.blocks;if(!l)return{};let a=Object.entries(l).filter(([s])=>s.startsWith(n+".")&&!s.replace(n+".","").includes(".")).map(([,s])=>s[0]),c=Object.entries(l).filter(([s])=>s.startsWith(i+".")&&!s.replace(i+".","").includes(".")).map(([,s])=>s[0]),u=a.map(s=>s.blockReferences?typeof s.blockReferences[0]=="string"?t.blocksMap[s.blockReferences[0]]:s.blockReferences[0]:s.blocks[0]).filter(s=>s!==void 0),p=c.map(s=>s.blockReferences?typeof s.blockReferences[0]=="string"?t.blocksMap[s.blockReferences[0]]:s.blockReferences[0]:s.blocks[0]).filter(s=>s!==void 0);return{nodes:[ue,ho],plugins:[{Component:nn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[u?.length?{items:u.map(s=>({Icon:Ot(s.imageURL,s.imageAltText),key:"block-"+s.slug,keywords:["block","blocks",s.slug],label:({i18n:d})=>s?.labels?.singular?Ht(s.labels.singular,d):s?.slug,onSelect:({editor:d})=>{d.dispatchCommand(Be,{blockName:"",blockType:s.slug})}})),key:"blocks",label:({i18n:s})=>s.t("lexical:blocks:label")}:null,p?.length?{items:p.map(s=>({Icon:At,key:"inlineBlocks-"+s.slug,keywords:["inlineBlock","inline block",s.slug],label:({i18n:d})=>s?.labels?.singular?Ht(s.labels.singular,d):s?.slug,onSelect:({editor:d})=>{d.dispatchCommand(He,{blockName:"",blockType:s.slug})}})),key:"inlineBlocks",label:({i18n:s})=>s.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[u.length?{type:"dropdown",ChildComponent:Dt,items:u.map((s,d)=>({ChildComponent:Ot(s.imageURL,s.imageAltText),isActive:void 0,key:"block-"+s.slug,label:({i18n:m})=>s?.labels?.singular?Ht(s.labels.singular,m):s?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Be,{blockName:"",blockType:s.slug})},order:d})),key:"blocks",order:20}:null,p?.length?{type:"dropdown",ChildComponent:At,items:p.map((s,d)=>({ChildComponent:s.imageURL?Ot(s.imageURL,s.imageAltText):At,isActive:void 0,key:"inlineBlock-"+s.slug,label:({i18n:m})=>s?.labels?.singular?Ht(s.labels.singular,m):s?.slug,onSelect:({editor:m})=>{m.dispatchCommand(He,{blockName:"",blockType:s.slug})},order:d})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Ya}from"react/compiler-runtime";import{jsx as Se,jsxs as vo}from"react/jsx-runtime";import{useLexicalComposerContext as za}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Xa,$createTextNode as Ja,$getRoot as qa,getDOMSelection as So}from"lexical";import*as cn from"react";import{useCallback as Re,useEffect as Io,useLayoutEffect as ln,useRef as yo,useState as jt}from"react";var Qa=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)},ec=(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)},tc=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);
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let i=t.getPreviousSibling();if(Hr(i)){i.splice(i.getChildrenSize(),0,[Zs(),...e]),i.select(0,0),t.remove();return}}let n=Vs();n.append(...e),t.replace(n),n.select(0,0)}};var Gr=[J([{ChildComponent:Eo,isActive:({selection:t})=>{if(!zs(t))return!1;for(let e of t.getNodes())if(!Ur(e)&&!Ur(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Kr();Vr(e,()=>Wr())})},order:20}])],Xs=y({markdownTransformers:[jr],nodes:[Ys],slashMenu:{groups:[z([{Icon:Eo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Kr();Vr(e,()=>Wr())})}}])]},toolbarFixed:{groups:Gr},toolbarInline:{groups:Gr}});import{getTranslation as Ht}from"@payloadcms/translations";import{jsx as wo,jsxs as Js}from"react/jsx-runtime";import"react";var Dt=()=>Js("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Zr}from"react/jsx-runtime";import"react";var At=()=>Zr("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:Zr("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 qs}from"react/jsx-runtime";import"react";function Ot(t,e){return t?()=>qs("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Dt}import{jsx as Sa}from"react/jsx-runtime";import Ia from"bson-objectid";import"react";import{DecoratorBlockNode as Qs}from"@lexical/react/LexicalDecoratorBlockNode.js";import ea from"bson-objectid";var qe=class extends Qs{__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=ta(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}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 ta(t){return new qe({fields:{...t,id:t?.id||new ea.default().toHexString()}})}import{jsx as W,jsxs as Qe,Fragment as aa}from"react/jsx-runtime";import{Button as Jr,Collapsible as ca,Drawer as ua,EditDepthProvider as da,ErrorPill as ma,Form as pa,formatDrawerSlug as fa,FormSubmit as ha,Pill as ga,RenderFields as Ca,SectionTitle as xa,useConfig as ba,useDocumentForm as _a,useDocumentInfo as qr,useEditDepth as Ta,useFormSubmitted as Ea,useServerFunctions as wa,useTranslation as ka}from"@payloadcms/ui";import{abortAndIgnore as ko}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Ft,reduceFieldsToValues as Qr}from"payload/shared";import et,{useCallback as Lo,useEffect as No,useMemo as tt,useRef as Ro}from"react";import{useLexicalComposerContext as La}from"@lexical/react/LexicalComposerContext";import{getTranslation as Na}from"@payloadcms/translations";import{$getNodeByKey as Pt}from"lexical";import{v4 as Ra}from"uuid";import{c as oa}from"react/compiler-runtime";import{jsx as $t,jsxs as ra}from"react/jsx-runtime";import{RenderFields as na,useFormSubmitted as ia}from"@payloadcms/ui";import la,{createContext as sa}from"react";var Yr=sa({initialState:!1}),Ne=()=>la.useContext(Yr),zr=t=>{let e=oa(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:c,nodeKey:u,RemoveButton:p}=t,d=ia()&&l>0,m,f;e[0]!==r||e[1]!==l||e[2]!==d?(f=x=>$t(r,{editButton:x.editButton,errorCount:l,fieldHasErrors:d,Label:x.Label,removeButton:x.removeButton,children:x.children}),e[0]=r,e[1]=l,e[2]=d,e[3]=f):f=e[3],m=f;let h=m,g;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==i||e[8]!==p||e[9]!==s||e[10]!==c||e[11]!==u?(g=n?ra(Yr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:c,nodeKey:u,RemoveButton:p},children:[n,$t(o,{})]}):$t(h,{children:$t(na,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=i,e[8]=p,e[9]=s,e[10]=c,e[11]=u,e[12]=g):g=e[12],g};function Xr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var te="lexical-block",en=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=Ea(),{id:i,collectionSlug:l,globalSlug:s}=qr(),{fieldProps:{featureClientSchemaMap:c,field:u,initialLexicalFormState:p,permissions:a,readOnly:d,schemaPath:m},uuid:f}=P(),{fields:h}=_a(),g=Ro(new AbortController),x=Ta(),[N,v]=et.useState(0),{config:b}=ba(),T=fa({slug:`lexical-blocks-create-${f}-${o.id}`,depth:x}),{toggleDrawer:C}=ae(T),{getDocPreferences:E,setDocFieldPreferences:M}=qr(),[k]=La(),{getFormState:S}=wa(),D=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[w,_]=et.useState(()=>p?.[o.id]?.formState?{...p?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),L=Ro(!1),R=Ro(e);No(()=>{L.current?(R.current!==e&&_(!1),R.current=e):L.current=!0},[e]);let[I,O]=et.useState(w?._components?.customComponents?.BlockLabel),[A,H]=et.useState(w?._components?.customComponents?.Block);No(()=>{let B=new AbortController;return o&&!w&&(async()=>{let{state:U}=await S({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await E(),documentFormState:Ft(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:D,signal:B.signal});if(U){U.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let Y=Qr(Ft(U),!0);k.update(()=>{let G=Pt(r);if(G&&ot(G)){let Q=Y;Q.blockType=o.blockType,G.setFields(Q,!0)}}),_(U),O(U._components?.customComponents?.BlockLabel),H(U._components?.customComponents?.Block)}})(),()=>{ko(B)}},[S,D,i,o,k,r,w,l,s,E,h]);let[j,ee]=et.useState(p?.[o.id]?.collapsed??!1),wt=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,K=c.blocks?.[wt]?.[0],Z=K.blockReferences?typeof K?.blockReferences?.[0]=="string"?b.blocksMap[K?.blockReferences?.[0]]:K?.blockReferences?.[0]:K?.blocks?.[0],{i18n:Oe,t:_e}=ka(),se=Lo(async({formState:B,submit:re})=>{ko(g.current);let U=new AbortController;g.current=U;let{state:Y}=await S({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await E(),documentFormState:Ft(h),formState:B,globalSlug:s,initialBlockFormState:B,operation:"update",renderAllFields:!!re,schemaPath:D,signal:U.signal});if(!Y)return B;B.blockName&&(Y.blockName=B.blockName);let G=Qr(Xr({fields:Ft(Y)}),!0);if(setTimeout(()=>{k.update(()=>{let Q=Pt(r);if(Q&&ot(Q)){let Fe=G;Fe.blockType=o.blockType,Q.setFields(Fe,!0)}})},0),re){O(Y._components?.customComponents?.BlockLabel),H(Y._components?.customComponents?.Block);let Q=0;for(let Fe of Object.values(Y))Fe?.valid===!1&&Q++;v(Q)}return Y},[S,i,l,E,s,D,o.blockType,h,k,r]);No(()=>()=>{ko(g.current)},[]);let Lt=Lo(()=>{k.update(()=>{Pt(r)?.remove()})},[k,r]),Te=Z?.labels?.singular?Na(Z.labels.singular,Oe):Z?.slug,Nt=Lo(B=>{E().then(re=>{let Y=re?.fields?.[u.name]?.collapsed,G=Y&&Y?.length?Y:[];B?G.includes(o.id)||G.push(o.id):G.includes(o.id)&&G.splice(G.indexOf(o.id),1),M(u.name,{collapsed:G,hello:"hi"})})},[E,u.name,M,o.id]),$e=tt(()=>()=>W(Jr,{buttonStyle:"icon-label",className:`${te}__editButton`,disabled:d,el:"button",icon:"edit",onClick:B=>(B.preventDefault(),B.stopPropagation(),C(),!1),onMouseDown:B=>{B.preventDefault()},round:!0,size:"small",tooltip:_e("lexical:blocks:inlineBlocks:edit",{label:Te})}),[Te,d,_e,C]),Rt=tt(()=>()=>W(Jr,{buttonStyle:"icon-label",className:`${te}__removeButton`,disabled:u?.admin?.readOnly||!1,icon:"x",onClick:B=>{B.preventDefault(),Lt()},round:!0,tooltip:"Remove Block"}),[u?.admin?.readOnly,Lt]),fo=tt(()=>({children:B,disableBlockName:re,editButton:U,errorCount:Y,fieldHasErrors:G,Label:Q,removeButton:Fe})=>W("div",{className:te+" "+te+"-"+o.blockType,children:W(ca,{className:[`${te}__row`,G?`${te}__row--has-errors`:`${te}__row--no-errors`].join(" "),collapsibleStyle:G?"error":"default",header:Qe("div",{className:`${te}__block-header`,children:[Q??I?Q??I:Qe("div",{children:[W(ga,{className:`${te}__block-pill ${te}__block-pill-${o?.blockType}`,pillStyle:"white",children:Te??o?.blockType}),!re&&W(xa,{path:"blockName",readOnly:u?.admin?.readOnly||!1}),G&&W(ma,{count:Y??0,i18n:Oe,withMessage:!0})]}),Qe("div",{children:[A&&U!==!1||!A&&U?W($e,{}):null,Fe!==!1&&k.isEditable()?W(Rt,{}):null]})]}),isCollapsed:j,onToggle:Ir=>{Nt(Ir),ee(Ir)},children:B},0)}),[A,I,$e,Rt,Te,k,o.blockType,Oe,j,Nt,u?.admin?.readOnly]),St=Z?.fields??[],Sr=tt(()=>()=>W(da,{children:W(ua,{className:"",slug:T,title:_e(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:Te??_e("lexical:blocks:inlineBlocks:label")}),children:w?Qe(aa,{children:[W(Ca,{fields:St,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:D,permissions:a,readOnly:!1}),W(ha,{programmaticSubmit:!0,children:_e("fields:saveChanges")})]}):null})}),[w,T,Te,_e,Z?.fields,D,a]),ys=tt(()=>w?W(pa,{beforeSubmit:[async({formState:B})=>await se({formState:B,submit:!0})],el:"div",fields:St,initialState:w,onChange:[se],onSubmit:(B,re)=>{re.blockType=o.blockType,k.update(()=>{let U=Pt(r);U&&ot(U)&&U.setFields(re,!0)}),C()},submitted:n,uuid:Ra(),children:W(zr,{baseClass:te,BlockDrawer:Sr,Collapsible:fo,CustomBlock:A,EditButton:$e,errorCount:N,formSchema:St,initialState:w,nodeKey:r,RemoveButton:Rt})}):null,[fo,Sr,A,St,Rt,$e,k,N,C,Z?.fields,w,r,se,n]);return Z?ys:W(fo,{disableBlockName:!0,fieldHasErrors:!0,children:Qe("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var ue=class extends qe{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=Bt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Sa(en,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Bt(t){return new ue({fields:{...t,id:t?.id||new Ia.default().toHexString()}})}function ot(t){return t instanceof ue}import{createCommand as tn}from"lexical";var Be=tn("INSERT_BLOCK_COMMAND"),He=tn("INSERT_INLINE_BLOCK_COMMAND");import{c as ya}from"react/compiler-runtime";import{useLexicalComposerContext as va}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ma,$wrapNodeInElement as Da,mergeRegister as Aa}from"@lexical/utils";import{formatDrawerSlug as Oa,useEditDepth as $a}from"@payloadcms/ui";import{$createParagraphNode as Fa,$getNodeByKey as Pa,$getPreviousSelection as Ba,$getSelection as Ha,$insertNodes as ja,$isParagraphNode as rn,$isRangeSelection as Ua,$isRootOrShadowRoot as Ga,COMMAND_PRIORITY_EDITOR as on}from"lexical";import{useEffect as Wa,useState as Va}from"react";var nn=()=>{let t=ya(12),[e]=va(),[o,r]=Va(null),{setCreatedInlineBlock:n,uuid:i}=P(),l=$a(),s="lexical-inlineBlocks-create-"+i,c;t[0]!==l||t[1]!==s?(c=Oa({slug:s,depth:l}),t[0]=l,t[1]=s,t[2]=c):c=t[2];let u=c,{toggleDrawer:p}=ae(u,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([ue]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Aa(e.registerCommand(Be,m=>(e.update(()=>{let f=Ha()||Ba();if(Ua(f)){let h=Bt(m);Ma(h);let{focus:g}=f,x=g.getNode();rn(x)&&x.getTextContentSize()===0&&x.getParentOrThrow().getChildren().filter(Ka).length>1&&x.remove()}}),!0),on),e.registerCommand(He,m=>{if(o){let h=Pa(o);return!h||!Co(h)?!1:(h.setFields(m),r(null),!0)}let f=go(m);return n?.(f),ja([f]),Ga(f.getParentOrThrow())&&Da(f,Fa).selectEnd(),!0},on))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let d;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==p?(d=[e,n,o,p],t[7]=e,t[8]=n,t[9]=o,t[10]=p,t[11]=d):d=t[11],Wa(a,d),null};function Ka(t){return rn(t)}var Za=y(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,l=e.blocks;if(!l)return{};let s=Object.entries(l).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),c=Object.entries(l).filter(([a])=>a.startsWith(i+".")&&!a.replace(i+".","").includes(".")).map(([,a])=>a[0]),u=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),p=c.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{nodes:[ue,ho],plugins:[{Component:nn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[u?.length?{items:u.map(a=>({Icon:Ot(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:d})=>a?.labels?.singular?Ht(a.labels.singular,d):a?.slug,onSelect:({editor:d})=>{d.dispatchCommand(Be,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,p?.length?{items:p.map(a=>({Icon:At,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:d})=>a?.labels?.singular?Ht(a.labels.singular,d):a?.slug,onSelect:({editor:d})=>{d.dispatchCommand(He,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[u.length?{type:"dropdown",ChildComponent:Dt,items:u.map((a,d)=>({ChildComponent:Ot(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Ht(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Be,{blockName:"",blockType:a.slug})},order:d})),key:"blocks",order:20}:null,p?.length?{type:"dropdown",ChildComponent:At,items:p.map((a,d)=>({ChildComponent:a.imageURL?Ot(a.imageURL,a.imageAltText):At,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Ht(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(He,{blockName:"",blockType:a.slug})},order:d})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Ya}from"react/compiler-runtime";import{jsx as Se,jsxs as vo}from"react/jsx-runtime";import{useLexicalComposerContext as za}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Xa,$createTextNode as Ja,$getRoot as qa,getDOMSelection as So}from"lexical";import*as cn from"react";import{useCallback as Re,useEffect as Io,useLayoutEffect as ln,useRef as yo,useState as jt}from"react";var Qa=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)},ec=(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)},tc=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);
4
4
  await assertSelection(page, {
5
5
  anchorPath: [${n.anchorPath.toString()}],
6
6
  anchorOffset: ${n.anchorOffset},
@@ -10,7 +10,7 @@
10
10
  `;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(`
11
11
  `);default:return` await repeat(${t.count}, async () => {
12
12
  ${o}
13
- );`}};function oc(t){return t.key.toLowerCase()==="a"&&(yr?t.metaKey:t.ctrlKey)}function rc(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 sn(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 an=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function nc(t){let[e,o]=jt([]),[r,n]=jt(!1),[,i]=jt(""),[l,a]=jt(""),c=yo(null),u=yo(!1),p=yo(null),s=Re(()=>t,[t]),d=Re(()=>{let b=t.getRootElement(),T=So(t._window);return b==null||T==null||T.anchorNode==null||T.focusNode==null||!b.contains(T.anchorNode)||!b.contains(T.focusNode)?null:`
13
+ );`}};function oc(t){return t.key.toLowerCase()==="a"&&(yr?t.metaKey:t.ctrlKey)}function rc(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 sn(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 an=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function nc(t){let[e,o]=jt([]),[r,n]=jt(!1),[,i]=jt(""),[l,s]=jt(""),c=yo(null),u=yo(!1),p=yo(null),a=Re(()=>t,[t]),d=Re(()=>{let b=t.getRootElement(),T=So(t._window);return b==null||T==null||T.anchorNode==null||T.focusNode==null||!b.contains(T.anchorNode)||!b.contains(T.focusNode)?null:`
14
14
  import {
15
15
  initializeE2E,
16
16
  assertHTMLSnapshot,
@@ -31,11 +31,11 @@ ${e.map(tc).join(`
31
31
  `)}
32
32
  });
33
33
  });
34
- `},[t,e]),m=Re((b,T)=>{o(C=>{let E=e.length-1,M=e[E];if(M&&M.name===b){if(b==="type")return[...e.slice(0,E),{...M,value:M.value+T}];if(M.value===T)return[...e.slice(0,E),{...M,count:M.count+1}]}return[...C,{name:b,count:1,value:T}]})},[e,o]);ln(()=>{let b=C=>{if(!r)return;let E=C.key;oc(C)?m("selectAll",""):an.has(E)?m("press",C.key):[...E].length>1?m("keydown",C.key):m("type",C.key)},T=C=>{if(!r)return;let E=C.key;!an.has(E)&&[...E].length>1&&m("keyup",C.key)};return t.registerRootListener((C,E)=>{E!==null&&(E.removeEventListener("keydown",b),E.removeEventListener("keyup",T)),C!==null&&(C.addEventListener("keydown",b),C.addEventListener("keyup",T))})},[t,r,m]),ln(()=>{p.current&&p.current.scrollTo(0,p.current.scrollHeight)},[d]),Io(()=>{if(e){let b=d();b!==null&&a(b),p.current&&p.current.scrollTo(0,p.current.scrollHeight)}},[d,e]),Io(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:C,editorState:E})=>{if(!r)return;let M=E._selection,k=c.current,S=u.current;if(k!==M){if(C.size===0&&T.size===0&&!S){let w=So(t._window);if(w&&(w.anchorNode==null||w.focusNode==null))return}c.current=M}u.current=!1;let D=d();D!==null&&a(D)}),[t,d,r,m]),Io(()=>r?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,r]);let f=Re(b=>{r||(b.update(()=>{let T=qa();T.clear();let C=Ja();T.append(Xa().append(C)),C.select()}),o([])),n(T=>!T)},[r]),h=Re(()=>{if(!r)return;let b=So(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:T,anchorOffset:C,focusNode:E,focusOffset:M}=rc(b),k=s().getRootElement(),S;T!==null&&(S=sn(T,k));let D;E!==null&&(D=sn(E,k)),m("snapshot",{anchorNode:T,anchorOffset:C,anchorPath:S,focusNode:E,focusOffset:M,focusPath:D})},[m,r,s]),g=Re(()=>{Qa(d())},[d]),x=Re(()=>{ec("test.js",d())},[d]);return[Se("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(s()),b.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?vo("div",{className:"test-recorder-output",children:[vo("div",{className:"test-recorder-toolbar",children:[Se("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Se("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Se("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{x(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Se("pre",{id:"test-recorder",ref:p,children:l})]}):null]}var un=()=>{let t=Ya(3),[e]=za(),[o,r]=nc(e),n;return t[0]!==o||t[1]!==r?(n=vo(cn.Fragment,{children:[Se("p",{children:"HI"}),o,r,Se("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var ic=y({plugins:[{Component:un,position:"bottom"}]});import{c as lc}from"react/compiler-runtime";import{jsx as sc}from"react/jsx-runtime";import{useLexicalComposerContext as ac}from"@lexical/react/LexicalComposerContext.js";import{TreeView as cc}from"@lexical/react/LexicalTreeView.js";import"react";var dn=()=>{let t=lc(2),[e]=ac(),o;return t[0]!==e?(o=sc(cc,{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 uc=y({plugins:[{Component:dn,position:"bottom"}]});import{$isTableSelection as dc}from"@lexical/table";import{$isRangeSelection as mc,FORMAT_TEXT_COMMAND as pc}from"lexical";import{jsx as mn}from"react/jsx-runtime";import"react";var pn=()=>mn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:mn("path",{d:"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 X=t=>({type:"buttons",items:t,key:"format",order:40});var fn={type:"text-format",format:["bold","italic"],tag:"***"},hn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},gn={type:"text-format",format:["bold"],tag:"**"},Cn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var xn=[X([{ChildComponent:pn,isActive:({selection:t})=>mc(t)||dc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(pc,"bold")},order:1}])],fc=y(({featureProviderMap:t})=>{let e=[gn,Cn];return t.get("italic")&&e.push(hn,fn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:xn},toolbarInline:{groups:xn}}});import{$isTableSelection as gc}from"@lexical/table";import{$isRangeSelection as Cc,FORMAT_TEXT_COMMAND as xc}from"lexical";import{jsx as bn,jsxs as hc}from"react/jsx-runtime";import"react";var _n=()=>hc("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:[bn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),bn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Tn={type:"text-format",format:["code"],tag:"`"};var En=[X([{ChildComponent:_n,isActive:({selection:t})=>Cc(t)||gc(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(xc,"code")},order:7}])],bc=y({enableFormats:["code"],markdownTransformers:[Tn],toolbarFixed:{groups:En},toolbarInline:{groups:En}});import{$isTableSelection as _c}from"@lexical/table";import{$isRangeSelection as Tc,FORMAT_TEXT_COMMAND as Ec}from"lexical";import{jsx as wn}from"react/jsx-runtime";import"react";var kn=()=>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.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 Ln={type:"text-format",format:["italic"],tag:"*"},Nn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Rn=[X([{ChildComponent:kn,isActive:({selection:t})=>Tc(t)||_c(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Ec,"italic")},order:2}])],wc=y({enableFormats:["italic"],markdownTransformers:[Ln,Nn],toolbarFixed:{groups:Rn},toolbarInline:{groups:Rn}});import{$isTableSelection as Lc}from"@lexical/table";import{$isRangeSelection as Nc,FORMAT_TEXT_COMMAND as Rc}from"lexical";import{jsx as Sn,jsxs as kc}from"react/jsx-runtime";import"react";var In=()=>kc("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:"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"}),Sn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var yn={type:"text-format",format:["strikethrough"],tag:"~~"};var vn=[X([{ChildComponent:In,isActive:({selection:t})=>Nc(t)||Lc(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Rc,"strikethrough")},order:4}])],Sc=y({enableFormats:["strikethrough"],markdownTransformers:[yn],toolbarFixed:{groups:vn},toolbarInline:{groups:vn}});import{$isTableSelection as Ic}from"@lexical/table";import{$isRangeSelection as yc,FORMAT_TEXT_COMMAND as vc}from"lexical";import{jsx as Mn}from"react/jsx-runtime";import"react";var Dn=()=>Mn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Mn("path",{d:"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 An=[X([{ChildComponent:Dn,isActive:({selection:t})=>yc(t)||Ic(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(vc,"subscript")},order:5}])],Mc=y({enableFormats:["subscript"],toolbarFixed:{groups:An},toolbarInline:{groups:An}});import{$isTableSelection as Dc}from"@lexical/table";import{$isRangeSelection as Ac,FORMAT_TEXT_COMMAND as Oc}from"lexical";import{jsx as On}from"react/jsx-runtime";import"react";var $n=()=>On("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:On("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 Fn=[X([{ChildComponent:$n,isActive:({selection:t})=>Ac(t)||Dc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Oc,"superscript")},order:6}])],$c=y({enableFormats:["superscript"],toolbarFixed:{groups:Fn},toolbarInline:{groups:Fn}});import{$isTableSelection as Pc}from"@lexical/table";import{$isRangeSelection as Bc,FORMAT_TEXT_COMMAND as Hc}from"lexical";import{jsx as Pn,jsxs as Fc}from"react/jsx-runtime";import"react";var Bn=()=>Fc("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:[Pn("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"}),Pn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Hn=[X([{ChildComponent:Bn,isActive:({selection:t})=>Bc(t)||Pc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Hc,"underline")},order:3}])],jc=y({enableFormats:["underline"],toolbarFixed:{groups:Hn},toolbarInline:{groups:Hn}});import{$createHeadingNode as Vc,$isHeadingNode as ei,HeadingNode as Kc}from"@lexical/rich-text";import{$setBlocksType as Zc}from"@lexical/selection";import{$getSelection as Yc,$isRangeSelection as zc}from"lexical";import{jsx as jn}from"react/jsx-runtime";import"react";var Un=()=>jn("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:jn("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 Gn}from"react/jsx-runtime";import"react";var Wn=()=>Gn("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:Gn("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 Vn}from"react/jsx-runtime";import"react";var Kn=()=>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",{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 Zn}from"react/jsx-runtime";import"react";var Yn=()=>Zn("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:Zn("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 zn}from"react/jsx-runtime";import"react";var Xn=()=>zn("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:zn("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 Jn}from"react/jsx-runtime";import"react";var qn=()=>Jn("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:Jn("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 Uc,$isHeadingNode as Gc,HeadingNode as Wc}from"@lexical/rich-text";var Mo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Qn=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Wc],export:(n,i)=>{if(!Gc(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Mo(n=>{let i="h"+n[1]?.length;return Uc(i)})}};var ti=t=>{let e=Yc();Zc(e,()=>Vc(t))},oi={h1:Un,h2:Wn,h3:Kn,h4:Yn,h5:Xn,h6:qn},Xc=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[J(e.map((r,n)=>({ChildComponent:oi[r],isActive:({selection:i})=>{if(!zc(i))return!1;for(let l of i.getNodes()){if(ei(l)&&l.getTag()===r)continue;let a=l.getParent();if(!(ei(a)&&a.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{ti(r)})},order:n+2})))];return{markdownTransformers:[Qn(e)],nodes:[Kc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:oi[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(()=>{ti(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as mu}from"lexical";import{jsx as ri}from"react/jsx-runtime";import"react";var Do=()=>ri("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:ri("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as ni,jsxs as Jc}from"react/jsx-runtime";import"react";var ii=()=>Jc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ni("path",{d:"M5 10h10",stroke:"currentColor"}),ni("path",{d:"M10 15V5",stroke:"currentColor"})]});var de=t=>({type:"dropdown",ChildComponent:ii,items:t,key:"add",order:10});import{addClassNamesToElement as qc}from"@lexical/utils";import{$applyNodeReplacement as Qc,createCommand as eu,DecoratorNode as tu}from"lexical";var nt=eu("INSERT_HORIZONTAL_RULE_COMMAND"),rt=class extends tu{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:ou,priority:0})}}static importJSON(e){return li()}createDOM(e){let o=document.createElement("hr");return qc(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
35
- `}isInline(){return!1}updateDOM(){return!1}};function ou(){return{node:li()}}function li(){return Qc(new rt)}import{$applyNodeReplacement as ru}from"lexical";import"react";var we=class extends rt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return it()}decorate(){return null}exportJSON(){return super.exportJSON()}};function it(){return ru(new we)}function Ut(t){return t instanceof we}var si={type:"element",dependencies:[we],export:(t,e)=>Ut(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=it();e&&t.replace(e)}};import{c as nu}from"react/compiler-runtime";import{useLexicalComposerContext as iu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as lu}from"@lexical/utils";import{$getSelection as su,$isRangeSelection as au,COMMAND_PRIORITY_EDITOR as cu}from"lexical";import{useEffect as uu}from"react";var ai=()=>{let t=nu(3),[e]=iu(),o,r;return t[0]!==e?(o=()=>e.registerCommand(nt,du,cu),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),uu(o,r),null};function du(t){let e=su();if(!au(e))return!1;if(e.focus.getNode()!==null){let r=it();lu(r)}return!0}var pu=y({markdownTransformers:[si],nodes:[we],plugins:[{Component:ai,position:"normal"}],slashMenu:{groups:[z([{Icon:Do,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:[de([{ChildComponent:Do,isActive:({selection:t})=>{if(!mu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ut(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(nt,void 0)}}])]}});import{TabIndentationPlugin as gu}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as mi}from"@lexical/utils";import{$isElementNode as Cu,$isRangeSelection as xu,INDENT_CONTENT_COMMAND as bu,OUTDENT_CONTENT_COMMAND as _u}from"lexical";import{jsx as Gt,jsxs as fu}from"react/jsx-runtime";import"react";var ci=()=>fu("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:[Gt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Wt,jsxs as hu}from"react/jsx-runtime";import"react";var ui=()=>hu("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:[Wt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var di=t=>({type:"buttons",items:t,key:"indent",order:35});var pi=[di([{ChildComponent:ci,isActive:()=>!1,isEnabled:({selection:t})=>{let e=t?.getNodes();if(!e?.length)return!1;let o=!1,r=n=>Cu(n)&&n.canIndent();for(let n of e)if(r(n)){if(n.getIndent()<=0)return!1;o=!0}if(!o&&xu(t)){let n=t.anchor.getNode();if(mi(n,l=>r(l)&&l.getIndent()>0))return!0;let i=t.focus.getNode();if(mi(i,l=>r(l)&&l.getIndent()>0))return!0}return o},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(_u,void 0)},order:1},{ChildComponent:ui,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(bu,void 0)},order:2}])],Tu=y({plugins:[{Component:gu,position:"normal"}],toolbarFixed:{groups:pi},toolbarInline:{groups:pi}});import{$findMatchingParent as Dd}from"@lexical/utils";import{$getSelection as Uo,$isRangeSelection as Wi}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 je(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 Ao=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Mu}from"lexical";import{addClassNamesToElement as Eu,isHTMLAnchorElement as wu}from"@lexical/utils";import Fo from"bson-objectid";import{$applyNodeReplacement as ku,$createTextNode as Ci,$getSelection as Lu,$isElementNode as xi,$isRangeSelection as $o,createCommand as Nu,ElementNode as Ru}from"lexical";var Su=new Set(["http:","https:","mailto:","sms:","tel:"]),q=class t extends Ru{__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 t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Iu,priority:1})}}static importJSON(e){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 Fo.default().toHexString(),e.version=3);let o=me({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),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=Oo(o.rel,"add","noopener")),Eu(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(!$o(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&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(xi(r)){let n=me({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Su.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,r){let n=this.__fields?.url,i=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=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Oo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Oo(o.rel,"remove","noopener"))),!1}};function Iu(t){let e=null;if(wu(t)){let o=t.textContent;o!==null&&o!==""&&(e=me({id:new Fo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function me({id:t,fields:e}){return ku(new q({id:t??new Fo.default().toHexString(),fields:e}))}function V(t){return t instanceof q}var ne=Nu("TOGGLE_LINK_COMMAND");function Po(t){let e=Lu();if(!$o(e)&&(t===null||!t.selectedNodes?.length))return;let o=$o(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(i=>{let l=i.getParent();V(l)&&(l.getChildren().forEach(c=>{l.insertBefore(c)}),l.remove())});return}if(o?.length===1){let i=o[0],l=V(i)?i:yu(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Ci(t.text)),l.getChildren().forEach(a=>{a!==l.getLastChild()&&a.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||xi(i)&&!i.isInline())){if(V(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Ci(t.text)),l.getChildren().forEach(a=>{a!==l.getLastChild()&&a.remove()}));return}if(l.is(r)||(r=l,n=me({fields:t.fields}),V(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),V(i)){if(i.is(n))return;if(n!==null){let a=i.getChildren();n.append(...a)}i.remove();return}n!==null&&n.append(i)}})}function yu(t){return vu(t,e=>V(e))}function vu(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Oo(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var bi={type:"text-match",dependencies:[q],export:(t,e)=>{if(!V(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=me({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Mu(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as Du,$isElementNode as Au}from"lexical";var pe=class t extends q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){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);let o=lt({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),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(Au(r)){let n=lt({fields:this.__fields});return r.append(n),n}return null}};function lt({fields:t}){return Du(new pe({id:"",fields:t}))}function fe(t){return t instanceof pe}import{c as Ou}from"react/compiler-runtime";import{useLexicalComposerContext as $u}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Fu}from"@lexical/utils";import{$createTextNode as _i,$getSelection as Pu,$isElementNode as Ei,$isLineBreakNode as wi,$isNodeSelection as Bu,$isRangeSelection as Hu,$isTextNode as st,TextNode as ju}from"lexical";import{useEffect as Uu}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 ki(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Gu=/[.,;\s]/;function Kt(t){return t!==void 0&&Gu.test(t)}function Li(t){return Kt(t[t.length-1])}function Ho(t){return Kt(t[0])}function Wu(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ni(t){let e=t.getPreviousSibling();return Ei(e)&&(e=e.getLastDescendant()),e===null||wi(e)||st(e)&&Li(e.getTextContent())}function Ri(t){let e=t.getNextSibling();return Ei(e)&&(e=e.getFirstDescendant()),e===null||wi(e)||st(e)&&Ho(e.getTextContent())}function Vu(t,e,o,r){return(t>0?Kt(o[t-1]):Ni(r[0]))?e<o.length?Kt(o[e]):Ri(r[r.length-1]):!1}function Ku(t,e,o){let r=[],n=[],i=[],l=0,a=0,c=[...t];for(;c.length>0;){let u=c[0],s=u.getTextContent().length,d=a;a+s<=e?(r.push(u),l+=s):d>=o?i.push(u):n.push(u),a+=s,c.shift()}return[l,r,n,i]}function Zu(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=lt({fields:n});if(t.length===1){let l=e===0?t[0]?.splitText(o):t[0]?.splitText(e,o),[a,c]=l;if(a){let u=_i(r.text);u.setFormat(a.getFormat()),u.setDetail(a.getDetail()),u.setStyle(a.getStyle()),i.append(u),a.replace(i)}return c}else if(t.length>1){let l=t[0],a=l.getTextContent().length,c;e===0?c=l:[,c]=l.splitText(e);let u=[],p;if(t.forEach(s=>{let m=s.getTextContent().length,f=a,h=a+m;if(f<o)if(h<=o)u.push(s);else{let[g,x]=s.splitText(o-f);g&&u.push(g),p=x}a+=m}),c){let s=Pu(),d=s?s.getNodes().find(st):void 0,m=_i(c.getTextContent());return m.setFormat(c.getFormat()),m.setDetail(c.getDetail()),m.setStyle(c.getStyle()),i.append(m,...u),d&&d===c&&(Hu(s)?m.select(s.anchor.offset,s.focus.offset):Bu(s)&&m.select(0,m.getTextContent().length)),c.replace(i),p}}}function Yu(t,e,o){let r=[...t],n=r.map(c=>c.getTextContent()).join(""),i=n,l,a=0;for(;(l=ki(i,e))!=null&&l!==null;){let c=l.index,u=l.length,p=c+u;if(Vu(a+c,a+p,n,r)){let[d,,m,f]=Ku(r,a+c,a+p),h=a+c-d,g=a+p-d,x=Zu(m,h,g,l);r=x?[x,...f]:f,o(l.url,null),a=0}else a+=p;i=i.substring(p)}}function Bo(t,e,o){let r=t.getChildren(),n=r.length;for(let c=0;c<n;c++){let u=r[c];if(!st(u)||!u.isSimpleText()){Vt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=ki(i,e);if(l===null||l.text!==i){Vt(t),o(null,t.getFields()?.url??null);return}if(!Ni(t)||!Ri(t)){Vt(t),o(null,t.getFields()?.url??null);return}let a=t.getFields()?.url;if(a!==l?.url){let c=t.getFields();c.url=l?.url,t.setFields(c),o(l.url,a??null)}}function zu(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(fe(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Ho(i)||Wu(i,l))&&(r.append(t),Bo(r,e,o),o(null,r.getFields()?.url??null))}fe(n)&&!Li(i)&&(Vt(n),Bo(n,e,o),o(null,n.getFields()?.url??null))}function Vt(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 Xu(t){let e=[t],o=t.getNextSibling();for(;o!==null&&st(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Ju(t,e,o){let r=Ou(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([pe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(a,c)=>{o?.(a,c)};return Fu(t.registerNodeTransform(ju,a=>{let c=a.getParentOrThrow(),u=a.getPreviousSibling();if(fe(c))Bo(c,e,l);else if(!V(c)){if(a.isSimpleText()&&(Ho(a.getTextContent())||!fe(u))){let p=Xu(a);Yu(p,e,l)}zu(a,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=i):(n=r[3],i=r[4]),Uu(n,i)}var qu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Qu=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,ed=[Ti(qu,t=>t.startsWith("http")?t:`https://${t}`),Ti(Qu,t=>`mailto:${t}`)],Si=()=>{let[t]=$u();return Ju(t,ed),null};import{jsx as td}from"react/jsx-runtime";import{ClickableLinkPlugin as od}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ii=()=>td(od,{});import{jsx as _d}from"react/jsx-runtime";import"react";import{createPortal as Td}from"react-dom";import{jsx as he,jsxs as at,Fragment as nd}from"react/jsx-runtime";import{useLexicalComposerContext as id}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as yi,mergeRegister as vi}from"@lexical/utils";import{getTranslation as jo}from"@payloadcms/translations";import{CloseMenuIcon as ld,EditIcon as sd,ExternalLinkIcon as Mi,formatDrawerSlug as ad,useConfig as cd,useEditDepth as ud,useLocale as dd,useTranslation as md}from"@payloadcms/ui";import{requests as pd}from"@payloadcms/ui/shared";import{$getSelection as Di,$isLineBreakNode as fd,$isRangeSelection as Ai,COMMAND_PRIORITY_HIGH as hd,COMMAND_PRIORITY_LOW as Oi,getDOMSelection as gd,KEY_ESCAPE_COMMAND as Cd,SELECTION_CHANGE_COMMAND as xd}from"lexical";import $i,{useCallback as Fi,useEffect as zt,useRef as bd,useState as Ie}from"react";function Zt(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),a=o.getBoundingClientRect(),c=i.getBoundingClientRect(),u=t.top-r,p=t.left-n;u<c.top&&(u+=l.height+t.height+r*2),p+l.width>c.right&&(p=c.right-l.width-n),u-=a.top,p-=a.left,e.style.opacity="1",e.style.transform=`translate(${p}px, ${u}px)`}import{createCommand as rd}from"lexical";var Yt=rd("TOGGLE_LINK_WITH_MODAL_COMMAND");function Pi(t){t.preventDefault()}function Bi({anchorElem:t}){let[e]=id(),[o,r]=Ie(),n=bd(null),[i,l]=Ie(null),[a,c]=Ie(null),{fieldProps:{schemaPath:u},uuid:p}=P(),{config:s,getEntityConfig:d}=cd(),{i18n:m,t:f}=md(),[h,g]=Ie(),x=ud(),[N,v]=Ie(!1),[b,T]=Ie([]),C=dd(),[E,M]=Ie(!1),k=ad({slug:"lexical-rich-text-link-"+p,depth:x}),{toggleDrawer:S}=ae(k),D=Fi(()=>{v(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),M(!1),l(null),c(null),T([]),g(void 0)},[v,l,c,T]),w=Fi(()=>{let _=Di(),L;if(!Ai(_)||!_){D();return}let R=je(_);L=e.getElementByKey(R.getKey())?.getBoundingClientRect();let I=yi(R,V),O=_.getNodes().filter(K=>!fd(K)).find(K=>{let Z=yi(K,V);return I&&!I.is(Z)||Z&&!Z.is(I)});if(I==null||O){D();return}r(I);let A=I.getFields(),H={...A,id:I.getID(),text:I.getTextContent()};if(A?.linkType==="custom")l(A?.url??null),c(null);else{l(`${s.routes.admin==="/"?"":s.routes.admin}/collections/${A?.doc?.relationTo}/${A?.doc?.value}`);let K=A?.doc?.relationTo?d({collectionSlug:A?.doc?.relationTo}):void 0;if(!K)c(A?.label?String(A?.label):null),l(A?.url?String(A?.url):null);else{let Z=typeof A.doc?.value=="object"?A.doc.value.id:A.doc?.value,Oe=A.doc?.relationTo;if(!Z||!Oe)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let _e=f("fields:linkedTo",{label:`${jo(K.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");c(_e),pd.get(`${s.serverURL}${s.routes.api}/${Oe}/${Z}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:C?.code}}).then(async se=>{if(!se.ok)throw new Error(`HTTP error! Status: ${se.status}`);let Lt=await se.json(),Te=K?.admin?.useAsTitle||"id",Nt=Lt[Te],$e=f("fields:linkedTo",{label:`${jo(K.labels.singular,m)} - ${Nt}`}).replace(/<[^>]*>?/g,"");c($e)}).catch(()=>{let se=f("fields:linkedTo",{label:`${jo(K.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${Z}`}).replace(/<[^>]*>?/g,"");c(se)})}}g(H),v(!0),T(_?_?.getNodes():[]),fe(I)?M(!0):M(!1);let j=n.current,ee=gd(e._window),{activeElement:wt}=document;if(j===null)return;let kt=e.getRootElement();return ee!==null&&kt!==null&&kt.contains(ee.anchorNode)?(L||(L=ee.getRangeAt(0).getBoundingClientRect()),L!=null&&(L.y+=40,Zt(L,j,t))):(wt==null||wt.className!=="link-input")&&(kt!==null&&Zt(null,j,t),l(null),c(null)),!0},[e,D,s.routes.admin,s.routes.api,s.serverURL,d,f,m,C?.code,t]);return zt(()=>vi(e.registerCommand(Yt,_=>(e.dispatchCommand(ne,_),w(),S(),!0),Oi)),[e,w,S,k]),zt(()=>{let _=t.parentElement,L=()=>{e.getEditorState().read(()=>{w()})};return window.addEventListener("resize",L),_?.addEventListener("scroll",L),()=>{window.removeEventListener("resize",L),_?.removeEventListener("scroll",L)}},[t.parentElement,e,w]),zt(()=>vi(e.registerUpdateListener(({editorState:_})=>{_.read(()=>{w()})}),e.registerCommand(xd,()=>(w(),!0),Oi),e.registerCommand(Cd,()=>N?(D(),!0):!1,hd)),[e,w,N,D]),zt(()=>{e.getEditorState().read(()=>{w()})},[e,w]),at($i.Fragment,{children:[he("div",{className:"link-editor",ref:n,children:at("div",{className:"link-input",children:[i&&i.length>0?at("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?he(Mi,{}):null,a!=null&&a.length>0?a:i]}):a!=null&&a.length>0?at(nd,{children:[o?.__fields.newTab?he(Mi,{}):null,he("span",{className:"link-input__label-pure",children:a})]}):null,e.isEditable()&&at($i.Fragment,{children:[he("button",{"aria-label":"Edit link",className:"link-edit",onClick:_=>{_.preventDefault(),S()},onMouseDown:Pi,tabIndex:0,type:"button",children:he(sd,{})}),!E&&he("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ne,null)},onMouseDown:Pi,tabIndex:0,type:"button",children:he(ld,{})})]})]})}),he(ze,{className:"lexical-link-edit-drawer",data:h,drawerSlug:k,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(_,L)=>{let R=L,I={...R};delete I.text,e.update(()=>{let O=Di(),A=null;if(Ai(O)?A=je(O).getParent():b.length&&(A=b[0]?.getParent()??null),A&&fe(A)){let H=me({fields:I});A.replace(H,!0)}}),e.dispatchCommand(ne,{fields:I,selectedNodes:b,text:R.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Hi=t=>{let{anchorElem:e=document.body}=t;return Td(_d(Bi,{anchorElem:e}),e)};import{c as kd}from"react/compiler-runtime";import{useLexicalComposerContext as Ld}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Nd}from"@lexical/utils";import{$getSelection as Rd,$isElementNode as Sd,$isRangeSelection as Id,COMMAND_PRIORITY_LOW as Ui,PASTE_COMMAND as yd}from"lexical";import{useEffect as vd}from"react";var Ed=/^(?:[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+)?$/,wd=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function ji(t){if(!t)return!1;if(t==="https://"||Ed.test(t)||wd.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Gi=t=>{let e=kd(5),{clientProps:o}=t,[r]=Ld(),n,i;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Nd(r.registerCommand(ne,l=>l===null?(Po(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),Po(l),!0),Ui),r.registerCommand(yd,l=>{let a=Rd();if(!Id(a)||a.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let c=l.clipboardData.getData("text");if(!ji(c))return!1;if(!a.getNodes().some(Md)){let u={doc:null,linkType:"custom",newTab:!1,url:c};return r.dispatchCommand(ne,{fields:u,text:null}),l.preventDefault(),!0}return!1},Ui))},i=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=i):(n=e[3],i=e[4]),vd(n,i),null};function Md(t){return Sd(t)}var Vi=[Ao([{ChildComponent:hi,isActive:({selection:t})=>{if(Wi(t)){let e=je(t);return Dd(e,V)!=null}return!1},isEnabled:({selection:t})=>!!(Wi(t)&&Uo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ne,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Uo()?.getTextContent(),r=Uo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,newTab:!1};t.dispatchCommand(Yt,{fields:n,selectedNodes:r,text:o})}},order:1}])],Ad=y({markdownTransformers:[bi],nodes:[q,pe],plugins:[{Component:Gi,position:"normal"},{Component:Si,position:"normal"},{Component:Ii,position:"normal"},{Component:Hi,position:"floatingAnchorElem"}],toolbarFixed:{groups:Vi},toolbarInline:{groups:Vi}});import{$isListNode as Vo,INSERT_CHECK_LIST_COMMAND as Ji,ListItemNode as Kd,ListNode as Zd}from"@lexical/list";import{$isRangeSelection as Yd}from"lexical";import{jsx as Ki,jsxs as Od}from"react/jsx-runtime";import"react";var Go=()=>Od("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 $d}from"react/jsx-runtime";import{ListPlugin as Fd}from"@lexical/react/LexicalListPlugin.js";import"react";var Ue=()=>$d(Fd,{});function Ge(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as jd,ListItemNode as Ud,ListNode as Gd}from"@lexical/list";import{$createListItemNode as Pd,$createListNode as Bd,$isListItemNode as Hd,$isListNode as Wo}from"@lexical/list";var Zi=4,We=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Pd(t==="check"?r[3]==="x":void 0);if(Wo(i)&&i.getListType()===t){let c=i.getFirstChild();c!==null?c.insertBefore(l):i.append(l),e.remove()}else if(Wo(n)&&n.getListType()===t)n.append(l),e.remove();else{let c=Bd(t,t==="number"?Number(r[2]):void 0);c.append(l),e.replace(c)}l.append(...o),l.select(0,0);let a=Math.floor(r[1].length/Zi);a&&l.setIndent(a)},ye=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(Hd(l)){if(l.getChildrenSize()===1){let p=l.getFirstChild();if(Wo(p)){r.push(ye(p,e,o+1));continue}}let a=" ".repeat(o*Zi),c=t.getListType(),u=c==="number"?`${t.getStart()+i}. `:c==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(a+u+e(l)),i++}return r.join(`
36
- `)};var Yi={type:"element",dependencies:[Gd,Ud],export:(t,e)=>jd(t)?ye(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:We("check")};import{jsx as Wd}from"react/jsx-runtime";import{CheckListPlugin as Vd}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var zi=()=>Wd(Vd,{});var Xi=[J([{ChildComponent:Go,isActive:({selection:t})=>{if(!Yd(t))return!1;for(let e of t.getNodes()){if(Vo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Vo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Vo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ji,void 0)},order:12}])],zd=y(({featureProviderMap:t})=>{let e=[{Component:zi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ue,position:"normal"}),{markdownTransformers:[Yi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Zd,Kd],plugins:e,slashMenu:{groups:[Ge([{Icon:Go,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Ji,void 0)}}])]},toolbarFixed:{groups:Xi},toolbarInline:{groups:Xi}}});import{$isListNode as Zo,INSERT_ORDERED_LIST_COMMAND as el,ListItemNode as em,ListNode as tm}from"@lexical/list";import{$isRangeSelection as om}from"lexical";import{jsx as ct,jsxs as Xd}from"react/jsx-runtime";import"react";var Ko=()=>Xd("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:[ct("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"}),ct("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"}),ct("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Jd,ListItemNode as qd,ListNode as Qd}from"@lexical/list";var qi={type:"element",dependencies:[Qd,qd],export:(t,e)=>Jd(t)?ye(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:We("number")};var Qi=[J([{ChildComponent:Ko,isActive:({selection:t})=>{if(!om(t))return!1;for(let e of t.getNodes()){if(Zo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Zo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Zo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(el,void 0)},order:10}])],rm=y(({featureProviderMap:t})=>({markdownTransformers:[qi],nodes:t.has("orderedList")?[]:[tm,em],plugins:t.has("orderedList")?[]:[{Component:Ue,position:"normal"}],slashMenu:{groups:[Ge([{Icon:Ko,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(el,void 0)}}])]},toolbarFixed:{groups:Qi},toolbarInline:{groups:Qi}}));import{$isListNode as zo,INSERT_UNORDERED_LIST_COMMAND as rl,ListItemNode as am,ListNode as cm}from"@lexical/list";import{$isRangeSelection as um}from"lexical";import{jsx as Ve,jsxs as nm}from"react/jsx-runtime";import"react";var Yo=()=>nm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ve("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ve("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ve("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ve("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Ve("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Ve("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as im,ListItemNode as lm,ListNode as sm}from"@lexical/list";var tl={type:"element",dependencies:[sm,lm],export:(t,e)=>im(t)?ye(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:We("bullet")};var ol=[J([{ChildComponent:Yo,isActive:({selection:t})=>{if(!um(t))return!1;for(let e of t.getNodes()){if(zo(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(zo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(zo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(rl,void 0)},order:11}])],dm=y({markdownTransformers:[tl],nodes:[cm,am],plugins:[{Component:Ue,position:"normal"}],slashMenu:{groups:[Ge([{Icon:Yo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(rl,void 0)}}])]},toolbarFixed:{groups:ol},toolbarInline:{groups:ol}});import{jsx as mm}from"react/jsx-runtime";import{addClassNamesToElement as pm}from"@lexical/utils";import{DecoratorNode as fm}from"lexical";import*as nl from"react";var hm=nl.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),ut=class t extends fm{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return gm({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return pm(o,"unknownConverted"),o}decorate(){return mm(hm,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function gm({data:t}){return new ut({data:t})}var Cm=y(()=>({nodes:[ut]}));import{jsx as xm}from"react/jsx-runtime";import{addClassNamesToElement as bm}from"@lexical/utils";import{DecoratorNode as _m}from"lexical";import*as il from"react";var Tm=il.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),dt=class t extends _m{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Em({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return bm(o,"unknownConverted"),o}decorate(){return xm(Tm,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Em({data:t}){return new dt({data:t})}var wm=y(()=>({nodes:[dt]}));import{$setBlocksType as al}from"@lexical/selection";import{$createParagraphNode as cl,$getSelection as ul,$isParagraphNode as ll,$isRangeSelection as km}from"lexical";var sl=[J([{ChildComponent:Je,isActive:({selection:t})=>{if(!km(t))return!1;for(let e of t.getNodes())if(!ll(e)&&!ll(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ul();al(e,()=>cl())})},order:1}])],Lm=y({slashMenu:{groups:[z([{Icon:Je,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ul();al(e,()=>cl())})}}])]},toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{$isNodeSelection as cp}from"lexical";import{jsx as mt,jsxs as Nm}from"react/jsx-runtime";import"react";var Xo=()=>Nm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mt("g",{clipPath:"url(#clip0_4397_10817)",children:mt("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"})}),mt("defs",{children:mt("clipPath",{id:"clip0_4397_10817",children:mt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Im}from"react/jsx-runtime";import*as ml from"react";import{DecoratorBlockNode as Rm}from"@lexical/react/LexicalDecoratorBlockNode.js";function Sm(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:dl({relationTo:o,value:e})}:null}var pt=class extends Rm{__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:Sm,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=dl(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function dl(t){return new pt({data:t})}var ym=ml.lazy(()=>import("./RelationshipComponent-JPESGV4Q.js").then(t=>({default:t.RelationshipComponent})));function vm(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 ge=class extends pt{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:vm,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 Im(ym,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function ve(t){return new ge({data:t})}function Jo(t){return t instanceof ge}import{c as zm}from"react/compiler-runtime";import{jsx as Xm}from"react/jsx-runtime";import{useLexicalComposerContext as Jm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as qm}from"@lexical/utils";import{useConfig as Qm}from"@payloadcms/ui";import{$getPreviousSelection as ep,$getSelection as tp,$isParagraphNode as xl,$isRangeSelection as op,COMMAND_PRIORITY_EDITOR as rp,createCommand as np}from"lexical";import{useEffect as ip}from"react";import{c as Gm}from"react/compiler-runtime";import{jsx as Xt}from"react/jsx-runtime";import{useLexicalComposerContext as Wm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Vm,COMMAND_PRIORITY_EDITOR as Km}from"lexical";import{useEffect as Zm,useState as hl}from"react";import{c as Mm}from"react/compiler-runtime";import{jsx as Dm}from"react/jsx-runtime";import{useLexicalComposerContext as Am}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Om,useModal as $m}from"@payloadcms/ui";import{$getNodeByKey as pl,$getPreviousSelection as Fm,$getRoot as Pm,$getSelection as Bm,$isRangeSelection as Hm,$setSelection as jm}from"lexical";import{useEffect as Um,useState as fl}from"react";var ft=t=>{let e=Mm(23),[o]=Am(),[r,n]=fl(null),[i,l]=fl(!1),[a,c,u]=Om(t),{closeDrawer:p,drawerSlug:s,isDrawerOpen:d,openDrawer:m}=u,{modalState:f}=$m(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let S=Bm()??Fm();n(S)},e[0]=h):h=e[0];let g=h,x;e[1]!==o||e[2]!==r?(x=()=>{r&&o.update(()=>{if(Hm(r)){let{anchor:S,focus:D}=r;pl(S.key)&&pl(D.key)&&jm(r.clone())}else Pm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=x):x=e[3];let N=x,v;e[4]!==p?(v=()=>{p()},e[4]=p,e[5]=v):v=e[5];let b=v,T,C;e[6]!==s||e[7]!==f||e[8]!==N||e[9]!==i?(T=()=>{if(!i)return;let S=f[s];S&&!S?.isOpen&&(l(!1),setTimeout(()=>{N()},1))},C=[f,s,N,i],e[6]=s,e[7]=f,e[8]=N,e[9]=i,e[10]=T,e[11]=C):(T=e[10],C=e[11]),Um(T,C);let E;e[12]!==c?(E=S=>Dm(c,{...S,onClick:()=>{g()}}),e[12]=c,e[13]=E):E=e[13];let M;e[14]!==m?(M=()=>{g(),m(),l(!0)},e[14]=m,e[15]=M):M=e[15];let k;return e[16]!==a||e[17]!==b||e[18]!==d||e[19]!==s||e[20]!==E||e[21]!==M?(k={closeListDrawer:b,isListDrawerOpen:d,ListDrawer:a,listDrawerSlug:s,ListDrawerToggler:E,openListDrawer:M},e[16]=a,e[17]=b,e[18]=d,e[19]=s,e[20]=E,e[21]=M,e[22]=k):k=e[22],k};var Ym=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Vm(o);n&&n.replace(ve({relationTo:e,value:r}))}):t.dispatchCommand(qo,{relationTo:e,value:r})},gl=t=>{let e=Gm(16),{enabledCollectionSlugs:o}=t,[r]=Wm(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i]=hl(n),[l,a]=hl(null),c=o||void 0,u;e[2]!==i||e[3]!==c?(u={collectionSlugs:c,selectedCollection:i},e[2]=i,e[3]=c,e[4]=u):u=e[4];let{closeListDrawer:p,ListDrawer:s,openListDrawer:d}=ft(u),m,f;e[5]!==r||e[6]!==d?(m=()=>r.registerCommand(Xe,N=>(a(N?.replace?N?.replace.nodeKey:null),d(),!0),Km),f=[r,d],e[5]=r,e[6]=d,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Zm(m,f);let h;e[9]!==p||e[10]!==r||e[11]!==l?(h=N=>{let{collectionSlug:v,doc:b}=N;Ym({editor:r,relationTo:v,replaceNodeKey:l,value:b.id}),p()},e[9]=p,e[10]=r,e[11]=l,e[12]=h):h=e[12];let g=h,x;return e[13]!==s||e[14]!==g?(x=Xt(s,{onSelect:g}),e[13]=s,e[14]=g,e[15]=x):x=e[15],x},Cl=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Xt(gl,{...t}):Xt(It,{...t,children:Xt(gl,{...t})});var qo=np("INSERT_RELATIONSHIP_COMMAND"),bl=t=>{let e=zm(10),{clientProps:o}=t,[r]=Jm(),{config:n}=Qm(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let p;if(e[0]!==o?.disabledCollections||e[1]!==i){let s;e[3]!==o?.disabledCollections?(s=d=>{let{slug:m}=d;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=s):s=e[4],p=i.filter(s).map(lp),e[0]=o?.disabledCollections,e[1]=i,e[2]=p}else p=e[2];l=p}let a,c;e[5]!==r?(a=()=>{if(!r.hasNodes([ge]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(qo,ap,rp)},c=[r],e[5]=r,e[6]=a,e[7]=c):(a=e[6],c=e[7]),ip(a,c);let u;return e[8]!==l?(u=Xm(Cl,{enabledCollectionSlugs:l}),e[8]=l,e[9]=u):u=e[9],u};function lp(t){let{slug:e}=t;return e}function sp(t){return xl(t)}function ap(t){let e=tp()||ep();if(op(e)){let o=ve(t);qm(o);let{focus:r}=e,n=r.getNode();xl(n)&&n.getTextContentSize()===0&&n.getParentOrThrow().getChildren().filter(sp).length>1&&n.remove()}return!0}var up=y({nodes:[ge],plugins:[{Component:bl,position:"normal"}],slashMenu:{groups:[z([{Icon:Xo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:Xo,isActive:({selection:t})=>{if(!cp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Jo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]}});import{c as Ll}from"react/compiler-runtime";import{jsx as oe,jsxs as yp}from"react/jsx-runtime";import{useLexicalComposerContext as vp}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Mp,useThrottledEffect as Dp,useTranslation as Ap}from"@payloadcms/ui";import*as Ce from"react";import{useMemo as Op}from"react";import{c as dp}from"react/compiler-runtime";import{jsx as mp}from"react/jsx-runtime";import{mergeRegister as pp}from"@lexical/utils";import{$addUpdateTag as fp,$getSelection as hp}from"lexical";import{useEffect as Jt,useState as Qo}from"react";var er="toolbar-popup__button",ht=t=>{let e=dp(34),{children:o,editor:r,item:n}=t,[i,l]=Qo(!0),[a,c]=Qo(!1),[u,p]=Qo(er),s=P(),d;e[0]!==a||e[1]!==r||e[2]!==s||e[3]!==i||e[4]!==n?(d=()=>{r.getEditorState().read(()=>{let M=hp();if(M){if(n.isActive){let k=n.isActive({editor:r,editorConfigContext:s,selection:M});a!==k&&c(k)}if(n.isEnabled){let k=n.isEnabled({editor:r,editorConfigContext:s,selection:M});i!==k&&l(k)}}})},e[0]=a,e[1]=r,e[2]=s,e[3]=i,e[4]=n,e[5]=d):d=e[5];let m=d,f,h;e[6]!==m?(f=()=>{m()},h=[m],e[6]=m,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Jt(f,h);let g,x;e[9]!==m?(g=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),x=[m],e[9]=m,e[10]=g,e[11]=x):(g=e[10],x=e[11]),Jt(g,x);let N,v;e[12]!==r||e[13]!==m?(N=()=>pp(r.registerUpdateListener(()=>{m()})),v=[r,m],e[12]=r,e[13]=m,e[14]=N,e[15]=v):(N=e[14],v=e[15]),Jt(N,v);let b;e[16]!==a||e[17]!==i||e[18]!==n.key?(b=()=>{p([er,i===!1?"disabled":"",a?"active":"",n?.key?`${er}-`+n.key:""].filter(Boolean).join(" "))},e[16]=a,e[17]=i,e[18]=n.key,e[19]=b):b=e[19];let T;e[20]!==a||e[21]!==u||e[22]!==i||e[23]!==n.key?(T=[i,a,u,n.key],e[20]=a,e[21]=u,e[22]=i,e[23]=n.key,e[24]=T):T=e[24],Jt(b,T);let C;e[25]!==a||e[26]!==r||e[27]!==i||e[28]!==n?(C=()=>{if(i!==!1)return r.focus(()=>{r.update(gp),n.onSelect?.({editor:r,isActive:a})}),!0},e[25]=a,e[26]=r,e[27]=i,e[28]=n,e[29]=C):C=e[29];let E;return e[30]!==o||e[31]!==u||e[32]!==C?(E=mp("button",{className:u,onClick:C,onMouseDown:Cp,type:"button",children:o}),e[30]=o,e[31]=u,e[32]=C,e[33]=E):E=e[33],E};function gp(){fp("toolbar")}function Cp(t){t.preventDefault()}import{c as kp}from"react/compiler-runtime";import{jsx as Ke}from"react/jsx-runtime";import rr,{useCallback as Lp,useEffect as kl}from"react";import{mergeRegister as Np}from"@lexical/utils";import{useTranslation as Rp}from"@payloadcms/ui";import{$getSelection as Sp}from"lexical";import{jsx as ke,jsxs as _l}from"react/jsx-runtime";import{Button as xp}from"@payloadcms/ui";import{$addUpdateTag as bp}from"lexical";import qt,{useCallback as _p,useEffect as gt,useMemo as Tp,useRef as or,useState as Qt}from"react";import{createPortal as Ep}from"react-dom";var tr="toolbar-popup__dropdown-item",Tl=qt.createContext(null);function El({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[a,c]=Qt(tr);gt(()=>{c([tr,r===!1?"disabled":"",t?"active":"",i?.key?`${tr}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,a,i.key]);let u=or(null),p=qt.useContext(Tl);if(p===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:s}=p;return gt(()=>{u?.current!=null&&s(u)},[u,s]),ke(xp,{"aria-label":l,buttonStyle:"none",className:a,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{bp("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:d=>{d.preventDefault()},ref:u,tooltip:l,type:"button",children:e})}function wp({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=Qt(),[l,a]=Qt(),c=_p(s=>{i(d=>d!=null?[...d,s]:[s])},[i]),u=s=>{if(n==null)return;let{key:d}=s;["ArrowDown","ArrowUp","Escape","Tab"].includes(d)&&s.preventDefault(),d==="Escape"||d==="Tab"?r():d==="ArrowUp"?a(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):d==="ArrowDown"&&a(m=>m==null?n[0]:n[n.indexOf(m)+1])},p=Tp(()=>({registerItem:c}),[c]);return gt(()=>{n!=null&&l==null&&a(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),ke(Tl.Provider,{value:p,children:ke("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:u,ref:e,children:t})})}function wl({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:a}){let c=or(null),u=or(null),[p,s]=Qt(!1),d=()=>{s(!1),u?.current!=null&&u.current.focus()};gt(()=>{let f=u.current,h=c.current;if(p&&f!==null&&h!==null){let{left:g,top:x}=f.getBoundingClientRect(),N=window.scrollY||document.documentElement.scrollTop;h.style.top=`${x+N+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[c,u,p]),gt(()=>{let f=u.current;if(f!==null&&p){let h=g=>{let{target:x}=g;a!=null&&c.current!=null&&c.current.contains(x)||f.contains(x)||s(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[c,u,p,a]);let m=Ep(ke(wp,{dropDownRef:c,itemsContainerClassNames:i,onClose:d,children:o}),document.body);return _l(qt.Fragment,{children:[_l("button",{"aria-label":t,className:e+(p?" active":""),disabled:r,onClick:f=>{f.preventDefault(),s(!p)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[n&&ke(n,{}),l&&ke("span",{className:"toolbar-popup__dropdown-label",children:l}),ke("i",{className:"toolbar-popup__dropdown-caret"})]}),p&&ke(qt.Fragment,{children:m})]})}var nr="toolbar-popup__dropdown",Ip=t=>{let e=kp(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:a}=Rp(),{fieldProps:c}=P(),{featureClientSchemaMap:u,schemaPath:p}=c;if(l.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==l?(f=l?.Component&&Ke(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=o,e[1]=r,e[2]=n,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let s=l.key,d;if(l.label){let f;e[6]!==u||e[7]!==a||e[8]!==l||e[9]!==p?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:u,i18n:a,schemaPath:p}):l.label,e[6]=u,e[7]=a,e[8]=l,e[9]=p,e[10]=f):f=e[10],s=f}s.length>25?d=s.substring(0,25)+"...":d=s;let m;return e[11]!==o||e[12]!==d||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==s?(m=Ke(El,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?Ke(l.ChildComponent,{}):void 0,item:l,tooltip:s,children:Ke("span",{className:"text",children:d})},l.key),e[11]=o,e[12]=d,e[13]=n,e[14]=i,e[15]=l,e[16]=s,e[17]=m):m=e[17],m},Me=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:i,label:l,maxActiveItems:a,onActiveChange:c})=>{let[u,p]=rr.useState([]),[s,d]=rr.useState([]),[m,f]=rr.useState(!0),h=P(),{items:g,key:x}=r,N=Lp(()=>{o.getEditorState().read(()=>{let v=Sp();if(!v)return;let b=[],T=[],C=[];for(let E of g)E.isActive&&(!a||b.length<a)&&E.isActive({editor:o,editorConfigContext:h,selection:v})&&(b.push(E.key),T.push(E)),E.isEnabled?E.isEnabled({editor:o,editorConfigContext:h,selection:v})&&C.push(E.key):C.push(E.key);r.isEnabled&&f(r.isEnabled({editor:o,editorConfigContext:h,selection:v})),p(b),d(C),c&&c({activeItems:T})})},[o,h,r,g,a,c]);return kl(()=>{N()},[N]),kl(()=>Np(o.registerUpdateListener(()=>{N()})),[o,N]),Ke(wl,{buttonAriaLabel:`${x} dropdown`,buttonClassName:[nr,`${nr}-${x}`,...e||[]].filter(Boolean).join(" "),disabled:!m,Icon:n,itemsContainerClassNames:[`${nr}-items`,...i||[]],label:l,children:g.length?g.map(v=>Ke(Ip,{active:u.includes(v.key),anchorElem:t,editor:o,enabled:s.includes(v.key),item:v},v.key)):null},x)};function $p({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&oe(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?oe(ht,{editor:e,item:o,children:oe(o.ChildComponent,{})},o.key):null}function Fp(t){let e=Ll(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:a}=Ap(),{fieldProps:c}=P(),{featureClientSchemaMap:u,schemaPath:p}=c,[s,d]=Ce.useState(void 0),[m,f]=Ce.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let g;e[4]!==i?(g=[i],e[4]=i,e[5]=g):g=e[5],Ce.useEffect(h,g);let x;e[6]!==u||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==a||e[11]!==p?(x=T=>{let{activeItems:C}=T;if(!C.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),d(void 0)):(f(void 0),d(void 0));return}let E=C[0],M=E.key;E.label&&(M=typeof E.label=="function"?E.label({featureClientSchemaMap:u,i18n:a,schemaPath:p}):E.label),M.length>25&&(M=M.substring(0,25)+"..."),C.length===1?(d(M),f(()=>E.ChildComponent)):(d(a.t("lexical:general:toolbarItemsActive",{count:C.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=u,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=a,e[11]=p,e[12]=x):x=e[12];let N=x,v=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,b;return e[13]!==m||e[14]!==o||e[15]!==s||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==N||e[21]!==v?(b=yp("div",{className:v,children:[i.type==="dropdown"&&i.items.length?m?oe(Me,{anchorElem:o,editor:r,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:s,maxActiveItems:i.maxActiveItems??1,onActiveChange:N}):oe(Me,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:s,maxActiveItems:i.maxActiveItems??1,onActiveChange:N}):null,i.type==="buttons"&&i.items.length?i.items.map(T=>oe($p,{anchorElem:o,editor:r,item:T},T.key)):null,l<n.features.toolbarFixed?.groups.length-1&&oe("div",{className:"divider"})]},i.key),e[13]=m,e[14]=o,e[15]=s,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=N,e[21]=v,e[22]=b):b=e[22],b}function Pp({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=Ce.useRef(null),{y:l}=Mp(),a=Op(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Dp(()=>{if(!a)return;let c=i.current;if(!c)return;let u=c.getBoundingClientRect(),p=a.getBoundingClientRect();if(!(u.bottom<p.top||u.top>p.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),a.classList.remove("fixed-toolbar--hide"),a.classList.add("fixed-toolbar")}},50,[i,a,l]),oe("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:i,children:o.isEditable()&&oe(Ce.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>oe(Fp,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Nl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Nl(t.parentEditor)}return!1},Rl=t=>{let e=Ll(6),{clientProps:o}=t,[r]=vp(),n=P(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,a=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==a||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let p=Nl(n);if(o?.disableIfParentHasFixedToolbar&&p){u=null;break e}if(!a?.features?.toolbarFixed?.groups?.length){u=null;break e}c=oe(Pp,{anchorElem:document.body,editor:l,editorConfig:a,parentWithFixedToolbar:p})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=a,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 Bp=y({plugins:[{Component:Rl,position:"aboveContainer"}]});import{c as yl}from"react/compiler-runtime";import{jsx as ie,jsxs as vl}from"react/jsx-runtime";import{useLexicalComposerContext as Hp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ml}from"@lexical/utils";import{$getSelection as Dl,$isRangeSelection as Sl,$isTextNode as jp,COMMAND_PRIORITY_LOW as Up,getDOMSelection as Al,SELECTION_CHANGE_COMMAND as Gp}from"lexical";import{useCallback as to,useEffect as Ct,useRef as Il,useState as Wp}from"react";import*as oo from"react";import{createPortal as Vp}from"react-dom";function ir(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function eo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:a=!1,targetRect:c,verticalGap:u=10}=t,p=o.parentElement;if(c===null||p==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let s=n.getBoundingClientRect(),d=o.getBoundingClientRect(),m=p.getBoundingClientRect(),f=c.top-s.height-u,h=c.left-i;l==="center"&&(h=c.left+c.width/2-s.width/2);let g=0;return!e&&f<m.top&&!a&&(g=s.height+c.height+u*2,f+=g),l==="center"?h+s.width>m.right?h=m.right-s.width-i:h<m.left&&(h=m.left+i):h+s.width>m.right&&(h=m.right-s.width-i),h-=d.left,n.style.opacity="1",a&&r!==0?(f-=d.bottom-r+s.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=d.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function Kp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ie(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ie(ht,{editor:e,item:o,children:ie(o.ChildComponent,{})},o.key):null}function Zp(t){let e=yl(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=P(),[a,c]=oo.useState(),u;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(u=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=u):u=e[3];let p;e[4]!==n?(p=[n],e[4]=n,e[5]=p):p=e[5],oo.useEffect(u,p);let s;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(s=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0);return}let x=g[0];c(()=>x?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=s):s=e[9];let d=s,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==a||e[11]!==o||e[12]!==r||e[13]!==l.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==i||e[16]!==d||e[17]!==m?(f=vl("div",{className:m,children:[n.type==="dropdown"&&n.items.length?a?ie(Me,{anchorElem:o,editor:r,group:n,Icon:a,maxActiveItems:n.maxActiveItems??1,onActiveChange:d}):ie(Me,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:d}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ie(Kp,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&ie("div",{className:"divider"})]},n.key),e[10]=a,e[11]=o,e[12]=r,e[13]=l.features.toolbarInline?.groups.length,e[14]=n,e[15]=i,e[16]=d,e[17]=m,e[18]=f):f=e[18],f}function Yp({anchorElem:t,editor:e}){let o=Il(null),r=Il(null),{editorConfig:n}=P(),i=to(()=>{if(o?.current){let u=o.current.style.opacity==="0",p=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),p||(o.current.style.pointerEvents="none")}},[o]),l=to(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let p=o.current.style.opacity==="0",s=o.current.style.pointerEvents==="none";if(!p||!s){let d=u.clientX,m=u.clientY,f=document.elementFromPoint(d,m);o.current.contains(f)||i()}}},[i]),a=to(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}),[o,l,a]);let c=to(()=>{let u=Dl(),p=Al(e._window);if(o.current===null)return;let s=t.querySelector(":scope > .link-editor"),d=s!==null&&"style"in s&&s?.style?.opacity==="1",m=e.getRootElement();if(u!==null&&p!==null&&!p.isCollapsed&&m!==null&&m.contains(p.anchorNode)){let f=ir(p,m),h=eo({alwaysDisplayOnTop:d,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&eo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return Ct(()=>{let u=t.parentElement,p=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",p),u&&u.addEventListener("scroll",p),()=>{window.removeEventListener("resize",p),u&&u.removeEventListener("scroll",p)}},[e,c,t]),Ct(()=>(e.getEditorState().read(()=>{c()}),Ml(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(Gp,()=>(c(),!1),Up))),[e,c]),vl("div",{className:"inline-toolbar-popup",ref:o,children:[ie("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,p)=>ie(Zp,{anchorElem:t,editor:e,group:u,index:p},u.key))]})}function zp(t,e){let o=yl(12),[r,n]=Wp(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let d=Dl(),m=Al(t._window),f=t.getRootElement();if(m!==null&&(!Sl(d)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!Sl(d))return;if(d.getTextContent()!==""){let g=d.getNodes(),x=!1;for(let N of g)if(jp(N)){n(!0),x=!0;break}x||n(!1)}else n(!1);let h=d.getTextContent().replace(/\n/g,"");if(!d.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,a,c;o[2]!==l?(a=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),c=[l],o[2]=l,o[3]=a,o[4]=c):(a=o[3],c=o[4]),Ct(a,c);let u,p;if(o[5]!==t||o[6]!==l?(u=()=>Ml(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),p=[t,l],o[5]=t,o[6]=l,o[7]=u,o[8]=p):(u=o[7],p=o[8]),Ct(u,p),!r||!t.isEditable())return null;let s;return o[9]!==e||o[10]!==t?(s=Vp(ie(Yp,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=s):s=o[11],s}var Ol=t=>{let{anchorElem:e}=t,[o]=Hp();return zp(o,e)};var Xp=y({plugins:[{Component:Ol,position:"floatingAnchorElem"}]});import{TableCellNode as A1,TableNode as O1,TableRowNode as $1}from"@lexical/table";import{jsx as $l}from"react/jsx-runtime";import"react";var lr=()=>$l("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$l("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 Jp,$createTableNode as qp,$createTableRowNode as Qp,$isTableCellNode as Fl,$isTableNode as sr,$isTableRowNode as ar,TableCellHeaderStates as ro,TableCellNode as ef,TableNode as tf,TableRowNode as of}from"@lexical/table";import{$isParagraphNode as rf,$isTextNode as nf}from"lexical";var Bl=/^\|(.+)\|\s?$/,lf=/^(\| ?:?-*:? ?)+\|\s?$/,Hl=({allTransformers:t})=>({type:"element",dependencies:[tf,of,ef],export:e=>{if(!sr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!ar(r))continue;let i=!1;for(let l of r.getChildren())Fl(l)&&(n.push(Mr(t,l).replace(/\n/g,"\\n")),l.__headerState===ro.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
37
- `)},regExp:Bl,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(lf.test(n)){let s=e.getPreviousSibling();if(!s||!sr(s))return;let d=s.getChildren(),m=d[d.length-1];if(!m||!ar(m))return;m.getChildren().forEach(f=>{Fl(f)&&f.setHeaderStyles(ro.ROW,ro.ROW)}),e.remove();return}let i=Pl(n,t);if(i==null)return;let l=[i],a=e.getPreviousSibling(),c=i.length;for(;a&&!(!rf(a)||a.getChildrenSize()!==1);){let s=a.getFirstChild();if(!nf(s))break;let d=Pl(s.getTextContent(),t);if(d==null)break;c=Math.max(c,d.length),l.unshift(d);let m=a.getPreviousSibling();a.remove(),a=m}let u=qp();for(let s of l){let d=Qp();u.append(d);for(let m=0;m<c;m++)d.append(m<s.length?s[m]:jl("",t))}let p=e.getPreviousSibling();sr(p)&&sf(p)===c?(p.append(...u.getChildren()),e.remove()):e.replace(u),u.selectEnd()}});function sf(t){let e=t.getFirstChild();return ar(e)?e.getChildrenSize():0}var jl=(t,e)=>{t=t.replace(/\\n/g,`
38
- `);let o=Jp(ro.NO_STATUS);return vr(t,e,o),o},Pl=(t,e)=>{let o=t.match(Bl);return!o||!o[1]?null:o[1].split("|").map(r=>jl(r,e))};import{c as cf}from"react/compiler-runtime";import{jsx as F,jsxs as xe}from"react/jsx-runtime";import{useLexicalComposerContext as Kl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as uf}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as df,$deleteTableRow__EXPERIMENTAL as mf,$getNodeTriplet as pf,$getTableCellNodeFromLexicalNode as Gl,$getTableColumnIndexFromTableCellNode as ff,$getTableNodeFromLexicalNodeOrThrow as De,$getTableRowIndexFromTableCellNode as hf,$insertTableColumn__EXPERIMENTAL as gf,$insertTableRow__EXPERIMENTAL as Cf,$isTableCellNode as xt,$isTableRowNode as Wl,$isTableSelection as bt,$unmergeCell as xf,getTableElement as dr,getTableObserverFromTableElement as mr,TableCellHeaderStates as Le,TableCellNode as bf}from"@lexical/table";import{mergeRegister as _f}from"@lexical/utils";import{useScrollInfo as Tf}from"@payloadcms/ui";import{$createParagraphNode as Ef,$getRoot as wf,$getSelection as io,$isElementNode as kf,$isParagraphNode as Zl,$isRangeSelection as pr,$isTextNode as Lf,COMMAND_PRIORITY_CRITICAL as Nf,getDOMSelection as Rf,SELECTION_CHANGE_COMMAND as Sf}from"lexical";import*as fr from"react";import{useCallback as le,useEffect as Ze,useRef as no,useState as Ye}from"react";import{createPortal as Yl}from"react-dom";import{jsx as cr,jsxs as af}from"react/jsx-runtime";import"react";var Ul=()=>af("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[cr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),cr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),cr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function ur(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function If(){let t=io();if(pr(t)&&!t.isCollapsed()||bt(t)&&!t.anchor.is(t.focus)||!pr(t)&&!bt(t))return!1;let[e]=pf(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Vl(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Zl(e)||!e.isEmpty())}function yf(t){let e=t.getLastDescendant();Lf(e)?e.select():kf(e)?e.selectEnd():e!==null&&e.selectNext()}function vf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Kl(),l=no(null),[a,c]=Ye(n),[u,p]=Ye({columns:1,rows:1}),[s,d]=Ye(!1),[m,f]=Ye(!1),{y:h}=Tf();Ze(()=>i.registerMutationListener(bf,w=>{w.get(a.getKey())==="updated"&&i.getEditorState().read(()=>{c(a.getLatest())})},{skipInitialization:!0}),[i,a]),Ze(()=>{i.getEditorState().read(()=>{let w=io();if(bt(w)){let _=ur(w);p(ur(w)),d(_.columns>1||_.rows>1)}f(If())})},[i]),Ze(()=>{let w=e.current,_=l.current,L=i.getRootElement();if(w!=null&&_!=null&&L!=null){let R=L.getBoundingClientRect(),I=w.getBoundingClientRect();_.style.opacity="1";let O=_.getBoundingClientRect(),A=5,H=I.right+A;if(H+O.width>window.innerWidth||H+O.width>R.right){let ee=I.left-O.width-A;H=(ee<0?A:ee)+window.pageXOffset}_.style.left=`${H+window.pageXOffset}px`;let j=I.top;if(j+O.height>window.innerHeight){let ee=I.bottom-O.height;j=ee<0?A:ee}_.style.top=`${j}px`}},[e,l,i,h]),Ze(()=>{function w(_){l.current!=null&&e.current!=null&&!l.current.contains(_.target)&&!e.current.contains(_.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let g=le(()=>{i.update(()=>{if(a.isAttached()){let _=De(a),L=dr(_,i.getElementByKey(_.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let R=mr(L);R!==null&&R.$clearHighlight(),_.markDirty(),c(a.getLatest())}wf().selectStart()})},[i,a]),x=()=>{i.update(()=>{let w=io();if(bt(w)){let{columns:_,rows:L}=ur(w),R=w.getNodes(),I=null;for(let O=0;O<R.length;O++){let A=R[O];if(xt(A))if(I===null){A.setColSpan(_).setRowSpan(L),I=A;let H=Vl(A),j;H&&Zl(j=A.getFirstChild())&&j.remove()}else xt(I)&&(Vl(A)||I.append(...A.getChildren()),A.remove())}I!==null&&(I.getChildrenSize()===0&&I.append(Ef()),yf(I)),o()}})},N=()=>{i.update(()=>{xf()})},v=le(w=>{i.update(()=>{Cf(w),o()})},[i,o]),b=le(w=>{i.update(()=>{for(let _=0;_<u.columns;_++)gf(w);o()})},[i,o,u.columns]),T=le(()=>{i.update(()=>{mf(),o()})},[i,o]),C=le(()=>{i.update(()=>{De(a).remove(),g(),o()})},[i,a,g,o]),E=le(()=>{i.update(()=>{df(),o()})},[i,o]),M=le(()=>{i.update(()=>{let w=De(a),_=hf(a),L=w.getChildren();if(_>=L.length||_<0)throw new Error("Expected table cell to be inside of table row.");let R=L[_];if(!Wl(R))throw new Error("Expected table row");let I=a.getHeaderStyles()^Le.ROW;R.getChildren().forEach(O=>{if(!xt(O))throw new Error("Expected table cell");O.setHeaderStyles(I,Le.ROW)}),g(),o()})},[i,a,g,o]),k=le(()=>{i.update(()=>{let w=De(a),_=ff(a),L=w.getChildren(),R=Math.max(...L.map(O=>O.getChildren().length));if(_>=R||_<0)throw new Error("Expected table cell to be inside of table row.");let I=a.getHeaderStyles()^Le.COLUMN;for(let O=0;O<L.length;O++){let A=L[O];if(!Wl(A))throw new Error("Expected table row");let H=A.getChildren();if(_>=H.length)continue;let j=H[_];if(!xt(j))throw new Error("Expected table cell");j.setHeaderStyles(I,Le.COLUMN)}g(),o()})},[i,a,g,o]),S=le(()=>{i.update(()=>{if(a.isAttached()){let w=De(a);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[i,a,g,o]),D=null;return t&&(s?D=F("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>x(),type:"button",children:F("span",{className:"text",children:"Merge cells"})}):m&&(D=F("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>N(),type:"button",children:F("span",{className:"text",children:"Unmerge cells"})}))),Yl(xe("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:l,children:[D?xe(fr.Fragment,{children:[D,F("hr",{})]}):null,F("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>S(),type:"button",children:F("span",{className:"text",children:"Toggle Row Striping"})}),F("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>v(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),F("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>v(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),F("hr",{}),F("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),F("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),F("hr",{}),F("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>E(),type:"button",children:F("span",{className:"text",children:"Delete column"})}),F("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>T(),type:"button",children:F("span",{className:"text",children:"Delete row"})}),F("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:F("span",{className:"text",children:"Delete table"})}),F("hr",{}),F("button",{className:"item",onClick:()=>M(),type:"button",children:xe("span",{className:"text",children:[(a.__headerState&Le.ROW)===Le.ROW?"Remove":"Add"," ","row header"]})}),F("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:xe("span",{className:"text",children:[(a.__headerState&Le.COLUMN)===Le.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Mf({anchorElem:t,cellMerge:e}){let[o]=Kl(),r=no(null),n=no(null),[i,l]=Ye(!1),[a,c]=Ye(null),u=le(()=>{let s=r.current,d=io(),m=Rf(o._window),f=document.activeElement;function h(){s&&(s.classList.remove("table-cell-action-button-container--active"),s.classList.add("table-cell-action-button-container--inactive")),c(null)}if(d==null||s==null)return h();let g=o.getRootElement(),x=null,N=null;if(pr(d)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let b=Gl(d.anchor.getNode());if(b==null||(N=o.getElementByKey(b.getKey()),N==null||!b.isAttached()))return h();let T=De(b),C=dr(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");x=mr(C),c(b)}else if(bt(d)){let b=Gl(d.anchor.getNode());if(!xt(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let T=De(b),C=dr(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");x=mr(C),N=o.getElementByKey(b.getKey())}else if(!f)return h();if(x===null||N===null)return h();let v=!x||!x.isSelecting;if(s.classList.toggle("table-cell-action-button-container--active",v),s.classList.toggle("table-cell-action-button-container--inactive",!v),v){let b=N.getBoundingClientRect(),T=t.getBoundingClientRect(),C=b.top-T.top,E=b.right-T.left;s.style.transform=`translate(${E}px, ${C}px)`}},[o,t]);Ze(()=>{let s,d=()=>{s=void 0,o.getEditorState().read(u)},m=()=>(s===void 0&&(s=setTimeout(d,0)),!1);return _f(o.registerUpdateListener(m),o.registerCommand(Sf,m,Nf),o.registerRootListener((f,h)=>{h&&h.removeEventListener("mouseup",m),f&&(f.addEventListener("mouseup",m),m())}),()=>clearTimeout(s))});let p=no(a);return Ze(()=>{p.current!==a&&l(!1),p.current=a},[p,a]),F("div",{className:"table-cell-action-button-container",ref:r,children:a!=null&&xe(fr.Fragment,{children:[F("button",{className:"table-cell-action-button",onClick:s=>{s.stopPropagation(),l(!i)},ref:n,type:"button",children:F(Ul,{})}),i&&F(vf,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:a})]})})}var zl=t=>{let e=cf(3),{anchorElem:o}=t,r=uf(),n;return e[0]!==o||e[1]!==r?(n=Yl(r?F(Mf,{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 Df}from"react/compiler-runtime";import{jsx as so,jsxs as Af}from"react/jsx-runtime";import{useLexicalComposerContext as Of}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as $f}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Ff,$getTableNodeFromLexicalNodeOrThrow as hr,$getTableRowIndexFromTableCellNode as Pf,$isTableCellNode as Xl,$isTableRowNode as Bf,getDOMCellFromTarget as Hf,getTableElement as jf,TableNode as Uf}from"@lexical/table";import{calculateZoomLevel as Jl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as gr}from"lexical";import*as Ql from"react";import{useCallback as _t,useEffect as Cr,useRef as lo,useState as Tt}from"react";import{createPortal as Gf}from"react-dom";var Wf=33,ql=92;function Vf({editor:t}){let e=lo(null),o=lo(null),r=lo(null),n=P(),i=lo(null),[l,a]=Tt(null),[c,u]=Tt(null),[p,s]=Tt(!1),[d,m]=Tt(null),f=_t(()=>{u(null),e.current=null,m(null),i.current=null,r.current=null},[]),h=k=>(k.buttons&1)===1;Cr(()=>t.registerNodeTransform(Uf,k=>{if(k.getColWidths())return k;let S=k.getColumnCount(),D=ql;return k.setColWidths(Array(S).fill(D)),k}),[t]),Cr(()=>{let k=_=>{let L=_.target;if(d){a({x:_.clientX,y:_.clientY});return}if(s(h(_)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let R=Hf(L);R&&c!==R?t.getEditorState().read(()=>{let I=gr(R.elem);if(!I)throw new Error("TableCellResizer: Table cell node not found.");let O=hr(I),A=jf(O,t.getElementByKey(O.getKey()));if(!A)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=A.getBoundingClientRect(),u(R)},{editor:t}):R==null&&f()}},S=_=>{s(!0)},D=_=>{s(!1)},w=t.registerRootListener((_,L)=>{L?.removeEventListener("mousemove",k),L?.removeEventListener("mousedown",S),L?.removeEventListener("mouseup",D),_?.addEventListener("mousemove",k),_?.addEventListener("mousedown",S),_?.addEventListener("mouseup",D)});return()=>{w()}},[c,d,t,f]);let g=k=>k==="bottom",x=_t(k=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=gr(c.elem);if(!Xl(S))throw new Error("TableCellResizer: Table cell node not found.");let D=hr(S),w=Pf(S)+S.getRowSpan()-1,_=D.getChildren();if(w>=_.length||w<0)throw new Error("Expected table cell to be inside of table row.");let L=_[w];if(!Bf(L))throw new Error("Expected table row");let R=L.getHeight();if(R===void 0){let O=L.getChildren();R=Math.min(...O.map(A=>N(A,t)??1/0))}let I=Math.max(R+k,Wf);L.setHeight(I)},{tag:"skip-scroll-into-view"})},[c,t]),N=(k,S)=>S.getElementByKey(k.getKey())?.clientHeight,v=(k,S)=>{let D;return S.forEach(w=>{w.forEach((_,L)=>{_.cell===k&&(D=L)})}),D},b=_t(k=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=gr(c.elem);if(!Xl(S))throw new Error("TableCellResizer: Table cell node not found.");let D=hr(S),[w]=Ff(D,null,null),_=v(S,w);if(_===void 0)throw new Error("TableCellResizer: Table column not found.");let L=D.getColWidths();if(!L)return;let R=L[_];if(R===void 0)return;let I=[...L],O=Math.max(R+k,ql);I[_]=O,D.setColWidths(I)},{tag:"skip-scroll-into-view"})},[c,t]),T=_t(k=>{let S=D=>{if(D.preventDefault(),D.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:w,y:_}=i.current;if(c===null)return;let L=Jl(D.target);if(g(k)){let R=(D.clientY-_)/L;x(R)}else{let R=(D.clientX-w)/L;b(R)}f(),document.removeEventListener("mouseup",S)}};return S},[c,f,b,x]),C=_t(k=>S=>{if(S.preventDefault(),S.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},a(i.current),m(k),document.addEventListener("mouseup",T(k))},[c,T]),[E,M]=Tt({bottom:null,left:null,right:null,top:null});return Cr(()=>{if(c){let{height:k,left:S,top:D,width:w}=c.elem.getBoundingClientRect(),_=Jl(c.elem),L=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+D+k-L/2}px`,width:`${w}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+S+w-L/2}px`,top:`${window.scrollY+D}px`,width:`${L}px`}},I=r.current;d&&l&&I&&(g(d)?(R[d].left=`${window.scrollX+I.left}px`,R[d].top=`${window.scrollY+l.y/_}px`,R[d].height="3px",R[d].width=`${I.width}px`):(R[d].top=`${window.scrollY+I.top}px`,R[d].left=`${window.scrollX+l.x/_}px`,R[d].width="3px",R[d].height=`${I.height}px`),R[d].backgroundColor="#adf"),M(R)}else M({bottom:null,left:null,right:null,top:null})},[c,d,l]),so("div",{ref:o,children:c!=null&&!p&&Af(Ql.Fragment,{children:[so("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:C("right"),style:E.right||void 0}),so("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:C("bottom"),style:E.bottom||void 0})]})})}var es=()=>{let t=Df(3),[e]=Of(),o=$f(),r,n;return t[0]!==e||t[1]!==o?(n=o?Gf(so(Vf,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as Qf}from"react/compiler-runtime";import{jsx as xr,jsxs as e1,Fragment as t1}from"react/jsx-runtime";import{useLexicalComposerContext as as}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as o1,$getTableColumnIndexFromTableCellNode as r1,$getTableRowIndexFromTableCellNode as n1,$insertTableColumn__EXPERIMENTAL as i1,$insertTableRow__EXPERIMENTAL as l1,$isTableCellNode as s1,$isTableNode as rs,getTableElement as a1,TableNode as c1}from"@lexical/table";import{$findMatchingParent as u1,mergeRegister as d1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ns}from"lexical";import{useEffect as is,useMemo as m1,useRef as ls,useState as ao}from"react";import"react";import{createPortal as p1}from"react-dom";import{c as Xf}from"react/compiler-runtime";import{useEffect as Jf,useRef as qf}from"react";var Kf="Expected a function",Zf=Math.max,Yf=Math.min;function zf(t,e,o){let r,n,i=0,l,a=!1,c=!1,u,p,s,d=!0;if(typeof t!="function")throw new TypeError(Kf);e=e||0,typeof o=="object"&&(a=!!o.leading,c="maxWait"in o,u=c?Zf(o.maxWait||0,e):u,d="trailing"in o?!!o.trailing:d);function m(C){let E=r,M=l;return r=l=void 0,i=C,p=t.apply(M,E),p}function f(C){return i=C,s=setTimeout(x,e),a?m(C):p}function h(C){let E=C-n,M=C-i,k=e-E;return c?Yf(k,u-M):k}function g(C){let E=C-n,M=C-i;return n===void 0||E>=e||E<0||c&&M>=u}function x(){let C=Date.now();if(g(C))return N(C);s=setTimeout(x,h(C))}function N(C){return s=void 0,d&&r?m(C):(r=l=void 0,p)}function v(){s!==void 0&&clearTimeout(s),i=0,r=n=l=s=void 0}function b(){return s===void 0?p:N(Date.now())}function T(){let C=Date.now(),E=g(C);if(r=arguments,l=this,n=C,E){if(s===void 0)return f(n);if(c)return clearTimeout(s),s=setTimeout(x,e),m(n)}return s===void 0&&(s=setTimeout(x,e)),p}return T.cancel=v,T.flush=b,T}var ts=zf;function os(t,e,o){let r=Xf(6),n=qf(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=ts(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=i,r[4]=l):(i=r[3],l=r[4]),Jf(i,l);let a;return r[5]===Symbol.for("react.memo_cache_sentinel")?(a=(...u)=>{let p=u;n.current&&n.current(...p)},r[5]=a):a=r[5],a}var ss=20;function f1({anchorElem:t}){let[e]=as(),o=P(),[r,n]=ao(!1),[i,l]=ao(!1),[a,c]=ao(!1),[u,p]=ao({}),s=ls(new Set),d=ls(null),m=os(g=>{let{isOutside:x,tableDOMNode:N}=h1(g,o.editorConfig?.lexical);if(x){n(!1),l(!1);return}if(!N)return;d.current=N;let v=null,b=null,T=null;if(e.getEditorState().read(()=>{let R=ns(N);if(s1(R)){let I=u1(R,O=>rs(O));if(!rs(I))return;if(T=a1(I,e.getElementByKey(I.getKey())),T){let O=I.getChildrenSize(),A=I.getChildAtIndex(0)?.getChildrenSize(),H=n1(R),j=r1(R);H===O-1?v=R:j===A-1&&(b=R)}}},{editor:e}),!T)return;let C=T.parentElement;if(!C)return;let{bottom:E,height:M,left:k,right:S,width:D,y:w}=C.getBoundingClientRect(),{left:_,y:L}=t.getBoundingClientRect();v?(l(!1),n(!0),p({height:ss,left:k-_,top:E-L+5,width:D})):b&&(l(!0),n(!1),p({height:M,left:S-_+5,top:w-L,width:ss}))},50,250),f=m1(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);is(()=>{if(a)return document.addEventListener("mousemove",m),()=>{n(!1),l(!1),document.removeEventListener("mousemove",m)}},[a,m]),is(()=>d1(e.registerMutationListener(c1,g=>{e.getEditorState().read(()=>{let x=!1;for(let[N,v]of g)switch(v){case"created":{s.current.add(N),x=!0;break}case"destroyed":{s.current.delete(N),x=!0;break}default:break}if(x){f.disconnect();for(let N of s.current){let{tableElement:v}=o1(N);f.observe(v)}c(s.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{d.current&&(ns(d.current)?.selectEnd(),g?(l1(),n(!1)):(i1(),l(!1)))})};return e?.isEditable()?e1(t1,{children:[r&&xr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&xr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function h1(t,e){let o=t.target;if(o&&o instanceof HTMLElement){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 cs(t){let e=Qf(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=as();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=p1(xr(f1,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as g1}from"react/compiler-runtime";import{jsx as br,jsxs as C1}from"react/jsx-runtime";import{useLexicalComposerContext as x1}from"@lexical/react/LexicalComposerContext";import{TablePlugin as b1}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as _1,TableNode as T1}from"@lexical/table";import{mergeRegister as E1}from"@lexical/utils";import{formatDrawerSlug as w1,useEditDepth as k1}from"@payloadcms/ui";import{$getSelection as L1,$isRangeSelection as N1,COMMAND_PRIORITY_EDITOR as R1,createCommand as S1}from"lexical";import{createContext as I1,useContext as y1,useEffect as v1,useMemo as M1,useState as D1}from"react";import*as us from"react";var co=S1("OPEN_EMBED_DRAWER_COMMAND"),ds=I1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ms({children:t}){let[e,o]=D1({cellEditorConfig:null,cellEditorPlugins:null});return br(ds.Provider,{value:M1(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ps=()=>{let t=g1(16),[e]=x1(),o=y1(ds),r=k1(),{fieldProps:n,uuid:i}=P(),{schemaPath:l}=n,a="lexical-table-create-"+i,c;t[0]!==r||t[1]!==a?(c=w1({slug:a,depth:r}),t[0]=r,t[1]=a,t[2]=c):c=t[2];let u=c,{toggleDrawer:p}=ae(u,!0),s;t[3]!==e||t[4]!==p?(s=()=>{if(!e.hasNodes([T1]))throw new Error("TablePlugin: TableNode is not registered on editor");return E1(e.registerCommand(co,()=>{let h;return h=null,e.getEditorState().read(()=>{let g=L1();N1(g)&&(h=g)}),h&&p(),!0},R1))},t[3]=e,t[4]=p,t[5]=s):s=t[5];let d;t[6]!==o||t[7]!==e||t[8]!==p?(d=[o,e,p],t[6]=o,t[7]=e,t[8]=p,t[9]=d):d=t[9],v1(s,d);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(_1,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==m?(f=C1(us.Fragment,{children:[br(ze,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:l,schemaPathSuffix:"fields"}),br(b1,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=u,t[13]=l,t[14]=m,t[15]=f):f=t[15],f};var F1=y({markdownTransformers:[Hl],nodes:[O1,A1,$1],plugins:[{Component:ps,position:"normal"},{Component:es,position:"normal"},{Component:zl,position:"floatingAnchorElem"},{Component:cs,position:"floatingAnchorElem"}],providers:[ms],slashMenu:{groups:[z([{Icon:lr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(co,{})}}])]},toolbarFixed:{groups:[de([{ChildComponent:lr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(co,{})}}])]}});import{$isNodeSelection as fh}from"lexical";import{jsx as _r,jsxs as P1}from"react/jsx-runtime";import"react";var Tr=()=>P1("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:[_r("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"}),_r("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"}),_r("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 G1}from"react/jsx-runtime";import gs from"bson-objectid";import{$applyNodeReplacement as W1}from"lexical";import*as Cs from"react";import{jsx as B1}from"react/jsx-runtime";import{DecoratorBlockNode as H1}from"@lexical/react/LexicalDecoratorBlockNode.js";import fs from"bson-objectid";import{$applyNodeReplacement as j1}from"lexical";import"react";function Er(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function U1(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:hs({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Er(e),null}var Et=class extends H1{__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:U1,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new fs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=hs({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return B1(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function hs({data:t}){return t?.id||(t.id=new fs.default().toHexString()),j1(new Et({data:t}))}var V1=Cs.lazy(()=>import("./component-P5K7Z5NW.js").then(t=>({default:t.UploadComponent})));function K1(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Ae({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Er(e),null}var be=class extends Et{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:K1,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new gs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ae({data:o});return r.setFormat(e.format),r}decorate(){return G1(V1,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ae({data:t}){return t?.id||(t.id=new gs.default().toHexString()),W1(new be({data:t}))}function wr(t){return t instanceof be}import{c as eh}from"react/compiler-runtime";import{jsx as th}from"react/jsx-runtime";import{useLexicalComposerContext as oh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as rh,mergeRegister as nh}from"@lexical/utils";import{useConfig as ih}from"@payloadcms/ui";import{$getPreviousSelection as lh,$getSelection as sh,$isParagraphNode as ah,$isRangeSelection as ch,COMMAND_PRIORITY_EDITOR as uh,createCommand as dh}from"lexical";import{useEffect as mh}from"react";import{c as xs}from"react/compiler-runtime";import{jsx as kr}from"react/jsx-runtime";import{useLexicalComposerContext as bs}from"@lexical/react/LexicalComposerContext.js";import{toast as Z1}from"@payloadcms/ui";import{$getNodeByKey as Y1,COMMAND_PRIORITY_EDITOR as _s}from"lexical";import{useEffect as Ts,useState as z1}from"react";var X1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Y1(o);n&&n.replace(Ae({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Lr,{fields:null,relationTo:e,value:r})},J1=t=>{let e=xs(13),{enabledCollectionSlugs:o}=t,[r]=bs(),[n,i]=z1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:a,ListDrawer:c,openListDrawer:u}=ft(l),p,s;e[2]!==r||e[3]!==u?(p=()=>r.registerCommand(Pe,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),_s),s=[r,u],e[2]=r,e[3]=u,e[4]=p,e[5]=s):(p=e[4],s=e[5]),Ts(p,s);let d;e[6]!==a||e[7]!==r||e[8]!==n?(d=h=>{let{collectionSlug:g,doc:x}=h;a(),X1({editor:r,relationTo:g,replaceNodeKey:n,value:x.id})},e[6]=a,e[7]=r,e[8]=n,e[9]=d):d=e[9];let m=d,f;return e[10]!==c||e[11]!==m?(f=kr(c,{onSelect:m}),e[10]=c,e[11]=m,e[12]=f):f=e[12],f},q1=()=>{let t=xs(3),[e]=bs(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Pe,Q1,_s),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ts(o,r),null},Es=t=>kr(It,{...t,FallbackComponent:q1,uploads:!0,children:kr(J1,{...t})});function Q1(){return Z1.error("No upload collections enabled"),!0}var Lr=dh("INSERT_UPLOAD_COMMAND"),ws=t=>{let e=eh(5),[o]=oh(),{config:r}=ih(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([be]))throw new Error("UploadPlugin: UploadNode not registered on editor");return nh(o.registerCommand(Lr,c=>(o.update(()=>{let u=sh()||lh();if(ch(u)){let p=Ae({data:{id:c.id,fields:c.fields,relationTo:c.relationTo,value:c.value}});rh(p);let{focus:s}=u,d=s.getNode();ah(d)&&!d.__first&&(d.__prev||d.__next)&&d.remove()}}),!0),uh))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),mh(i,l);let a;return e[3]!==n?(a=th(Es,{enabledCollectionSlugs:n.map(ph)}),e[3]=n,e[4]=a):a=e[4],a};function ph(t){let{slug:e}=t;return e}var hh=y({nodes:[be],plugins:[{Component:ws,position:"normal"}],slashMenu:{groups:[z([{Icon:Tr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Pe,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:Tr,isActive:({selection:t})=>{if(!fh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Pe,{replace:!1})}}])]}});import{c as gh}from"react/compiler-runtime";import{jsx as Rr}from"react/jsx-runtime";import{ShimmerEffect as Ch,useConfig as xh}from"@payloadcms/ui";import{lazy as bh,Suspense as _h,useEffect as Th,useState as Eh}from"react";var ks={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var uo={namespace:"lexical",theme:ks};function Ls({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:i}){for(let u of i.features)if(!u?.clientFeatureProps?.featureKey||u?.clientFeatureProps?.order===void 0||u?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");i.features=i.features.sort((u,p)=>u.clientFeatureProps.order-p.clientFeatureProps.order);let l=new Map;for(let u of i.features)l.set(u.clientFeatureProps.featureKey,u);let a=new Map,c=0;for(let u of i.features){let p=typeof u.feature=="function"?u.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:l,field:r,resolvedFeatures:a,schemaPath:n,unSanitizedEditorConfig:i}):u.feature;p.key=u.clientFeatureProps.featureKey,p.order=c,a.set(u.clientFeatureProps.featureKey,p),c++}return a}var Ns=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function Nr(t,e,o){return{admin:o,features:Ns(t),lexical:e,resolvedFeatureMap:t}}var wh=bh(()=>import("./Field-NNWFQETL.js").then(t=>({default:t.RichText}))),kh=t=>{let e=gh(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:i,field:l,lexicalEditorConfig:a,schemaPath:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let p=u,s=a===void 0?uo:a,{config:d}=xh(),[m,f]=Eh(null),h,g;e[2]!==p||e[3]!==r||e[4]!==d||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==m||e[9]!==s||e[10]!==c?(h=()=>{if(m)return;let N=[];for(let[T,C]of Object.entries(r))C.clientFeatureProvider&&N.push(C.clientFeatureProvider(C.clientFeatureProps));let v=s||uo,b=Ls({config:d,featureClientImportMap:n,featureClientSchemaMap:i,field:l,schemaPath:c??l.name,unSanitizedEditorConfig:{features:N,lexical:v}});f(Nr(b,v,p))},g=[s,p,m,r,n,i,l,d,c],e[2]=p,e[3]=r,e[4]=d,e[5]=n,e[6]=i,e[7]=l,e[8]=m,e[9]=s,e[10]=c,e[11]=h,e[12]=g):(h=e[11],g=e[12]),Th(h,g);let x;return e[13]!==m||e[14]!==t?(x=Rr(_h,{fallback:Rr(Ch,{height:"35vh"}),children:m&&Rr(wh,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=x):x=e[15],x};function Lh(...t){return t.filter(Boolean).join(" ")}var mo=new WeakMap;function Rs(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function po(t,e){let o=mo.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=Rs(l))},i=l=>{if(o===void 0)return;let{start:a}=o;if(a===null)return;let c=Rs(l);for(let u of r)c!==null&&u([c[0]-a[0],c[1]-a[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},mo.set(t,o)}return o.listeners.add(e),()=>{Nh(t,e)}}function Nh(t,e){let o=mo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(mo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Rh(t,e){return po(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function Sh(t,e){return po(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function Ih(t,e){return po(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function yh(t,e){return po(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var $={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},vh=$.IS_BOLD|$.IS_ITALIC|$.IS_STRIKETHROUGH|$.IS_UNDERLINE|$.IS_CODE|$.IS_SUBSCRIPT|$.IS_SUPERSCRIPT|$.IS_HIGHLIGHT,Mh="\xA0",Dh=`
34
+ `},[t,e]),m=Re((b,T)=>{o(C=>{let E=e.length-1,M=e[E];if(M&&M.name===b){if(b==="type")return[...e.slice(0,E),{...M,value:M.value+T}];if(M.value===T)return[...e.slice(0,E),{...M,count:M.count+1}]}return[...C,{name:b,count:1,value:T}]})},[e,o]);ln(()=>{let b=C=>{if(!r)return;let E=C.key;oc(C)?m("selectAll",""):an.has(E)?m("press",C.key):[...E].length>1?m("keydown",C.key):m("type",C.key)},T=C=>{if(!r)return;let E=C.key;!an.has(E)&&[...E].length>1&&m("keyup",C.key)};return t.registerRootListener((C,E)=>{E!==null&&(E.removeEventListener("keydown",b),E.removeEventListener("keyup",T)),C!==null&&(C.addEventListener("keydown",b),C.addEventListener("keyup",T))})},[t,r,m]),ln(()=>{p.current&&p.current.scrollTo(0,p.current.scrollHeight)},[d]),Io(()=>{if(e){let b=d();b!==null&&s(b),p.current&&p.current.scrollTo(0,p.current.scrollHeight)}},[d,e]),Io(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:C,editorState:E})=>{if(!r)return;let M=E._selection,k=c.current,S=u.current;if(k!==M){if(C.size===0&&T.size===0&&!S){let w=So(t._window);if(w&&(w.anchorNode==null||w.focusNode==null))return}c.current=M}u.current=!1;let D=d();D!==null&&s(D)}),[t,d,r,m]),Io(()=>r?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,r]);let f=Re(b=>{r||(b.update(()=>{let T=qa();T.clear();let C=Ja();T.append(Xa().append(C)),C.select()}),o([])),n(T=>!T)},[r]),h=Re(()=>{if(!r)return;let b=So(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:T,anchorOffset:C,focusNode:E,focusOffset:M}=rc(b),k=a().getRootElement(),S;T!==null&&(S=sn(T,k));let D;E!==null&&(D=sn(E,k)),m("snapshot",{anchorNode:T,anchorOffset:C,anchorPath:S,focusNode:E,focusOffset:M,focusPath:D})},[m,r,a]),g=Re(()=>{Qa(d())},[d]),x=Re(()=>{ec("test.js",d())},[d]);return[Se("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(a()),b.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?vo("div",{className:"test-recorder-output",children:[vo("div",{className:"test-recorder-toolbar",children:[Se("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Se("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Se("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{x(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Se("pre",{id:"test-recorder",ref:p,children:l})]}):null]}var un=()=>{let t=Ya(3),[e]=za(),[o,r]=nc(e),n;return t[0]!==o||t[1]!==r?(n=vo(cn.Fragment,{children:[Se("p",{children:"HI"}),o,r,Se("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var ic=y({plugins:[{Component:un,position:"bottom"}]});import{c as lc}from"react/compiler-runtime";import{jsx as sc}from"react/jsx-runtime";import{useLexicalComposerContext as ac}from"@lexical/react/LexicalComposerContext.js";import{TreeView as cc}from"@lexical/react/LexicalTreeView.js";import"react";var dn=()=>{let t=lc(2),[e]=ac(),o;return t[0]!==e?(o=sc(cc,{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 uc=y({plugins:[{Component:dn,position:"bottom"}]});import{$isTableSelection as dc}from"@lexical/table";import{$isRangeSelection as mc,FORMAT_TEXT_COMMAND as pc}from"lexical";import{jsx as mn}from"react/jsx-runtime";import"react";var pn=()=>mn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:mn("path",{d:"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 X=t=>({type:"buttons",items:t,key:"format",order:40});var fn={type:"text-format",format:["bold","italic"],tag:"***"},hn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},gn={type:"text-format",format:["bold"],tag:"**"},Cn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var xn=[X([{ChildComponent:pn,isActive:({selection:t})=>mc(t)||dc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(pc,"bold")},order:1}])],fc=y(({featureProviderMap:t})=>{let e=[gn,Cn];return t.get("italic")&&e.push(hn,fn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:xn},toolbarInline:{groups:xn}}});import{$isTableSelection as gc}from"@lexical/table";import{$isRangeSelection as Cc,FORMAT_TEXT_COMMAND as xc}from"lexical";import{jsx as bn,jsxs as hc}from"react/jsx-runtime";import"react";var _n=()=>hc("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:[bn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),bn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Tn={type:"text-format",format:["code"],tag:"`"};var En=[X([{ChildComponent:_n,isActive:({selection:t})=>Cc(t)||gc(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(xc,"code")},order:7}])],bc=y({enableFormats:["code"],markdownTransformers:[Tn],toolbarFixed:{groups:En},toolbarInline:{groups:En}});import{$isTableSelection as _c}from"@lexical/table";import{$isRangeSelection as Tc,FORMAT_TEXT_COMMAND as Ec}from"lexical";import{jsx as wn}from"react/jsx-runtime";import"react";var kn=()=>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.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 Ln={type:"text-format",format:["italic"],tag:"*"},Nn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Rn=[X([{ChildComponent:kn,isActive:({selection:t})=>Tc(t)||_c(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Ec,"italic")},order:2}])],wc=y({enableFormats:["italic"],markdownTransformers:[Ln,Nn],toolbarFixed:{groups:Rn},toolbarInline:{groups:Rn}});import{$isTableSelection as Lc}from"@lexical/table";import{$isRangeSelection as Nc,FORMAT_TEXT_COMMAND as Rc}from"lexical";import{jsx as Sn,jsxs as kc}from"react/jsx-runtime";import"react";var In=()=>kc("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:"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"}),Sn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var yn={type:"text-format",format:["strikethrough"],tag:"~~"};var vn=[X([{ChildComponent:In,isActive:({selection:t})=>Nc(t)||Lc(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Rc,"strikethrough")},order:4}])],Sc=y({enableFormats:["strikethrough"],markdownTransformers:[yn],toolbarFixed:{groups:vn},toolbarInline:{groups:vn}});import{$isTableSelection as Ic}from"@lexical/table";import{$isRangeSelection as yc,FORMAT_TEXT_COMMAND as vc}from"lexical";import{jsx as Mn}from"react/jsx-runtime";import"react";var Dn=()=>Mn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Mn("path",{d:"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 An=[X([{ChildComponent:Dn,isActive:({selection:t})=>yc(t)||Ic(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(vc,"subscript")},order:5}])],Mc=y({enableFormats:["subscript"],toolbarFixed:{groups:An},toolbarInline:{groups:An}});import{$isTableSelection as Dc}from"@lexical/table";import{$isRangeSelection as Ac,FORMAT_TEXT_COMMAND as Oc}from"lexical";import{jsx as On}from"react/jsx-runtime";import"react";var $n=()=>On("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:On("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 Fn=[X([{ChildComponent:$n,isActive:({selection:t})=>Ac(t)||Dc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Oc,"superscript")},order:6}])],$c=y({enableFormats:["superscript"],toolbarFixed:{groups:Fn},toolbarInline:{groups:Fn}});import{$isTableSelection as Pc}from"@lexical/table";import{$isRangeSelection as Bc,FORMAT_TEXT_COMMAND as Hc}from"lexical";import{jsx as Pn,jsxs as Fc}from"react/jsx-runtime";import"react";var Bn=()=>Fc("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:[Pn("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"}),Pn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Hn=[X([{ChildComponent:Bn,isActive:({selection:t})=>Bc(t)||Pc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Hc,"underline")},order:3}])],jc=y({enableFormats:["underline"],toolbarFixed:{groups:Hn},toolbarInline:{groups:Hn}});import{$createHeadingNode as Vc,$isHeadingNode as ei,HeadingNode as Kc}from"@lexical/rich-text";import{$setBlocksType as Zc}from"@lexical/selection";import{$getSelection as Yc,$isRangeSelection as zc}from"lexical";import{jsx as jn}from"react/jsx-runtime";import"react";var Un=()=>jn("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:jn("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 Gn}from"react/jsx-runtime";import"react";var Wn=()=>Gn("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:Gn("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 Vn}from"react/jsx-runtime";import"react";var Kn=()=>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",{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 Zn}from"react/jsx-runtime";import"react";var Yn=()=>Zn("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:Zn("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 zn}from"react/jsx-runtime";import"react";var Xn=()=>zn("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:zn("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 Jn}from"react/jsx-runtime";import"react";var qn=()=>Jn("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:Jn("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 Uc,$isHeadingNode as Gc,HeadingNode as Wc}from"@lexical/rich-text";var Mo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Qn=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Wc],export:(n,i)=>{if(!Gc(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Mo(n=>{let i="h"+n[1]?.length;return Uc(i)})}};var ti=t=>{let e=Yc();Zc(e,()=>Vc(t))},oi={h1:Un,h2:Wn,h3:Kn,h4:Yn,h5:Xn,h6:qn},Xc=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[J(e.map((r,n)=>({ChildComponent:oi[r],isActive:({selection:i})=>{if(!zc(i))return!1;for(let l of i.getNodes()){if(ei(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(ei(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{ti(r)})},order:n+2})))];return{markdownTransformers:[Qn(e)],nodes:[Kc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:oi[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(()=>{ti(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as mu}from"lexical";import{jsx as ri}from"react/jsx-runtime";import"react";var Do=()=>ri("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:ri("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as ni,jsxs as Jc}from"react/jsx-runtime";import"react";var ii=()=>Jc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ni("path",{d:"M5 10h10",stroke:"currentColor"}),ni("path",{d:"M10 15V5",stroke:"currentColor"})]});var de=t=>({type:"dropdown",ChildComponent:ii,items:t,key:"add",order:10});import{addClassNamesToElement as qc}from"@lexical/utils";import{$applyNodeReplacement as Qc,createCommand as eu,DecoratorNode as tu}from"lexical";var nt=eu("INSERT_HORIZONTAL_RULE_COMMAND"),rt=class extends tu{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:ou,priority:0})}}static importJSON(e){return li()}createDOM(e){let o=document.createElement("hr");return qc(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
35
+ `}isInline(){return!1}updateDOM(){return!1}};function ou(){return{node:li()}}function li(){return Qc(new rt)}import{$applyNodeReplacement as ru}from"lexical";import"react";var we=class extends rt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return it()}decorate(){return null}exportJSON(){return super.exportJSON()}};function it(){return ru(new we)}function Ut(t){return t instanceof we}var si={type:"element",dependencies:[we],export:(t,e)=>Ut(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=it();e&&t.replace(e)}};import{c as nu}from"react/compiler-runtime";import{useLexicalComposerContext as iu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as lu}from"@lexical/utils";import{$getSelection as su,$isRangeSelection as au,COMMAND_PRIORITY_EDITOR as cu}from"lexical";import{useEffect as uu}from"react";var ai=()=>{let t=nu(3),[e]=iu(),o,r;return t[0]!==e?(o=()=>e.registerCommand(nt,du,cu),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),uu(o,r),null};function du(t){let e=su();if(!au(e))return!1;if(e.focus.getNode()!==null){let r=it();lu(r)}return!0}var pu=y({markdownTransformers:[si],nodes:[we],plugins:[{Component:ai,position:"normal"}],slashMenu:{groups:[z([{Icon:Do,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:[de([{ChildComponent:Do,isActive:({selection:t})=>{if(!mu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ut(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(nt,void 0)}}])]}});import{TabIndentationPlugin as gu}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as mi}from"@lexical/utils";import{$isElementNode as Cu,$isRangeSelection as xu,INDENT_CONTENT_COMMAND as bu,OUTDENT_CONTENT_COMMAND as _u}from"lexical";import{jsx as Gt,jsxs as fu}from"react/jsx-runtime";import"react";var ci=()=>fu("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:[Gt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Wt,jsxs as hu}from"react/jsx-runtime";import"react";var ui=()=>hu("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:[Wt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var di=t=>({type:"buttons",items:t,key:"indent",order:35});var pi=[di([{ChildComponent:ci,isActive:()=>!1,isEnabled:({selection:t})=>{let e=t?.getNodes();if(!e?.length)return!1;let o=!1,r=n=>Cu(n)&&n.canIndent();for(let n of e)if(r(n)){if(n.getIndent()<=0)return!1;o=!0}if(!o&&xu(t)){let n=t.anchor.getNode();if(mi(n,l=>r(l)&&l.getIndent()>0))return!0;let i=t.focus.getNode();if(mi(i,l=>r(l)&&l.getIndent()>0))return!0}return o},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(_u,void 0)},order:1},{ChildComponent:ui,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(bu,void 0)},order:2}])],Tu=y({plugins:[{Component:gu,position:"normal"}],toolbarFixed:{groups:pi},toolbarInline:{groups:pi}});import{$findMatchingParent as Dd}from"@lexical/utils";import{$getSelection as Uo,$isRangeSelection as Wi}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 je(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 Ao=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Mu}from"lexical";import{addClassNamesToElement as Eu,isHTMLAnchorElement as wu}from"@lexical/utils";import Fo from"bson-objectid";import{$applyNodeReplacement as ku,$createTextNode as Ci,$getSelection as Lu,$isElementNode as xi,$isRangeSelection as $o,createCommand as Nu,ElementNode as Ru}from"lexical";var Su=new Set(["http:","https:","mailto:","sms:","tel:"]),q=class t extends Ru{__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 t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Iu,priority:1})}}static importJSON(e){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 Fo.default().toHexString(),e.version=3);let o=me({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),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=Oo(o.rel,"add","noopener")),Eu(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(!$o(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&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(xi(r)){let n=me({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Su.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,r){let n=this.__fields?.url,i=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=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Oo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Oo(o.rel,"remove","noopener"))),!1}};function Iu(t){let e=null;if(wu(t)){let o=t.textContent;o!==null&&o!==""&&(e=me({id:new Fo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function me({id:t,fields:e}){return ku(new q({id:t??new Fo.default().toHexString(),fields:e}))}function V(t){return t instanceof q}var ne=Nu("TOGGLE_LINK_COMMAND");function Po(t){let e=Lu();if(!$o(e)&&(t===null||!t.selectedNodes?.length))return;let o=$o(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(i=>{let l=i.getParent();V(l)&&(l.getChildren().forEach(c=>{l.insertBefore(c)}),l.remove())});return}if(o?.length===1){let i=o[0],l=V(i)?i:yu(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Ci(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||xi(i)&&!i.isInline())){if(V(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Ci(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=me({fields:t.fields}),V(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),V(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();n.append(...s)}i.remove();return}n!==null&&n.append(i)}})}function yu(t){return vu(t,e=>V(e))}function vu(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Oo(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var bi={type:"text-match",dependencies:[q],export:(t,e)=>{if(!V(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=me({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Mu(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as Du,$isElementNode as Au}from"lexical";var pe=class t extends q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){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);let o=lt({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),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(Au(r)){let n=lt({fields:this.__fields});return r.append(n),n}return null}};function lt({fields:t}){return Du(new pe({id:"",fields:t}))}function fe(t){return t instanceof pe}import{c as Ou}from"react/compiler-runtime";import{useLexicalComposerContext as $u}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Fu}from"@lexical/utils";import{$createTextNode as _i,$getSelection as Pu,$isElementNode as Ei,$isLineBreakNode as wi,$isNodeSelection as Bu,$isRangeSelection as Hu,$isTextNode as st,TextNode as ju}from"lexical";import{useEffect as Uu}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 ki(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Gu=/[.,;\s]/;function Kt(t){return t!==void 0&&Gu.test(t)}function Li(t){return Kt(t[t.length-1])}function Ho(t){return Kt(t[0])}function Wu(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ni(t){let e=t.getPreviousSibling();return Ei(e)&&(e=e.getLastDescendant()),e===null||wi(e)||st(e)&&Li(e.getTextContent())}function Ri(t){let e=t.getNextSibling();return Ei(e)&&(e=e.getFirstDescendant()),e===null||wi(e)||st(e)&&Ho(e.getTextContent())}function Vu(t,e,o,r){return(t>0?Kt(o[t-1]):Ni(r[0]))?e<o.length?Kt(o[e]):Ri(r[r.length-1]):!1}function Ku(t,e,o){let r=[],n=[],i=[],l=0,s=0,c=[...t];for(;c.length>0;){let u=c[0],a=u.getTextContent().length,d=s;s+a<=e?(r.push(u),l+=a):d>=o?i.push(u):n.push(u),s+=a,c.shift()}return[l,r,n,i]}function Zu(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=lt({fields:n});if(t.length===1){let l=t[0],s;if(e===0?[s]=l.splitText(o):[,s]=l.splitText(e,o),s){let c=_i(r.text);c.setFormat(s.getFormat()),c.setDetail(s.getDetail()),c.setStyle(s.getStyle()),i.append(c),s.replace(i)}return l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,c;e===0?c=l:[,c]=l.splitText(e);let u=[],p;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)u.push(a);else{let[g,x]=a.splitText(o-f);g&&u.push(g),p=x}s+=m}),c){let a=Pu(),d=a?a.getNodes().find(st):void 0,m=_i(c.getTextContent());return m.setFormat(c.getFormat()),m.setDetail(c.getDetail()),m.setStyle(c.getStyle()),i.append(m,...u),d&&d===c&&(Hu(a)?m.select(a.anchor.offset,a.focus.offset):Bu(a)&&m.select(0,m.getTextContent().length)),c.replace(i),p}}}function Yu(t,e,o){let r=[...t],n=r.map(c=>c.getTextContent()).join(""),i=n,l,s=0;for(;(l=ki(i,e))!=null&&l!==null;){let c=l.index,u=l.length,p=c+u;if(Vu(s+c,s+p,n,r)){let[d,,m,f]=Ku(r,s+c,s+p),h=s+c-d,g=s+p-d,x=Zu(m,h,g,l);r=x?[x,...f]:f,o(l.url,null),s=0}else s+=p;i=i.substring(p)}}function Bo(t,e,o){let r=t.getChildren(),n=r.length;for(let c=0;c<n;c++){let u=r[c];if(!st(u)||!u.isSimpleText()){Vt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=ki(i,e);if(l===null||l.text!==i){Vt(t),o(null,t.getFields()?.url??null);return}if(!Ni(t)||!Ri(t)){Vt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let c=t.getFields();c.url=l?.url,t.setFields(c),o(l.url,s??null)}}function zu(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(fe(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Ho(i)||Wu(i,l))&&(r.append(t),Bo(r,e,o),o(null,r.getFields()?.url??null))}fe(n)&&!Li(i)&&(Vt(n),Bo(n,e,o),o(null,n.getFields()?.url??null))}function Vt(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 Xu(t){let e=[t],o=t.getNextSibling();for(;o!==null&&st(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Ju(t,e,o){let r=Ou(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([pe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,c)=>{o?.(s,c)};return Fu(t.registerNodeTransform(ju,s=>{let c=s.getParentOrThrow(),u=s.getPreviousSibling();if(fe(c))Bo(c,e,l);else if(!V(c)){if(s.isSimpleText()&&(Ho(s.getTextContent())||!fe(u))){let p=Xu(s);Yu(p,e,l)}zu(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=i):(n=r[3],i=r[4]),Uu(n,i)}var qu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Qu=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,ed=[Ti(qu,t=>t.startsWith("http")?t:`https://${t}`),Ti(Qu,t=>`mailto:${t}`)],Si=()=>{let[t]=$u();return Ju(t,ed),null};import{jsx as td}from"react/jsx-runtime";import{ClickableLinkPlugin as od}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ii=()=>td(od,{});import{jsx as _d}from"react/jsx-runtime";import"react";import{createPortal as Td}from"react-dom";import{jsx as he,jsxs as at,Fragment as nd}from"react/jsx-runtime";import{useLexicalComposerContext as id}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as yi,mergeRegister as vi}from"@lexical/utils";import{getTranslation as jo}from"@payloadcms/translations";import{CloseMenuIcon as ld,EditIcon as sd,ExternalLinkIcon as Mi,formatDrawerSlug as ad,useConfig as cd,useEditDepth as ud,useLocale as dd,useTranslation as md}from"@payloadcms/ui";import{requests as pd}from"@payloadcms/ui/shared";import{$getSelection as Di,$isLineBreakNode as fd,$isRangeSelection as Ai,COMMAND_PRIORITY_HIGH as hd,COMMAND_PRIORITY_LOW as Oi,getDOMSelection as gd,KEY_ESCAPE_COMMAND as Cd,SELECTION_CHANGE_COMMAND as xd}from"lexical";import $i,{useCallback as Fi,useEffect as zt,useRef as bd,useState as Ie}from"react";function Zt(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),c=i.getBoundingClientRect(),u=t.top-r,p=t.left-n;u<c.top&&(u+=l.height+t.height+r*2),p+l.width>c.right&&(p=c.right-l.width-n),u-=s.top,p-=s.left,e.style.opacity="1",e.style.transform=`translate(${p}px, ${u}px)`}import{createCommand as rd}from"lexical";var Yt=rd("TOGGLE_LINK_WITH_MODAL_COMMAND");function Pi(t){t.preventDefault()}function Bi({anchorElem:t}){let[e]=id(),[o,r]=Ie(),n=bd(null),[i,l]=Ie(null),[s,c]=Ie(null),{fieldProps:{schemaPath:u},uuid:p}=P(),{config:a,getEntityConfig:d}=cd(),{i18n:m,t:f}=md(),[h,g]=Ie(),x=ud(),[N,v]=Ie(!1),[b,T]=Ie([]),C=dd(),[E,M]=Ie(!1),k=ad({slug:"lexical-rich-text-link-"+p,depth:x}),{toggleDrawer:S}=ae(k),D=Fi(()=>{v(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),M(!1),l(null),c(null),T([]),g(void 0)},[v,l,c,T]),w=Fi(()=>{let _=Di(),L;if(!Ai(_)||!_){D();return}let R=je(_);L=e.getElementByKey(R.getKey())?.getBoundingClientRect();let I=yi(R,V),O=_.getNodes().filter(K=>!fd(K)).find(K=>{let Z=yi(K,V);return I&&!I.is(Z)||Z&&!Z.is(I)});if(I==null||O){D();return}r(I);let A=I.getFields(),H={...A,id:I.getID(),text:I.getTextContent()};if(A?.linkType==="custom")l(A?.url??null),c(null);else{l(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${A?.doc?.relationTo}/${A?.doc?.value}`);let K=A?.doc?.relationTo?d({collectionSlug:A?.doc?.relationTo}):void 0;if(!K)c(A?.label?String(A?.label):null),l(A?.url?String(A?.url):null);else{let Z=typeof A.doc?.value=="object"?A.doc.value.id:A.doc?.value,Oe=A.doc?.relationTo;if(!Z||!Oe)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let _e=f("fields:linkedTo",{label:`${jo(K.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");c(_e),pd.get(`${a.serverURL}${a.routes.api}/${Oe}/${Z}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:C?.code}}).then(async se=>{if(!se.ok)throw new Error(`HTTP error! Status: ${se.status}`);let Lt=await se.json(),Te=K?.admin?.useAsTitle||"id",Nt=Lt[Te],$e=f("fields:linkedTo",{label:`${jo(K.labels.singular,m)} - ${Nt}`}).replace(/<[^>]*>?/g,"");c($e)}).catch(()=>{let se=f("fields:linkedTo",{label:`${jo(K.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${Z}`}).replace(/<[^>]*>?/g,"");c(se)})}}g(H),v(!0),T(_?_?.getNodes():[]),fe(I)?M(!0):M(!1);let j=n.current,ee=gd(e._window),{activeElement:wt}=document;if(j===null)return;let kt=e.getRootElement();return ee!==null&&kt!==null&&kt.contains(ee.anchorNode)?(L||(L=ee.getRangeAt(0).getBoundingClientRect()),L!=null&&(L.y+=40,Zt(L,j,t))):(wt==null||wt.className!=="link-input")&&(kt!==null&&Zt(null,j,t),l(null),c(null)),!0},[e,D,a.routes.admin,a.routes.api,a.serverURL,d,f,m,C?.code,t]);return zt(()=>vi(e.registerCommand(Yt,_=>(e.dispatchCommand(ne,_),w(),S(),!0),Oi)),[e,w,S,k]),zt(()=>{let _=t.parentElement,L=()=>{e.getEditorState().read(()=>{w()})};return window.addEventListener("resize",L),_?.addEventListener("scroll",L),()=>{window.removeEventListener("resize",L),_?.removeEventListener("scroll",L)}},[t.parentElement,e,w]),zt(()=>vi(e.registerUpdateListener(({editorState:_})=>{_.read(()=>{w()})}),e.registerCommand(xd,()=>(w(),!0),Oi),e.registerCommand(Cd,()=>N?(D(),!0):!1,hd)),[e,w,N,D]),zt(()=>{e.getEditorState().read(()=>{w()})},[e,w]),at($i.Fragment,{children:[he("div",{className:"link-editor",ref:n,children:at("div",{className:"link-input",children:[i&&i.length>0?at("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?he(Mi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?at(nd,{children:[o?.__fields.newTab?he(Mi,{}):null,he("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&at($i.Fragment,{children:[he("button",{"aria-label":"Edit link",className:"link-edit",onClick:_=>{_.preventDefault(),S()},onMouseDown:Pi,tabIndex:0,type:"button",children:he(sd,{})}),!E&&he("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ne,null)},onMouseDown:Pi,tabIndex:0,type:"button",children:he(ld,{})})]})]})}),he(ze,{className:"lexical-link-edit-drawer",data:h,drawerSlug:k,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(_,L)=>{let R=L,I={...R};delete I.text,e.update(()=>{let O=Di(),A=null;if(Ai(O)?A=je(O).getParent():b.length&&(A=b[0]?.getParent()??null),A&&fe(A)){let H=me({fields:I});A.replace(H,!0)}}),e.dispatchCommand(ne,{fields:I,selectedNodes:b,text:R.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Hi=t=>{let{anchorElem:e=document.body}=t;return Td(_d(Bi,{anchorElem:e}),e)};import{c as kd}from"react/compiler-runtime";import{useLexicalComposerContext as Ld}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Nd}from"@lexical/utils";import{$getSelection as Rd,$isElementNode as Sd,$isRangeSelection as Id,COMMAND_PRIORITY_LOW as Ui,PASTE_COMMAND as yd}from"lexical";import{useEffect as vd}from"react";var Ed=/^(?:[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+)?$/,wd=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function ji(t){if(!t)return!1;if(t==="https://"||Ed.test(t)||wd.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Gi=t=>{let e=kd(5),{clientProps:o}=t,[r]=Ld(),n,i;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Nd(r.registerCommand(ne,l=>l===null?(Po(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),Po(l),!0),Ui),r.registerCommand(yd,l=>{let s=Rd();if(!Id(s)||s.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let c=l.clipboardData.getData("text");if(!ji(c))return!1;if(!s.getNodes().some(Md)){let u={doc:null,linkType:"custom",newTab:!1,url:c};return r.dispatchCommand(ne,{fields:u,text:null}),l.preventDefault(),!0}return!1},Ui))},i=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=i):(n=e[3],i=e[4]),vd(n,i),null};function Md(t){return Sd(t)}var Vi=[Ao([{ChildComponent:hi,isActive:({selection:t})=>{if(Wi(t)){let e=je(t);return Dd(e,V)!=null}return!1},isEnabled:({selection:t})=>!!(Wi(t)&&Uo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ne,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Uo()?.getTextContent(),r=Uo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,newTab:!1};t.dispatchCommand(Yt,{fields:n,selectedNodes:r,text:o})}},order:1}])],Ad=y({markdownTransformers:[bi],nodes:[q,pe],plugins:[{Component:Gi,position:"normal"},{Component:Si,position:"normal"},{Component:Ii,position:"normal"},{Component:Hi,position:"floatingAnchorElem"}],toolbarFixed:{groups:Vi},toolbarInline:{groups:Vi}});import{$isListNode as Vo,INSERT_CHECK_LIST_COMMAND as Ji,ListItemNode as Kd,ListNode as Zd}from"@lexical/list";import{$isRangeSelection as Yd}from"lexical";import{jsx as Ki,jsxs as Od}from"react/jsx-runtime";import"react";var Go=()=>Od("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 $d}from"react/jsx-runtime";import{ListPlugin as Fd}from"@lexical/react/LexicalListPlugin.js";import"react";var Ue=()=>$d(Fd,{});function Ge(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as jd,ListItemNode as Ud,ListNode as Gd}from"@lexical/list";import{$createListItemNode as Pd,$createListNode as Bd,$isListItemNode as Hd,$isListNode as Wo}from"@lexical/list";var Zi=4,We=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Pd(t==="check"?r[3]==="x":void 0);if(Wo(i)&&i.getListType()===t){let c=i.getFirstChild();c!==null?c.insertBefore(l):i.append(l),e.remove()}else if(Wo(n)&&n.getListType()===t)n.append(l),e.remove();else{let c=Bd(t,t==="number"?Number(r[2]):void 0);c.append(l),e.replace(c)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Zi);s&&l.setIndent(s)},ye=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(Hd(l)){if(l.getChildrenSize()===1){let p=l.getFirstChild();if(Wo(p)){r.push(ye(p,e,o+1));continue}}let s=" ".repeat(o*Zi),c=t.getListType(),u=c==="number"?`${t.getStart()+i}. `:c==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+u+e(l)),i++}return r.join(`
36
+ `)};var Yi={type:"element",dependencies:[Gd,Ud],export:(t,e)=>jd(t)?ye(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:We("check")};import{jsx as Wd}from"react/jsx-runtime";import{CheckListPlugin as Vd}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var zi=()=>Wd(Vd,{});var Xi=[J([{ChildComponent:Go,isActive:({selection:t})=>{if(!Yd(t))return!1;for(let e of t.getNodes()){if(Vo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Vo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Vo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ji,void 0)},order:12}])],zd=y(({featureProviderMap:t})=>{let e=[{Component:zi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ue,position:"normal"}),{markdownTransformers:[Yi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Zd,Kd],plugins:e,slashMenu:{groups:[Ge([{Icon:Go,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Ji,void 0)}}])]},toolbarFixed:{groups:Xi},toolbarInline:{groups:Xi}}});import{$isListNode as Zo,INSERT_ORDERED_LIST_COMMAND as el,ListItemNode as em,ListNode as tm}from"@lexical/list";import{$isRangeSelection as om}from"lexical";import{jsx as ct,jsxs as Xd}from"react/jsx-runtime";import"react";var Ko=()=>Xd("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:[ct("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"}),ct("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"}),ct("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Jd,ListItemNode as qd,ListNode as Qd}from"@lexical/list";var qi={type:"element",dependencies:[Qd,qd],export:(t,e)=>Jd(t)?ye(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:We("number")};var Qi=[J([{ChildComponent:Ko,isActive:({selection:t})=>{if(!om(t))return!1;for(let e of t.getNodes()){if(Zo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Zo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Zo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(el,void 0)},order:10}])],rm=y(({featureProviderMap:t})=>({markdownTransformers:[qi],nodes:t.has("orderedList")?[]:[tm,em],plugins:t.has("orderedList")?[]:[{Component:Ue,position:"normal"}],slashMenu:{groups:[Ge([{Icon:Ko,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(el,void 0)}}])]},toolbarFixed:{groups:Qi},toolbarInline:{groups:Qi}}));import{$isListNode as zo,INSERT_UNORDERED_LIST_COMMAND as rl,ListItemNode as am,ListNode as cm}from"@lexical/list";import{$isRangeSelection as um}from"lexical";import{jsx as Ve,jsxs as nm}from"react/jsx-runtime";import"react";var Yo=()=>nm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ve("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ve("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ve("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ve("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Ve("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Ve("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as im,ListItemNode as lm,ListNode as sm}from"@lexical/list";var tl={type:"element",dependencies:[sm,lm],export:(t,e)=>im(t)?ye(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:We("bullet")};var ol=[J([{ChildComponent:Yo,isActive:({selection:t})=>{if(!um(t))return!1;for(let e of t.getNodes()){if(zo(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(zo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(zo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(rl,void 0)},order:11}])],dm=y({markdownTransformers:[tl],nodes:[cm,am],plugins:[{Component:Ue,position:"normal"}],slashMenu:{groups:[Ge([{Icon:Yo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(rl,void 0)}}])]},toolbarFixed:{groups:ol},toolbarInline:{groups:ol}});import{jsx as mm}from"react/jsx-runtime";import{addClassNamesToElement as pm}from"@lexical/utils";import{DecoratorNode as fm}from"lexical";import*as nl from"react";var hm=nl.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),ut=class t extends fm{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return gm({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return pm(o,"unknownConverted"),o}decorate(){return mm(hm,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function gm({data:t}){return new ut({data:t})}var Cm=y(()=>({nodes:[ut]}));import{jsx as xm}from"react/jsx-runtime";import{addClassNamesToElement as bm}from"@lexical/utils";import{DecoratorNode as _m}from"lexical";import*as il from"react";var Tm=il.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),dt=class t extends _m{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Em({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return bm(o,"unknownConverted"),o}decorate(){return xm(Tm,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Em({data:t}){return new dt({data:t})}var wm=y(()=>({nodes:[dt]}));import{$setBlocksType as al}from"@lexical/selection";import{$createParagraphNode as cl,$getSelection as ul,$isParagraphNode as ll,$isRangeSelection as km}from"lexical";var sl=[J([{ChildComponent:Je,isActive:({selection:t})=>{if(!km(t))return!1;for(let e of t.getNodes())if(!ll(e)&&!ll(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ul();al(e,()=>cl())})},order:1}])],Lm=y({slashMenu:{groups:[z([{Icon:Je,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ul();al(e,()=>cl())})}}])]},toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{$isNodeSelection as cp}from"lexical";import{jsx as mt,jsxs as Nm}from"react/jsx-runtime";import"react";var Xo=()=>Nm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mt("g",{clipPath:"url(#clip0_4397_10817)",children:mt("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"})}),mt("defs",{children:mt("clipPath",{id:"clip0_4397_10817",children:mt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Im}from"react/jsx-runtime";import*as ml from"react";import{DecoratorBlockNode as Rm}from"@lexical/react/LexicalDecoratorBlockNode.js";function Sm(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:dl({relationTo:o,value:e})}:null}var pt=class extends Rm{__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:Sm,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=dl(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function dl(t){return new pt({data:t})}var ym=ml.lazy(()=>import("./RelationshipComponent-JPESGV4Q.js").then(t=>({default:t.RelationshipComponent})));function vm(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 ge=class extends pt{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:vm,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 Im(ym,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function ve(t){return new ge({data:t})}function Jo(t){return t instanceof ge}import{c as zm}from"react/compiler-runtime";import{jsx as Xm}from"react/jsx-runtime";import{useLexicalComposerContext as Jm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as qm}from"@lexical/utils";import{useConfig as Qm}from"@payloadcms/ui";import{$getPreviousSelection as ep,$getSelection as tp,$isParagraphNode as xl,$isRangeSelection as op,COMMAND_PRIORITY_EDITOR as rp,createCommand as np}from"lexical";import{useEffect as ip}from"react";import{c as Gm}from"react/compiler-runtime";import{jsx as Xt}from"react/jsx-runtime";import{useLexicalComposerContext as Wm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Vm,COMMAND_PRIORITY_EDITOR as Km}from"lexical";import{useEffect as Zm,useState as hl}from"react";import{c as Mm}from"react/compiler-runtime";import{jsx as Dm}from"react/jsx-runtime";import{useLexicalComposerContext as Am}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Om,useModal as $m}from"@payloadcms/ui";import{$getNodeByKey as pl,$getPreviousSelection as Fm,$getRoot as Pm,$getSelection as Bm,$isRangeSelection as Hm,$setSelection as jm}from"lexical";import{useEffect as Um,useState as fl}from"react";var ft=t=>{let e=Mm(23),[o]=Am(),[r,n]=fl(null),[i,l]=fl(!1),[s,c,u]=Om(t),{closeDrawer:p,drawerSlug:a,isDrawerOpen:d,openDrawer:m}=u,{modalState:f}=$m(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let S=Bm()??Fm();n(S)},e[0]=h):h=e[0];let g=h,x;e[1]!==o||e[2]!==r?(x=()=>{r&&o.update(()=>{if(Hm(r)){let{anchor:S,focus:D}=r;pl(S.key)&&pl(D.key)&&jm(r.clone())}else Pm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=x):x=e[3];let N=x,v;e[4]!==p?(v=()=>{p()},e[4]=p,e[5]=v):v=e[5];let b=v,T,C;e[6]!==a||e[7]!==f||e[8]!==N||e[9]!==i?(T=()=>{if(!i)return;let S=f[a];S&&!S?.isOpen&&(l(!1),setTimeout(()=>{N()},1))},C=[f,a,N,i],e[6]=a,e[7]=f,e[8]=N,e[9]=i,e[10]=T,e[11]=C):(T=e[10],C=e[11]),Um(T,C);let E;e[12]!==c?(E=S=>Dm(c,{...S,onClick:()=>{g()}}),e[12]=c,e[13]=E):E=e[13];let M;e[14]!==m?(M=()=>{g(),m(),l(!0)},e[14]=m,e[15]=M):M=e[15];let k;return e[16]!==s||e[17]!==b||e[18]!==d||e[19]!==a||e[20]!==E||e[21]!==M?(k={closeListDrawer:b,isListDrawerOpen:d,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:E,openListDrawer:M},e[16]=s,e[17]=b,e[18]=d,e[19]=a,e[20]=E,e[21]=M,e[22]=k):k=e[22],k};var Ym=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Vm(o);n&&n.replace(ve({relationTo:e,value:r}))}):t.dispatchCommand(qo,{relationTo:e,value:r})},gl=t=>{let e=Gm(16),{enabledCollectionSlugs:o}=t,[r]=Wm(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i]=hl(n),[l,s]=hl(null),c=o||void 0,u;e[2]!==i||e[3]!==c?(u={collectionSlugs:c,selectedCollection:i},e[2]=i,e[3]=c,e[4]=u):u=e[4];let{closeListDrawer:p,ListDrawer:a,openListDrawer:d}=ft(u),m,f;e[5]!==r||e[6]!==d?(m=()=>r.registerCommand(Xe,N=>(s(N?.replace?N?.replace.nodeKey:null),d(),!0),Km),f=[r,d],e[5]=r,e[6]=d,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Zm(m,f);let h;e[9]!==p||e[10]!==r||e[11]!==l?(h=N=>{let{collectionSlug:v,doc:b}=N;Ym({editor:r,relationTo:v,replaceNodeKey:l,value:b.id}),p()},e[9]=p,e[10]=r,e[11]=l,e[12]=h):h=e[12];let g=h,x;return e[13]!==a||e[14]!==g?(x=Xt(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=x):x=e[15],x},Cl=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Xt(gl,{...t}):Xt(It,{...t,children:Xt(gl,{...t})});var qo=np("INSERT_RELATIONSHIP_COMMAND"),bl=t=>{let e=zm(10),{clientProps:o}=t,[r]=Jm(),{config:n}=Qm(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let p;if(e[0]!==o?.disabledCollections||e[1]!==i){let a;e[3]!==o?.disabledCollections?(a=d=>{let{slug:m}=d;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=a):a=e[4],p=i.filter(a).map(lp),e[0]=o?.disabledCollections,e[1]=i,e[2]=p}else p=e[2];l=p}let s,c;e[5]!==r?(s=()=>{if(!r.hasNodes([ge]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(qo,ap,rp)},c=[r],e[5]=r,e[6]=s,e[7]=c):(s=e[6],c=e[7]),ip(s,c);let u;return e[8]!==l?(u=Xm(Cl,{enabledCollectionSlugs:l}),e[8]=l,e[9]=u):u=e[9],u};function lp(t){let{slug:e}=t;return e}function sp(t){return xl(t)}function ap(t){let e=tp()||ep();if(op(e)){let o=ve(t);qm(o);let{focus:r}=e,n=r.getNode();xl(n)&&n.getTextContentSize()===0&&n.getParentOrThrow().getChildren().filter(sp).length>1&&n.remove()}return!0}var up=y({nodes:[ge],plugins:[{Component:bl,position:"normal"}],slashMenu:{groups:[z([{Icon:Xo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:Xo,isActive:({selection:t})=>{if(!cp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Jo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]}});import{c as Ll}from"react/compiler-runtime";import{jsx as oe,jsxs as yp}from"react/jsx-runtime";import{useLexicalComposerContext as vp}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Mp,useThrottledEffect as Dp,useTranslation as Ap}from"@payloadcms/ui";import*as Ce from"react";import{useMemo as Op}from"react";import{c as dp}from"react/compiler-runtime";import{jsx as mp}from"react/jsx-runtime";import{mergeRegister as pp}from"@lexical/utils";import{$addUpdateTag as fp,$getSelection as hp}from"lexical";import{useEffect as Jt,useState as Qo}from"react";var er="toolbar-popup__button",ht=t=>{let e=dp(34),{children:o,editor:r,item:n}=t,[i,l]=Qo(!0),[s,c]=Qo(!1),[u,p]=Qo(er),a=P(),d;e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==i||e[4]!==n?(d=()=>{r.getEditorState().read(()=>{let M=hp();if(M){if(n.isActive){let k=n.isActive({editor:r,editorConfigContext:a,selection:M});s!==k&&c(k)}if(n.isEnabled){let k=n.isEnabled({editor:r,editorConfigContext:a,selection:M});i!==k&&l(k)}}})},e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=n,e[5]=d):d=e[5];let m=d,f,h;e[6]!==m?(f=()=>{m()},h=[m],e[6]=m,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Jt(f,h);let g,x;e[9]!==m?(g=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),x=[m],e[9]=m,e[10]=g,e[11]=x):(g=e[10],x=e[11]),Jt(g,x);let N,v;e[12]!==r||e[13]!==m?(N=()=>pp(r.registerUpdateListener(()=>{m()})),v=[r,m],e[12]=r,e[13]=m,e[14]=N,e[15]=v):(N=e[14],v=e[15]),Jt(N,v);let b;e[16]!==s||e[17]!==i||e[18]!==n.key?(b=()=>{p([er,i===!1?"disabled":"",s?"active":"",n?.key?`${er}-`+n.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=n.key,e[19]=b):b=e[19];let T;e[20]!==s||e[21]!==u||e[22]!==i||e[23]!==n.key?(T=[i,s,u,n.key],e[20]=s,e[21]=u,e[22]=i,e[23]=n.key,e[24]=T):T=e[24],Jt(b,T);let C;e[25]!==s||e[26]!==r||e[27]!==i||e[28]!==n?(C=()=>{if(i!==!1)return r.focus(()=>{r.update(gp),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=i,e[28]=n,e[29]=C):C=e[29];let E;return e[30]!==o||e[31]!==u||e[32]!==C?(E=mp("button",{className:u,onClick:C,onMouseDown:Cp,type:"button",children:o}),e[30]=o,e[31]=u,e[32]=C,e[33]=E):E=e[33],E};function gp(){fp("toolbar")}function Cp(t){t.preventDefault()}import{c as kp}from"react/compiler-runtime";import{jsx as Ke}from"react/jsx-runtime";import rr,{useCallback as Lp,useEffect as kl}from"react";import{mergeRegister as Np}from"@lexical/utils";import{useTranslation as Rp}from"@payloadcms/ui";import{$getSelection as Sp}from"lexical";import{jsx as ke,jsxs as _l}from"react/jsx-runtime";import{Button as xp}from"@payloadcms/ui";import{$addUpdateTag as bp}from"lexical";import qt,{useCallback as _p,useEffect as gt,useMemo as Tp,useRef as or,useState as Qt}from"react";import{createPortal as Ep}from"react-dom";var tr="toolbar-popup__dropdown-item",Tl=qt.createContext(null);function El({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,c]=Qt(tr);gt(()=>{c([tr,r===!1?"disabled":"",t?"active":"",i?.key?`${tr}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let u=or(null),p=qt.useContext(Tl);if(p===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=p;return gt(()=>{u?.current!=null&&a(u)},[u,a]),ke(xp,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{bp("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:d=>{d.preventDefault()},ref:u,tooltip:l,type:"button",children:e})}function wp({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=Qt(),[l,s]=Qt(),c=_p(a=>{i(d=>d!=null?[...d,a]:[a])},[i]),u=a=>{if(n==null)return;let{key:d}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(d)&&a.preventDefault(),d==="Escape"||d==="Tab"?r():d==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):d==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},p=Tp(()=>({registerItem:c}),[c]);return gt(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),ke(Tl.Provider,{value:p,children:ke("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:u,ref:e,children:t})})}function wl({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let c=or(null),u=or(null),[p,a]=Qt(!1),d=()=>{a(!1),u?.current!=null&&u.current.focus()};gt(()=>{let f=u.current,h=c.current;if(p&&f!==null&&h!==null){let{left:g,top:x}=f.getBoundingClientRect(),N=window.scrollY||document.documentElement.scrollTop;h.style.top=`${x+N+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[c,u,p]),gt(()=>{let f=u.current;if(f!==null&&p){let h=g=>{let{target:x}=g;s!=null&&c.current!=null&&c.current.contains(x)||f.contains(x)||a(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[c,u,p,s]);let m=Ep(ke(wp,{dropDownRef:c,itemsContainerClassNames:i,onClose:d,children:o}),document.body);return _l(qt.Fragment,{children:[_l("button",{"aria-label":t,className:e+(p?" active":""),disabled:r,onClick:f=>{f.preventDefault(),a(!p)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[n&&ke(n,{}),l&&ke("span",{className:"toolbar-popup__dropdown-label",children:l}),ke("i",{className:"toolbar-popup__dropdown-caret"})]}),p&&ke(qt.Fragment,{children:m})]})}var nr="toolbar-popup__dropdown",Ip=t=>{let e=kp(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=Rp(),{fieldProps:c}=P(),{featureClientSchemaMap:u,schemaPath:p}=c;if(l.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==l?(f=l?.Component&&Ke(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=o,e[1]=r,e[2]=n,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let a=l.key,d;if(l.label){let f;e[6]!==u||e[7]!==s||e[8]!==l||e[9]!==p?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:u,i18n:s,schemaPath:p}):l.label,e[6]=u,e[7]=s,e[8]=l,e[9]=p,e[10]=f):f=e[10],a=f}a.length>25?d=a.substring(0,25)+"...":d=a;let m;return e[11]!==o||e[12]!==d||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==a?(m=Ke(El,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?Ke(l.ChildComponent,{}):void 0,item:l,tooltip:a,children:Ke("span",{className:"text",children:d})},l.key),e[11]=o,e[12]=d,e[13]=n,e[14]=i,e[15]=l,e[16]=a,e[17]=m):m=e[17],m},Me=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:i,label:l,maxActiveItems:s,onActiveChange:c})=>{let[u,p]=rr.useState([]),[a,d]=rr.useState([]),[m,f]=rr.useState(!0),h=P(),{items:g,key:x}=r,N=Lp(()=>{o.getEditorState().read(()=>{let v=Sp();if(!v)return;let b=[],T=[],C=[];for(let E of g)E.isActive&&(!s||b.length<s)&&E.isActive({editor:o,editorConfigContext:h,selection:v})&&(b.push(E.key),T.push(E)),E.isEnabled?E.isEnabled({editor:o,editorConfigContext:h,selection:v})&&C.push(E.key):C.push(E.key);r.isEnabled&&f(r.isEnabled({editor:o,editorConfigContext:h,selection:v})),p(b),d(C),c&&c({activeItems:T})})},[o,h,r,g,s,c]);return kl(()=>{N()},[N]),kl(()=>Np(o.registerUpdateListener(()=>{N()})),[o,N]),Ke(wl,{buttonAriaLabel:`${x} dropdown`,buttonClassName:[nr,`${nr}-${x}`,...e||[]].filter(Boolean).join(" "),disabled:!m,Icon:n,itemsContainerClassNames:[`${nr}-items`,...i||[]],label:l,children:g.length?g.map(v=>Ke(Ip,{active:u.includes(v.key),anchorElem:t,editor:o,enabled:a.includes(v.key),item:v},v.key)):null},x)};function $p({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&oe(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?oe(ht,{editor:e,item:o,children:oe(o.ChildComponent,{})},o.key):null}function Fp(t){let e=Ll(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=Ap(),{fieldProps:c}=P(),{featureClientSchemaMap:u,schemaPath:p}=c,[a,d]=Ce.useState(void 0),[m,f]=Ce.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let g;e[4]!==i?(g=[i],e[4]=i,e[5]=g):g=e[5],Ce.useEffect(h,g);let x;e[6]!==u||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==p?(x=T=>{let{activeItems:C}=T;if(!C.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),d(void 0)):(f(void 0),d(void 0));return}let E=C[0],M=E.key;E.label&&(M=typeof E.label=="function"?E.label({featureClientSchemaMap:u,i18n:s,schemaPath:p}):E.label),M.length>25&&(M=M.substring(0,25)+"..."),C.length===1?(d(M),f(()=>E.ChildComponent)):(d(s.t("lexical:general:toolbarItemsActive",{count:C.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=u,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=p,e[12]=x):x=e[12];let N=x,v=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,b;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==N||e[21]!==v?(b=yp("div",{className:v,children:[i.type==="dropdown"&&i.items.length?m?oe(Me,{anchorElem:o,editor:r,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:N}):oe(Me,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:N}):null,i.type==="buttons"&&i.items.length?i.items.map(T=>oe($p,{anchorElem:o,editor:r,item:T},T.key)):null,l<n.features.toolbarFixed?.groups.length-1&&oe("div",{className:"divider"})]},i.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=N,e[21]=v,e[22]=b):b=e[22],b}function Pp({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=Ce.useRef(null),{y:l}=Mp(),s=Op(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Dp(()=>{if(!s)return;let c=i.current;if(!c)return;let u=c.getBoundingClientRect(),p=s.getBoundingClientRect();if(!(u.bottom<p.top||u.top>p.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),oe("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:i,children:o.isEditable()&&oe(Ce.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>oe(Fp,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Nl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Nl(t.parentEditor)}return!1},Rl=t=>{let e=Ll(6),{clientProps:o}=t,[r]=vp(),n=P(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let p=Nl(n);if(o?.disableIfParentHasFixedToolbar&&p){u=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){u=null;break e}c=oe(Pp,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:p})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,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 Bp=y({plugins:[{Component:Rl,position:"aboveContainer"}]});import{c as yl}from"react/compiler-runtime";import{jsx as ie,jsxs as vl}from"react/jsx-runtime";import{useLexicalComposerContext as Hp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ml}from"@lexical/utils";import{$getSelection as Dl,$isRangeSelection as Sl,$isTextNode as jp,COMMAND_PRIORITY_LOW as Up,getDOMSelection as Al,SELECTION_CHANGE_COMMAND as Gp}from"lexical";import{useCallback as to,useEffect as Ct,useRef as Il,useState as Wp}from"react";import*as oo from"react";import{createPortal as Vp}from"react-dom";function ir(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function eo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:c,verticalGap:u=10}=t,p=o.parentElement;if(c===null||p==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),d=o.getBoundingClientRect(),m=p.getBoundingClientRect(),f=c.top-a.height-u,h=c.left-i;l==="center"&&(h=c.left+c.width/2-a.width/2);let g=0;return!e&&f<m.top&&!s&&(g=a.height+c.height+u*2,f+=g),l==="center"?h+a.width>m.right?h=m.right-a.width-i:h<m.left&&(h=m.left+i):h+a.width>m.right&&(h=m.right-a.width-i),h-=d.left,n.style.opacity="1",s&&r!==0?(f-=d.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=d.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function Kp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ie(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ie(ht,{editor:e,item:o,children:ie(o.ChildComponent,{})},o.key):null}function Zp(t){let e=yl(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=P(),[s,c]=oo.useState(),u;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(u=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=u):u=e[3];let p;e[4]!==n?(p=[n],e[4]=n,e[5]=p):p=e[5],oo.useEffect(u,p);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0);return}let x=g[0];c(()=>x?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let d=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==l.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==i||e[16]!==d||e[17]!==m?(f=vl("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?ie(Me,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:d}):ie(Me,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:d}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ie(Kp,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&ie("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=l.features.toolbarInline?.groups.length,e[14]=n,e[15]=i,e[16]=d,e[17]=m,e[18]=f):f=e[18],f}function Yp({anchorElem:t,editor:e}){let o=Il(null),r=Il(null),{editorConfig:n}=P(),i=to(()=>{if(o?.current){let u=o.current.style.opacity==="0",p=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),p||(o.current.style.pointerEvents="none")}},[o]),l=to(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let p=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!p||!a){let d=u.clientX,m=u.clientY,f=document.elementFromPoint(d,m);o.current.contains(f)||i()}}},[i]),s=to(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let c=to(()=>{let u=Dl(),p=Al(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),d=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(u!==null&&p!==null&&!p.isCollapsed&&m!==null&&m.contains(p.anchorNode)){let f=ir(p,m),h=eo({alwaysDisplayOnTop:d,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&eo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return Ct(()=>{let u=t.parentElement,p=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",p),u&&u.addEventListener("scroll",p),()=>{window.removeEventListener("resize",p),u&&u.removeEventListener("scroll",p)}},[e,c,t]),Ct(()=>(e.getEditorState().read(()=>{c()}),Ml(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(Gp,()=>(c(),!1),Up))),[e,c]),vl("div",{className:"inline-toolbar-popup",ref:o,children:[ie("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,p)=>ie(Zp,{anchorElem:t,editor:e,group:u,index:p},u.key))]})}function zp(t,e){let o=yl(12),[r,n]=Wp(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let d=Dl(),m=Al(t._window),f=t.getRootElement();if(m!==null&&(!Sl(d)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!Sl(d))return;if(d.getTextContent()!==""){let g=d.getNodes(),x=!1;for(let N of g)if(jp(N)){n(!0),x=!0;break}x||n(!1)}else n(!1);let h=d.getTextContent().replace(/\n/g,"");if(!d.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,c;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),c=[l],o[2]=l,o[3]=s,o[4]=c):(s=o[3],c=o[4]),Ct(s,c);let u,p;if(o[5]!==t||o[6]!==l?(u=()=>Ml(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),p=[t,l],o[5]=t,o[6]=l,o[7]=u,o[8]=p):(u=o[7],p=o[8]),Ct(u,p),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=Vp(ie(Yp,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Ol=t=>{let{anchorElem:e}=t,[o]=Hp();return zp(o,e)};var Xp=y({plugins:[{Component:Ol,position:"floatingAnchorElem"}]});import{TableCellNode as A1,TableNode as O1,TableRowNode as $1}from"@lexical/table";import{jsx as $l}from"react/jsx-runtime";import"react";var lr=()=>$l("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$l("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 Jp,$createTableNode as qp,$createTableRowNode as Qp,$isTableCellNode as Fl,$isTableNode as sr,$isTableRowNode as ar,TableCellHeaderStates as ro,TableCellNode as ef,TableNode as tf,TableRowNode as of}from"@lexical/table";import{$isParagraphNode as rf,$isTextNode as nf}from"lexical";var Bl=/^\|(.+)\|\s?$/,lf=/^(\| ?:?-*:? ?)+\|\s?$/,Hl=({allTransformers:t})=>({type:"element",dependencies:[tf,of,ef],export:e=>{if(!sr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!ar(r))continue;let i=!1;for(let l of r.getChildren())Fl(l)&&(n.push(Mr(t,l).replace(/\n/g,"\\n")),l.__headerState===ro.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
37
+ `)},regExp:Bl,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(lf.test(n)){let a=e.getPreviousSibling();if(!a||!sr(a))return;let d=a.getChildren(),m=d[d.length-1];if(!m||!ar(m))return;m.getChildren().forEach(f=>{Fl(f)&&f.setHeaderStyles(ro.ROW,ro.ROW)}),e.remove();return}let i=Pl(n,t);if(i==null)return;let l=[i],s=e.getPreviousSibling(),c=i.length;for(;s&&!(!rf(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!nf(a))break;let d=Pl(a.getTextContent(),t);if(d==null)break;c=Math.max(c,d.length),l.unshift(d);let m=s.getPreviousSibling();s.remove(),s=m}let u=qp();for(let a of l){let d=Qp();u.append(d);for(let m=0;m<c;m++)d.append(m<a.length?a[m]:jl("",t))}let p=e.getPreviousSibling();sr(p)&&sf(p)===c?(p.append(...u.getChildren()),e.remove()):e.replace(u),u.selectEnd()}});function sf(t){let e=t.getFirstChild();return ar(e)?e.getChildrenSize():0}var jl=(t,e)=>{t=t.replace(/\\n/g,`
38
+ `);let o=Jp(ro.NO_STATUS);return vr(t,e,o),o},Pl=(t,e)=>{let o=t.match(Bl);return!o||!o[1]?null:o[1].split("|").map(r=>jl(r,e))};import{c as cf}from"react/compiler-runtime";import{jsx as F,jsxs as xe}from"react/jsx-runtime";import{useLexicalComposerContext as Kl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as uf}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as df,$deleteTableRow__EXPERIMENTAL as mf,$getNodeTriplet as pf,$getTableCellNodeFromLexicalNode as Gl,$getTableColumnIndexFromTableCellNode as ff,$getTableNodeFromLexicalNodeOrThrow as De,$getTableRowIndexFromTableCellNode as hf,$insertTableColumn__EXPERIMENTAL as gf,$insertTableRow__EXPERIMENTAL as Cf,$isTableCellNode as xt,$isTableRowNode as Wl,$isTableSelection as bt,$unmergeCell as xf,getTableElement as dr,getTableObserverFromTableElement as mr,TableCellHeaderStates as Le,TableCellNode as bf}from"@lexical/table";import{mergeRegister as _f}from"@lexical/utils";import{useScrollInfo as Tf}from"@payloadcms/ui";import{$createParagraphNode as Ef,$getRoot as wf,$getSelection as io,$isElementNode as kf,$isParagraphNode as Zl,$isRangeSelection as pr,$isTextNode as Lf,COMMAND_PRIORITY_CRITICAL as Nf,getDOMSelection as Rf,SELECTION_CHANGE_COMMAND as Sf}from"lexical";import*as fr from"react";import{useCallback as le,useEffect as Ze,useRef as no,useState as Ye}from"react";import{createPortal as Yl}from"react-dom";import{jsx as cr,jsxs as af}from"react/jsx-runtime";import"react";var Ul=()=>af("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[cr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),cr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),cr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function ur(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function If(){let t=io();if(pr(t)&&!t.isCollapsed()||bt(t)&&!t.anchor.is(t.focus)||!pr(t)&&!bt(t))return!1;let[e]=pf(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Vl(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Zl(e)||!e.isEmpty())}function yf(t){let e=t.getLastDescendant();Lf(e)?e.select():kf(e)?e.selectEnd():e!==null&&e.selectNext()}function vf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Kl(),l=no(null),[s,c]=Ye(n),[u,p]=Ye({columns:1,rows:1}),[a,d]=Ye(!1),[m,f]=Ye(!1),{y:h}=Tf();Ze(()=>i.registerMutationListener(bf,w=>{w.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{c(s.getLatest())})},{skipInitialization:!0}),[i,s]),Ze(()=>{i.getEditorState().read(()=>{let w=io();if(bt(w)){let _=ur(w);p(ur(w)),d(_.columns>1||_.rows>1)}f(If())})},[i]),Ze(()=>{let w=e.current,_=l.current,L=i.getRootElement();if(w!=null&&_!=null&&L!=null){let R=L.getBoundingClientRect(),I=w.getBoundingClientRect();_.style.opacity="1";let O=_.getBoundingClientRect(),A=5,H=I.right+A;if(H+O.width>window.innerWidth||H+O.width>R.right){let ee=I.left-O.width-A;H=(ee<0?A:ee)+window.pageXOffset}_.style.left=`${H+window.pageXOffset}px`;let j=I.top;if(j+O.height>window.innerHeight){let ee=I.bottom-O.height;j=ee<0?A:ee}_.style.top=`${j}px`}},[e,l,i,h]),Ze(()=>{function w(_){l.current!=null&&e.current!=null&&!l.current.contains(_.target)&&!e.current.contains(_.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let g=le(()=>{i.update(()=>{if(s.isAttached()){let _=De(s),L=dr(_,i.getElementByKey(_.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let R=mr(L);R!==null&&R.$clearHighlight(),_.markDirty(),c(s.getLatest())}wf().selectStart()})},[i,s]),x=()=>{i.update(()=>{let w=io();if(bt(w)){let{columns:_,rows:L}=ur(w),R=w.getNodes(),I=null;for(let O=0;O<R.length;O++){let A=R[O];if(xt(A))if(I===null){A.setColSpan(_).setRowSpan(L),I=A;let H=Vl(A),j;H&&Zl(j=A.getFirstChild())&&j.remove()}else xt(I)&&(Vl(A)||I.append(...A.getChildren()),A.remove())}I!==null&&(I.getChildrenSize()===0&&I.append(Ef()),yf(I)),o()}})},N=()=>{i.update(()=>{xf()})},v=le(w=>{i.update(()=>{Cf(w),o()})},[i,o]),b=le(w=>{i.update(()=>{for(let _=0;_<u.columns;_++)gf(w);o()})},[i,o,u.columns]),T=le(()=>{i.update(()=>{mf(),o()})},[i,o]),C=le(()=>{i.update(()=>{De(s).remove(),g(),o()})},[i,s,g,o]),E=le(()=>{i.update(()=>{df(),o()})},[i,o]),M=le(()=>{i.update(()=>{let w=De(s),_=hf(s),L=w.getChildren();if(_>=L.length||_<0)throw new Error("Expected table cell to be inside of table row.");let R=L[_];if(!Wl(R))throw new Error("Expected table row");let I=s.getHeaderStyles()^Le.ROW;R.getChildren().forEach(O=>{if(!xt(O))throw new Error("Expected table cell");O.setHeaderStyles(I,Le.ROW)}),g(),o()})},[i,s,g,o]),k=le(()=>{i.update(()=>{let w=De(s),_=ff(s),L=w.getChildren(),R=Math.max(...L.map(O=>O.getChildren().length));if(_>=R||_<0)throw new Error("Expected table cell to be inside of table row.");let I=s.getHeaderStyles()^Le.COLUMN;for(let O=0;O<L.length;O++){let A=L[O];if(!Wl(A))throw new Error("Expected table row");let H=A.getChildren();if(_>=H.length)continue;let j=H[_];if(!xt(j))throw new Error("Expected table cell");j.setHeaderStyles(I,Le.COLUMN)}g(),o()})},[i,s,g,o]),S=le(()=>{i.update(()=>{if(s.isAttached()){let w=De(s);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[i,s,g,o]),D=null;return t&&(a?D=F("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>x(),type:"button",children:F("span",{className:"text",children:"Merge cells"})}):m&&(D=F("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>N(),type:"button",children:F("span",{className:"text",children:"Unmerge cells"})}))),Yl(xe("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:l,children:[D?xe(fr.Fragment,{children:[D,F("hr",{})]}):null,F("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>S(),type:"button",children:F("span",{className:"text",children:"Toggle Row Striping"})}),F("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>v(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),F("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>v(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),F("hr",{}),F("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),F("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),F("hr",{}),F("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>E(),type:"button",children:F("span",{className:"text",children:"Delete column"})}),F("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>T(),type:"button",children:F("span",{className:"text",children:"Delete row"})}),F("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:F("span",{className:"text",children:"Delete table"})}),F("hr",{}),F("button",{className:"item",onClick:()=>M(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Le.ROW)===Le.ROW?"Remove":"Add"," ","row header"]})}),F("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Le.COLUMN)===Le.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Mf({anchorElem:t,cellMerge:e}){let[o]=Kl(),r=no(null),n=no(null),[i,l]=Ye(!1),[s,c]=Ye(null),u=le(()=>{let a=r.current,d=io(),m=Rf(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),c(null)}if(d==null||a==null)return h();let g=o.getRootElement(),x=null,N=null;if(pr(d)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let b=Gl(d.anchor.getNode());if(b==null||(N=o.getElementByKey(b.getKey()),N==null||!b.isAttached()))return h();let T=De(b),C=dr(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");x=mr(C),c(b)}else if(bt(d)){let b=Gl(d.anchor.getNode());if(!xt(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let T=De(b),C=dr(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");x=mr(C),N=o.getElementByKey(b.getKey())}else if(!f)return h();if(x===null||N===null)return h();let v=!x||!x.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",v),a.classList.toggle("table-cell-action-button-container--inactive",!v),v){let b=N.getBoundingClientRect(),T=t.getBoundingClientRect(),C=b.top-T.top,E=b.right-T.left;a.style.transform=`translate(${E}px, ${C}px)`}},[o,t]);Ze(()=>{let a,d=()=>{a=void 0,o.getEditorState().read(u)},m=()=>(a===void 0&&(a=setTimeout(d,0)),!1);return _f(o.registerUpdateListener(m),o.registerCommand(Sf,m,Nf),o.registerRootListener((f,h)=>{h&&h.removeEventListener("mouseup",m),f&&(f.addEventListener("mouseup",m),m())}),()=>clearTimeout(a))});let p=no(s);return Ze(()=>{p.current!==s&&l(!1),p.current=s},[p,s]),F("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&xe(fr.Fragment,{children:[F("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),l(!i)},ref:n,type:"button",children:F(Ul,{})}),i&&F(vf,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var zl=t=>{let e=cf(3),{anchorElem:o}=t,r=uf(),n;return e[0]!==o||e[1]!==r?(n=Yl(r?F(Mf,{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 Df}from"react/compiler-runtime";import{jsx as so,jsxs as Af}from"react/jsx-runtime";import{useLexicalComposerContext as Of}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as $f}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Ff,$getTableNodeFromLexicalNodeOrThrow as hr,$getTableRowIndexFromTableCellNode as Pf,$isTableCellNode as Xl,$isTableRowNode as Bf,getDOMCellFromTarget as Hf,getTableElement as jf,TableNode as Uf}from"@lexical/table";import{calculateZoomLevel as Jl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as gr}from"lexical";import*as Ql from"react";import{useCallback as _t,useEffect as Cr,useRef as lo,useState as Tt}from"react";import{createPortal as Gf}from"react-dom";var Wf=33,ql=92;function Vf({editor:t}){let e=lo(null),o=lo(null),r=lo(null),n=P(),i=lo(null),[l,s]=Tt(null),[c,u]=Tt(null),[p,a]=Tt(!1),[d,m]=Tt(null),f=_t(()=>{u(null),e.current=null,m(null),i.current=null,r.current=null},[]),h=k=>(k.buttons&1)===1;Cr(()=>t.registerNodeTransform(Uf,k=>{if(k.getColWidths())return k;let S=k.getColumnCount(),D=ql;return k.setColWidths(Array(S).fill(D)),k}),[t]),Cr(()=>{let k=_=>{let L=_.target;if(d){s({x:_.clientX,y:_.clientY});return}if(a(h(_)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let R=Hf(L);R&&c!==R?t.getEditorState().read(()=>{let I=gr(R.elem);if(!I)throw new Error("TableCellResizer: Table cell node not found.");let O=hr(I),A=jf(O,t.getElementByKey(O.getKey()));if(!A)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=A.getBoundingClientRect(),u(R)},{editor:t}):R==null&&f()}},S=_=>{a(!0)},D=_=>{a(!1)},w=t.registerRootListener((_,L)=>{L?.removeEventListener("mousemove",k),L?.removeEventListener("mousedown",S),L?.removeEventListener("mouseup",D),_?.addEventListener("mousemove",k),_?.addEventListener("mousedown",S),_?.addEventListener("mouseup",D)});return()=>{w()}},[c,d,t,f]);let g=k=>k==="bottom",x=_t(k=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=gr(c.elem);if(!Xl(S))throw new Error("TableCellResizer: Table cell node not found.");let D=hr(S),w=Pf(S)+S.getRowSpan()-1,_=D.getChildren();if(w>=_.length||w<0)throw new Error("Expected table cell to be inside of table row.");let L=_[w];if(!Bf(L))throw new Error("Expected table row");let R=L.getHeight();if(R===void 0){let O=L.getChildren();R=Math.min(...O.map(A=>N(A,t)??1/0))}let I=Math.max(R+k,Wf);L.setHeight(I)},{tag:"skip-scroll-into-view"})},[c,t]),N=(k,S)=>S.getElementByKey(k.getKey())?.clientHeight,v=(k,S)=>{let D;return S.forEach(w=>{w.forEach((_,L)=>{_.cell===k&&(D=L)})}),D},b=_t(k=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=gr(c.elem);if(!Xl(S))throw new Error("TableCellResizer: Table cell node not found.");let D=hr(S),[w]=Ff(D,null,null),_=v(S,w);if(_===void 0)throw new Error("TableCellResizer: Table column not found.");let L=D.getColWidths();if(!L)return;let R=L[_];if(R===void 0)return;let I=[...L],O=Math.max(R+k,ql);I[_]=O,D.setColWidths(I)},{tag:"skip-scroll-into-view"})},[c,t]),T=_t(k=>{let S=D=>{if(D.preventDefault(),D.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:w,y:_}=i.current;if(c===null)return;let L=Jl(D.target);if(g(k)){let R=(D.clientY-_)/L;x(R)}else{let R=(D.clientX-w)/L;b(R)}f(),document.removeEventListener("mouseup",S)}};return S},[c,f,b,x]),C=_t(k=>S=>{if(S.preventDefault(),S.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},s(i.current),m(k),document.addEventListener("mouseup",T(k))},[c,T]),[E,M]=Tt({bottom:null,left:null,right:null,top:null});return Cr(()=>{if(c){let{height:k,left:S,top:D,width:w}=c.elem.getBoundingClientRect(),_=Jl(c.elem),L=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+D+k-L/2}px`,width:`${w}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+S+w-L/2}px`,top:`${window.scrollY+D}px`,width:`${L}px`}},I=r.current;d&&l&&I&&(g(d)?(R[d].left=`${window.scrollX+I.left}px`,R[d].top=`${window.scrollY+l.y/_}px`,R[d].height="3px",R[d].width=`${I.width}px`):(R[d].top=`${window.scrollY+I.top}px`,R[d].left=`${window.scrollX+l.x/_}px`,R[d].width="3px",R[d].height=`${I.height}px`),R[d].backgroundColor="#adf"),M(R)}else M({bottom:null,left:null,right:null,top:null})},[c,d,l]),so("div",{ref:o,children:c!=null&&!p&&Af(Ql.Fragment,{children:[so("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:C("right"),style:E.right||void 0}),so("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:C("bottom"),style:E.bottom||void 0})]})})}var es=()=>{let t=Df(3),[e]=Of(),o=$f(),r,n;return t[0]!==e||t[1]!==o?(n=o?Gf(so(Vf,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as Qf}from"react/compiler-runtime";import{jsx as xr,jsxs as e1,Fragment as t1}from"react/jsx-runtime";import{useLexicalComposerContext as as}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as o1,$getTableColumnIndexFromTableCellNode as r1,$getTableRowIndexFromTableCellNode as n1,$insertTableColumn__EXPERIMENTAL as i1,$insertTableRow__EXPERIMENTAL as l1,$isTableCellNode as s1,$isTableNode as rs,getTableElement as a1,TableNode as c1}from"@lexical/table";import{$findMatchingParent as u1,mergeRegister as d1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ns}from"lexical";import{useEffect as is,useMemo as m1,useRef as ls,useState as ao}from"react";import"react";import{createPortal as p1}from"react-dom";import{c as Xf}from"react/compiler-runtime";import{useEffect as Jf,useRef as qf}from"react";var Kf="Expected a function",Zf=Math.max,Yf=Math.min;function zf(t,e,o){let r,n,i=0,l,s=!1,c=!1,u,p,a,d=!0;if(typeof t!="function")throw new TypeError(Kf);e=e||0,typeof o=="object"&&(s=!!o.leading,c="maxWait"in o,u=c?Zf(o.maxWait||0,e):u,d="trailing"in o?!!o.trailing:d);function m(C){let E=r,M=l;return r=l=void 0,i=C,p=t.apply(M,E),p}function f(C){return i=C,a=setTimeout(x,e),s?m(C):p}function h(C){let E=C-n,M=C-i,k=e-E;return c?Yf(k,u-M):k}function g(C){let E=C-n,M=C-i;return n===void 0||E>=e||E<0||c&&M>=u}function x(){let C=Date.now();if(g(C))return N(C);a=setTimeout(x,h(C))}function N(C){return a=void 0,d&&r?m(C):(r=l=void 0,p)}function v(){a!==void 0&&clearTimeout(a),i=0,r=n=l=a=void 0}function b(){return a===void 0?p:N(Date.now())}function T(){let C=Date.now(),E=g(C);if(r=arguments,l=this,n=C,E){if(a===void 0)return f(n);if(c)return clearTimeout(a),a=setTimeout(x,e),m(n)}return a===void 0&&(a=setTimeout(x,e)),p}return T.cancel=v,T.flush=b,T}var ts=zf;function os(t,e,o){let r=Xf(6),n=qf(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=ts(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=i,r[4]=l):(i=r[3],l=r[4]),Jf(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let p=u;n.current&&n.current(...p)},r[5]=s):s=r[5],s}var ss=20;function f1({anchorElem:t}){let[e]=as(),o=P(),[r,n]=ao(!1),[i,l]=ao(!1),[s,c]=ao(!1),[u,p]=ao({}),a=ls(new Set),d=ls(null),m=os(g=>{let{isOutside:x,tableDOMNode:N}=h1(g,o.editorConfig?.lexical);if(x){n(!1),l(!1);return}if(!N)return;d.current=N;let v=null,b=null,T=null;if(e.getEditorState().read(()=>{let R=ns(N);if(s1(R)){let I=u1(R,O=>rs(O));if(!rs(I))return;if(T=a1(I,e.getElementByKey(I.getKey())),T){let O=I.getChildrenSize(),A=I.getChildAtIndex(0)?.getChildrenSize(),H=n1(R),j=r1(R);H===O-1?v=R:j===A-1&&(b=R)}}},{editor:e}),!T)return;let C=T.parentElement;if(!C)return;let{bottom:E,height:M,left:k,right:S,width:D,y:w}=C.getBoundingClientRect(),{left:_,y:L}=t.getBoundingClientRect();v?(l(!1),n(!0),p({height:ss,left:k-_,top:E-L+5,width:D})):b&&(l(!0),n(!1),p({height:M,left:S-_+5,top:w-L,width:ss}))},50,250),f=m1(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);is(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),l(!1),document.removeEventListener("mousemove",m)}},[s,m]),is(()=>d1(e.registerMutationListener(c1,g=>{e.getEditorState().read(()=>{let x=!1;for(let[N,v]of g)switch(v){case"created":{a.current.add(N),x=!0;break}case"destroyed":{a.current.delete(N),x=!0;break}default:break}if(x){f.disconnect();for(let N of a.current){let{tableElement:v}=o1(N);f.observe(v)}c(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{d.current&&(ns(d.current)?.selectEnd(),g?(l1(),n(!1)):(i1(),l(!1)))})};return e?.isEditable()?e1(t1,{children:[r&&xr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&xr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function h1(t,e){let o=t.target;if(o&&o instanceof HTMLElement){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 cs(t){let e=Qf(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=as();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=p1(xr(f1,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as g1}from"react/compiler-runtime";import{jsx as br,jsxs as C1}from"react/jsx-runtime";import{useLexicalComposerContext as x1}from"@lexical/react/LexicalComposerContext";import{TablePlugin as b1}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as _1,TableNode as T1}from"@lexical/table";import{mergeRegister as E1}from"@lexical/utils";import{formatDrawerSlug as w1,useEditDepth as k1}from"@payloadcms/ui";import{$getSelection as L1,$isRangeSelection as N1,COMMAND_PRIORITY_EDITOR as R1,createCommand as S1}from"lexical";import{createContext as I1,useContext as y1,useEffect as v1,useMemo as M1,useState as D1}from"react";import*as us from"react";var co=S1("OPEN_EMBED_DRAWER_COMMAND"),ds=I1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ms({children:t}){let[e,o]=D1({cellEditorConfig:null,cellEditorPlugins:null});return br(ds.Provider,{value:M1(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ps=()=>{let t=g1(16),[e]=x1(),o=y1(ds),r=k1(),{fieldProps:n,uuid:i}=P(),{schemaPath:l}=n,s="lexical-table-create-"+i,c;t[0]!==r||t[1]!==s?(c=w1({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=c):c=t[2];let u=c,{toggleDrawer:p}=ae(u,!0),a;t[3]!==e||t[4]!==p?(a=()=>{if(!e.hasNodes([T1]))throw new Error("TablePlugin: TableNode is not registered on editor");return E1(e.registerCommand(co,()=>{let h;return h=null,e.getEditorState().read(()=>{let g=L1();N1(g)&&(h=g)}),h&&p(),!0},R1))},t[3]=e,t[4]=p,t[5]=a):a=t[5];let d;t[6]!==o||t[7]!==e||t[8]!==p?(d=[o,e,p],t[6]=o,t[7]=e,t[8]=p,t[9]=d):d=t[9],v1(a,d);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(_1,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==m?(f=C1(us.Fragment,{children:[br(ze,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:l,schemaPathSuffix:"fields"}),br(b1,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=u,t[13]=l,t[14]=m,t[15]=f):f=t[15],f};var F1=y({markdownTransformers:[Hl],nodes:[O1,A1,$1],plugins:[{Component:ps,position:"normal"},{Component:es,position:"normal"},{Component:zl,position:"floatingAnchorElem"},{Component:cs,position:"floatingAnchorElem"}],providers:[ms],slashMenu:{groups:[z([{Icon:lr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(co,{})}}])]},toolbarFixed:{groups:[de([{ChildComponent:lr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(co,{})}}])]}});import{$isNodeSelection as fh}from"lexical";import{jsx as _r,jsxs as P1}from"react/jsx-runtime";import"react";var Tr=()=>P1("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:[_r("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"}),_r("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"}),_r("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 G1}from"react/jsx-runtime";import gs from"bson-objectid";import{$applyNodeReplacement as W1}from"lexical";import*as Cs from"react";import{jsx as B1}from"react/jsx-runtime";import{DecoratorBlockNode as H1}from"@lexical/react/LexicalDecoratorBlockNode.js";import fs from"bson-objectid";import{$applyNodeReplacement as j1}from"lexical";import"react";function Er(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function U1(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:hs({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Er(e),null}var Et=class extends H1{__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:U1,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new fs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=hs({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return B1(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function hs({data:t}){return t?.id||(t.id=new fs.default().toHexString()),j1(new Et({data:t}))}var V1=Cs.lazy(()=>import("./component-P5K7Z5NW.js").then(t=>({default:t.UploadComponent})));function K1(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Ae({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Er(e),null}var be=class extends Et{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:K1,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new gs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ae({data:o});return r.setFormat(e.format),r}decorate(){return G1(V1,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ae({data:t}){return t?.id||(t.id=new gs.default().toHexString()),W1(new be({data:t}))}function wr(t){return t instanceof be}import{c as eh}from"react/compiler-runtime";import{jsx as th}from"react/jsx-runtime";import{useLexicalComposerContext as oh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as rh,mergeRegister as nh}from"@lexical/utils";import{useConfig as ih}from"@payloadcms/ui";import{$getPreviousSelection as lh,$getSelection as sh,$isParagraphNode as ah,$isRangeSelection as ch,COMMAND_PRIORITY_EDITOR as uh,createCommand as dh}from"lexical";import{useEffect as mh}from"react";import{c as xs}from"react/compiler-runtime";import{jsx as kr}from"react/jsx-runtime";import{useLexicalComposerContext as bs}from"@lexical/react/LexicalComposerContext.js";import{toast as Z1}from"@payloadcms/ui";import{$getNodeByKey as Y1,COMMAND_PRIORITY_EDITOR as _s}from"lexical";import{useEffect as Ts,useState as z1}from"react";var X1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Y1(o);n&&n.replace(Ae({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Lr,{fields:null,relationTo:e,value:r})},J1=t=>{let e=xs(13),{enabledCollectionSlugs:o}=t,[r]=bs(),[n,i]=z1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:c,openListDrawer:u}=ft(l),p,a;e[2]!==r||e[3]!==u?(p=()=>r.registerCommand(Pe,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),_s),a=[r,u],e[2]=r,e[3]=u,e[4]=p,e[5]=a):(p=e[4],a=e[5]),Ts(p,a);let d;e[6]!==s||e[7]!==r||e[8]!==n?(d=h=>{let{collectionSlug:g,doc:x}=h;s(),X1({editor:r,relationTo:g,replaceNodeKey:n,value:x.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=d):d=e[9];let m=d,f;return e[10]!==c||e[11]!==m?(f=kr(c,{onSelect:m}),e[10]=c,e[11]=m,e[12]=f):f=e[12],f},q1=()=>{let t=xs(3),[e]=bs(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Pe,Q1,_s),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ts(o,r),null},Es=t=>kr(It,{...t,FallbackComponent:q1,uploads:!0,children:kr(J1,{...t})});function Q1(){return Z1.error("No upload collections enabled"),!0}var Lr=dh("INSERT_UPLOAD_COMMAND"),ws=t=>{let e=eh(5),[o]=oh(),{config:r}=ih(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([be]))throw new Error("UploadPlugin: UploadNode not registered on editor");return nh(o.registerCommand(Lr,c=>(o.update(()=>{let u=sh()||lh();if(ch(u)){let p=Ae({data:{id:c.id,fields:c.fields,relationTo:c.relationTo,value:c.value}});rh(p);let{focus:a}=u,d=a.getNode();ah(d)&&!d.__first&&(d.__prev||d.__next)&&d.remove()}}),!0),uh))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),mh(i,l);let s;return e[3]!==n?(s=th(Es,{enabledCollectionSlugs:n.map(ph)}),e[3]=n,e[4]=s):s=e[4],s};function ph(t){let{slug:e}=t;return e}var hh=y({nodes:[be],plugins:[{Component:ws,position:"normal"}],slashMenu:{groups:[z([{Icon:Tr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Pe,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:Tr,isActive:({selection:t})=>{if(!fh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Pe,{replace:!1})}}])]}});import{c as gh}from"react/compiler-runtime";import{jsx as Rr}from"react/jsx-runtime";import{ShimmerEffect as Ch,useConfig as xh}from"@payloadcms/ui";import{lazy as bh,Suspense as _h,useEffect as Th,useState as Eh}from"react";var ks={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var uo={namespace:"lexical",theme:ks};function Ls({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:i}){for(let u of i.features)if(!u?.clientFeatureProps?.featureKey||u?.clientFeatureProps?.order===void 0||u?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");i.features=i.features.sort((u,p)=>u.clientFeatureProps.order-p.clientFeatureProps.order);let l=new Map;for(let u of i.features)l.set(u.clientFeatureProps.featureKey,u);let s=new Map,c=0;for(let u of i.features){let p=typeof u.feature=="function"?u.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:l,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:i}):u.feature;p.key=u.clientFeatureProps.featureKey,p.order=c,s.set(u.clientFeatureProps.featureKey,p),c++}return s}var Ns=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function Nr(t,e,o){return{admin:o,features:Ns(t),lexical:e,resolvedFeatureMap:t}}var wh=bh(()=>import("./Field-NNWFQETL.js").then(t=>({default:t.RichText}))),kh=t=>{let e=gh(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:i,field:l,lexicalEditorConfig:s,schemaPath:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let p=u,a=s===void 0?uo:s,{config:d}=xh(),[m,f]=Eh(null),h,g;e[2]!==p||e[3]!==r||e[4]!==d||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==m||e[9]!==a||e[10]!==c?(h=()=>{if(m)return;let N=[];for(let[T,C]of Object.entries(r))C.clientFeatureProvider&&N.push(C.clientFeatureProvider(C.clientFeatureProps));let v=a||uo,b=Ls({config:d,featureClientImportMap:n,featureClientSchemaMap:i,field:l,schemaPath:c??l.name,unSanitizedEditorConfig:{features:N,lexical:v}});f(Nr(b,v,p))},g=[a,p,m,r,n,i,l,d,c],e[2]=p,e[3]=r,e[4]=d,e[5]=n,e[6]=i,e[7]=l,e[8]=m,e[9]=a,e[10]=c,e[11]=h,e[12]=g):(h=e[11],g=e[12]),Th(h,g);let x;return e[13]!==m||e[14]!==t?(x=Rr(_h,{fallback:Rr(Ch,{height:"35vh"}),children:m&&Rr(wh,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=x):x=e[15],x};function Lh(...t){return t.filter(Boolean).join(" ")}var mo=new WeakMap;function Rs(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function po(t,e){let o=mo.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=Rs(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let c=Rs(l);for(let u of r)c!==null&&u([c[0]-s[0],c[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},mo.set(t,o)}return o.listeners.add(e),()=>{Nh(t,e)}}function Nh(t,e){let o=mo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(mo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Rh(t,e){return po(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function Sh(t,e){return po(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function Ih(t,e){return po(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function yh(t,e){return po(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var $={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},vh=$.IS_BOLD|$.IS_ITALIC|$.IS_STRIKETHROUGH|$.IS_UNDERLINE|$.IS_CODE|$.IS_SUBSCRIPT|$.IS_SUPERSCRIPT|$.IS_HIGHLIGHT,Mh="\xA0",Dh=`
39
39
 
40
- `,Ss="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Is="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Ah=new RegExp("^[^"+Is+"]*["+Ss+"]"),Oh=new RegExp("^[^"+Ss+"]*["+Is+"]"),$h={bold:$.IS_BOLD,code:$.IS_CODE,highlight:$.IS_HIGHLIGHT,italic:$.IS_ITALIC,strikethrough:$.IS_STRIKETHROUGH,subscript:$.IS_SUBSCRIPT,superscript:$.IS_SUPERSCRIPT,underline:$.IS_UNDERLINE},Fh={directionless:$.IS_DIRECTIONLESS,unmergeable:$.IS_UNMERGEABLE},Ph={center:$.IS_ALIGN_CENTER,end:$.IS_ALIGN_END,justify:$.IS_ALIGN_JUSTIFY,left:$.IS_ALIGN_LEFT,right:$.IS_ALIGN_RIGHT,start:$.IS_ALIGN_START},Bh={[$.IS_ALIGN_CENTER]:"center",[$.IS_ALIGN_END]:"end",[$.IS_ALIGN_JUSTIFY]:"justify",[$.IS_ALIGN_LEFT]:"left",[$.IS_ALIGN_RIGHT]:"right",[$.IS_ALIGN_START]:"start"},Hh={normal:$.IS_NORMAL,segmented:$.IS_SEGMENTED,token:$.IS_TOKEN},jh={[$.IS_NORMAL]:"normal",[$.IS_SEGMENTED]:"segmented",[$.IS_TOKEN]:"token"};import{c as Uh}from"react/compiler-runtime";import{jsx as Gh}from"react/jsx-runtime";import"react";var Wh=()=>{let t=Uh(2),{EditButton:e}=ce(),o;return t[0]!==e?(o=e?Gh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Vh}from"react/compiler-runtime";import{jsx as Kh}from"react/jsx-runtime";import"react";var Zh=()=>{let t=Vh(2),{RemoveButton:e}=ce(),o;return t[0]!==e?(o=e?Kh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Yh}from"react/compiler-runtime";import{jsx as zh}from"react/jsx-runtime";import"react";var Xh=()=>{let t=Yh(2),{Label:e}=ce(),o;return t[0]!==e?(o=e?zh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Jh}from"react/compiler-runtime";import{jsx as qh}from"react/jsx-runtime";import"react";var Qh=t=>{let e=Jh(3),{children:o}=t,{InlineBlockContainer:r}=ce(),n;return e[0]!==r||e[1]!==o?(n=r?qh(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as eg}from"react/compiler-runtime";import{jsx as tg}from"react/jsx-runtime";import"react";var og=t=>{let e=eg(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=Ne(),a;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(a=l?tg(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=a):a=e[5],a};import{c as rg}from"react/compiler-runtime";import{jsx as ng}from"react/jsx-runtime";import"react";var ig=()=>{let t=rg(2),{EditButton:e}=Ne(),o;return t[0]!==e?(o=e?ng(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as lg}from"react/compiler-runtime";import{jsx as sg}from"react/jsx-runtime";import"react";var ag=()=>{let t=lg(2),{RemoveButton:e}=Ne(),o;return t[0]!==e?(o=e?sg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};export{lt as $createAutoLinkNode,Bt as $createBlockNode,go as $createInlineBlockNode,me as $createLinkNode,ve as $createRelationshipNode,Ae as $createUploadNode,fe as $isAutoLinkNode,ot as $isBlockNode,Co as $isInlineBlockNode,V as $isLinkNode,Jo as $isRelationshipNode,wr as $isUploadNode,Ws as AlignFeatureClient,pe as AutoLinkNode,og as BlockCollapsible,ig as BlockEditButton,ue as BlockNode,ag as BlockRemoveButton,Xs as BlockquoteFeatureClient,Za as BlocksFeatureClient,fc as BoldFeatureClient,Ms as CAN_USE_DOM,zd as ChecklistFeatureClient,Fh as DETAIL_TYPE_TO_DETAIL,Dh as DOUBLE_LINE_BREAK,Bh as ELEMENT_FORMAT_TO_TYPE,Ph as ELEMENT_TYPE_TO_FORMAT,Fs as ENABLE_SLASH_MENU_COMMAND,vs as EditorConfigProvider,ze as FieldsDrawer,Bp as FixedToolbarFeatureClient,Xc as HeadingFeatureClient,pu as HorizontalRuleFeatureClient,Be as INSERT_BLOCK_COMMAND,He as INSERT_INLINE_BLOCK_COMMAND,vh as IS_ALL_FORMATTING,Tu as IndentFeatureClient,Qh as InlineBlockContainer,Wh as InlineBlockEditButton,Xh as InlineBlockLabel,ho as InlineBlockNode,Zh as InlineBlockRemoveButton,bc as InlineCodeFeatureClient,Xp as InlineToolbarFeatureClient,wc as ItalicFeatureClient,Oh as LTR_REGEX,Cm as LexicalPluginToLexicalFeatureClient,Ad as LinkFeatureClient,q as LinkNode,Mh as NON_BREAKING_SPACE,$ as NodeFormat,rm as OrderedListFeatureClient,Lm as ParagraphFeatureClient,Os as Point,Ah as RTL_REGEX,Ps as Rect,up as RelationshipFeatureClient,ge as RelationshipNode,kh as RichTextField,wm as SlateToLexicalFeatureClient,Sc as StrikethroughFeatureClient,Mc as SubscriptFeatureClient,$c as SuperscriptFeatureClient,Hh as TEXT_MODE_TO_TYPE,$h as TEXT_TYPE_TO_FORMAT,jh as TEXT_TYPE_TO_MODE,ne as TOGGLE_LINK_COMMAND,F1 as TableFeatureClient,ic as TestRecorderFeatureClient,ht as ToolbarButton,Me as ToolbarDropdown,uc as TreeViewFeatureClient,jc as UnderlineFeatureClient,dm as UnorderedListFeatureClient,hh as UploadFeatureClient,be as UploadNode,yh as addSwipeDownListener,Rh as addSwipeLeftListener,Sh as addSwipeRightListener,Ih as addSwipeUpListener,Mo as createBlockNode,y as createClientFeature,uo as defaultEditorLexicalConfig,ir as getDOMRangeRect,Bs as getEnabledNodes,je as getSelectedNode,As as isHTMLElement,$s as isPoint,Lh as joinClasses,Nr as sanitizeClientEditorConfig,Ns as sanitizeClientFeatures,eo as setFloatingElemPosition,Zt as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,de as toolbarAddDropdownGroupWithItems,Ao as toolbarFeatureButtonsGroupWithItems,X as toolbarFormatGroupWithItems,J as toolbarTextDropdownGroupWithItems,Ne as useBlockComponentContext,P as useEditorConfigContext,ce as useInlineBlockComponentContext,Ds as useLexicalDocumentDrawer,ae as useLexicalDrawer,ft as useLexicalListDrawer};
40
+ `,Ss="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Is="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Ah=new RegExp("^[^"+Is+"]*["+Ss+"]"),Oh=new RegExp("^[^"+Ss+"]*["+Is+"]"),$h={bold:$.IS_BOLD,code:$.IS_CODE,highlight:$.IS_HIGHLIGHT,italic:$.IS_ITALIC,strikethrough:$.IS_STRIKETHROUGH,subscript:$.IS_SUBSCRIPT,superscript:$.IS_SUPERSCRIPT,underline:$.IS_UNDERLINE},Fh={directionless:$.IS_DIRECTIONLESS,unmergeable:$.IS_UNMERGEABLE},Ph={center:$.IS_ALIGN_CENTER,end:$.IS_ALIGN_END,justify:$.IS_ALIGN_JUSTIFY,left:$.IS_ALIGN_LEFT,right:$.IS_ALIGN_RIGHT,start:$.IS_ALIGN_START},Bh={[$.IS_ALIGN_CENTER]:"center",[$.IS_ALIGN_END]:"end",[$.IS_ALIGN_JUSTIFY]:"justify",[$.IS_ALIGN_LEFT]:"left",[$.IS_ALIGN_RIGHT]:"right",[$.IS_ALIGN_START]:"start"},Hh={normal:$.IS_NORMAL,segmented:$.IS_SEGMENTED,token:$.IS_TOKEN},jh={[$.IS_NORMAL]:"normal",[$.IS_SEGMENTED]:"segmented",[$.IS_TOKEN]:"token"};import{c as Uh}from"react/compiler-runtime";import{jsx as Gh}from"react/jsx-runtime";import"react";var Wh=()=>{let t=Uh(2),{EditButton:e}=ce(),o;return t[0]!==e?(o=e?Gh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Vh}from"react/compiler-runtime";import{jsx as Kh}from"react/jsx-runtime";import"react";var Zh=()=>{let t=Vh(2),{RemoveButton:e}=ce(),o;return t[0]!==e?(o=e?Kh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Yh}from"react/compiler-runtime";import{jsx as zh}from"react/jsx-runtime";import"react";var Xh=()=>{let t=Yh(2),{Label:e}=ce(),o;return t[0]!==e?(o=e?zh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Jh}from"react/compiler-runtime";import{jsx as qh}from"react/jsx-runtime";import"react";var Qh=t=>{let e=Jh(3),{children:o}=t,{InlineBlockContainer:r}=ce(),n;return e[0]!==r||e[1]!==o?(n=r?qh(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as eg}from"react/compiler-runtime";import{jsx as tg}from"react/jsx-runtime";import"react";var og=t=>{let e=eg(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=Ne(),s;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(s=l?tg(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=s):s=e[5],s};import{c as rg}from"react/compiler-runtime";import{jsx as ng}from"react/jsx-runtime";import"react";var ig=()=>{let t=rg(2),{EditButton:e}=Ne(),o;return t[0]!==e?(o=e?ng(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as lg}from"react/compiler-runtime";import{jsx as sg}from"react/jsx-runtime";import"react";var ag=()=>{let t=lg(2),{RemoveButton:e}=Ne(),o;return t[0]!==e?(o=e?sg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};export{lt as $createAutoLinkNode,Bt as $createBlockNode,go as $createInlineBlockNode,me as $createLinkNode,ve as $createRelationshipNode,Ae as $createUploadNode,fe as $isAutoLinkNode,ot as $isBlockNode,Co as $isInlineBlockNode,V as $isLinkNode,Jo as $isRelationshipNode,wr as $isUploadNode,Ws as AlignFeatureClient,pe as AutoLinkNode,og as BlockCollapsible,ig as BlockEditButton,ue as BlockNode,ag as BlockRemoveButton,Xs as BlockquoteFeatureClient,Za as BlocksFeatureClient,fc as BoldFeatureClient,Ms as CAN_USE_DOM,zd as ChecklistFeatureClient,Fh as DETAIL_TYPE_TO_DETAIL,Dh as DOUBLE_LINE_BREAK,Bh as ELEMENT_FORMAT_TO_TYPE,Ph as ELEMENT_TYPE_TO_FORMAT,Fs as ENABLE_SLASH_MENU_COMMAND,vs as EditorConfigProvider,ze as FieldsDrawer,Bp as FixedToolbarFeatureClient,Xc as HeadingFeatureClient,pu as HorizontalRuleFeatureClient,Be as INSERT_BLOCK_COMMAND,He as INSERT_INLINE_BLOCK_COMMAND,vh as IS_ALL_FORMATTING,Tu as IndentFeatureClient,Qh as InlineBlockContainer,Wh as InlineBlockEditButton,Xh as InlineBlockLabel,ho as InlineBlockNode,Zh as InlineBlockRemoveButton,bc as InlineCodeFeatureClient,Xp as InlineToolbarFeatureClient,wc as ItalicFeatureClient,Oh as LTR_REGEX,Cm as LexicalPluginToLexicalFeatureClient,Ad as LinkFeatureClient,q as LinkNode,Mh as NON_BREAKING_SPACE,$ as NodeFormat,rm as OrderedListFeatureClient,Lm as ParagraphFeatureClient,Os as Point,Ah as RTL_REGEX,Ps as Rect,up as RelationshipFeatureClient,ge as RelationshipNode,kh as RichTextField,wm as SlateToLexicalFeatureClient,Sc as StrikethroughFeatureClient,Mc as SubscriptFeatureClient,$c as SuperscriptFeatureClient,Hh as TEXT_MODE_TO_TYPE,$h as TEXT_TYPE_TO_FORMAT,jh as TEXT_TYPE_TO_MODE,ne as TOGGLE_LINK_COMMAND,F1 as TableFeatureClient,ic as TestRecorderFeatureClient,ht as ToolbarButton,Me as ToolbarDropdown,uc as TreeViewFeatureClient,jc as UnderlineFeatureClient,dm as UnorderedListFeatureClient,hh as UploadFeatureClient,be as UploadNode,yh as addSwipeDownListener,Rh as addSwipeLeftListener,Sh as addSwipeRightListener,Ih as addSwipeUpListener,Mo as createBlockNode,y as createClientFeature,uo as defaultEditorLexicalConfig,ir as getDOMRangeRect,Bs as getEnabledNodes,je as getSelectedNode,As as isHTMLElement,$s as isPoint,Lh as joinClasses,Nr as sanitizeClientEditorConfig,Ns as sanitizeClientFeatures,eo as setFloatingElemPosition,Zt as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,de as toolbarAddDropdownGroupWithItems,Ao as toolbarFeatureButtonsGroupWithItems,X as toolbarFormatGroupWithItems,J as toolbarTextDropdownGroupWithItems,Ne as useBlockComponentContext,P as useEditorConfigContext,ce as useInlineBlockComponentContext,Ds as useLexicalDocumentDrawer,ae as useLexicalDrawer,ft as useLexicalListDrawer};
41
41
  //# sourceMappingURL=index.js.map