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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- "use client";import{a as xe,c as _o,d as To,e as wo}from"./chunk-TMS3LIBB.js";import{a as st}from"./chunk-DBWINSQN.js";import{a as lt,b as Ot,c as Ve}from"./chunk-FSKAVN4P.js";import{a as Ce}from"./chunk-INBEEENE.js";import{a as da}from"./chunk-F26IQ5RE.js";import{a as ae,c as Pr,d as Br,e as ma,f as pa,h as fa,j as ha,k as ga}from"./chunk-DOZWITPU.js";import{a as ua,b as j}from"./chunk-BZZVLW4U.js";function Q(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as ye,$isRangeSelection as $t,FORMAT_ELEMENT_COMMAND as Pt}from"lexical";import{jsx as ko,jsxs as Ca}from"react/jsx-runtime";import"react";var Hr=()=>Ca("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ko("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ko("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ko("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Eo,jsxs as xa}from"react/jsx-runtime";import"react";var jr=()=>xa("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:[Eo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Eo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Eo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as No,jsxs as ba}from"react/jsx-runtime";import"react";var Ft=()=>ba("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:[No("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),No("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),No("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lo,jsxs as _a}from"react/jsx-runtime";import"react";var Ur=()=>_a("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:[Lo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Lo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Lo("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:u,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a})=>{let p=t({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:s,field:u,props:o,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a});return p.sanitizedClientFeatureProps===null&&(p.sanitizedClientFeatureProps=o),p};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Gr=t=>({type:"dropdown",ChildComponent:Ft,items:t,key:"align",order:30});var Wr=[Gr([{ChildComponent:Ft,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"left")},order:1},{ChildComponent:Hr,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"center")},order:2},{ChildComponent:Ur,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"right")},order:3},{ChildComponent:jr,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"justify")},order:4}])],Ta=y({toolbarFixed:{groups:Wr},toolbarInline:{groups:Wr}});import{$createQuoteNode as Yr,$isQuoteNode as zr,QuoteNode as Ea}from"@lexical/rich-text";import{$setBlocksType as qr}from"@lexical/selection";import{$getSelection as Qr,$isRangeSelection as Na}from"lexical";import{jsx as Vr}from"react/jsx-runtime";import"react";var So=()=>Vr("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:Vr("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 Kr}from"react/jsx-runtime";import"react";var at=()=>Kr("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:Kr("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 ne=t=>({type:"dropdown",ChildComponent:at,items:t,key:"text",order:25});import{$createQuoteNode as wa,$isQuoteNode as Jr,QuoteNode as ka}from"@lexical/rich-text";var Xr={type:"element",dependencies:[ka],export:(t,e)=>{if(!Jr(t))return null;let o=e(t).split(`
1
+ "use client";import{a as xe,c as _o,d as To,e as wo}from"./chunk-TMS3LIBB.js";import{a as st}from"./chunk-DBWINSQN.js";import{a as lt,b as Ot,c as Ve}from"./chunk-FSKAVN4P.js";import{a as Ce}from"./chunk-INBEEENE.js";import{a as ma}from"./chunk-F26IQ5RE.js";import{a as ae,c as Pr,d as Br,e as pa,f as fa,h as ha,j as ga,k as Ca}from"./chunk-DOZWITPU.js";import{a as da,b as j}from"./chunk-BZZVLW4U.js";function Q(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as ye,$isRangeSelection as $t,FORMAT_ELEMENT_COMMAND as Pt}from"lexical";import{jsx as ko,jsxs as xa}from"react/jsx-runtime";import"react";var Hr=()=>xa("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ko("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ko("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ko("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Eo,jsxs as ba}from"react/jsx-runtime";import"react";var jr=()=>ba("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:[Eo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Eo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Eo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as No,jsxs as _a}from"react/jsx-runtime";import"react";var Ft=()=>_a("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:[No("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),No("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),No("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lo,jsxs as Ta}from"react/jsx-runtime";import"react";var Ur=()=>Ta("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:[Lo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Lo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Lo("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:u,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a})=>{let p=t({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:s,field:u,props:o,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a});return p.sanitizedClientFeatureProps===null&&(p.sanitizedClientFeatureProps=o),p};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Gr=t=>({type:"dropdown",ChildComponent:Ft,items:t,key:"align",order:30});var Wr=[Gr([{ChildComponent:Ft,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"left")},order:1},{ChildComponent:Hr,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"center")},order:2},{ChildComponent:Ur,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"right")},order:3},{ChildComponent:jr,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(ye(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ye(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"justify")},order:4}])],wa=y({toolbarFixed:{groups:Wr},toolbarInline:{groups:Wr}});import{$createQuoteNode as Yr,$isQuoteNode as zr,QuoteNode as Na}from"@lexical/rich-text";import{$setBlocksType as qr}from"@lexical/selection";import{$getSelection as Qr,$isRangeSelection as La}from"lexical";import{jsx as Vr}from"react/jsx-runtime";import"react";var So=()=>Vr("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:Vr("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 Kr}from"react/jsx-runtime";import"react";var at=()=>Kr("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:Kr("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 ne=t=>({type:"dropdown",ChildComponent:at,items:t,key:"text",order:25});import{$createQuoteNode as ka,$isQuoteNode as Jr,QuoteNode as Ea}from"@lexical/rich-text";var Xr={type:"element",dependencies:[Ea],export:(t,e)=>{if(!Jr(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(Jr(i)){i.splice(i.getChildrenSize(),0,[...e]),i.select(0,0),t.remove();return}}let n=wa();n.append(...e),t.replace(n),n.select(0,0)}};var Zr=[ne([{ChildComponent:So,isActive:({selection:t})=>{if(!Na(t))return!1;for(let e of t.getNodes())if(!zr(e)&&!zr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qr();qr(e,()=>Yr())})},order:20}])],La=y({markdownTransformers:[Xr],nodes:[Ea],slashMenu:{groups:[Q([{Icon:So,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qr();qr(e,()=>Yr())})}}])]},toolbarFixed:{groups:Zr},toolbarInline:{groups:Zr}});import{getTranslation as Kt}from"@payloadcms/translations";import{jsx as Io,jsxs as Sa}from"react/jsx-runtime";import"react";var Bt=()=>Sa("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:[Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as en}from"react/jsx-runtime";import"react";var Ht=()=>en("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:en("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 Ia}from"react/jsx-runtime";import"react";function jt(t,e){return t?()=>Ia("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Bt}import{jsx as nc}from"react/jsx-runtime";import ic from"bson-objectid";import"react";import{DecoratorBlockNode as Ra}from"@lexical/react/LexicalDecoratorBlockNode.js";import ya from"bson-objectid";var ct=class extends Ra{__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=va(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 va(t){return new ct({fields:{...t,id:t?.id||new ya.default().toHexString()}})}import{jsx as z,jsxs as ut,Fragment as Pa}from"react/jsx-runtime";import{Button as nn,Collapsible as Ba,Drawer as Ha,EditDepthProvider as ja,ErrorPill as Ua,Form as Ga,formatDrawerSlug as Wa,FormSubmit as Va,Pill as Ka,RenderFields as Ja,SectionTitle as Xa,useConfig as za,useDocumentForm as Za,useDocumentInfo as ln,useEditDepth as Ya,useFormSubmitted as qa,useServerFunctions as Qa,useTranslation as ec}from"@payloadcms/ui";import{abortAndIgnore as Ro}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Gt,reduceFieldsToValues as sn}from"payload/shared";import dt,{useCallback as yo,useEffect as vo,useMemo as mt,useRef as Mo}from"react";import{useLexicalComposerContext as tc}from"@lexical/react/LexicalComposerContext";import{getTranslation as oc}from"@payloadcms/translations";import{$getNodeByKey as Wt}from"lexical";import{v4 as rc}from"uuid";import{c as Ma}from"react/compiler-runtime";import{jsx as Ut,jsxs as Aa}from"react/jsx-runtime";import{RenderFields as Da,useFormSubmitted as Oa}from"@payloadcms/ui";import Fa,{createContext as $a}from"react";var tn=$a({initialState:!1}),Oe=()=>Fa.use(tn),on=t=>{let e=Ma(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=Oa()&&l>0,m,f;e[0]!==r||e[1]!==l||e[2]!==p?(f=_=>Ut(r,{editButton:_.editButton,errorCount:l,fieldHasErrors:p,Label:_.Label,removeButton:_.removeButton,children:_.children}),e[0]=r,e[1]=l,e[2]=p,e[3]=f):f=e[3],m=f;let h=m,C;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==i||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(C=n?Aa(tn,{value:{BlockCollapsible:h,EditButton:i,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Ut(o,{})]}):Ut(h,{children:Ut(Da,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=i,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=C):C=e[12],C};function rn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ue="lexical-block",an=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=qa(),{id:i,collectionSlug:l,globalSlug:s}=ln(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=j(),{fields:h}=Za(),C=Mo(new AbortController),_=Ya(),[I,A]=dt.useState(0),{config:b}=za(),T=Wa({slug:`lexical-blocks-create-${f}-${o.id}`,depth:_}),{toggleDrawer:g}=Ce(T),{getDocPreferences:k,setDocFieldPreferences:M}=ln(),[D]=tc(),{getFormState:P}=Qa(),v=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[N,x]=dt.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),E=Mo(!1),S=Mo(e);vo(()=>{E.current?(S.current!==e&&x(!1),S.current=e):E.current=!0},[e]);let[L,R]=dt.useState(N?._components?.customComponents?.BlockLabel),[w,F]=dt.useState(N?._components?.customComponents?.Block);vo(()=>{let G=new AbortController;return o&&!N&&(async()=>{let{state:J}=await P({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:Gt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:v,signal:G.signal});if(J){J.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let q=sn(Gt(J),!0);D.update(()=>{let X=Wt(r);if(X&&pt(X)){let se=q;se.blockType=o.blockType,X.setFields(se,!0)}}),x(J),R(J._components?.customComponents?.BlockLabel),F(J._components?.customComponents?.Block)}})(),()=>{Ro(G)}},[P,v,i,o,D,r,N,l,s,k,h]);let[$,U]=dt.useState(d?.[o.id]?.collapsed??!1),V=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,H=u.blocks?.[V]?.[0],W=H.blockReferences?typeof H?.blockReferences?.[0]=="string"?b.blocksMap[H?.blockReferences?.[0]]:H?.blockReferences?.[0]:H?.blocks?.[0],{i18n:te,t:ce}=ec(),Y=yo(async({formState:G,submit:fe})=>{Ro(C.current);let J=new AbortController;C.current=J;let{state:q}=await P({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:Gt(h),formState:G,globalSlug:s,initialBlockFormState:G,operation:"update",renderAllFields:!!fe,schemaPath:v,signal:J.signal});if(!q)return G;G.blockName&&(q.blockName=G.blockName);let X=sn(rn({fields:Gt(q)}),!0);if(setTimeout(()=>{D.update(()=>{let se=Wt(r);if(se&&pt(se)){let We=X;We.blockType=o.blockType,se.setFields(We,!0)}})},0),fe){R(q._components?.customComponents?.BlockLabel),F(q._components?.customComponents?.Block);let se=0;for(let We of Object.values(q))We?.valid===!1&&se++;A(se)}return q},[P,i,l,k,s,v,o.blockType,h,D,r]);vo(()=>()=>{Ro(C.current)},[]);let K=yo(()=>{D.update(()=>{Wt(r)?.remove()})},[D,r]),oe=W?.labels?.singular?oc(W.labels.singular,te):W?.slug,re=yo(G=>{k().then(fe=>{let q=fe?.fields?.[c.name]?.collapsed,X=q&&q?.length?q:[];G?X.includes(o.id)||X.push(o.id):X.includes(o.id)&&X.splice(X.indexOf(o.id),1),M(c.name,{collapsed:X,hello:"hi"})})},[k,c.name,M,o.id]),le=mt(()=>()=>z(nn,{buttonStyle:"icon-label",className:`${ue}__editButton`,disabled:p,el:"button",icon:"edit",onClick:G=>(G.preventDefault(),G.stopPropagation(),g(),!1),onMouseDown:G=>{G.preventDefault()},round:!0,size:"small",tooltip:ce("lexical:blocks:inlineBlocks:edit",{label:oe})}),[oe,p,ce,g]),De=mt(()=>()=>z(nn,{buttonStyle:"icon-label",className:`${ue}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:G=>{G.preventDefault(),K()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,K]),it=mt(()=>({children:G,disableBlockName:fe,editButton:J,errorCount:q,fieldHasErrors:X,Label:se,removeButton:We})=>z("div",{className:ue+" "+ue+"-"+o.blockType,children:z(Ba,{className:[`${ue}__row`,X?`${ue}__row--has-errors`:`${ue}__row--no-errors`].join(" "),collapsibleStyle:X?"error":"default",header:ut("div",{className:`${ue}__block-header`,children:[se??L?se??L:ut("div",{children:[z(Ka,{className:`${ue}__block-pill ${ue}__block-pill-${o?.blockType}`,pillStyle:"white",children:oe??o?.blockType}),!fe&&z(Xa,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),X&&z(Ua,{count:q??0,i18n:te,withMessage:!0})]}),ut("div",{children:[w&&J!==!1||!w&&J?z(le,{}):null,We!==!1&&D.isEditable()?z(De,{}):null]})]}),isCollapsed:$,onToggle:$r=>{re($r),U($r)},children:G},0)}),[w,L,le,De,oe,D,o.blockType,te,$,re,c?.admin?.readOnly]),Dt=W?.fields??[],Fr=mt(()=>()=>z(ja,{children:z(Ha,{className:"",slug:T,title:ce(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:oe??ce("lexical:blocks:inlineBlocks:label")}),children:N?ut(Pa,{children:[z(Ja,{fields:Dt,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!1}),z(Va,{programmaticSubmit:!0,children:ce("fields:saveChanges")})]}):null})}),[N,T,oe,ce,W?.fields,v,a]),ca=mt(()=>N?z(Ga,{beforeSubmit:[async({formState:G})=>await Y({formState:G,submit:!0})],el:"div",fields:Dt,initialState:N,onChange:[Y],onSubmit:(G,fe)=>{fe.blockType=o.blockType,D.update(()=>{let J=Wt(r);J&&pt(J)&&J.setFields(fe,!0)}),g()},submitted:n,uuid:rc(),children:z(on,{baseClass:ue,BlockDrawer:Fr,Collapsible:it,CustomBlock:w,EditButton:le,errorCount:I,formSchema:Dt,initialState:N,nodeKey:r,RemoveButton:De})}):null,[it,Fr,w,Dt,De,le,D,I,g,W?.fields,N,r,Y,n]);return W?ca:z(it,{disableBlockName:!0,fieldHasErrors:!0,children:ut("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var be=class extends ct{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=Vt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return nc(an,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Vt(t){return new be({fields:{...t,id:t?.id||new ic.default().toHexString()}})}function pt(t){return t instanceof be}import{createCommand as cn}from"lexical";var Ke=cn("INSERT_BLOCK_COMMAND"),Je=cn("INSERT_INLINE_BLOCK_COMMAND");import{c as lc}from"react/compiler-runtime";import{useLexicalComposerContext as sc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ac,$wrapNodeInElement as cc,mergeRegister as uc}from"@lexical/utils";import{formatDrawerSlug as dc,useEditDepth as mc}from"@payloadcms/ui";import{$createParagraphNode as pc,$getNodeByKey as fc,$getPreviousSelection as hc,$getSelection as gc,$insertNodes as Cc,$isParagraphNode as dn,$isRangeSelection as xc,$isRootOrShadowRoot as bc,COMMAND_PRIORITY_EDITOR as un}from"lexical";import{useEffect as _c,useState as Tc}from"react";var mn=()=>{let t=lc(12),[e]=sc(),[o,r]=Tc(null),{setCreatedInlineBlock:n,uuid:i}=j(),l=mc(),s="lexical-inlineBlocks-create-"+i,u;t[0]!==l||t[1]!==s?(u=dc({slug:s,depth:l}),t[0]=l,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=Ce(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([be]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return uc(e.registerCommand(Ke,m=>(e.update(()=>{let f=gc()||hc();if(xc(f)){let h=Vt(m);ac(h);let{focus:C}=f,_=C.getNode();dn(_)&&_.getTextContentSize()===0&&_.getParentOrThrow().getChildren().filter(wc).length>1&&_.remove()}}),!0),un),e.registerCommand(Je,m=>{if(o){let h=fc(o);return!h||!wo(h)?!1:(h.setFields(m),r(null),!0)}let f=To(m);return n?.(f),Cc([f]),bc(f.getParentOrThrow())&&cc(f,pc).selectEnd(),!0},un))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(p=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=p):p=t[11],_c(a,p),null};function wc(t){return dn(t)}var kc=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]),u=Object.entries(l).filter(([a])=>a.startsWith(i+".")&&!a.replace(i+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=u.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:[be,_o],plugins:[{Component:mn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:jt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Kt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ke,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Ht,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Kt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Je,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Bt,items:c.map((a,p)=>({ChildComponent:jt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Kt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ke,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Ht,items:d.map((a,p)=>({ChildComponent:a.imageURL?jt(a.imageURL,a.imageAltText):Ht,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Kt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Lc}from"react/compiler-runtime";import{jsx as $e,jsxs as Fo}from"react/jsx-runtime";import{useLexicalComposerContext as Sc}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Ic,$createTextNode as Rc,$getRoot as yc,getDOMSelection as Ao}from"lexical";import*as Cn from"react";import{useCallback as Fe,useEffect as Do,useLayoutEffect as fn,useRef as Oo,useState as Jt}from"react";var Ec=ae&&"documentMode"in document?document.documentMode:null,pn=ae&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Mb=ae&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ab=ae&&"InputEvent"in window&&!Ec?"getTargetRanges"in new window.InputEvent("input"):!1,Db=ae&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Ob=ae&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Fb=ae&&/Android/.test(navigator.userAgent),$b=ae&&/Win/.test(navigator.platform),Nc=ae&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Pb=ae&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Nc;var vc=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)},Mc=(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)},Ac=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(Jr(i)){i.splice(i.getChildrenSize(),0,[...e]),i.select(0,0),t.remove();return}}let n=ka();n.append(...e),t.replace(n),n.select(0,0)}};var Zr=[ne([{ChildComponent:So,isActive:({selection:t})=>{if(!La(t))return!1;for(let e of t.getNodes())if(!zr(e)&&!zr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qr();qr(e,()=>Yr())})},order:20}])],Sa=y({markdownTransformers:[Xr],nodes:[Na],slashMenu:{groups:[Q([{Icon:So,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qr();qr(e,()=>Yr())})}}])]},toolbarFixed:{groups:Zr},toolbarInline:{groups:Zr}});import{getTranslation as Kt}from"@payloadcms/translations";import{jsx as Io,jsxs as Ia}from"react/jsx-runtime";import"react";var Bt=()=>Ia("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:[Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as en}from"react/jsx-runtime";import"react";var Ht=()=>en("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:en("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 Ra}from"react/jsx-runtime";import"react";function jt(t,e){return t?()=>Ra("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Bt}import{jsx as ic}from"react/jsx-runtime";import lc from"bson-objectid";import"react";import{DecoratorBlockNode as ya}from"@lexical/react/LexicalDecoratorBlockNode.js";import va from"bson-objectid";var ct=class extends ya{__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=Ma(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 Ma(t){return new ct({fields:{...t,id:t?.id||new va.default().toHexString()}})}import{jsx as z,jsxs as ut,Fragment as Ba}from"react/jsx-runtime";import{Button as nn,Collapsible as Ha,Drawer as ja,EditDepthProvider as Ua,ErrorPill as Ga,Form as Wa,formatDrawerSlug as Va,FormSubmit as Ka,Pill as Ja,RenderFields as Xa,SectionTitle as za,useConfig as Za,useDocumentForm as Ya,useDocumentInfo as ln,useEditDepth as qa,useFormSubmitted as Qa,useServerFunctions as ec,useTranslation as tc}from"@payloadcms/ui";import{abortAndIgnore as Ro}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Gt,reduceFieldsToValues as sn}from"payload/shared";import dt,{useCallback as yo,useEffect as vo,useMemo as mt,useRef as Mo}from"react";import{useLexicalComposerContext as oc}from"@lexical/react/LexicalComposerContext";import{getTranslation as rc}from"@payloadcms/translations";import{$getNodeByKey as Wt}from"lexical";import{v4 as nc}from"uuid";import{c as Aa}from"react/compiler-runtime";import{jsx as Ut,jsxs as Da}from"react/jsx-runtime";import{RenderFields as Oa,useFormSubmitted as Fa}from"@payloadcms/ui";import $a,{createContext as Pa}from"react";var tn=Pa({initialState:!1}),Oe=()=>$a.use(tn),on=t=>{let e=Aa(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=Fa()&&l>0,m,f;e[0]!==r||e[1]!==l||e[2]!==p?(f=_=>Ut(r,{editButton:_.editButton,errorCount:l,fieldHasErrors:p,Label:_.Label,removeButton:_.removeButton,children:_.children}),e[0]=r,e[1]=l,e[2]=p,e[3]=f):f=e[3],m=f;let h=m,C;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==i||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(C=n?Da(tn,{value:{BlockCollapsible:h,EditButton:i,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Ut(o,{})]}):Ut(h,{children:Ut(Oa,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=i,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=C):C=e[12],C};function rn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ue="lexical-block",an=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=Qa(),{id:i,collectionSlug:l,globalSlug:s}=ln(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=j(),{fields:h}=Ya(),C=Mo(new AbortController),_=qa(),[I,A]=dt.useState(0),{config:b}=Za(),T=Va({slug:`lexical-blocks-create-${f}-${o.id}`,depth:_}),{toggleDrawer:g}=Ce(T),{getDocPreferences:k,setDocFieldPreferences:M}=ln(),[D]=oc(),{getFormState:P}=ec(),v=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[N,x]=dt.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),E=Mo(!1),S=Mo(e);vo(()=>{E.current?(S.current!==e&&x(!1),S.current=e):E.current=!0},[e]);let[L,R]=dt.useState(N?._components?.customComponents?.BlockLabel),[w,F]=dt.useState(N?._components?.customComponents?.Block);vo(()=>{let G=new AbortController;return o&&!N&&(async()=>{let{state:J}=await P({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:Gt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:v,signal:G.signal});if(J){J.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let q=sn(Gt(J),!0);D.update(()=>{let X=Wt(r);if(X&&pt(X)){let se=q;se.blockType=o.blockType,X.setFields(se,!0)}}),x(J),R(J._components?.customComponents?.BlockLabel),F(J._components?.customComponents?.Block)}})(),()=>{Ro(G)}},[P,v,i,o,D,r,N,l,s,k,h]);let[$,U]=dt.useState(d?.[o.id]?.collapsed??!1),V=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,H=u.blocks?.[V]?.[0],W=H.blockReferences?typeof H?.blockReferences?.[0]=="string"?b.blocksMap[H?.blockReferences?.[0]]:H?.blockReferences?.[0]:H?.blocks?.[0],{i18n:te,t:ce}=tc(),Y=yo(async({formState:G,submit:fe})=>{Ro(C.current);let J=new AbortController;C.current=J;let{state:q}=await P({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:Gt(h),formState:G,globalSlug:s,initialBlockFormState:G,operation:"update",renderAllFields:!!fe,schemaPath:v,signal:J.signal});if(!q)return G;G.blockName&&(q.blockName=G.blockName);let X=sn(rn({fields:Gt(q)}),!0);if(setTimeout(()=>{D.update(()=>{let se=Wt(r);if(se&&pt(se)){let We=X;We.blockType=o.blockType,se.setFields(We,!0)}})},0),fe){R(q._components?.customComponents?.BlockLabel),F(q._components?.customComponents?.Block);let se=0;for(let We of Object.values(q))We?.valid===!1&&se++;A(se)}return q},[P,i,l,k,s,v,o.blockType,h,D,r]);vo(()=>()=>{Ro(C.current)},[]);let K=yo(()=>{D.update(()=>{Wt(r)?.remove()})},[D,r]),oe=W?.labels?.singular?rc(W.labels.singular,te):W?.slug,re=yo(G=>{k().then(fe=>{let q=fe?.fields?.[c.name]?.collapsed,X=q&&q?.length?q:[];G?X.includes(o.id)||X.push(o.id):X.includes(o.id)&&X.splice(X.indexOf(o.id),1),M(c.name,{collapsed:X,hello:"hi"})})},[k,c.name,M,o.id]),le=mt(()=>()=>z(nn,{buttonStyle:"icon-label",className:`${ue}__editButton`,disabled:p,el:"button",icon:"edit",onClick:G=>(G.preventDefault(),G.stopPropagation(),g(),!1),onMouseDown:G=>{G.preventDefault()},round:!0,size:"small",tooltip:ce("lexical:blocks:inlineBlocks:edit",{label:oe})}),[oe,p,ce,g]),De=mt(()=>()=>z(nn,{buttonStyle:"icon-label",className:`${ue}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:G=>{G.preventDefault(),K()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,K]),it=mt(()=>({children:G,disableBlockName:fe,editButton:J,errorCount:q,fieldHasErrors:X,Label:se,removeButton:We})=>z("div",{className:ue+" "+ue+"-"+o.blockType,children:z(Ha,{className:[`${ue}__row`,X?`${ue}__row--has-errors`:`${ue}__row--no-errors`].join(" "),collapsibleStyle:X?"error":"default",header:ut("div",{className:`${ue}__block-header`,children:[se??L?se??L:ut("div",{children:[z(Ja,{className:`${ue}__block-pill ${ue}__block-pill-${o?.blockType}`,pillStyle:"white",children:oe??o?.blockType}),!fe&&z(za,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),X&&z(Ga,{count:q??0,i18n:te,withMessage:!0})]}),ut("div",{children:[w&&J!==!1||!w&&J?z(le,{}):null,We!==!1&&D.isEditable()?z(De,{}):null]})]}),isCollapsed:$,onToggle:$r=>{re($r),U($r)},children:G},0)}),[w,L,le,De,oe,D,o.blockType,te,$,re,c?.admin?.readOnly]),Dt=W?.fields??[],Fr=mt(()=>()=>z(Ua,{children:z(ja,{className:"",slug:T,title:ce(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:oe??ce("lexical:blocks:inlineBlocks:label")}),children:N?ut(Ba,{children:[z(Xa,{fields:Dt,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!1}),z(Ka,{programmaticSubmit:!0,children:ce("fields:saveChanges")})]}):null})}),[N,T,oe,ce,W?.fields,v,a]),ua=mt(()=>N?z(Wa,{beforeSubmit:[async({formState:G})=>await Y({formState:G,submit:!0})],el:"div",fields:Dt,initialState:N,onChange:[Y],onSubmit:(G,fe)=>{fe.blockType=o.blockType,D.update(()=>{let J=Wt(r);J&&pt(J)&&J.setFields(fe,!0)}),g()},submitted:n,uuid:nc(),children:z(on,{baseClass:ue,BlockDrawer:Fr,Collapsible:it,CustomBlock:w,EditButton:le,errorCount:I,formSchema:Dt,initialState:N,nodeKey:r,RemoveButton:De})}):null,[it,Fr,w,Dt,De,le,D,I,g,W?.fields,N,r,Y,n]);return W?ua:z(it,{disableBlockName:!0,fieldHasErrors:!0,children:ut("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var be=class extends ct{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=Vt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return ic(an,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Vt(t){return new be({fields:{...t,id:t?.id||new lc.default().toHexString()}})}function pt(t){return t instanceof be}import{createCommand as cn}from"lexical";var Ke=cn("INSERT_BLOCK_COMMAND"),Je=cn("INSERT_INLINE_BLOCK_COMMAND");import{c as sc}from"react/compiler-runtime";import{useLexicalComposerContext as ac}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as cc,$wrapNodeInElement as uc,mergeRegister as dc}from"@lexical/utils";import{formatDrawerSlug as mc,useEditDepth as pc}from"@payloadcms/ui";import{$createParagraphNode as fc,$getNodeByKey as hc,$getPreviousSelection as gc,$getSelection as Cc,$insertNodes as xc,$isParagraphNode as dn,$isRangeSelection as bc,$isRootOrShadowRoot as _c,COMMAND_PRIORITY_EDITOR as un}from"lexical";import{useEffect as Tc,useState as wc}from"react";var mn=()=>{let t=sc(12),[e]=ac(),[o,r]=wc(null),{setCreatedInlineBlock:n,uuid:i}=j(),l=pc(),s="lexical-inlineBlocks-create-"+i,u;t[0]!==l||t[1]!==s?(u=mc({slug:s,depth:l}),t[0]=l,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=Ce(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([be]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return dc(e.registerCommand(Ke,m=>(e.update(()=>{let f=Cc()||gc();if(bc(f)){let h=Vt(m);cc(h);let{focus:C}=f,_=C.getNode();dn(_)&&_.getTextContentSize()===0&&_.getParentOrThrow().getChildren().filter(kc).length>1&&_.remove()}}),!0),un),e.registerCommand(Je,m=>{if(o){let h=hc(o);return!h||!wo(h)?!1:(h.setFields(m),r(null),!0)}let f=To(m);return n?.(f),xc([f]),_c(f.getParentOrThrow())&&uc(f,fc).selectEnd(),!0},un))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(p=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=p):p=t[11],Tc(a,p),null};function kc(t){return dn(t)}var Ec=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]),u=Object.entries(l).filter(([a])=>a.startsWith(i+".")&&!a.replace(i+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=u.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:[be,_o],plugins:[{Component:mn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:jt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Kt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ke,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Ht,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Kt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Je,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Bt,items:c.map((a,p)=>({ChildComponent:jt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Kt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ke,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Ht,items:d.map((a,p)=>({ChildComponent:a.imageURL?jt(a.imageURL,a.imageAltText):Ht,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Kt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Sc}from"react/compiler-runtime";import{jsx as $e,jsxs as Fo}from"react/jsx-runtime";import{useLexicalComposerContext as Ic}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Rc,$createTextNode as yc,$getRoot as vc,getDOMSelection as Ao}from"lexical";import*as Cn from"react";import{useCallback as Fe,useEffect as Do,useLayoutEffect as fn,useRef as Oo,useState as Jt}from"react";var Nc=ae&&"documentMode"in document?document.documentMode:null,pn=ae&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),vb=ae&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Mb=ae&&"InputEvent"in window&&!Nc?"getTargetRanges"in new window.InputEvent("input"):!1,Ab=ae&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Db=ae&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ob=ae&&/Android/.test(navigator.userAgent),Fb=ae&&/Win/.test(navigator.platform),Lc=ae&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$b=ae&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Lc;var Mc=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)},Ac=(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)},Dc=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 Dc(t){return t.key.toLowerCase()==="a"&&(pn?t.metaKey:t.ctrlKey)}function Oc(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 hn(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 gn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Fc(t){let[e,o]=Jt([]),[r,n]=Jt(!1),[,i]=Jt(""),[l,s]=Jt(""),u=Oo(null),c=Oo(!1),d=Oo(null),a=Fe(()=>t,[t]),p=Fe(()=>{let b=t.getRootElement(),T=Ao(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"&&(pn?t.metaKey:t.ctrlKey)}function Fc(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 hn(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 gn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function $c(t){let[e,o]=Jt([]),[r,n]=Jt(!1),[,i]=Jt(""),[l,s]=Jt(""),u=Oo(null),c=Oo(!1),d=Oo(null),a=Fe(()=>t,[t]),p=Fe(()=>{let b=t.getRootElement(),T=Ao(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,
@@ -27,15 +27,15 @@ describe('Test case', () => {
27
27
  const {page} = e2e;
28
28
 
29
29
  await page.focus('div[contenteditable="true"]');
30
- ${e.map(Ac).join(`
30
+ ${e.map(Dc).join(`
31
31
  `)}
32
32
  });
33
33
  });
34
- `},[t,e]),m=Fe((b,T)=>{o(g=>{let k=e.length-1,M=e[k];if(M&&M.name===b){if(b==="type")return[...e.slice(0,k),{...M,value:M.value+T}];if(M.value===T)return[...e.slice(0,k),{...M,count:M.count+1}]}return[...g,{name:b,count:1,value:T}]})},[e,o]);fn(()=>{let b=g=>{if(!r)return;let k=g.key;Dc(g)?m("selectAll",""):gn.has(k)?m("press",g.key):[...k].length>1?m("keydown",g.key):m("type",g.key)},T=g=>{if(!r)return;let k=g.key;!gn.has(k)&&[...k].length>1&&m("keyup",g.key)};return t.registerRootListener((g,k)=>{k!==null&&(k.removeEventListener("keydown",b),k.removeEventListener("keyup",T)),g!==null&&(g.addEventListener("keydown",b),g.addEventListener("keyup",T))})},[t,r,m]),fn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Do(()=>{if(e){let b=p();b!==null&&s(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Do(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:g,editorState:k})=>{if(!r)return;let M=k._selection,D=u.current,P=c.current;if(D!==M){if(g.size===0&&T.size===0&&!P){let N=Ao(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}u.current=M}c.current=!1;let v=p();v!==null&&s(v)}),[t,p,r,m]),Do(()=>r?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,r]);let f=Fe(b=>{r||(b.update(()=>{let T=yc();T.clear();let g=Rc();T.append(Ic().append(g)),g.select()}),o([])),n(T=>!T)},[r]),h=Fe(()=>{if(!r)return;let b=Ao(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:T,anchorOffset:g,focusNode:k,focusOffset:M}=Oc(b),D=a().getRootElement(),P;T!==null&&(P=hn(T,D));let v;k!==null&&(v=hn(k,D)),m("snapshot",{anchorNode:T,anchorOffset:g,anchorPath:P,focusNode:k,focusOffset:M,focusPath:v})},[m,r,a]),C=Fe(()=>{vc(p())},[p]),_=Fe(()=>{Mc("test.js",p())},[p]);return[$e("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?Fo("div",{className:"test-recorder-output",children:[Fo("div",{className:"test-recorder-toolbar",children:[$e("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),$e("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{C(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),$e("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{_(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),$e("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var xn=()=>{let t=Lc(3),[e]=Sc(),[o,r]=Fc(e),n;return t[0]!==o||t[1]!==r?(n=Fo(Cn.Fragment,{children:[$e("p",{children:"HI"}),o,r,$e("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var $c=y({plugins:[{Component:xn,position:"bottom"}]});import{c as Pc}from"react/compiler-runtime";import{jsx as Bc}from"react/jsx-runtime";import{useLexicalComposerContext as Hc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as jc}from"@lexical/react/LexicalTreeView.js";import"react";var bn=()=>{let t=Pc(2),[e]=Hc(),o;return t[0]!==e?(o=Bc(jc,{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:bn,position:"bottom"}]});import{$isTableSelection as Gc}from"@lexical/table";import{$isRangeSelection as Wc,FORMAT_TEXT_COMMAND as Vc}from"lexical";import{jsx as _n}from"react/jsx-runtime";import"react";var Tn=()=>_n("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:_n("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 ee=t=>({type:"buttons",items:t,key:"format",order:40});var wn={type:"text-format",format:["bold","italic"],tag:"***"},kn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},En={type:"text-format",format:["bold"],tag:"**"},Nn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Ln=[ee([{ChildComponent:Tn,isActive:({selection:t})=>Wc(t)||Gc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Vc,"bold")},order:1}])],Kc=y(({featureProviderMap:t})=>{let e=[En,Nn];return t.get("italic")&&e.push(kn,wn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Ln},toolbarInline:{groups:Ln}}});import{$isTableSelection as Xc}from"@lexical/table";import{$isRangeSelection as zc,FORMAT_TEXT_COMMAND as Zc}from"lexical";import{jsx as Sn,jsxs as Jc}from"react/jsx-runtime";import"react";var In=()=>Jc("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:[Sn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Sn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Rn={type:"text-format",format:["code"],tag:"`"};var yn=[ee([{ChildComponent:In,isActive:({selection:t})=>zc(t)||Xc(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Zc,"code")},order:7}])],Yc=y({enableFormats:["code"],markdownTransformers:[Rn],toolbarFixed:{groups:yn},toolbarInline:{groups:yn}});import{$isTableSelection as qc}from"@lexical/table";import{$isRangeSelection as Qc,FORMAT_TEXT_COMMAND as eu}from"lexical";import{jsx as vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("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:vn("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 An={type:"text-format",format:["italic"],tag:"*"},Dn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var On=[ee([{ChildComponent:Mn,isActive:({selection:t})=>Qc(t)||qc(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(eu,"italic")},order:2}])],tu=y({enableFormats:["italic"],markdownTransformers:[An,Dn],toolbarFixed:{groups:On},toolbarInline:{groups:On}});import{$isTableSelection as ru}from"@lexical/table";import{$isRangeSelection as nu,FORMAT_TEXT_COMMAND as iu}from"lexical";import{jsx as Fn,jsxs as ou}from"react/jsx-runtime";import"react";var $n=()=>ou("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Fn("path",{d:"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"}),Fn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Pn={type:"text-format",format:["strikethrough"],tag:"~~"};var Bn=[ee([{ChildComponent:$n,isActive:({selection:t})=>nu(t)||ru(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(iu,"strikethrough")},order:4}])],lu=y({enableFormats:["strikethrough"],markdownTransformers:[Pn],toolbarFixed:{groups:Bn},toolbarInline:{groups:Bn}});import{$isTableSelection as su}from"@lexical/table";import{$isRangeSelection as au,FORMAT_TEXT_COMMAND as cu}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var jn=()=>Hn("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:Hn("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 Un=[ee([{ChildComponent:jn,isActive:({selection:t})=>au(t)||su(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(cu,"subscript")},order:5}])],uu=y({enableFormats:["subscript"],toolbarFixed:{groups:Un},toolbarInline:{groups:Un}});import{$isTableSelection as du}from"@lexical/table";import{$isRangeSelection as mu,FORMAT_TEXT_COMMAND as pu}from"lexical";import{jsx as Gn}from"react/jsx-runtime";import"react";var Wn=()=>Gn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Gn("path",{d:"M10.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 Vn=[ee([{ChildComponent:Wn,isActive:({selection:t})=>mu(t)||du(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(pu,"superscript")},order:6}])],fu=y({enableFormats:["superscript"],toolbarFixed:{groups:Vn},toolbarInline:{groups:Vn}});import{$isTableSelection as gu}from"@lexical/table";import{$isRangeSelection as Cu,FORMAT_TEXT_COMMAND as xu}from"lexical";import{jsx as Kn,jsxs as hu}from"react/jsx-runtime";import"react";var Jn=()=>hu("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Kn("path",{d:"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"}),Kn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Xn=[ee([{ChildComponent:Jn,isActive:({selection:t})=>Cu(t)||gu(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(xu,"underline")},order:3}])],bu=y({enableFormats:["underline"],toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$createHeadingNode as ku,$isHeadingNode as ai,HeadingNode as Eu}from"@lexical/rich-text";import{$setBlocksType as Nu}from"@lexical/selection";import{$getSelection as Lu,$isRangeSelection as Su}from"lexical";import{jsx as zn}from"react/jsx-runtime";import"react";var Zn=()=>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:"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 Yn}from"react/jsx-runtime";import"react";var qn=()=>Yn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yn("path",{d:"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 Qn}from"react/jsx-runtime";import"react";var ei=()=>Qn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qn("path",{d:"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 ti}from"react/jsx-runtime";import"react";var oi=()=>ti("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:ti("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 ri}from"react/jsx-runtime";import"react";var ni=()=>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("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 ii}from"react/jsx-runtime";import"react";var li=()=>ii("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:ii("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 _u,$isHeadingNode as Tu,HeadingNode as wu}from"@lexical/rich-text";var $o=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var si=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[wu],export:(n,i)=>{if(!Tu(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:$o(n=>{let i="h"+n[1]?.length;return _u(i)})}};var ci=t=>{let e=Lu();Nu(e,()=>ku(t))},ui={h1:Zn,h2:qn,h3:ei,h4:oi,h5:ni,h6:li},Iu=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ne(e.map((r,n)=>({ChildComponent:ui[r],isActive:({selection:i})=>{if(!Su(i))return!1;for(let l of i.getNodes()){if(ai(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(ai(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(()=>{ci(r)})},order:n+2})))];return{markdownTransformers:[si(e)],nodes:[Eu],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Q(e.map(r=>({Icon:ui[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(()=>{ci(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Wu}from"lexical";import{jsx as di}from"react/jsx-runtime";import"react";var Po=()=>di("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:di("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as mi,jsxs as Ru}from"react/jsx-runtime";import"react";var pi=()=>Ru("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mi("path",{d:"M5 10h10",stroke:"currentColor"}),mi("path",{d:"M10 15V5",stroke:"currentColor"})]});var _e=t=>({type:"dropdown",ChildComponent:pi,items:t,key:"add",order:10});import{addClassNamesToElement as yu}from"@lexical/utils";import{$applyNodeReplacement as vu,createCommand as Mu,DecoratorNode as Au}from"lexical";var ht=Mu("INSERT_HORIZONTAL_RULE_COMMAND"),ft=class extends Au{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Du,priority:0})}}static importJSON(e){return fi()}createDOM(e){let o=document.createElement("hr");return yu(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 Du(){return{node:fi()}}function fi(){return vu(new ft)}import{$applyNodeReplacement as Ou}from"lexical";import"react";var ve=class extends ft{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return gt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function gt(){return Ou(new ve)}function Xt(t){return t instanceof ve}var hi={type:"element",dependencies:[ve],export:(t,e)=>Xt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=gt();e&&t.replace(e)}};import{c as Fu}from"react/compiler-runtime";import{useLexicalComposerContext as $u}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Pu}from"@lexical/utils";import{$getSelection as Bu,$isRangeSelection as Hu,COMMAND_PRIORITY_EDITOR as ju}from"lexical";import{useEffect as Uu}from"react";var gi=()=>{let t=Fu(3),[e]=$u(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ht,Gu,ju),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Uu(o,r),null};function Gu(t){let e=Bu();if(!Hu(e))return!1;if(e.focus.getNode()!==null){let r=gt();Pu(r)}return!0}var Vu=y({markdownTransformers:[hi],nodes:[ve],plugins:[{Component:gi,position:"normal"}],slashMenu:{groups:[Q([{Icon:Po,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(ht,void 0)}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Po,isActive:({selection:t})=>{if(!Wu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Xt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(ht,void 0)}}])]}});import{$findMatchingParent as Li}from"@lexical/utils";import{$isElementNode as nd,$isRangeSelection as id,INDENT_CONTENT_COMMAND as ld,OUTDENT_CONTENT_COMMAND as sd}from"lexical";import{jsx as zt,jsxs as Ku}from"react/jsx-runtime";import"react";var Ci=()=>Ku("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:[zt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),zt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),zt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Zt,jsxs as Ju}from"react/jsx-runtime";import"react";var xi=()=>Ju("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:[Zt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Xu}from"react/jsx-runtime";import{useLexicalComposerContext as zu}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Zu}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Yu,mergeRegister as bi}from"@lexical/utils";import{$getSelection as qu,$isElementNode as ki,$isRangeSelection as Qu,COMMAND_PRIORITY_LOW as _i,INDENT_CONTENT_COMMAND as Ti,KEY_TAB_COMMAND as ed,OUTDENT_CONTENT_COMMAND as td,TabNode as od}from"lexical";import{useEffect as wi}from"react";var Ei=({clientProps:t})=>{let[e]=zu(),{disabledNodes:o,disableTabNode:r}=t;return wi(()=>{if(!(!e||!o?.length))return bi(e.registerCommand(Ti,()=>rd(n=>{if(!o.includes(n.getType())){let i=n.getIndent();n.setIndent(i+1)}}),_i),e.registerUpdateListener(({dirtyElements:n,editorState:i})=>{e.update(()=>{for(let[l]of n){let s=i._nodeMap.get(l);ki(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),wi(()=>{if(!(!e||!r))return bi(e.registerCommand(ed,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?td:Ti,void 0)),_i),e.registerNodeTransform(od,n=>{n.remove()}))},[e,r]),Xu(Zu,{})};function rd(t){let e=qu();if(!Qu(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let i=r[n],l=i.getKey();if(o.has(l))continue;let s=Yu(i,c=>ki(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var Ni=t=>({type:"buttons",items:t,key:"indent",order:35});var Si=({disabledNodes:t})=>[Ni([{ChildComponent:Ci,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes();if(!o?.length)return!1;let r=!1,n=i=>nd(i)&&i.canIndent();for(let i of o)if(n(i)){if(i.getIndent()<=0)return!1;r=!0}return!r&&cd(e,i=>n(i)&&i.getIndent()>0)?!0:r},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(sd,void 0)},order:1},{ChildComponent:xi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes();return o?.length?!o.some(r=>t?.includes(r.getType())):!1},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ld,void 0)},order:2}])],ad=y(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Ei,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Si({disabledNodes:e})},toolbarInline:{groups:Si({disabledNodes:e})}}});function cd(t,e){return id(t)&&(!!Li(t.anchor.getNode(),e)||!!Li(t.focus.getNode(),e))}import{$findMatchingParent as Tm}from"@lexical/utils";import{$getSelection as Jo,$isRangeSelection as nl}from"lexical";import{jsx as Ii}from"react/jsx-runtime";import"react";var Ri=()=>Ii("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:Ii("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 yi}from"@lexical/selection";function Xe(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?yi(o)?r:n:yi(e)?r:n}var Bo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as _d}from"lexical";import{addClassNamesToElement as ud,isHTMLAnchorElement as dd}from"@lexical/utils";import Uo from"bson-objectid";import{$applyNodeReplacement as md,$createTextNode as vi,$getSelection as pd,$isElementNode as Mi,$isRangeSelection as jo,createCommand as fd,ElementNode as hd}from"lexical";var gd=new Set(["http:","https:","mailto:","sms:","tel:"]),ie=class t extends hd{__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:Cd,priority:1})}}static importJSON(e){let o=Te({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Uo.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Ho(o.rel,"add","noopener")),ud(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(!jo(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(Mi(r)){let n=Te({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!gd.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,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=Ho(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Ho(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Cd(t){let e=null;if(dd(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new Uo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Te({id:t,fields:e}){return md(new ie({id:t??new Uo.default().toHexString(),fields:e}))}function Z(t){return t instanceof ie}var he=fd("TOGGLE_LINK_COMMAND");function Go(t){let e=pd();if(!jo(e)&&(t===null||!t.selectedNodes?.length))return;let o=jo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(i=>{let l=i.getParent();Z(l)&&(l.getChildren().forEach(u=>{l.insertBefore(u)}),l.remove())});return}if(o?.length===1){let i=o[0],l=Z(i)?i:xd(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(vi(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||Mi(i)&&!i.isInline())){if(Z(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(vi(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=Te({fields:t.fields}),Z(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),Z(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 xd(t){return bd(t,e=>Z(e))}function bd(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Ho(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 Ai={type:"text-match",dependencies:[ie],export:(t,e)=>{if(!Z(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=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=_d(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as Td,$isElementNode as wd}from"lexical";var we=class t extends ie{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Ct({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(wd(r)){let n=Ct({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Ct({fields:t}){return Td(new we({id:"",fields:t}))}function ke(t){return t instanceof we}import{c as kd}from"react/compiler-runtime";import{useLexicalComposerContext as Ed}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Nd}from"@lexical/utils";import{$createTextNode as Di,$getSelection as Ld,$isElementNode as Fi,$isLineBreakNode as $i,$isNodeSelection as Sd,$isRangeSelection as Id,$isTextNode as xt,TextNode as Rd}from"lexical";import{useEffect as yd}from"react";function Oi(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function Pi(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var vd=/[.,;\s]/;function qt(t){return t!==void 0&&vd.test(t)}function Bi(t){return qt(t[t.length-1])}function Vo(t){return qt(t[0])}function Md(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Hi(t){let e=t.getPreviousSibling();return Fi(e)&&(e=e.getLastDescendant()),e===null||$i(e)||xt(e)&&Bi(e.getTextContent())}function ji(t){let e=t.getNextSibling();return Fi(e)&&(e=e.getFirstDescendant()),e===null||$i(e)||xt(e)&&Vo(e.getTextContent())}function Ad(t,e,o,r){return(t>0?qt(o[t-1]):Hi(r[0]))?e<o.length?qt(o[e]):ji(r[r.length-1]):!1}function Dd(t,e,o){let r=[],n=[],i=[],l=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,p=s;s+a<=e?(r.push(c),l+=a):p>=o?i.push(c):n.push(c),s+=a,u.shift()}return[l,r,n,i]}function Od(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=Ct({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 u=Di(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),i.append(u),s.replace(i)}return l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,u;e===0?u=l:[,u]=l.splitText(e);let c=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)c.push(a);else{let[C,_]=a.splitText(o-f);C&&c.push(C),d=_}s+=m}),u){let a=Ld(),p=a?a.getNodes().find(xt):void 0,m=Di(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),i.append(m,...c),p&&p===u&&(Id(a)?m.select(a.anchor.offset,a.focus.offset):Sd(a)&&m.select(0,m.getTextContent().length)),u.replace(i),d}}}function Fd(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),i=n,l,s=0;for(;(l=Pi(i,e))!=null&&l!==null;){let u=l.index,c=l.length,d=u+c;if(Ad(s+u,s+d,n,r)){let[p,,m,f]=Dd(r,s+u,s+d),h=s+u-p,C=s+d-p,_=Od(m,h,C,l);r=_?[_,...f]:f,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function Wo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!xt(c)||!c.isSimpleText()){Yt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=Pi(i,e);if(l===null||l.text!==i){Yt(t),o(null,t.getFields()?.url??null);return}if(!Hi(t)||!ji(t)){Yt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let u=t.getFields();u.url=l?.url,t.setFields(u),o(l.url,s??null)}}function $d(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(ke(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Vo(i)||Md(i,l))&&(r.append(t),Wo(r,e,o),o(null,r.getFields()?.url??null))}ke(n)&&!Bi(i)&&(Yt(n),Wo(n,e,o),o(null,n.getFields()?.url??null))}function Yt(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 Pd(t){let e=[t],o=t.getNextSibling();for(;o!==null&&xt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Bd(t,e,o){let r=kd(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([we]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,u)=>{o?.(s,u)};return Nd(t.registerNodeTransform(Rd,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(ke(u))Wo(u,e,l);else if(!Z(u)){if(s.isSimpleText()&&(Vo(s.getTextContent())||!ke(c))){let d=Pd(s);Fd(d,e,l)}$d(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]),yd(n,i)}var Hd=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,jd=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ud=[Oi(Hd,t=>t.startsWith("http")?t:`https://${t}`),Oi(jd,t=>`mailto:${t}`)],Ui=()=>{let[t]=Ed();return Bd(t,Ud),null};import{jsx as Gd}from"react/jsx-runtime";import{ClickableLinkPlugin as Wd}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Gi=()=>Gd(Wd,{});import{jsx as am}from"react/jsx-runtime";import"react";import{createPortal as cm}from"react-dom";import{jsx as Ee,jsxs as bt,Fragment as Kd}from"react/jsx-runtime";import{useLexicalComposerContext as Jd}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Wi,mergeRegister as Vi}from"@lexical/utils";import{getTranslation as Ko}from"@payloadcms/translations";import{CloseMenuIcon as Xd,EditIcon as zd,ExternalLinkIcon as Ki,formatDrawerSlug as Zd,useConfig as Yd,useEditDepth as qd,useLocale as Qd,useTranslation as em}from"@payloadcms/ui";import{requests as tm}from"@payloadcms/ui/shared";import{$getSelection as Ji,$isLineBreakNode as om,$isRangeSelection as Xi,COMMAND_PRIORITY_HIGH as rm,COMMAND_PRIORITY_LOW as zi,getDOMSelection as nm,KEY_ESCAPE_COMMAND as im,SELECTION_CHANGE_COMMAND as lm}from"lexical";import Zi,{useCallback as Yi,useEffect as to,useRef as sm,useState as Pe}from"react";function Qt(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(),u=i.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=l.height+t.height+r*2),d+l.width>u.right&&(d=u.right-l.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as Vd}from"lexical";var eo=Vd("TOGGLE_LINK_WITH_MODAL_COMMAND");function qi(t){t.preventDefault()}function Qi({anchorElem:t}){let[e]=Jd(),[o,r]=Pe(),n=sm(null),[i,l]=Pe(null),[s,u]=Pe(null),{fieldProps:{schemaPath:c},uuid:d}=j(),{config:a,getEntityConfig:p}=Yd(),{i18n:m,t:f}=em(),[h,C]=Pe(),_=qd(),[I,A]=Pe(!1),[b,T]=Pe([]),g=Qd(),[k,M]=Pe(!1),D=Zd({slug:"lexical-rich-text-link-"+d,depth:_}),{toggleDrawer:P}=Ce(D),v=Yi(()=>{A(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),M(!1),l(null),u(null),T([]),C(void 0)},[A,l,u,T]),N=Yi(()=>{let x=Ji(),E;if(!Xi(x)||!x){v();return}let S=Xe(x);E=e.getElementByKey(S.getKey())?.getBoundingClientRect();let L=Wi(S,Z),R=x.getNodes().filter(H=>!om(H)).find(H=>{let W=Wi(H,Z);return L&&!L.is(W)||W&&!W.is(L)});if(L==null||R){v();return}r(L);let w=L.getFields(),F={...w,id:L.getID(),text:L.getTextContent()};if(w?.linkType==="custom")l(w?.url??null),u(null);else{l(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${w?.doc?.relationTo}/${w?.doc?.value}`);let H=w?.doc?.relationTo?p({collectionSlug:w?.doc?.relationTo}):void 0;if(!H)u(w?.label?String(w?.label):null),l(w?.url?String(w?.url):null);else{let W=typeof w.doc?.value=="object"?w.doc.value.id:w.doc?.value,te=w.doc?.relationTo;if(!W||!te)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ce=f("fields:linkedTo",{label:`${Ko(H.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(ce),tm.get(`${a.serverURL}${a.routes.api}/${te}/${W}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:g?.code}}).then(async Y=>{if(!Y.ok)throw new Error(`HTTP error! Status: ${Y.status}`);let K=await Y.json(),oe=H?.admin?.useAsTitle||"id",re=K[oe],le=f("fields:linkedTo",{label:`${Ko(H.labels.singular,m)} - ${re}`}).replace(/<[^>]*>?/g,"");u(le)}).catch(()=>{let Y=f("fields:linkedTo",{label:`${Ko(H.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${W}`}).replace(/<[^>]*>?/g,"");u(Y)})}}C(F),A(!0),T(x?x?.getNodes():[]),ke(L)?M(!0):M(!1);let $=n.current,U=nm(e._window),{activeElement:V}=document;if($===null)return;let pe=e.getRootElement();return U!==null&&pe!==null&&pe.contains(U.anchorNode)?(E||(E=U.getRangeAt(0).getBoundingClientRect()),E!=null&&(E.y+=40,Qt(E,$,t))):(V==null||V.className!=="link-input")&&(pe!==null&&Qt(null,$,t),l(null),u(null)),!0},[e,v,a.routes.admin,a.routes.api,a.serverURL,p,f,m,g?.code,t]);return to(()=>Vi(e.registerCommand(eo,x=>(e.dispatchCommand(he,x),N(),P(),!0),zi)),[e,N,P,D]),to(()=>{let x=t.parentElement,E=()=>{e.getEditorState().read(()=>{N()})};return window.addEventListener("resize",E),x?.addEventListener("scroll",E),()=>{window.removeEventListener("resize",E),x?.removeEventListener("scroll",E)}},[t.parentElement,e,N]),to(()=>Vi(e.registerUpdateListener(({editorState:x})=>{x.read(()=>{N()})}),e.registerCommand(lm,()=>(N(),!0),zi),e.registerCommand(im,()=>I?(v(),!0):!1,rm)),[e,N,I,v]),to(()=>{e.getEditorState().read(()=>{N()})},[e,N]),bt(Zi.Fragment,{children:[Ee("div",{className:"link-editor",ref:n,children:bt("div",{className:"link-input",children:[i&&i.length>0?bt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Ee(Ki,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?bt(Kd,{children:[o?.__fields.newTab?Ee(Ki,{}):null,Ee("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&bt(Zi.Fragment,{children:[Ee("button",{"aria-label":"Edit link",className:"link-edit",onClick:x=>{x.preventDefault(),P()},onMouseDown:qi,tabIndex:0,type:"button",children:Ee(zd,{})}),!k&&Ee("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(he,null)},onMouseDown:qi,tabIndex:0,type:"button",children:Ee(Xd,{})})]})]})}),Ee(lt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:D,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(x,E)=>{let S=E,L={...S};delete L.text,e.update(()=>{let R=Ji(),w=null;if(Xi(R)?w=Xe(R).getParent():b.length&&(w=b[0]?.getParent()??null),w&&ke(w)){let F=Te({fields:L});w.replace(F,!0)}}),e.dispatchCommand(he,{fields:L,selectedNodes:b,text:S.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var el=t=>{let{anchorElem:e=document.body}=t;return cm(am(Qi,{anchorElem:e}),e)};import{c as mm}from"react/compiler-runtime";import{useLexicalComposerContext as pm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as fm}from"@lexical/utils";import{$getSelection as hm,$isElementNode as gm,$isRangeSelection as Cm,COMMAND_PRIORITY_LOW as ol,PASTE_COMMAND as xm}from"lexical";import{useEffect as bm}from"react";var um=/^(?:[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+)?$/,dm=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function tl(t){if(!t)return!1;if(t==="https://"||um.test(t)||dm.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var rl=t=>{let e=mm(5),{clientProps:o}=t,[r]=pm(),n,i;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ie]))throw new Error("LinkPlugin: LinkNode not registered on editor");return fm(r.registerCommand(he,l=>l===null?(Go(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),Go(l),!0),ol),r.registerCommand(xm,l=>{let s=hm();if(!Cm(s)||s.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let u=l.clipboardData.getData("text");if(!tl(u))return!1;if(!s.getNodes().some(_m)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(he,{fields:c,text:null}),l.preventDefault(),!0}return!1},ol))},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]),bm(n,i),null};function _m(t){return gm(t)}var il=[Bo([{ChildComponent:Ri,isActive:({selection:t})=>{if(nl(t)){let e=Xe(t);return Tm(e,Z)!=null}return!1},isEnabled:({selection:t})=>!!(nl(t)&&Jo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(he,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Jo()?.getTextContent(),r=Jo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,newTab:!1};t.dispatchCommand(eo,{fields:n,selectedNodes:r,text:o})}},order:1}])],wm=y(({props:t})=>({markdownTransformers:[Ai],nodes:[ie,t?.disableAutoLinks===!0?null:we].filter(Boolean),plugins:[{Component:rl,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Ui,position:"normal"},{Component:Gi,position:"normal"},{Component:el,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:il},toolbarInline:{groups:il}}));import{$isListNode as Zo,INSERT_CHECK_LIST_COMMAND as dl,ListItemNode as Dm,ListNode as Om}from"@lexical/list";import{$isRangeSelection as Fm}from"lexical";import{jsx as ll,jsxs as km}from"react/jsx-runtime";import"react";var Xo=()=>km("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:[ll("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),ll("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Em}from"react/jsx-runtime";import{ListPlugin as Nm}from"@lexical/react/LexicalListPlugin.js";import"react";var ze=()=>Em(Nm,{});function Ze(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Rm,ListItemNode as ym,ListNode as vm}from"@lexical/list";import{$createListItemNode as Lm,$createListNode as Sm,$isListItemNode as Im,$isListNode as zo}from"@lexical/list";var sl=4,Ye=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Lm(t==="check"?r[3]==="x":void 0);if(zo(i)&&i.getListType()===t){let u=i.getFirstChild();u!==null?u.insertBefore(l):i.append(l),e.remove()}else if(zo(n)&&n.getListType()===t)n.append(l),e.remove();else{let u=Sm(t,t==="number"?Number(r[2]):void 0);u.append(l),e.replace(u)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/sl);s&&l.setIndent(s)},Be=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(Im(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(zo(d)){r.push(Be(d,e,o+1));continue}}let s=" ".repeat(o*sl),u=t.getListType(),c=u==="number"?`${t.getStart()+i}. `:u==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(l)),i++}return r.join(`
36
- `)};var al={type:"element",dependencies:[vm,ym],export:(t,e)=>Rm(t)?Be(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Ye("check")};import{jsx as Mm}from"react/jsx-runtime";import{CheckListPlugin as Am}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var cl=()=>Mm(Am,{});var ul=[ne([{ChildComponent:Xo,isActive:({selection:t})=>{if(!Fm(t))return!1;for(let e of t.getNodes()){if(Zo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Zo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Zo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(dl,void 0)},order:12}])],$m=y(({featureProviderMap:t})=>{let e=[{Component:cl,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:ze,position:"normal"}),{markdownTransformers:[al],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Om,Dm],plugins:e,slashMenu:{groups:[Ze([{Icon:Xo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(dl,void 0)}}])]},toolbarFixed:{groups:ul},toolbarInline:{groups:ul}}});import{$isListNode as qo,INSERT_ORDERED_LIST_COMMAND as fl,ListItemNode as Um,ListNode as Gm}from"@lexical/list";import{$isRangeSelection as Wm}from"lexical";import{jsx as _t,jsxs as Pm}from"react/jsx-runtime";import"react";var Yo=()=>Pm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[_t("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"}),_t("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"}),_t("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),_t("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),_t("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Bm,ListItemNode as Hm,ListNode as jm}from"@lexical/list";var ml={type:"element",dependencies:[jm,Hm],export:(t,e)=>Bm(t)?Be(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Ye("number")};var pl=[ne([{ChildComponent:Yo,isActive:({selection:t})=>{if(!Wm(t))return!1;for(let e of t.getNodes()){if(qo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(qo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(qo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(fl,void 0)},order:10}])],Vm=y(({featureProviderMap:t})=>({markdownTransformers:[ml],nodes:t.has("orderedList")?[]:[Gm,Um],plugins:t.has("orderedList")?[]:[{Component:ze,position:"normal"}],slashMenu:{groups:[Ze([{Icon:Yo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(fl,void 0)}}])]},toolbarFixed:{groups:pl},toolbarInline:{groups:pl}}));import{$isListNode as er,INSERT_UNORDERED_LIST_COMMAND as Cl,ListItemNode as Zm,ListNode as Ym}from"@lexical/list";import{$isRangeSelection as qm}from"lexical";import{jsx as qe,jsxs as Km}from"react/jsx-runtime";import"react";var Qo=()=>Km("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:[qe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),qe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),qe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),qe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),qe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),qe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Jm,ListItemNode as Xm,ListNode as zm}from"@lexical/list";var hl={type:"element",dependencies:[zm,Xm],export:(t,e)=>Jm(t)?Be(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ye("bullet")};var gl=[ne([{ChildComponent:Qo,isActive:({selection:t})=>{if(!qm(t))return!1;for(let e of t.getNodes()){if(er(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(er(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(er(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Cl,void 0)},order:11}])],Qm=y({markdownTransformers:[hl],nodes:[Ym,Zm],plugins:[{Component:ze,position:"normal"}],slashMenu:{groups:[Ze([{Icon:Qo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Cl,void 0)}}])]},toolbarFixed:{groups:gl},toolbarInline:{groups:gl}});import{jsx as ep}from"react/jsx-runtime";import{addClassNamesToElement as tp}from"@lexical/utils";import{DecoratorNode as op}from"lexical";import*as xl from"react";var rp=xl.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Tt=class t extends op{__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 np({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return tp(o,"unknownConverted"),o}decorate(){return ep(rp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function np({data:t}){return new Tt({data:t})}var ip=y(()=>({nodes:[Tt]}));import{jsx as lp}from"react/jsx-runtime";import{addClassNamesToElement as sp}from"@lexical/utils";import{DecoratorNode as ap}from"lexical";import*as bl from"react";var cp=bl.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),wt=class t extends ap{__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 up({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return sp(o,"unknownConverted"),o}decorate(){return lp(cp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function up({data:t}){return new wt({data:t})}var dp=y(()=>({nodes:[wt]}));import{$setBlocksType as wl}from"@lexical/selection";import{$createParagraphNode as kl,$getSelection as El,$isParagraphNode as _l,$isRangeSelection as mp}from"lexical";var Tl=[ne([{ChildComponent:at,isActive:({selection:t})=>{if(!mp(t))return!1;for(let e of t.getNodes())if(!_l(e)&&!_l(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=El();wl(e,()=>kl())})},order:1}])],pp=y({slashMenu:{groups:[Q([{Icon:at,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=El();wl(e,()=>kl())})}}])]},toolbarFixed:{groups:Tl},toolbarInline:{groups:Tl}});import{c as Dp}from"react/compiler-runtime";import{jsx as Op}from"react/jsx-runtime";import{useLexicalComposerContext as Fp}from"@lexical/react/LexicalComposerContext";import{useEffect as $p,useState as Pp}from"react";import{jsx as Gl,Fragment as Ap}from"react/jsx-runtime";import"react";import{jsx as fp}from"react/jsx-runtime";var Nl={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return fp("blockquote",{children:o})}};import{jsx as hp}from"react/jsx-runtime";var Ll={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return hp(r,{children:o})}};import{jsx as gp}from"react/jsx-runtime";var Sl={horizontalrule:gp("hr",{})};import{jsx as Cp}from"react/jsx-runtime";var Il={linebreak:Cp("br",{})};import{jsx as Rl}from"react/jsx-runtime";var yl=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,i=e.fields.newTab?"_blank":void 0;return Rl("a",{href:e.fields.url,rel:n,target:i,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,i=e.fields.newTab?"_blank":void 0,l=e.fields.url??"";return e.fields.linkType==="internal"&&(t?l=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),l="#")),Rl("a",{href:l,rel:n,target:i,children:r})}});import{jsx as Qe,jsxs as xp,Fragment as bp}from"react/jsx-runtime";import{v4 as _p}from"uuid";var vl={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Qe(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(i=>i.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let i=_p();return Qe("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:xp(bp,{children:[Qe("input",{checked:t.checked,id:i,readOnly:!0,type:"checkbox"}),Qe("label",{htmlFor:i,children:n}),Qe("br",{})]})})}else return Qe("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as tr}from"react/jsx-runtime";var Ml={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?tr("p",{children:o}):tr("p",{children:tr("br",{})})}};var Al={tab:" "};import{jsx as kt}from"react/jsx-runtime";var Dl={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return kt("div",{className:"lexical-table-container",children:kt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:kt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,i={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},l=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return kt(r,{className:`lexical-table-cell ${n}`,colSpan:l,rowSpan:s,style:i,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return kt("tr",{className:"lexical-table-row",children:o})}};import{jsx as He}from"react/jsx-runtime";import"react";var O={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},Tp=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,wp="\xA0",kp=`
34
+ `},[t,e]),m=Fe((b,T)=>{o(g=>{let k=e.length-1,M=e[k];if(M&&M.name===b){if(b==="type")return[...e.slice(0,k),{...M,value:M.value+T}];if(M.value===T)return[...e.slice(0,k),{...M,count:M.count+1}]}return[...g,{name:b,count:1,value:T}]})},[e,o]);fn(()=>{let b=g=>{if(!r)return;let k=g.key;Oc(g)?m("selectAll",""):gn.has(k)?m("press",g.key):[...k].length>1?m("keydown",g.key):m("type",g.key)},T=g=>{if(!r)return;let k=g.key;!gn.has(k)&&[...k].length>1&&m("keyup",g.key)};return t.registerRootListener((g,k)=>{k!==null&&(k.removeEventListener("keydown",b),k.removeEventListener("keyup",T)),g!==null&&(g.addEventListener("keydown",b),g.addEventListener("keyup",T))})},[t,r,m]),fn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Do(()=>{if(e){let b=p();b!==null&&s(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Do(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:g,editorState:k})=>{if(!r)return;let M=k._selection,D=u.current,P=c.current;if(D!==M){if(g.size===0&&T.size===0&&!P){let N=Ao(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}u.current=M}c.current=!1;let v=p();v!==null&&s(v)}),[t,p,r,m]),Do(()=>r?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,r]);let f=Fe(b=>{r||(b.update(()=>{let T=vc();T.clear();let g=yc();T.append(Rc().append(g)),g.select()}),o([])),n(T=>!T)},[r]),h=Fe(()=>{if(!r)return;let b=Ao(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:T,anchorOffset:g,focusNode:k,focusOffset:M}=Fc(b),D=a().getRootElement(),P;T!==null&&(P=hn(T,D));let v;k!==null&&(v=hn(k,D)),m("snapshot",{anchorNode:T,anchorOffset:g,anchorPath:P,focusNode:k,focusOffset:M,focusPath:v})},[m,r,a]),C=Fe(()=>{Mc(p())},[p]),_=Fe(()=>{Ac("test.js",p())},[p]);return[$e("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?Fo("div",{className:"test-recorder-output",children:[Fo("div",{className:"test-recorder-toolbar",children:[$e("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),$e("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{C(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),$e("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{_(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),$e("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var xn=()=>{let t=Sc(3),[e]=Ic(),[o,r]=$c(e),n;return t[0]!==o||t[1]!==r?(n=Fo(Cn.Fragment,{children:[$e("p",{children:"HI"}),o,r,$e("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Pc=y({plugins:[{Component:xn,position:"bottom"}]});import{c as Bc}from"react/compiler-runtime";import{jsx as Hc}from"react/jsx-runtime";import{useLexicalComposerContext as jc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Uc}from"@lexical/react/LexicalTreeView.js";import"react";var bn=()=>{let t=Bc(2),[e]=jc(),o;return t[0]!==e?(o=Hc(Uc,{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 Gc=y({plugins:[{Component:bn,position:"bottom"}]});import{$isTableSelection as Wc}from"@lexical/table";import{$isRangeSelection as Vc,FORMAT_TEXT_COMMAND as Kc}from"lexical";import{jsx as _n}from"react/jsx-runtime";import"react";var Tn=()=>_n("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:_n("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 ee=t=>({type:"buttons",items:t,key:"format",order:40});var wn={type:"text-format",format:["bold","italic"],tag:"***"},kn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},En={type:"text-format",format:["bold"],tag:"**"},Nn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Ln=[ee([{ChildComponent:Tn,isActive:({selection:t})=>Vc(t)||Wc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Kc,"bold")},order:1}])],Jc=y(({featureProviderMap:t})=>{let e=[En,Nn];return t.get("italic")&&e.push(kn,wn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Ln},toolbarInline:{groups:Ln}}});import{$isTableSelection as zc}from"@lexical/table";import{$isRangeSelection as Zc,FORMAT_TEXT_COMMAND as Yc}from"lexical";import{jsx as Sn,jsxs as Xc}from"react/jsx-runtime";import"react";var In=()=>Xc("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:[Sn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Sn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Rn={type:"text-format",format:["code"],tag:"`"};var yn=[ee([{ChildComponent:In,isActive:({selection:t})=>Zc(t)||zc(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Yc,"code")},order:7}])],qc=y({enableFormats:["code"],markdownTransformers:[Rn],toolbarFixed:{groups:yn},toolbarInline:{groups:yn}});import{$isTableSelection as Qc}from"@lexical/table";import{$isRangeSelection as eu,FORMAT_TEXT_COMMAND as tu}from"lexical";import{jsx as vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("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:vn("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 An={type:"text-format",format:["italic"],tag:"*"},Dn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var On=[ee([{ChildComponent:Mn,isActive:({selection:t})=>eu(t)||Qc(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(tu,"italic")},order:2}])],ou=y({enableFormats:["italic"],markdownTransformers:[An,Dn],toolbarFixed:{groups:On},toolbarInline:{groups:On}});import{$isTableSelection as nu}from"@lexical/table";import{$isRangeSelection as iu,FORMAT_TEXT_COMMAND as lu}from"lexical";import{jsx as Fn,jsxs as ru}from"react/jsx-runtime";import"react";var $n=()=>ru("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Fn("path",{d:"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"}),Fn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Pn={type:"text-format",format:["strikethrough"],tag:"~~"};var Bn=[ee([{ChildComponent:$n,isActive:({selection:t})=>iu(t)||nu(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(lu,"strikethrough")},order:4}])],su=y({enableFormats:["strikethrough"],markdownTransformers:[Pn],toolbarFixed:{groups:Bn},toolbarInline:{groups:Bn}});import{$isTableSelection as au}from"@lexical/table";import{$isRangeSelection as cu,FORMAT_TEXT_COMMAND as uu}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var jn=()=>Hn("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:Hn("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 Un=[ee([{ChildComponent:jn,isActive:({selection:t})=>cu(t)||au(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(uu,"subscript")},order:5}])],du=y({enableFormats:["subscript"],toolbarFixed:{groups:Un},toolbarInline:{groups:Un}});import{$isTableSelection as mu}from"@lexical/table";import{$isRangeSelection as pu,FORMAT_TEXT_COMMAND as fu}from"lexical";import{jsx as Gn}from"react/jsx-runtime";import"react";var Wn=()=>Gn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Gn("path",{d:"M10.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 Vn=[ee([{ChildComponent:Wn,isActive:({selection:t})=>pu(t)||mu(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(fu,"superscript")},order:6}])],hu=y({enableFormats:["superscript"],toolbarFixed:{groups:Vn},toolbarInline:{groups:Vn}});import{$isTableSelection as Cu}from"@lexical/table";import{$isRangeSelection as xu,FORMAT_TEXT_COMMAND as bu}from"lexical";import{jsx as Kn,jsxs as gu}from"react/jsx-runtime";import"react";var Jn=()=>gu("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Kn("path",{d:"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"}),Kn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Xn=[ee([{ChildComponent:Jn,isActive:({selection:t})=>xu(t)||Cu(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(bu,"underline")},order:3}])],_u=y({enableFormats:["underline"],toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$createHeadingNode as Eu,$isHeadingNode as ai,HeadingNode as Nu}from"@lexical/rich-text";import{$setBlocksType as Lu}from"@lexical/selection";import{$getSelection as Su,$isRangeSelection as Iu}from"lexical";import{jsx as zn}from"react/jsx-runtime";import"react";var Zn=()=>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:"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 Yn}from"react/jsx-runtime";import"react";var qn=()=>Yn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yn("path",{d:"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 Qn}from"react/jsx-runtime";import"react";var ei=()=>Qn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qn("path",{d:"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 ti}from"react/jsx-runtime";import"react";var oi=()=>ti("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:ti("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 ri}from"react/jsx-runtime";import"react";var ni=()=>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("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 ii}from"react/jsx-runtime";import"react";var li=()=>ii("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:ii("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 Tu,$isHeadingNode as wu,HeadingNode as ku}from"@lexical/rich-text";var $o=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var si=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[ku],export:(n,i)=>{if(!wu(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:$o(n=>{let i="h"+n[1]?.length;return Tu(i)})}};var ci=t=>{let e=Su();Lu(e,()=>Eu(t))},ui={h1:Zn,h2:qn,h3:ei,h4:oi,h5:ni,h6:li},Ru=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ne(e.map((r,n)=>({ChildComponent:ui[r],isActive:({selection:i})=>{if(!Iu(i))return!1;for(let l of i.getNodes()){if(ai(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(ai(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(()=>{ci(r)})},order:n+2})))];return{markdownTransformers:[si(e)],nodes:[Nu],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Q(e.map(r=>({Icon:ui[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(()=>{ci(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Vu}from"lexical";import{jsx as di}from"react/jsx-runtime";import"react";var Po=()=>di("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:di("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as mi,jsxs as yu}from"react/jsx-runtime";import"react";var pi=()=>yu("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mi("path",{d:"M5 10h10",stroke:"currentColor"}),mi("path",{d:"M10 15V5",stroke:"currentColor"})]});var _e=t=>({type:"dropdown",ChildComponent:pi,items:t,key:"add",order:10});import{addClassNamesToElement as vu}from"@lexical/utils";import{$applyNodeReplacement as Mu,createCommand as Au,DecoratorNode as Du}from"lexical";var ht=Au("INSERT_HORIZONTAL_RULE_COMMAND"),ft=class extends Du{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Ou,priority:0})}}static importJSON(e){return fi()}createDOM(e){let o=document.createElement("hr");return vu(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:fi()}}function fi(){return Mu(new ft)}import{$applyNodeReplacement as Fu}from"lexical";import"react";var ve=class extends ft{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return gt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function gt(){return Fu(new ve)}function Xt(t){return t instanceof ve}var hi={type:"element",dependencies:[ve],export:(t,e)=>Xt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=gt();e&&t.replace(e)}};import{c as $u}from"react/compiler-runtime";import{useLexicalComposerContext as Pu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Bu}from"@lexical/utils";import{$getSelection as Hu,$isRangeSelection as ju,COMMAND_PRIORITY_EDITOR as Uu}from"lexical";import{useEffect as Gu}from"react";var gi=()=>{let t=$u(3),[e]=Pu(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ht,Wu,Uu),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Gu(o,r),null};function Wu(t){let e=Hu();if(!ju(e))return!1;if(e.focus.getNode()!==null){let r=gt();Bu(r)}return!0}var Ku=y({markdownTransformers:[hi],nodes:[ve],plugins:[{Component:gi,position:"normal"}],slashMenu:{groups:[Q([{Icon:Po,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(ht,void 0)}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Po,isActive:({selection:t})=>{if(!Vu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Xt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(ht,void 0)}}])]}});import{$findMatchingParent as Li}from"@lexical/utils";import{$isElementNode as id,INDENT_CONTENT_COMMAND as ld,OUTDENT_CONTENT_COMMAND as sd}from"lexical";import{jsx as zt,jsxs as Ju}from"react/jsx-runtime";import"react";var Ci=()=>Ju("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:[zt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),zt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),zt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Zt,jsxs as Xu}from"react/jsx-runtime";import"react";var xi=()=>Xu("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:[Zt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as zu}from"react/jsx-runtime";import{useLexicalComposerContext as Zu}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Yu}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as qu,mergeRegister as bi}from"@lexical/utils";import{$getSelection as Qu,$isElementNode as ki,$isRangeSelection as ed,COMMAND_PRIORITY_LOW as _i,INDENT_CONTENT_COMMAND as Ti,KEY_TAB_COMMAND as td,OUTDENT_CONTENT_COMMAND as od,TabNode as rd}from"lexical";import{useEffect as wi}from"react";var Ei=({clientProps:t})=>{let[e]=Zu(),{disabledNodes:o,disableTabNode:r}=t;return wi(()=>{if(!(!e||!o?.length))return bi(e.registerCommand(Ti,()=>nd(n=>{if(!o.includes(n.getType())){let i=n.getIndent();n.setIndent(i+1)}}),_i),e.registerUpdateListener(({dirtyElements:n,editorState:i})=>{e.update(()=>{for(let[l]of n){let s=i._nodeMap.get(l);ki(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),wi(()=>{if(!(!e||!r))return bi(e.registerCommand(td,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?od:Ti,void 0)),_i),e.registerNodeTransform(rd,n=>{n.remove()}))},[e,r]),zu(Yu,{})};function nd(t){let e=Qu();if(!ed(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let i=r[n],l=i.getKey();if(o.has(l))continue;let s=qu(i,c=>ki(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var Ni=t=>({type:"buttons",items:t,key:"indent",order:35});var Si=({disabledNodes:t})=>[Ni([{ChildComponent:Ci,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Ii(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!Li(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(sd,void 0)},order:1},{ChildComponent:xi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Ii(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!Li(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ld,void 0)},order:2}])],ad=y(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Ei,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Si({disabledNodes:e})},toolbarInline:{groups:Si({disabledNodes:e})}}}),Ii=t=>id(t)&&t.canIndent();import{$findMatchingParent as _m}from"@lexical/utils";import{$getSelection as Jo,$isRangeSelection as il}from"lexical";import{jsx as Ri}from"react/jsx-runtime";import"react";var yi=()=>Ri("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ri("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as vi}from"@lexical/selection";function Xe(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?vi(o)?r:n:vi(e)?r:n}var Bo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as bd}from"lexical";import{addClassNamesToElement as cd,isHTMLAnchorElement as ud}from"@lexical/utils";import Uo from"bson-objectid";import{$applyNodeReplacement as dd,$createTextNode as Mi,$getSelection as md,$isElementNode as Ai,$isRangeSelection as jo,createCommand as pd,ElementNode as fd}from"lexical";var hd=new Set(["http:","https:","mailto:","sms:","tel:"]),ie=class t extends fd{__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:gd,priority:1})}}static importJSON(e){let o=Te({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Uo.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Ho(o.rel,"add","noopener")),cd(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(!jo(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(Ai(r)){let n=Te({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!hd.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,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=Ho(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Ho(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function gd(t){let e=null;if(ud(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new Uo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Te({id:t,fields:e}){return dd(new ie({id:t??new Uo.default().toHexString(),fields:e}))}function Z(t){return t instanceof ie}var he=pd("TOGGLE_LINK_COMMAND");function Go(t){let e=md();if(!jo(e)&&(t===null||!t.selectedNodes?.length))return;let o=jo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(i=>{let l=i.getParent();Z(l)&&(l.getChildren().forEach(u=>{l.insertBefore(u)}),l.remove())});return}if(o?.length===1){let i=o[0],l=Z(i)?i:Cd(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Mi(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||Ai(i)&&!i.isInline())){if(Z(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Mi(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=Te({fields:t.fields}),Z(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),Z(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 Cd(t){return xd(t,e=>Z(e))}function xd(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Ho(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 Di={type:"text-match",dependencies:[ie],export:(t,e)=>{if(!Z(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=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=bd(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as _d,$isElementNode as Td}from"lexical";var we=class t extends ie{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Ct({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Td(r)){let n=Ct({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Ct({fields:t}){return _d(new we({id:"",fields:t}))}function ke(t){return t instanceof we}import{c as wd}from"react/compiler-runtime";import{useLexicalComposerContext as kd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ed}from"@lexical/utils";import{$createTextNode as Oi,$getSelection as Nd,$isElementNode as $i,$isLineBreakNode as Pi,$isNodeSelection as Ld,$isRangeSelection as Sd,$isTextNode as xt,TextNode as Id}from"lexical";import{useEffect as Rd}from"react";function Fi(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 Bi(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var yd=/[.,;\s]/;function qt(t){return t!==void 0&&yd.test(t)}function Hi(t){return qt(t[t.length-1])}function Vo(t){return qt(t[0])}function vd(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function ji(t){let e=t.getPreviousSibling();return $i(e)&&(e=e.getLastDescendant()),e===null||Pi(e)||xt(e)&&Hi(e.getTextContent())}function Ui(t){let e=t.getNextSibling();return $i(e)&&(e=e.getFirstDescendant()),e===null||Pi(e)||xt(e)&&Vo(e.getTextContent())}function Md(t,e,o,r){return(t>0?qt(o[t-1]):ji(r[0]))?e<o.length?qt(o[e]):Ui(r[r.length-1]):!1}function Ad(t,e,o){let r=[],n=[],i=[],l=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,p=s;s+a<=e?(r.push(c),l+=a):p>=o?i.push(c):n.push(c),s+=a,u.shift()}return[l,r,n,i]}function Dd(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=Ct({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 u=Oi(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),i.append(u),s.replace(i)}return l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,u;e===0?u=l:[,u]=l.splitText(e);let c=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)c.push(a);else{let[C,_]=a.splitText(o-f);C&&c.push(C),d=_}s+=m}),u){let a=Nd(),p=a?a.getNodes().find(xt):void 0,m=Oi(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),i.append(m,...c),p&&p===u&&(Sd(a)?m.select(a.anchor.offset,a.focus.offset):Ld(a)&&m.select(0,m.getTextContent().length)),u.replace(i),d}}}function Od(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),i=n,l,s=0;for(;(l=Bi(i,e))!=null&&l!==null;){let u=l.index,c=l.length,d=u+c;if(Md(s+u,s+d,n,r)){let[p,,m,f]=Ad(r,s+u,s+d),h=s+u-p,C=s+d-p,_=Dd(m,h,C,l);r=_?[_,...f]:f,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function Wo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!xt(c)||!c.isSimpleText()){Yt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=Bi(i,e);if(l===null||l.text!==i){Yt(t),o(null,t.getFields()?.url??null);return}if(!ji(t)||!Ui(t)){Yt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let u=t.getFields();u.url=l?.url,t.setFields(u),o(l.url,s??null)}}function Fd(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(ke(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Vo(i)||vd(i,l))&&(r.append(t),Wo(r,e,o),o(null,r.getFields()?.url??null))}ke(n)&&!Hi(i)&&(Yt(n),Wo(n,e,o),o(null,n.getFields()?.url??null))}function Yt(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 $d(t){let e=[t],o=t.getNextSibling();for(;o!==null&&xt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Pd(t,e,o){let r=wd(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([we]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,u)=>{o?.(s,u)};return Ed(t.registerNodeTransform(Id,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(ke(u))Wo(u,e,l);else if(!Z(u)){if(s.isSimpleText()&&(Vo(s.getTextContent())||!ke(c))){let d=$d(s);Od(d,e,l)}Fd(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]),Rd(n,i)}var Bd=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Hd=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,jd=[Fi(Bd,t=>t.startsWith("http")?t:`https://${t}`),Fi(Hd,t=>`mailto:${t}`)],Gi=()=>{let[t]=kd();return Pd(t,jd),null};import{jsx as Ud}from"react/jsx-runtime";import{ClickableLinkPlugin as Gd}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Wi=()=>Ud(Gd,{});import{jsx as sm}from"react/jsx-runtime";import"react";import{createPortal as am}from"react-dom";import{jsx as Ee,jsxs as bt,Fragment as Vd}from"react/jsx-runtime";import{useLexicalComposerContext as Kd}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Vi,mergeRegister as Ki}from"@lexical/utils";import{getTranslation as Ko}from"@payloadcms/translations";import{CloseMenuIcon as Jd,EditIcon as Xd,ExternalLinkIcon as Ji,formatDrawerSlug as zd,useConfig as Zd,useEditDepth as Yd,useLocale as qd,useTranslation as Qd}from"@payloadcms/ui";import{requests as em}from"@payloadcms/ui/shared";import{$getSelection as Xi,$isLineBreakNode as tm,$isRangeSelection as zi,COMMAND_PRIORITY_HIGH as om,COMMAND_PRIORITY_LOW as Zi,getDOMSelection as rm,KEY_ESCAPE_COMMAND as nm,SELECTION_CHANGE_COMMAND as im}from"lexical";import Yi,{useCallback as qi,useEffect as to,useRef as lm,useState as Pe}from"react";function Qt(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(),u=i.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=l.height+t.height+r*2),d+l.width>u.right&&(d=u.right-l.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as Wd}from"lexical";var eo=Wd("TOGGLE_LINK_WITH_MODAL_COMMAND");function Qi(t){t.preventDefault()}function el({anchorElem:t}){let[e]=Kd(),[o,r]=Pe(),n=lm(null),[i,l]=Pe(null),[s,u]=Pe(null),{fieldProps:{schemaPath:c},uuid:d}=j(),{config:a,getEntityConfig:p}=Zd(),{i18n:m,t:f}=Qd(),[h,C]=Pe(),_=Yd(),[I,A]=Pe(!1),[b,T]=Pe([]),g=qd(),[k,M]=Pe(!1),D=zd({slug:"lexical-rich-text-link-"+d,depth:_}),{toggleDrawer:P}=Ce(D),v=qi(()=>{A(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),M(!1),l(null),u(null),T([]),C(void 0)},[A,l,u,T]),N=qi(()=>{let x=Xi(),E;if(!zi(x)||!x){v();return}let S=Xe(x);E=e.getElementByKey(S.getKey())?.getBoundingClientRect();let L=Vi(S,Z),R=x.getNodes().filter(H=>!tm(H)).find(H=>{let W=Vi(H,Z);return L&&!L.is(W)||W&&!W.is(L)});if(L==null||R){v();return}r(L);let w=L.getFields(),F={...w,id:L.getID(),text:L.getTextContent()};if(w?.linkType==="custom")l(w?.url??null),u(null);else{l(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${w?.doc?.relationTo}/${w?.doc?.value}`);let H=w?.doc?.relationTo?p({collectionSlug:w?.doc?.relationTo}):void 0;if(!H)u(w?.label?String(w?.label):null),l(w?.url?String(w?.url):null);else{let W=typeof w.doc?.value=="object"?w.doc.value.id:w.doc?.value,te=w.doc?.relationTo;if(!W||!te)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ce=f("fields:linkedTo",{label:`${Ko(H.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(ce),em.get(`${a.serverURL}${a.routes.api}/${te}/${W}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:g?.code}}).then(async Y=>{if(!Y.ok)throw new Error(`HTTP error! Status: ${Y.status}`);let K=await Y.json(),oe=H?.admin?.useAsTitle||"id",re=K[oe],le=f("fields:linkedTo",{label:`${Ko(H.labels.singular,m)} - ${re}`}).replace(/<[^>]*>?/g,"");u(le)}).catch(()=>{let Y=f("fields:linkedTo",{label:`${Ko(H.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${W}`}).replace(/<[^>]*>?/g,"");u(Y)})}}C(F),A(!0),T(x?x?.getNodes():[]),ke(L)?M(!0):M(!1);let $=n.current,U=rm(e._window),{activeElement:V}=document;if($===null)return;let pe=e.getRootElement();return U!==null&&pe!==null&&pe.contains(U.anchorNode)?(E||(E=U.getRangeAt(0).getBoundingClientRect()),E!=null&&(E.y+=40,Qt(E,$,t))):(V==null||V.className!=="link-input")&&(pe!==null&&Qt(null,$,t),l(null),u(null)),!0},[e,v,a.routes.admin,a.routes.api,a.serverURL,p,f,m,g?.code,t]);return to(()=>Ki(e.registerCommand(eo,x=>(e.dispatchCommand(he,x),N(),P(),!0),Zi)),[e,N,P,D]),to(()=>{let x=t.parentElement,E=()=>{e.getEditorState().read(()=>{N()})};return window.addEventListener("resize",E),x?.addEventListener("scroll",E),()=>{window.removeEventListener("resize",E),x?.removeEventListener("scroll",E)}},[t.parentElement,e,N]),to(()=>Ki(e.registerUpdateListener(({editorState:x})=>{x.read(()=>{N()})}),e.registerCommand(im,()=>(N(),!0),Zi),e.registerCommand(nm,()=>I?(v(),!0):!1,om)),[e,N,I,v]),to(()=>{e.getEditorState().read(()=>{N()})},[e,N]),bt(Yi.Fragment,{children:[Ee("div",{className:"link-editor",ref:n,children:bt("div",{className:"link-input",children:[i&&i.length>0?bt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Ee(Ji,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?bt(Vd,{children:[o?.__fields.newTab?Ee(Ji,{}):null,Ee("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&bt(Yi.Fragment,{children:[Ee("button",{"aria-label":"Edit link",className:"link-edit",onClick:x=>{x.preventDefault(),P()},onMouseDown:Qi,tabIndex:0,type:"button",children:Ee(Xd,{})}),!k&&Ee("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(he,null)},onMouseDown:Qi,tabIndex:0,type:"button",children:Ee(Jd,{})})]})]})}),Ee(lt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:D,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(x,E)=>{let S=E,L={...S};delete L.text,e.update(()=>{let R=Xi(),w=null;if(zi(R)?w=Xe(R).getParent():b.length&&(w=b[0]?.getParent()??null),w&&ke(w)){let F=Te({fields:L});w.replace(F,!0)}}),e.dispatchCommand(he,{fields:L,selectedNodes:b,text:S.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var tl=t=>{let{anchorElem:e=document.body}=t;return am(sm(el,{anchorElem:e}),e)};import{c as dm}from"react/compiler-runtime";import{useLexicalComposerContext as mm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as pm}from"@lexical/utils";import{$getSelection as fm,$isElementNode as hm,$isRangeSelection as gm,COMMAND_PRIORITY_LOW as rl,PASTE_COMMAND as Cm}from"lexical";import{useEffect as xm}from"react";var cm=/^(?:[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+)?$/,um=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function ol(t){if(!t)return!1;if(t==="https://"||cm.test(t)||um.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var nl=t=>{let e=dm(5),{clientProps:o}=t,[r]=mm(),n,i;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ie]))throw new Error("LinkPlugin: LinkNode not registered on editor");return pm(r.registerCommand(he,l=>l===null?(Go(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),Go(l),!0),rl),r.registerCommand(Cm,l=>{let s=fm();if(!gm(s)||s.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let u=l.clipboardData.getData("text");if(!ol(u))return!1;if(!s.getNodes().some(bm)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(he,{fields:c,text:null}),l.preventDefault(),!0}return!1},rl))},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]),xm(n,i),null};function bm(t){return hm(t)}var ll=[Bo([{ChildComponent:yi,isActive:({selection:t})=>{if(il(t)){let e=Xe(t);return _m(e,Z)!=null}return!1},isEnabled:({selection:t})=>!!(il(t)&&Jo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(he,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Jo()?.getTextContent(),r=Jo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,newTab:!1};t.dispatchCommand(eo,{fields:n,selectedNodes:r,text:o})}},order:1}])],Tm=y(({props:t})=>({markdownTransformers:[Di],nodes:[ie,t?.disableAutoLinks===!0?null:we].filter(Boolean),plugins:[{Component:nl,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Gi,position:"normal"},{Component:Wi,position:"normal"},{Component:tl,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ll},toolbarInline:{groups:ll}}));import{$isListNode as Zo,INSERT_CHECK_LIST_COMMAND as ml,ListItemNode as Am,ListNode as Dm}from"@lexical/list";import{$isRangeSelection as Om}from"lexical";import{jsx as sl,jsxs as wm}from"react/jsx-runtime";import"react";var Xo=()=>wm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[sl("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),sl("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as km}from"react/jsx-runtime";import{ListPlugin as Em}from"@lexical/react/LexicalListPlugin.js";import"react";var ze=()=>km(Em,{});function Ze(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Im,ListItemNode as Rm,ListNode as ym}from"@lexical/list";import{$createListItemNode as Nm,$createListNode as Lm,$isListItemNode as Sm,$isListNode as zo}from"@lexical/list";var al=4,Ye=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Nm(t==="check"?r[3]==="x":void 0);if(zo(i)&&i.getListType()===t){let u=i.getFirstChild();u!==null?u.insertBefore(l):i.append(l),e.remove()}else if(zo(n)&&n.getListType()===t)n.append(l),e.remove();else{let u=Lm(t,t==="number"?Number(r[2]):void 0);u.append(l),e.replace(u)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/al);s&&l.setIndent(s)},Be=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(Sm(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(zo(d)){r.push(Be(d,e,o+1));continue}}let s=" ".repeat(o*al),u=t.getListType(),c=u==="number"?`${t.getStart()+i}. `:u==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(l)),i++}return r.join(`
36
+ `)};var cl={type:"element",dependencies:[ym,Rm],export:(t,e)=>Im(t)?Be(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Ye("check")};import{jsx as vm}from"react/jsx-runtime";import{CheckListPlugin as Mm}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var ul=()=>vm(Mm,{});var dl=[ne([{ChildComponent:Xo,isActive:({selection:t})=>{if(!Om(t))return!1;for(let e of t.getNodes()){if(Zo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Zo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Zo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(ml,void 0)},order:12}])],Fm=y(({featureProviderMap:t})=>{let e=[{Component:ul,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:ze,position:"normal"}),{markdownTransformers:[cl],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Dm,Am],plugins:e,slashMenu:{groups:[Ze([{Icon:Xo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(ml,void 0)}}])]},toolbarFixed:{groups:dl},toolbarInline:{groups:dl}}});import{$isListNode as qo,INSERT_ORDERED_LIST_COMMAND as hl,ListItemNode as jm,ListNode as Um}from"@lexical/list";import{$isRangeSelection as Gm}from"lexical";import{jsx as _t,jsxs as $m}from"react/jsx-runtime";import"react";var Yo=()=>$m("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[_t("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"}),_t("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"}),_t("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),_t("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),_t("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Pm,ListItemNode as Bm,ListNode as Hm}from"@lexical/list";var pl={type:"element",dependencies:[Hm,Bm],export:(t,e)=>Pm(t)?Be(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Ye("number")};var fl=[ne([{ChildComponent:Yo,isActive:({selection:t})=>{if(!Gm(t))return!1;for(let e of t.getNodes()){if(qo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(qo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(qo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(hl,void 0)},order:10}])],Wm=y(({featureProviderMap:t})=>({markdownTransformers:[pl],nodes:t.has("orderedList")?[]:[Um,jm],plugins:t.has("orderedList")?[]:[{Component:ze,position:"normal"}],slashMenu:{groups:[Ze([{Icon:Yo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(hl,void 0)}}])]},toolbarFixed:{groups:fl},toolbarInline:{groups:fl}}));import{$isListNode as er,INSERT_UNORDERED_LIST_COMMAND as xl,ListItemNode as zm,ListNode as Zm}from"@lexical/list";import{$isRangeSelection as Ym}from"lexical";import{jsx as qe,jsxs as Vm}from"react/jsx-runtime";import"react";var Qo=()=>Vm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[qe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),qe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),qe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),qe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),qe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),qe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Km,ListItemNode as Jm,ListNode as Xm}from"@lexical/list";var gl={type:"element",dependencies:[Xm,Jm],export:(t,e)=>Km(t)?Be(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ye("bullet")};var Cl=[ne([{ChildComponent:Qo,isActive:({selection:t})=>{if(!Ym(t))return!1;for(let e of t.getNodes()){if(er(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(er(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(er(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(xl,void 0)},order:11}])],qm=y({markdownTransformers:[gl],nodes:[Zm,zm],plugins:[{Component:ze,position:"normal"}],slashMenu:{groups:[Ze([{Icon:Qo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(xl,void 0)}}])]},toolbarFixed:{groups:Cl},toolbarInline:{groups:Cl}});import{jsx as Qm}from"react/jsx-runtime";import{addClassNamesToElement as ep}from"@lexical/utils";import{DecoratorNode as tp}from"lexical";import*as bl from"react";var op=bl.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Tt=class t extends tp{__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 rp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return ep(o,"unknownConverted"),o}decorate(){return Qm(op,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function rp({data:t}){return new Tt({data:t})}var np=y(()=>({nodes:[Tt]}));import{jsx as ip}from"react/jsx-runtime";import{addClassNamesToElement as lp}from"@lexical/utils";import{DecoratorNode as sp}from"lexical";import*as _l from"react";var ap=_l.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),wt=class t extends sp{__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 cp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return lp(o,"unknownConverted"),o}decorate(){return ip(ap,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function cp({data:t}){return new wt({data:t})}var up=y(()=>({nodes:[wt]}));import{$setBlocksType as kl}from"@lexical/selection";import{$createParagraphNode as El,$getSelection as Nl,$isParagraphNode as Tl,$isRangeSelection as dp}from"lexical";var wl=[ne([{ChildComponent:at,isActive:({selection:t})=>{if(!dp(t))return!1;for(let e of t.getNodes())if(!Tl(e)&&!Tl(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Nl();kl(e,()=>El())})},order:1}])],mp=y({slashMenu:{groups:[Q([{Icon:at,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Nl();kl(e,()=>El())})}}])]},toolbarFixed:{groups:wl},toolbarInline:{groups:wl}});import{c as Ap}from"react/compiler-runtime";import{jsx as Dp}from"react/jsx-runtime";import{useLexicalComposerContext as Op}from"@lexical/react/LexicalComposerContext";import{useEffect as Fp,useState as $p}from"react";import{jsx as Wl,Fragment as Mp}from"react/jsx-runtime";import"react";import{jsx as pp}from"react/jsx-runtime";var Ll={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return pp("blockquote",{children:o})}};import{jsx as fp}from"react/jsx-runtime";var Sl={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return fp(r,{children:o})}};import{jsx as hp}from"react/jsx-runtime";var Il={horizontalrule:hp("hr",{})};import{jsx as gp}from"react/jsx-runtime";var Rl={linebreak:gp("br",{})};import{jsx as yl}from"react/jsx-runtime";var vl=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,i=e.fields.newTab?"_blank":void 0;return yl("a",{href:e.fields.url,rel:n,target:i,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,i=e.fields.newTab?"_blank":void 0,l=e.fields.url??"";return e.fields.linkType==="internal"&&(t?l=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),l="#")),yl("a",{href:l,rel:n,target:i,children:r})}});import{jsx as Qe,jsxs as Cp,Fragment as xp}from"react/jsx-runtime";import{v4 as bp}from"uuid";var Ml={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Qe(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(i=>i.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let i=bp();return Qe("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Cp(xp,{children:[Qe("input",{checked:t.checked,id:i,readOnly:!0,type:"checkbox"}),Qe("label",{htmlFor:i,children:n}),Qe("br",{})]})})}else return Qe("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as tr}from"react/jsx-runtime";var Al={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?tr("p",{children:o}):tr("p",{children:tr("br",{})})}};var Dl={tab:" "};import{jsx as kt}from"react/jsx-runtime";var Ol={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return kt("div",{className:"lexical-table-container",children:kt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:kt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,i={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},l=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return kt(r,{className:`lexical-table-cell ${n}`,colSpan:l,rowSpan:s,style:i,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return kt("tr",{className:"lexical-table-row",children:o})}};import{jsx as He}from"react/jsx-runtime";import"react";var O={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},_p=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,Tp="\xA0",wp=`
37
37
 
38
- `,Ol="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Fl="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Ep=new RegExp("^[^"+Fl+"]*["+Ol+"]"),Np=new RegExp("^[^"+Ol+"]*["+Fl+"]"),Lp={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},Sp={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},Ip={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},Rp={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},yp={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},vp={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var $l={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=He("strong",{children:e})),t.format&O.IS_ITALIC&&(e=He("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=He("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=He("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=He("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=He("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=He("sup",{children:e})),e}};import{jsx as Et}from"react/jsx-runtime";var Pl={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Et("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Et("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let i in o.sizes){let l=o.sizes[i];if(!l||!l.width||!l.height||!l.mimeType||!l.filesize||!l.filename||!l.url)continue;let s=l?.url;n.push(Et("source",{media:`(max-width: ${l.width}px)`,srcSet:s,type:l.mimeType},i))}return n.push(Et("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Et("picture",{children:n})}};var et={...Ml,...$l,...Il,...Nl,...Dl,...Ll,...Sl,...vl,...yl({}),...Pl,...Al};import{jsx as Hl,Fragment as Mp}from"react/jsx-runtime";import or from"react";function Bl(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function jl({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Bl(e)?Ul({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Hl(Mp,{})}function Ul({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let i=t.unknown;return r.map((s,u)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!i&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!i&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&i&&(c=i);let d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:m=>Ul({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...s,parent:n}}),parent:n}):c:d=Hl("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*2}em`),or.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return or.cloneElement(d,{key:u,style:p})}return or.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var rr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:i})=>{if(!o)return null;let l={};e?typeof e=="function"?l=e({defaultConverters:et}):l=e:l=et;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&jl({converters:l,data:o,disableIndent:n,disableTextAlign:i});return r?Gl(Ap,{children:s}):Gl("div",{className:t??"payload-richtext",children:s})};function Wl(){let t=Dp(7),[e]=Fp(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=Pp(o),i,l;t[2]!==e?(i=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),l=[e],t[2]=e,t[3]=i,t[4]=l):(i=t[3],l=t[4]),$p(i,l);let s;return t[5]!==r?(s=Op(rr,{converters:et,data:r}),t[5]=r,t[6]=s):s=t[6],s}var Bp=y({plugins:[{Component:Wl,position:"bottom"}]});import{$isNodeSelection as Ef}from"lexical";import{jsx as Nt,jsxs as Hp}from"react/jsx-runtime";import"react";var nr=()=>Hp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Nt("g",{clipPath:"url(#clip0_4397_10817)",children:Nt("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"})}),Nt("defs",{children:Nt("clipPath",{id:"clip0_4397_10817",children:Nt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Gp}from"react/jsx-runtime";import*as Kl from"react";import{DecoratorBlockNode as jp}from"@lexical/react/LexicalDecoratorBlockNode.js";function Up(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Vl({relationTo:o,value:e})}:null}var Lt=class extends jp{__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:Up,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=Vl(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 Vl(t){return new Lt({data:t})}var Wp=Kl.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function Vp(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:je({relationTo:o,value:e})}:null}var Ne=class extends Lt{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:Vp,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=je(o);return r.setFormat(e.format),r}decorate(e,o){return Gp(Wp,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return new Ne({data:t})}function ir(t){return t instanceof Ne}import{c as uf}from"react/compiler-runtime";import{jsx as df}from"react/jsx-runtime";import{useLexicalComposerContext as mf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as pf}from"@lexical/utils";import{useConfig as ff}from"@payloadcms/ui";import{$getPreviousSelection as hf,$getSelection as gf,$isParagraphNode as ql,$isRangeSelection as Cf,COMMAND_PRIORITY_EDITOR as xf,createCommand as bf}from"lexical";import{useEffect as _f}from"react";import{c as rf}from"react/compiler-runtime";import{jsx as oo}from"react/jsx-runtime";import{useLexicalComposerContext as nf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as lf,COMMAND_PRIORITY_EDITOR as sf}from"lexical";import{useEffect as af,useState as zl}from"react";import{c as Kp}from"react/compiler-runtime";import{jsx as Jp}from"react/jsx-runtime";import{useLexicalComposerContext as Xp}from"@lexical/react/LexicalComposerContext";import{useListDrawer as zp,useModal as Zp}from"@payloadcms/ui";import{$getNodeByKey as Jl,$getPreviousSelection as Yp,$getRoot as qp,$getSelection as Qp,$isRangeSelection as ef,$setSelection as tf}from"lexical";import{useEffect as of,useState as Xl}from"react";var St=t=>{let e=Kp(23),[o]=Xp(),[r,n]=Xl(null),[i,l]=Xl(!1),[s,u,c]=zp(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=Zp(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let P=Qp()??Yp();n(P)},e[0]=h):h=e[0];let C=h,_;e[1]!==o||e[2]!==r?(_=()=>{r&&o.update(()=>{if(ef(r)){let{anchor:P,focus:v}=r;Jl(P.key)&&Jl(v.key)&&tf(r.clone())}else qp().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=_):_=e[3];let I=_,A;e[4]!==d?(A=()=>{d()},e[4]=d,e[5]=A):A=e[5];let b=A,T,g;e[6]!==a||e[7]!==f||e[8]!==I||e[9]!==i?(T=()=>{if(!i)return;let P=f[a];P&&!P?.isOpen&&(l(!1),setTimeout(()=>{I()},1))},g=[f,a,I,i],e[6]=a,e[7]=f,e[8]=I,e[9]=i,e[10]=T,e[11]=g):(T=e[10],g=e[11]),of(T,g);let k;e[12]!==u?(k=P=>Jp(u,{...P,onClick:()=>{C()}}),e[12]=u,e[13]=k):k=e[13];let M;e[14]!==m?(M=()=>{C(),m(),l(!0)},e[14]=m,e[15]=M):M=e[15];let D;return e[16]!==s||e[17]!==b||e[18]!==p||e[19]!==a||e[20]!==k||e[21]!==M?(D={closeListDrawer:b,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:M},e[16]=s,e[17]=b,e[18]=p,e[19]=a,e[20]=k,e[21]=M,e[22]=D):D=e[22],D};var cf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=lf(o);n&&n.replace(je({relationTo:e,value:r}))}):t.dispatchCommand(lr,{relationTo:e,value:r})},Zl=t=>{let e=rf(16),{enabledCollectionSlugs:o}=t,[r]=nf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[i]=zl(n),[l,s]=zl(null),u=o||void 0,c;e[2]!==i||e[3]!==u?(c={collectionSlugs:u,selectedCollection:i},e[2]=i,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=St(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(st,I=>(s(I?.replace?I?.replace.nodeKey:null),p(),!0),sf),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),af(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==l?(h=I=>{let{collectionSlug:A,doc:b}=I;cf({editor:r,relationTo:A,replaceNodeKey:l,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=l,e[12]=h):h=e[12];let C=h,_;return e[13]!==a||e[14]!==C?(_=oo(a,{onSelect:C}),e[13]=a,e[14]=C,e[15]=_):_=e[15],_},Yl=t=>(t?.enabledCollectionSlugs?.length??-1)>0?oo(Zl,{...t}):oo(Ot,{...t,children:oo(Zl,{...t})});var lr=bf("INSERT_RELATIONSHIP_COMMAND"),Ql=t=>{let e=uf(10),{clientProps:o}=t,[r]=mf(),{config:n}=ff(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o?.disabledCollections||e[1]!==i){let a;e[3]!==o?.disabledCollections?(a=p=>{let{slug:m}=p;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=a):a=e[4],d=i.filter(a).map(Tf),e[0]=o?.disabledCollections,e[1]=i,e[2]=d}else d=e[2];l=d}let s,u;e[5]!==r?(s=()=>{if(!r.hasNodes([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(lr,kf,xf)},u=[r],e[5]=r,e[6]=s,e[7]=u):(s=e[6],u=e[7]),_f(s,u);let c;return e[8]!==l?(c=df(Yl,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function Tf(t){let{slug:e}=t;return e}function wf(t){return ql(t)}function kf(t){let e=gf()||hf();if(Cf(e)){let o=je(t);pf(o);let{focus:r}=e,n=r.getNode();ql(n)&&n.getTextContentSize()===0&&n.getParentOrThrow().getChildren().filter(wf).length>1&&n.remove()}return!0}var Nf=y({nodes:[Ne],plugins:[{Component:Ql,position:"normal"}],slashMenu:{groups:[Q([{Icon:nr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(st,{replace:!1})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:nr,isActive:({selection:t})=>{if(!Ef(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ir(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(st,{replace:!1})}}])]}});import{c as ls}from"react/compiler-runtime";import{jsx as de,jsxs as Wf}from"react/jsx-runtime";import{useLexicalComposerContext as Vf}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Kf,useThrottledEffect as Jf,useTranslation as Xf}from"@payloadcms/ui";import*as Le from"react";import{useMemo as zf}from"react";import{c as Lf}from"react/compiler-runtime";import{jsx as Sf}from"react/jsx-runtime";import{mergeRegister as If}from"@lexical/utils";import{$addUpdateTag as Rf,$getSelection as yf}from"lexical";import{useEffect as ro,useState as sr}from"react";var ar="toolbar-popup__button",It=t=>{let e=Lf(34),{children:o,editor:r,item:n}=t,[i,l]=sr(!0),[s,u]=sr(!1),[c,d]=sr(ar),a=j(),p;e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==i||e[4]!==n?(p=()=>{r.getEditorState().read(()=>{let M=yf();if(M){if(n.isActive){let D=n.isActive({editor:r,editorConfigContext:a,selection:M});s!==D&&u(D)}if(n.isEnabled){let D=n.isEnabled({editor:r,editorConfigContext:a,selection:M});i!==D&&l(D)}}})},e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=n,e[5]=p):p=e[5];let m=p,f,h;e[6]!==m?(f=()=>{m()},h=[m],e[6]=m,e[7]=f,e[8]=h):(f=e[7],h=e[8]),ro(f,h);let C,_;e[9]!==m?(C=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),_=[m],e[9]=m,e[10]=C,e[11]=_):(C=e[10],_=e[11]),ro(C,_);let I,A;e[12]!==r||e[13]!==m?(I=()=>If(r.registerUpdateListener(()=>{m()})),A=[r,m],e[12]=r,e[13]=m,e[14]=I,e[15]=A):(I=e[14],A=e[15]),ro(I,A);let b;e[16]!==s||e[17]!==i||e[18]!==n.key?(b=()=>{d([ar,i===!1?"disabled":"",s?"active":"",n?.key?`${ar}-`+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]!==c||e[22]!==i||e[23]!==n.key?(T=[i,s,c,n.key],e[20]=s,e[21]=c,e[22]=i,e[23]=n.key,e[24]=T):T=e[24],ro(b,T);let g;e[25]!==s||e[26]!==r||e[27]!==i||e[28]!==n?(g=()=>{if(i!==!1)return r.focus(()=>{r.update(vf),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=i,e[28]=n,e[29]=g):g=e[29];let k;return e[30]!==o||e[31]!==c||e[32]!==g?(k=Sf("button",{className:c,onClick:g,onMouseDown:Mf,type:"button",children:o}),e[30]=o,e[31]=c,e[32]=g,e[33]=k):k=e[33],k};function vf(){Rf("toolbar")}function Mf(t){t.preventDefault()}import{c as is}from"react/compiler-runtime";import{jsx as tt}from"react/jsx-runtime";import dr,{useEffect as ns}from"react";import{mergeRegister as Hf}from"@lexical/utils";import{useTranslation as jf}from"@payloadcms/ui";import{$getSelection as Uf}from"lexical";import{jsx as Me,jsxs as es}from"react/jsx-runtime";import{Button as Af}from"@payloadcms/ui";import{$addUpdateTag as Df,isDOMNode as Of}from"lexical";import no,{useCallback as Ff,useEffect as Rt,useMemo as $f,useRef as ur,useState as io}from"react";import{createPortal as Pf}from"react-dom";var cr="toolbar-popup__dropdown-item",ts=no.createContext(null);function os({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,u]=io(cr);Rt(()=>{u([cr,r===!1?"disabled":"",t?"active":"",i?.key?`${cr}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let c=ur(null),d=no.use(ts);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return Rt(()=>{c?.current!=null&&a(c)},[c,a]),Me(Af,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Df("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:l,type:"button",children:e})}function Bf({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=io(),[l,s]=io(),u=Ff(a=>{i(p=>p!=null?[...p,a]:[a])},[i]),c=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=$f(()=>({registerItem:u}),[u]);return Rt(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),Me(ts,{value:d,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function rs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let u=ur(null),c=ur(null),[d,a]=io(!1),p=()=>{a(!1),c?.current!=null&&c.current.focus()};Rt(()=>{let f=c.current,h=u.current;if(d&&f!==null&&h!==null){let{left:C,top:_}=f.getBoundingClientRect(),I=window.scrollY||document.documentElement.scrollTop;h.style.top=`${_+I+f.offsetHeight+5}px`,h.style.left=`${Math.min(C-5,window.innerWidth-h.offsetWidth-20)}px`}},[u,c,d]),Rt(()=>{let f=c.current;if(f!==null&&d){let h=C=>{let _=C.target;Of(_)&&(s&&u.current&&u.current.contains(_)||f.contains(_)||a(!1))};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[u,c,d,s]);let m=Pf(Me(Bf,{dropDownRef:u,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return es(no.Fragment,{children:[es("button",{"aria-label":t,className:e+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),a(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[n&&Me(n,{}),l&&Me("span",{className:"toolbar-popup__dropdown-label",children:l}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&Me(no.Fragment,{children:m})]})}var mr="toolbar-popup__dropdown",Gf=t=>{let e=is(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=jf(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u;if(l.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==l?(f=l?.Component&&tt(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,p;if(l.label){let f;e[6]!==c||e[7]!==s||e[8]!==l||e[9]!==d?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):l.label,e[6]=c,e[7]=s,e[8]=l,e[9]=d,e[10]=f):f=e[10],a=f}a.length>25?p=a.substring(0,25)+"...":p=a;let m;return e[11]!==o||e[12]!==p||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==a?(m=tt(os,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?tt(l.ChildComponent,{}):void 0,item:l,tooltip:a,children:tt("span",{className:"text",children:p})},l.key),e[11]=o,e[12]=p,e[13]=n,e[14]=i,e[15]=l,e[16]=a,e[17]=m):m=e[17],m},Ue=t=>{let e=is(36),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:u,maxActiveItems:c,onActiveChange:d}=t,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[0]=a):a=e[0];let[p,m]=dr.useState(a),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,C]=dr.useState(f),[_,I]=dr.useState(!0),A=j(),{items:b,key:T}=i,g;e[2]!==n||e[3]!==A||e[4]!==i||e[5]!==b||e[6]!==c||e[7]!==d?(g=()=>{n.getEditorState().read(()=>{let $=Uf();if(!$)return;let U=[],V=[],pe=[];for(let H of b)H.isActive&&(!c||U.length<c)&&H.isActive({editor:n,editorConfigContext:A,selection:$})&&(U.push(H.key),V.push(H)),H.isEnabled?H.isEnabled({editor:n,editorConfigContext:A,selection:$})&&pe.push(H.key):pe.push(H.key);i.isEnabled&&I(i.isEnabled({editor:n,editorConfigContext:A,selection:$})),m(U),C(pe),d&&d({activeItems:V})})},e[2]=n,e[3]=A,e[4]=i,e[5]=b,e[6]=c,e[7]=d,e[8]=g):g=e[8];let k=g,M,D;e[9]!==k?(M=()=>{k()},D=[k],e[9]=k,e[10]=M,e[11]=D):(M=e[10],D=e[11]),ns(M,D);let P,v;e[12]!==n||e[13]!==k?(P=()=>Hf(n.registerUpdateListener(()=>{k()})),v=[n,k],e[12]=n,e[13]=k,e[14]=P,e[15]=v):(P=e[14],v=e[15]),ns(P,v);let N=`${T} dropdown`,x=`${mr}-${T}`,E;e[16]!==r?(E=r||[],e[16]=r,e[17]=E):E=e[17];let S;e[18]!==E||e[19]!==x?(S=[mr,x,...E].filter(Boolean),e[18]=E,e[19]=x,e[20]=S):S=e[20];let L=S.join(" "),R=!_,w;e[21]!==s?(w=s||[],e[21]=s,e[22]=w):w=e[22];let F;return e[23]!==l||e[24]!==p||e[25]!==o||e[26]!==n||e[27]!==h||e[28]!==T||e[29]!==b||e[30]!==u||e[31]!==L||e[32]!==R||e[33]!==w||e[34]!==N?(F=tt(rs,{buttonAriaLabel:N,buttonClassName:L,disabled:R,Icon:l,itemsContainerClassNames:[`${mr}-items`,...w],label:u,children:b.length?b.map($=>tt(Gf,{active:p.includes($.key),anchorElem:o,editor:n,enabled:h.includes($.key),item:$},$.key)):null},T),e[23]=l,e[24]=p,e[25]=o,e[26]=n,e[27]=h,e[28]=T,e[29]=b,e[30]=u,e[31]=L,e[32]=R,e[33]=w,e[34]=N,e[35]=F):F=e[35],F};function Zf({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&de(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?de(It,{editor:e,item:o,children:de(o.ChildComponent,{})},o.key):null}function Yf(t){let e=ls(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=Xf(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=Le.useState(void 0),[m,f]=Le.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 C;e[4]!==i?(C=[i],e[4]=i,e[5]=C):C=e[5],Le.useEffect(h,C);let _;e[6]!==c||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==d?(_=T=>{let{activeItems:g}=T;if(!g.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let k=g[0],M=k.key;k.label&&(M=typeof k.label=="function"?k.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):k.label),M.length>25&&(M=M.substring(0,25)+"..."),g.length===1?(p(M),f(()=>k.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:g.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=c,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=d,e[12]=_):_=e[12];let I=_,A=`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]!==I||e[21]!==A?(b=Wf("div",{className:A,children:[i.type==="dropdown"&&i.items.length?m?de(Ue,{anchorElem:o,editor:r,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:I}):de(Ue,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:I}):null,i.type==="buttons"&&i.items.length?i.items.map(T=>de(Zf,{anchorElem:o,editor:r,item:T},T.key)):null,l<n.features.toolbarFixed?.groups.length-1&&de("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]=I,e[21]=A,e[22]=b):b=e[22],b}function qf({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=Le.useRef(null),{y:l}=Kf(),s=zf(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Jf(()=>{if(!s)return;let u=i.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),de("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:i,children:o.isEditable()&&de(Le.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>de(Yf,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var ss=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ss(t.parentEditor)}return!1},as=t=>{let e=ls(6),{clientProps:o}=t,[r]=Vf(),n=j(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=ss(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=de(qf,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var Qf=y({plugins:[{Component:as,position:"aboveContainer"}]});import{c as ds}from"react/compiler-runtime";import{jsx as ge,jsxs as ms}from"react/jsx-runtime";import{useLexicalComposerContext as e1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ps}from"@lexical/utils";import{$getSelection as fs,$isRangeSelection as cs,$isTextNode as t1,COMMAND_PRIORITY_LOW as o1,getDOMSelection as hs,SELECTION_CHANGE_COMMAND as r1}from"lexical";import{useCallback as so,useEffect as yt,useRef as us,useState as n1}from"react";import*as ao from"react";import{createPortal as i1}from"react-dom";function pr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function lo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-i;l==="center"&&(h=u.left+u.width/2-a.width/2);let C=0;return!e&&f<m.top&&!s&&(C=a.height+u.height+c*2,f+=C),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-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),C}function l1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ge(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ge(It,{editor:e,item:o,children:ge(o.ChildComponent,{})},o.key):null}function s1(t){let e=ds(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=j(),[s,u]=ao.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],ao.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:C}=h;if(!C.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let _=C[0];u(()=>_?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=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]!==p||e[17]!==m?(f=ms("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?ge(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ge(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ge(l1,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&ge("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]=p,e[17]=m,e[18]=f):f=e[18],f}function a1({anchorElem:t,editor:e}){let o=us(null),r=us(null),{editorConfig:n}=j(),i=so(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=so(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||i()}}},[i]),s=so(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);yt(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let u=so(()=>{let c=fs(),d=hs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=pr(d,m),h=lo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&lo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return yt(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,u,t]),yt(()=>(e.getEditorState().read(()=>{u()}),ps(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(r1,()=>(u(),!1),o1))),[e,u]),ms("div",{className:"inline-toolbar-popup",ref:o,children:[ge("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>ge(s1,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function c1(t,e){let o=ds(12),[r,n]=n1(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=fs(),m=hs(t._window),f=t.getRootElement();if(m!==null&&(!cs(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!cs(p))return;if(p.getTextContent()!==""){let C=p.getNodes(),_=!1;for(let I of C)if(t1(I)){n(!0),_=!0;break}_||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,u;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),u=[l],o[2]=l,o[3]=s,o[4]=u):(s=o[3],u=o[4]),yt(s,u);let c,d;if(o[5]!==t||o[6]!==l?(c=()=>ps(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,l],o[5]=t,o[6]=l,o[7]=c,o[8]=d):(c=o[7],d=o[8]),yt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=i1(ge(a1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var gs=t=>{let{anchorElem:e}=t,[o]=e1();return c1(o,e)};var u1=y({plugins:[{Component:gs,position:"floatingAnchorElem"}]});import{TableCellNode as eg,TableNode as tg,TableRowNode as og}from"@lexical/table";import{jsx as Cs}from"react/jsx-runtime";import"react";var fr=()=>Cs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Cs("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 d1,$createTableNode as m1,$createTableRowNode as p1,$isTableCellNode as xs,$isTableNode as hr,$isTableRowNode as gr,TableCellHeaderStates as co,TableCellNode as f1,TableNode as h1,TableRowNode as g1}from"@lexical/table";import{$isParagraphNode as C1,$isTextNode as x1}from"lexical";var _s=/^\|(.+)\|\s?$/,b1=/^(\| ?:?-*:? ?)+\|\s?$/,Ts=({allTransformers:t})=>({type:"element",dependencies:[h1,g1,f1],export:e=>{if(!hr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!gr(r))continue;let i=!1;for(let l of r.getChildren())xs(l)&&(n.push(Br(t,l).replace(/\n/g,"\\n").trim()),l.__headerState===co.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
39
- `)},regExp:_s,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(b1.test(n)){let a=e.getPreviousSibling();if(!a||!hr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!gr(m))return;m.getChildren().forEach(f=>{xs(f)&&f.setHeaderStyles(co.ROW,co.ROW)}),e.remove();return}let i=bs(n,t);if(i==null)return;let l=[i],s=e.getPreviousSibling(),u=i.length;for(;s&&!(!C1(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!x1(a))break;let p=bs(a.getTextContent(),t);if(p==null)break;u=Math.max(u,p.length),l.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let c=m1();for(let a of l){let p=p1();c.append(p);for(let m=0;m<u;m++)p.append(m<a.length?a[m]:ws("",t))}let d=e.getPreviousSibling();hr(d)&&_1(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function _1(t){let e=t.getFirstChild();return gr(e)?e.getChildrenSize():0}var ws=(t,e)=>{t=t.replace(/\\n/g,`
40
- `);let o=d1(co.NO_STATUS);return Pr(t,e,o),o},bs=(t,e)=>{let o=t.match(_s);return!o||!o[1]?null:o[1].split("|").map(r=>ws(r,e))};import{c as w1}from"react/compiler-runtime";import{jsx as B,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as Ls}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as k1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as xr,$deleteTableColumn__EXPERIMENTAL as E1,$deleteTableRow__EXPERIMENTAL as N1,$getNodeTriplet as L1,$getTableCellNodeFromLexicalNode as Es,$getTableColumnIndexFromTableCellNode as S1,$getTableNodeFromLexicalNodeOrThrow as Ie,$getTableRowIndexFromTableCellNode as I1,$insertTableColumn__EXPERIMENTAL as R1,$insertTableRow__EXPERIMENTAL as y1,$isTableCellNode as Ss,$isTableSelection as vt,$unmergeCell as v1,getTableElement as br,getTableObserverFromTableElement as _r,TableCellHeaderStates as Ae,TableCellNode as M1}from"@lexical/table";import{mergeRegister as A1}from"@lexical/utils";import{useScrollInfo as D1}from"@payloadcms/ui";import{$createParagraphNode as O1,$getSelection as mo,$isElementNode as F1,$isParagraphNode as $1,$isRangeSelection as Tr,$isTextNode as P1,$setSelection as B1,COMMAND_PRIORITY_CRITICAL as H1,getDOMSelection as j1,isDOMNode as U1,SELECTION_CHANGE_COMMAND as G1}from"lexical";import*as wr from"react";import{useCallback as me,useEffect as ot,useRef as uo,useState as rt}from"react";import{createPortal as Is}from"react-dom";import{jsx as Cr,jsxs as T1}from"react/jsx-runtime";import"react";var ks=()=>T1("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 Ns(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function W1(){let t=mo();if(Tr(t)&&!t.isCollapsed()||vt(t)&&!t.anchor.is(t.focus)||!Tr(t)&&!vt(t))return!1;let[e]=L1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function V1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!$1(e)||!e.isEmpty())}function K1(t){let e=t.getLastDescendant();P1(e)?e.select():F1(e)?e.selectEnd():e!==null&&e.selectNext()}function J1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Ls(),l=uo(null),[s,u]=rt(n),[c,d]=rt({columns:1,rows:1}),[a,p]=rt(!1),[m,f]=rt(!1),{y:h}=D1();ot(()=>i.registerMutationListener(M1,x=>{x.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[i,s]),ot(()=>{i.getEditorState().read(()=>{let x=mo();if(vt(x)){let E=Ns(x);d(Ns(x)),p(E.columns>1||E.rows>1)}f(W1())})},[i]),ot(()=>{let x=e.current,E=l.current,S=i.getRootElement();if(x!=null&&E!=null&&S!=null){let L=S.getBoundingClientRect(),R=x.getBoundingClientRect();E.style.opacity="1";let w=E.getBoundingClientRect(),F=5,$=R.right+F;if($+w.width>window.innerWidth||$+w.width>L.right){let V=R.left-w.width-F;$=(V<0?F:V)+window.pageXOffset}E.style.left=`${$+window.pageXOffset}px`;let U=R.top;if(U+w.height>window.innerHeight){let V=R.bottom-w.height;U=V<0?F:V}E.style.top=`${U}px`}},[e,l,i,h]),ot(()=>{function x(E){l.current!=null&&e.current!=null&&U1(E.target)&&!l.current.contains(E.target)&&!e.current.contains(E.target)&&r(!1)}return window.addEventListener("click",x),()=>window.removeEventListener("click",x)},[r,e]);let C=me(()=>{i.update(()=>{if(s.isAttached()){let x=Ie(s),E=br(x,i.getElementByKey(x.getKey()));if(E===null)throw new Error("Expected to find tableElement in DOM");let S=_r(E);S!==null&&S.$clearHighlight(),x.markDirty(),u(s.getLatest())}B1(null)})},[i,s]),_=()=>{i.update(()=>{let x=mo();if(vt(x)){let S=x.getNodes().filter(Ss);if(S.length===0)return;let L=Ie(S[0]),[R]=xr(L,null,null),w=1/0,F=-1/0,$=1/0,U=-1/0,V=new Set;for(let Y of R)for(let K of Y){if(!K||!K.cell)continue;let oe=K.cell.getKey();if(!V.has(oe)&&S.some(re=>re.is(K.cell))){V.add(oe);let re=K.startRow,le=K.startColumn,De=K.cell.__rowSpan||1,it=K.cell.__colSpan||1;w=Math.min(w,re),F=Math.max(F,re+De-1),$=Math.min($,le),U=Math.max(U,le+it-1)}}if(w===1/0||$===1/0)return;let pe=F-w+1,H=U-$+1,W=R?.[w]?.[$];if(!W?.cell)return;let te=W.cell;te.setColSpan(H),te.setRowSpan(pe);let ce=new Set([te.getKey()]);for(let Y=w;Y<=F;Y++)for(let K=$;K<=U;K++){let oe=R?.[Y]?.[K];if(!oe?.cell)continue;let re=oe.cell,le=re.getKey();ce.has(le)||(ce.add(le),V1(re)||te.append(...re.getChildren()),re.remove())}te.getChildrenSize()===0&&te.append(O1()),K1(te),o()}})},I=()=>{i.update(()=>{v1()})},A=me(x=>{i.update(()=>{for(let E=0;E<c.rows;E++)y1(x);o()})},[i,o,c.rows]),b=me(x=>{i.update(()=>{for(let E=0;E<c.columns;E++)R1(x);o()})},[i,o,c.columns]),T=me(()=>{i.update(()=>{N1(),o()})},[i,o]),g=me(()=>{i.update(()=>{Ie(s).remove(),C(),o()})},[i,s,C,o]),k=me(()=>{i.update(()=>{E1(),o()})},[i,o]),M=me(()=>{i.update(()=>{let x=Ie(s),E=I1(s),[S]=xr(x,null,null),L=new Set,R=s.getHeaderStyles()^Ae.ROW;if(S[E])for(let w=0;w<S[E].length;w++){let F=S[E][w];F?.cell&&(L.has(F.cell)||(L.add(F.cell),F.cell.setHeaderStyles(R,Ae.ROW)))}C(),o()})},[i,s,C,o]),D=me(()=>{i.update(()=>{let x=Ie(s),E=S1(s),[S]=xr(x,null,null),L=new Set,R=s.getHeaderStyles()^Ae.COLUMN;if(S)for(let w=0;w<S.length;w++){let F=S?.[w]?.[E];F?.cell&&(L.has(F.cell)||(L.add(F.cell),F.cell.setHeaderStyles(R,Ae.COLUMN)))}C(),o()})},[i,s,C,o]),P=me(()=>{i.update(()=>{if(s.isAttached()){let x=Ie(s);x&&x.setRowStriping(!x.getRowStriping())}C(),o()})},[i,s,C,o]),v=me(()=>{i.update(()=>{if(s.isAttached()){let x=Ie(s);x&&x.setFrozenColumns(x.getFrozenColumns()===0?1:0)}C(),o()})},[i,s,C,o]),N=null;return t&&(a?N=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):m&&(N=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),Is(Se("div",{className:"table-action-menu-dropdown",onClick:x=>{x.stopPropagation()},ref:l,children:[N?Se(wr.Fragment,{children:[N,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>P(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>A(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>A(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>T(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&Ae.ROW)===Ae.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&Ae.COLUMN)===Ae.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function X1({anchorElem:t,cellMerge:e}){let[o]=Ls(),r=uo(null),n=uo(null),[i,l]=rt(!1),[s,u]=rt(null),c=me(()=>{let a=r.current,p=mo(),m=j1(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")),u(null)}if(p==null||a==null)return h();let C=o.getRootElement(),_=null,I=null;if(Tr(p)&&C!==null&&m!==null&&C.contains(m.anchorNode)){let b=Es(p.anchor.getNode());if(b==null||(I=o.getElementByKey(b.getKey()),I==null||!b.isAttached()))return h();let T=Ie(b),g=br(T,o.getElementByKey(T.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=_r(g),u(b)}else if(vt(p)){let b=Es(p.anchor.getNode());if(!Ss(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let T=Ie(b),g=br(T,o.getElementByKey(T.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=_r(g),I=o.getElementByKey(b.getKey())}else if(!f)return h();if(_===null||I===null)return h();let A=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",A),a.classList.toggle("table-cell-action-button-container--inactive",!A),A){let b=I.getBoundingClientRect(),T=t.getBoundingClientRect(),g=b.top-T.top,k=b.right-T.left;a.style.transform=`translate(${k}px, ${g}px)`}},[o,t]);ot(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return A1(o.registerUpdateListener(m),o.registerCommand(G1,m,H1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=uo(s);return ot(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),B("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Se(wr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),l(!i)},ref:n,type:"button",children:B(ks,{})}),i&&B(J1,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Rs=t=>{let e=w1(3),{anchorElem:o}=t,r=k1(),n;return e[0]!==o||e[1]!==r?(n=Is(r?B(X1,{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 z1}from"react/compiler-runtime";import{jsx as fo,jsxs as Z1}from"react/jsx-runtime";import{useLexicalComposerContext as Y1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as q1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Q1,$getTableNodeFromLexicalNodeOrThrow as kr,$getTableRowIndexFromTableCellNode as eh,$isTableCellNode as ys,$isTableRowNode as th,getDOMCellFromTarget as oh,getTableElement as rh,TableNode as vs}from"@lexical/table";import{calculateZoomLevel as Ms,mergeRegister as nh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Er,isHTMLElement as ih}from"lexical";import*as Ds from"react";import{useCallback as Mt,useEffect as Nr,useRef as po,useState as nt}from"react";import{createPortal as lh}from"react-dom";var sh=33,As=92;function ah({editor:t}){let e=po(null),o=po(null),r=po(null),[n,i]=nt(!1),l=j(),s=po(null),[u,c]=nt(null),[d,a]=nt(null),[p,m]=nt(!1),[f,h]=nt(null),C=Mt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),_=v=>(v.buttons&1)===1;Nr(()=>{let v=new Set;return nh(t.registerMutationListener(vs,N=>{for(let[x,E]of N)E==="destroyed"?v.delete(x):v.add(x);i(v.size>0)}),t.registerNodeTransform(vs,N=>{if(N.getColWidths())return N;let x=N.getColumnCount(),E=As;return N.setColWidths(Array(x).fill(E)),N}))},[t]),Nr(()=>{if(!n)return;let v=S=>{let L=S.target;if(ih(L)){if(f){c({x:S.clientX,y:S.clientY});return}if(m(_(S)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let R=oh(L);R&&d!==R?t.getEditorState().read(()=>{let w=Er(R.elem);if(!w)throw new Error("TableCellResizer: Table cell node not found.");let F=kr(w),$=rh(F,t.getElementByKey(F.getKey()));if(!$)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=$.getBoundingClientRect(),a(R)},{editor:t}):R==null&&C()}}},N=S=>{m(!0)},x=S=>{m(!1)},E=t.registerRootListener((S,L)=>{L?.removeEventListener("mousemove",v),L?.removeEventListener("mousedown",N),L?.removeEventListener("mouseup",x),S?.addEventListener("mousemove",v),S?.addEventListener("mousedown",N),S?.addEventListener("mouseup",x)});return()=>{E()}},[d,f,t,n,C]);let I=v=>v==="bottom",A=Mt(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Er(d.elem);if(!ys(N))throw new Error("TableCellResizer: Table cell node not found.");let x=kr(N),E=eh(N),S=x.getChildren(),R=N.getColSpan()===x.getColumnCount()?E:E+N.getRowSpan()-1;if(R>=S.length||R<0)throw new Error("Expected table cell to be inside of table row.");let w=S[R];if(!th(w))throw new Error("Expected table row");let F=w.getHeight();if(F===void 0){let U=w.getChildren();F=Math.min(...U.map(V=>b(V,t)??1/0))}let $=Math.max(F+v,sh);w.setHeight($)},{tag:"skip-scroll-into-view"})},[d,t]),b=(v,N)=>N.getElementByKey(v.getKey())?.clientHeight,T=(v,N)=>{let x;return N.forEach(E=>{E.forEach((S,L)=>{S.cell===v&&(x=L)})}),x},g=Mt(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Er(d.elem);if(!ys(N))throw new Error("TableCellResizer: Table cell node not found.");let x=kr(N),[E]=Q1(x,null,null),S=T(N,E);if(S===void 0)throw new Error("TableCellResizer: Table column not found.");let L=x.getColWidths();if(!L)return;let R=L[S];if(R===void 0)return;let w=[...L],F=Math.max(R+v,As);w[S]=F,x.setColWidths(w)},{tag:"skip-scroll-into-view"})},[d,t]),k=Mt(v=>{let N=x=>{if(x.preventDefault(),x.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:E,y:S}=s.current;if(d===null)return;let L=Ms(x.target);if(I(v)){let R=(x.clientY-S)/L;A(R)}else{let R=(x.clientX-E)/L;g(R)}C(),document.removeEventListener("mouseup",N)}};return N},[d,C,g,A]),M=Mt(v=>N=>{if(N.preventDefault(),N.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:N.clientX,y:N.clientY},c(s.current),h(v),document.addEventListener("mouseup",k(v))},[d,k]),[D,P]=nt({bottom:null,left:null,right:null,top:null});return Nr(()=>{if(d){let{height:v,left:N,top:x,width:E}=d.elem.getBoundingClientRect(),S=Ms(d.elem),L=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+x+v-L/2}px`,width:`${E}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+N+E-L/2}px`,top:`${window.scrollY+x}px`,width:`${L}px`}},w=r.current;f&&u&&w&&(I(f)?(R[f].left=`${window.scrollX+w.left}px`,R[f].top=`${window.scrollY+u.y/S}px`,R[f].height="3px",R[f].width=`${w.width}px`):(R[f].top=`${window.scrollY+w.top}px`,R[f].left=`${window.scrollX+u.x/S}px`,R[f].width="3px",R[f].height=`${w.height}px`),R[f].backgroundColor="#adf"),P(R)}else P({bottom:null,left:null,right:null,top:null})},[d,f,u]),fo("div",{ref:o,children:d!=null&&!p&&Z1(Ds.Fragment,{children:[fo("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:D.right||void 0}),fo("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:D.bottom||void 0})]})})}var Os=()=>{let t=z1(3),[e]=Y1(),o=q1(),r,n;return t[0]!==e||t[1]!==o?(n=o?lh(fo(ah,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as gh}from"react/compiler-runtime";import{jsx as Lr,jsxs as Ch,Fragment as xh}from"react/jsx-runtime";import{useLexicalComposerContext as Gs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as bh,$getTableColumnIndexFromTableCellNode as _h,$getTableRowIndexFromTableCellNode as Th,$insertTableColumn__EXPERIMENTAL as wh,$insertTableRow__EXPERIMENTAL as kh,$isTableCellNode as Eh,$isTableNode as Ps,getTableElement as Nh,TableNode as Lh}from"@lexical/table";import{$findMatchingParent as Sh,mergeRegister as Ih}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Bs,isHTMLElement as Rh}from"lexical";import{useEffect as Hs,useMemo as yh,useRef as js,useState as ho}from"react";import"react";import{createPortal as vh}from"react-dom";import{c as ph}from"react/compiler-runtime";import{useEffect as fh,useRef as hh}from"react";var ch="Expected a function",uh=Math.max,dh=Math.min;function mh(t,e,o){let r,n,i=0,l,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(ch);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?uh(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(g){let k=r,M=l;return r=l=void 0,i=g,d=t.apply(M,k),d}function f(g){return i=g,a=setTimeout(_,e),s?m(g):d}function h(g){let k=g-n,M=g-i,D=e-k;return u?dh(D,c-M):D}function C(g){let k=g-n,M=g-i;return n===void 0||k>=e||k<0||u&&M>=c}function _(){let g=Date.now();if(C(g))return I(g);a=setTimeout(_,h(g))}function I(g){return a=void 0,p&&r?m(g):(r=l=void 0,d)}function A(){a!==void 0&&clearTimeout(a),i=0,r=n=l=a=void 0}function b(){return a===void 0?d:I(Date.now())}function T(){let g=Date.now(),k=C(g);if(r=arguments,l=this,n=g,k){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(_,e),m(n)}return a===void 0&&(a=setTimeout(_,e)),d}return T.cancel=A,T.flush=b,T}var Fs=mh;function $s(t,e,o){let r=ph(6),n=hh(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=Fs(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]),fh(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Us=20;function Mh({anchorElem:t}){let[e]=Gs(),o=j(),[r,n]=ho(!1),[i,l]=ho(!1),[s,u]=ho(!1),[c,d]=ho({}),a=js(new Set),p=js(null),m=$s(C=>{let{isOutside:_,tableDOMNode:I}=Ah(C,o.editorConfig?.lexical);if(_){n(!1),l(!1);return}if(!I)return;p.current=I;let A=null,b=null,T=null;if(e.getEditorState().read(()=>{let L=Bs(I);if(Eh(L)){let R=Sh(L,w=>Ps(w));if(!Ps(R))return;if(T=Nh(R,e.getElementByKey(R.getKey())),T){let w=R.getChildrenSize(),F=R.getChildAtIndex(0)?.getChildrenSize(),$=Th(L),U=_h(L);$===w-1?A=L:U===F-1&&(b=L)}}},{editor:e}),!T)return;let g=T.parentElement;if(!g)return;let{bottom:k,height:M,left:D,right:P,width:v,y:N}=T.getBoundingClientRect(),x=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(x=g.scrollWidth>g.clientWidth);let{left:E,y:S}=t.getBoundingClientRect();A?(l(!1),n(!0),d({height:Us,left:x&&g?g.offsetLeft:D-E,top:k-S+5,width:x&&g?g.offsetWidth:v})):b&&(l(!0),n(!1),d({height:M,left:P-E+5,top:N-S,width:Us}))},50,250),f=yh(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);Hs(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),l(!1),document.removeEventListener("mousemove",m)}},[s,m]),Hs(()=>Ih(e.registerMutationListener(Lh,C=>{e.getEditorState().read(()=>{let _=!1;for(let[I,A]of C)switch(A){case"created":{a.current.add(I),_=!0;break}case"destroyed":{a.current.delete(I),_=!0;break}default:break}if(_){f.disconnect();for(let I of a.current){let{tableElement:A}=bh(I);f.observe(A)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{p.current&&(Bs(p.current)?.selectEnd(),C?(kh(),n(!1)):(wh(),l(!1)))})};return e?.isEditable()?Ch(xh,{children:[r&&Lr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),i&&Lr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function Ah(t,e){let o=t.target;if(Rh(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Ws(t){let e=gh(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Gs();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=vh(Lr(Mh,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as Dh}from"react/compiler-runtime";import{jsx as Sr,jsxs as Oh}from"react/jsx-runtime";import{useLexicalComposerContext as Fh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as $h}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Ph,TableCellNode as Bh,TableNode as Hh,TableRowNode as jh}from"@lexical/table";import{mergeRegister as Uh}from"@lexical/utils";import{formatDrawerSlug as Gh,useEditDepth as Wh}from"@payloadcms/ui";import{$getSelection as Vh,$isRangeSelection as Kh,COMMAND_PRIORITY_EDITOR as Jh,createCommand as Xh}from"lexical";import{createContext as zh,use as Zh,useEffect as Yh,useMemo as qh,useState as Qh}from"react";import*as Vs from"react";var go=Xh("OPEN_EMBED_DRAWER_COMMAND"),Ks=zh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Js({children:t}){let[e,o]=Qh({cellEditorConfig:null,cellEditorPlugins:null});return Sr(Ks,{value:qh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Xs=()=>{let t=Dh(16),[e]=Fh(),o=Zh(Ks),r=Wh(),{fieldProps:n,uuid:i}=j(),{schemaPath:l}=n,s="lexical-table-create-"+i,u;t[0]!==r||t[1]!==s?(u=Gh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=Ce(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([Hh,jh,Bh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Uh(e.registerCommand(go,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=Vh();Kh(C)&&(h=C)}),h&&d(),!0},Jh))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],Yh(a,p);let m;t[10]!==e?(m=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(Ph,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==l||t[14]!==m?(f=Oh(Vs.Fragment,{children:[Sr(lt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:l,schemaPathSuffix:"fields"}),Sr($h,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=l,t[14]=m,t[15]=f):f=t[15],f};var rg=y({markdownTransformers:[Ts],nodes:[tg,eg,og],plugins:[{Component:Xs,position:"normal"},{Component:Os,position:"normal"},{Component:Rs,position:"floatingAnchorElem"},{Component:Ws,position:"floatingAnchorElem"}],providers:[Js],slashMenu:{groups:[Q([{Icon:fr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:fr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]}});import{$isNodeSelection as Dg}from"lexical";import{jsx as Ir,jsxs as ng}from"react/jsx-runtime";import"react";var Rr=()=>ng("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:[Ir("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"}),Ir("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"}),Ir("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 cg}from"react/jsx-runtime";import Ys from"bson-objectid";import{$applyNodeReplacement as ug}from"lexical";import*as qs from"react";import{jsx as ig}from"react/jsx-runtime";import{DecoratorBlockNode as lg}from"@lexical/react/LexicalDecoratorBlockNode.js";import zs from"bson-objectid";import{$applyNodeReplacement as sg}from"lexical";import"react";function yr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function ag(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:Zs({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||yr(e),null}var At=class extends lg{__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:ag,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new zs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Zs({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return ig(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 Zs({data:t}){return t?.id||(t.id=new zs.default().toHexString()),sg(new At({data:t}))}var dg=qs.lazy(()=>import("./component-NNKG7K3O.js").then(t=>({default:t.UploadComponent})));function mg(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:Ge({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||yr(e),null}var Re=class extends At{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:mg,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ys.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ge({data:o});return r.setFormat(e.format),r}decorate(){return cg(dg,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge({data:t}){return t?.id||(t.id=new Ys.default().toHexString()),ug(new Re({data:t}))}function vr(t){return t instanceof Re}import{c as _g}from"react/compiler-runtime";import{jsx as Tg}from"react/jsx-runtime";import{useLexicalComposerContext as wg}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as kg,mergeRegister as Eg}from"@lexical/utils";import{useConfig as Ng}from"@payloadcms/ui";import{$getPreviousSelection as Lg,$getSelection as Sg,$isParagraphNode as Ig,$isRangeSelection as Rg,COMMAND_PRIORITY_EDITOR as yg,createCommand as vg}from"lexical";import{useEffect as Mg}from"react";import{c as Qs}from"react/compiler-runtime";import{jsx as Mr}from"react/jsx-runtime";import{useLexicalComposerContext as ea}from"@lexical/react/LexicalComposerContext.js";import{toast as pg}from"@payloadcms/ui";import{$getNodeByKey as fg,COMMAND_PRIORITY_EDITOR as ta}from"lexical";import{useEffect as oa,useState as hg}from"react";var gg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=fg(o);n&&n.replace(Ge({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Ar,{fields:null,relationTo:e,value:r})},Cg=t=>{let e=Qs(13),{enabledCollectionSlugs:o}=t,[r]=ea(),[n,i]=hg(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=St(l),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ve,h=>(i(h?.replace?h?.replace.nodeKey:null),c(),!0),ta),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),oa(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:C,doc:_}=h;s(),gg({editor:r,relationTo:C,replaceNodeKey:n,value:_.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=Mr(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},xg=()=>{let t=Qs(3),[e]=ea(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ve,bg,ta),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),oa(o,r),null},ra=t=>Mr(Ot,{...t,FallbackComponent:xg,uploads:!0,children:Mr(Cg,{...t})});function bg(){return pg.error("No upload collections enabled"),!0}var Ar=vg("INSERT_UPLOAD_COMMAND"),na=t=>{let e=_g(5),[o]=wg(),{config:r}=Ng(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Re]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Eg(o.registerCommand(Ar,u=>(o.update(()=>{let c=Sg()||Lg();if(Rg(c)){let d=Ge({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}});kg(d);let{focus:a}=c,p=a.getNode();Ig(p)&&!p.__first&&(p.__prev||p.__next)&&p.remove()}}),!0),yg))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Mg(i,l);let s;return e[3]!==n?(s=Tg(ra,{enabledCollectionSlugs:n.map(Ag)}),e[3]=n,e[4]=s):s=e[4],s};function Ag(t){let{slug:e}=t;return e}var Og=y({nodes:[Re],plugins:[{Component:na,position:"normal"}],slashMenu:{groups:[Q([{Icon:Rr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Rr,isActive:({selection:t})=>{if(!Dg(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]}});import{c as Fg}from"react/compiler-runtime";import{jsx as Or}from"react/jsx-runtime";import{ShimmerEffect as $g,useConfig as Pg}from"@payloadcms/ui";import{lazy as Bg,Suspense as Hg,useEffect as jg,useState as Ug}from"react";var ia={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",hrSelected:"LexicalEditorTheme__hrSelected",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",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Co={namespace:"lexical",theme:ia};function la({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:i}){for(let c of i.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");i.features=i.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let l=new Map;for(let c of i.features)l.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of i.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:l,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:i}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}var sa=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 Dr(t,e,o){return{admin:o,features:sa(t),lexical:e,resolvedFeatureMap:t}}var Gg=Bg(()=>import("./Field-VKDIZQ73.js").then(t=>({default:t.RichText}))),Wg=t=>{let e=Fg(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:i,field:l,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?Co:s,{config:p}=Pg(),[m,f]=Ug(null),h,C;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let I=[];for(let[T,g]of Object.entries(r))g.clientFeatureProvider&&I.push(g.clientFeatureProvider(g.clientFeatureProps));let A=a||Co,b=la({config:p,featureClientImportMap:n,featureClientSchemaMap:i,field:l,schemaPath:u??l.name,unSanitizedEditorConfig:{features:I,lexical:A}});f(Dr(b,A,d))},C=[a,d,m,r,n,i,l,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=i,e[7]=l,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=C):(h=e[11],C=e[12]),jg(h,C);let _;return e[13]!==m||e[14]!==t?(_=Or(Hg,{fallback:Or($g,{height:"35vh"}),children:m&&Or(Gg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=_):_=e[15],_};function Vg(t){return t instanceof HTMLElement}function Kg(...t){return t.filter(Boolean).join(" ")}var xo=new WeakMap;function aa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function bo(t,e){let o=xo.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=aa(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=aa(l);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},xo.set(t,o)}return o.listeners.add(e),()=>{Jg(t,e)}}function Jg(t,e){let o=xo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(xo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Xg(t,e){return bo(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function zg(t,e){return bo(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function Zg(t,e){return bo(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function Yg(t,e){return bo(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}import{c as qg}from"react/compiler-runtime";import{jsx as Qg}from"react/jsx-runtime";import"react";var eC=()=>{let t=qg(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?Qg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as tC}from"react/compiler-runtime";import{jsx as oC}from"react/jsx-runtime";import"react";var rC=()=>{let t=tC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?oC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as nC}from"react/compiler-runtime";import{jsx as iC}from"react/jsx-runtime";import"react";var lC=()=>{let t=nC(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?iC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as sC}from"react/compiler-runtime";import{jsx as aC}from"react/jsx-runtime";import"react";var cC=t=>{let e=sC(3),{children:o}=t,{InlineBlockContainer:r}=xe(),n;return e[0]!==r||e[1]!==o?(n=r?aC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as uC}from"react/compiler-runtime";import{jsx as dC}from"react/jsx-runtime";import"react";var mC=t=>{let e=uC(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=Oe(),s;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(s=l?dC(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 pC}from"react/compiler-runtime";import{jsx as fC}from"react/jsx-runtime";import"react";var hC=()=>{let t=pC(2),{EditButton:e}=Oe(),o;return t[0]!==e?(o=e?fC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gC}from"react/compiler-runtime";import{jsx as CC}from"react/jsx-runtime";import"react";var xC=()=>{let t=gC(2),{RemoveButton:e}=Oe(),o;return t[0]!==e?(o=e?CC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as bC}from"qs-esm";var _C=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:i,collectionSlug:l,select:s})=>{let u=bC({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${l}/${i}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};export{Ct as $createAutoLinkNode,Vt as $createBlockNode,To as $createInlineBlockNode,Te as $createLinkNode,je as $createRelationshipNode,Ge as $createUploadNode,ke as $isAutoLinkNode,pt as $isBlockNode,wo as $isInlineBlockNode,Z as $isLinkNode,ir as $isRelationshipNode,vr as $isUploadNode,Ta as AlignFeatureClient,we as AutoLinkNode,mC as BlockCollapsible,hC as BlockEditButton,be as BlockNode,xC as BlockRemoveButton,La as BlockquoteFeatureClient,kc as BlocksFeatureClient,Kc as BoldFeatureClient,ae as CAN_USE_DOM,$m as ChecklistFeatureClient,Sp as DETAIL_TYPE_TO_DETAIL,kp as DOUBLE_LINE_BREAK,Bp as DebugJsxConverterFeatureClient,Rp as ELEMENT_FORMAT_TO_TYPE,Ip as ELEMENT_TYPE_TO_FORMAT,fa as ENABLE_SLASH_MENU_COMMAND,ua as EditorConfigProvider,lt as FieldsDrawer,Qf as FixedToolbarFeatureClient,Iu as HeadingFeatureClient,Vu as HorizontalRuleFeatureClient,Ke as INSERT_BLOCK_COMMAND,Je as INSERT_INLINE_BLOCK_COMMAND,Tp as IS_ALL_FORMATTING,ad as IndentFeatureClient,cC as InlineBlockContainer,eC as InlineBlockEditButton,lC as InlineBlockLabel,_o as InlineBlockNode,rC as InlineBlockRemoveButton,Yc as InlineCodeFeatureClient,u1 as InlineToolbarFeatureClient,tu as ItalicFeatureClient,Np as LTR_REGEX,ip as LexicalPluginToLexicalFeatureClient,wm as LinkFeatureClient,ie as LinkNode,wp as NON_BREAKING_SPACE,O as NodeFormat,Vm as OrderedListFeatureClient,pp as ParagraphFeatureClient,ma as Point,Ep as RTL_REGEX,ha as Rect,Nf as RelationshipFeatureClient,Ne as RelationshipNode,Wg as RichTextField,dp as SlateToLexicalFeatureClient,lu as StrikethroughFeatureClient,uu as SubscriptFeatureClient,fu as SuperscriptFeatureClient,yp as TEXT_MODE_TO_TYPE,Lp as TEXT_TYPE_TO_FORMAT,vp as TEXT_TYPE_TO_MODE,he as TOGGLE_LINK_COMMAND,rg as TableFeatureClient,$c as TestRecorderFeatureClient,It as ToolbarButton,Ue as ToolbarDropdown,Uc as TreeViewFeatureClient,bu as UnderlineFeatureClient,Qm as UnorderedListFeatureClient,Og as UploadFeatureClient,Re as UploadNode,Yg as addSwipeDownListener,Xg as addSwipeLeftListener,zg as addSwipeRightListener,Zg as addSwipeUpListener,$o as createBlockNode,y as createClientFeature,Co as defaultEditorLexicalConfig,pr as getDOMRangeRect,ga as getEnabledNodes,_C as getRestPopulateFn,Xe as getSelectedNode,Vg as isHTMLElement,pa as isPoint,Kg as joinClasses,Dr as sanitizeClientEditorConfig,sa as sanitizeClientFeatures,lo as setFloatingElemPosition,Qt as setFloatingElemPositionForLinkEditor,Q as slashMenuBasicGroupWithItems,_e as toolbarAddDropdownGroupWithItems,Bo as toolbarFeatureButtonsGroupWithItems,ee as toolbarFormatGroupWithItems,ne as toolbarTextDropdownGroupWithItems,Oe as useBlockComponentContext,j as useEditorConfigContext,xe as useInlineBlockComponentContext,da as useLexicalDocumentDrawer,Ce as useLexicalDrawer,St as useLexicalListDrawer};
38
+ `,Fl="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",$l="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",kp=new RegExp("^[^"+$l+"]*["+Fl+"]"),Ep=new RegExp("^[^"+Fl+"]*["+$l+"]"),Np={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},Lp={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},Sp={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},Ip={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},Rp={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},yp={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Pl={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=He("strong",{children:e})),t.format&O.IS_ITALIC&&(e=He("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=He("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=He("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=He("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=He("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=He("sup",{children:e})),e}};import{jsx as Et}from"react/jsx-runtime";var Bl={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Et("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Et("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let i in o.sizes){let l=o.sizes[i];if(!l||!l.width||!l.height||!l.mimeType||!l.filesize||!l.filename||!l.url)continue;let s=l?.url;n.push(Et("source",{media:`(max-width: ${l.width}px)`,srcSet:s,type:l.mimeType},i))}return n.push(Et("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Et("picture",{children:n})}};var et={...Al,...Pl,...Rl,...Ll,...Ol,...Sl,...Il,...Ml,...vl({}),...Bl,...Dl};import{jsx as jl,Fragment as vp}from"react/jsx-runtime";import or from"react";function Hl(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function Ul({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Hl(e)?Gl({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):jl(vp,{})}function Gl({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let i=t.unknown;return r.map((s,u)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!i&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!i&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&i&&(c=i);let d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:m=>Gl({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...s,parent:n}}),parent:n}):c:d=jl("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*2}em`),or.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return or.cloneElement(d,{key:u,style:p})}return or.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var rr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:i})=>{if(!o)return null;let l={};e?typeof e=="function"?l=e({defaultConverters:et}):l=e:l=et;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Ul({converters:l,data:o,disableIndent:n,disableTextAlign:i});return r?Wl(Mp,{children:s}):Wl("div",{className:t??"payload-richtext",children:s})};function Vl(){let t=Ap(7),[e]=Op(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=$p(o),i,l;t[2]!==e?(i=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),l=[e],t[2]=e,t[3]=i,t[4]=l):(i=t[3],l=t[4]),Fp(i,l);let s;return t[5]!==r?(s=Dp(rr,{converters:et,data:r}),t[5]=r,t[6]=s):s=t[6],s}var Pp=y({plugins:[{Component:Vl,position:"bottom"}]});import{$isNodeSelection as kf}from"lexical";import{jsx as Nt,jsxs as Bp}from"react/jsx-runtime";import"react";var nr=()=>Bp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Nt("g",{clipPath:"url(#clip0_4397_10817)",children:Nt("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"})}),Nt("defs",{children:Nt("clipPath",{id:"clip0_4397_10817",children:Nt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Up}from"react/jsx-runtime";import*as Jl from"react";import{DecoratorBlockNode as Hp}from"@lexical/react/LexicalDecoratorBlockNode.js";function jp(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Kl({relationTo:o,value:e})}:null}var Lt=class extends Hp{__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:jp,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=Kl(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 Kl(t){return new Lt({data:t})}var Gp=Jl.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function Wp(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:je({relationTo:o,value:e})}:null}var Ne=class extends Lt{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:Wp,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=je(o);return r.setFormat(e.format),r}decorate(e,o){return Up(Gp,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return new Ne({data:t})}function ir(t){return t instanceof Ne}import{c as cf}from"react/compiler-runtime";import{jsx as uf}from"react/jsx-runtime";import{useLexicalComposerContext as df}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as mf}from"@lexical/utils";import{useConfig as pf}from"@payloadcms/ui";import{$getPreviousSelection as ff,$getSelection as hf,$isParagraphNode as Ql,$isRangeSelection as gf,COMMAND_PRIORITY_EDITOR as Cf,createCommand as xf}from"lexical";import{useEffect as bf}from"react";import{c as of}from"react/compiler-runtime";import{jsx as oo}from"react/jsx-runtime";import{useLexicalComposerContext as rf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as nf,COMMAND_PRIORITY_EDITOR as lf}from"lexical";import{useEffect as sf,useState as Zl}from"react";import{c as Vp}from"react/compiler-runtime";import{jsx as Kp}from"react/jsx-runtime";import{useLexicalComposerContext as Jp}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Xp,useModal as zp}from"@payloadcms/ui";import{$getNodeByKey as Xl,$getPreviousSelection as Zp,$getRoot as Yp,$getSelection as qp,$isRangeSelection as Qp,$setSelection as ef}from"lexical";import{useEffect as tf,useState as zl}from"react";var St=t=>{let e=Vp(23),[o]=Jp(),[r,n]=zl(null),[i,l]=zl(!1),[s,u,c]=Xp(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=zp(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let P=qp()??Zp();n(P)},e[0]=h):h=e[0];let C=h,_;e[1]!==o||e[2]!==r?(_=()=>{r&&o.update(()=>{if(Qp(r)){let{anchor:P,focus:v}=r;Xl(P.key)&&Xl(v.key)&&ef(r.clone())}else Yp().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=_):_=e[3];let I=_,A;e[4]!==d?(A=()=>{d()},e[4]=d,e[5]=A):A=e[5];let b=A,T,g;e[6]!==a||e[7]!==f||e[8]!==I||e[9]!==i?(T=()=>{if(!i)return;let P=f[a];P&&!P?.isOpen&&(l(!1),setTimeout(()=>{I()},1))},g=[f,a,I,i],e[6]=a,e[7]=f,e[8]=I,e[9]=i,e[10]=T,e[11]=g):(T=e[10],g=e[11]),tf(T,g);let k;e[12]!==u?(k=P=>Kp(u,{...P,onClick:()=>{C()}}),e[12]=u,e[13]=k):k=e[13];let M;e[14]!==m?(M=()=>{C(),m(),l(!0)},e[14]=m,e[15]=M):M=e[15];let D;return e[16]!==s||e[17]!==b||e[18]!==p||e[19]!==a||e[20]!==k||e[21]!==M?(D={closeListDrawer:b,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:M},e[16]=s,e[17]=b,e[18]=p,e[19]=a,e[20]=k,e[21]=M,e[22]=D):D=e[22],D};var af=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=nf(o);n&&n.replace(je({relationTo:e,value:r}))}):t.dispatchCommand(lr,{relationTo:e,value:r})},Yl=t=>{let e=of(16),{enabledCollectionSlugs:o}=t,[r]=rf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[i]=Zl(n),[l,s]=Zl(null),u=o||void 0,c;e[2]!==i||e[3]!==u?(c={collectionSlugs:u,selectedCollection:i},e[2]=i,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=St(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(st,I=>(s(I?.replace?I?.replace.nodeKey:null),p(),!0),lf),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),sf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==l?(h=I=>{let{collectionSlug:A,doc:b}=I;af({editor:r,relationTo:A,replaceNodeKey:l,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=l,e[12]=h):h=e[12];let C=h,_;return e[13]!==a||e[14]!==C?(_=oo(a,{onSelect:C}),e[13]=a,e[14]=C,e[15]=_):_=e[15],_},ql=t=>(t?.enabledCollectionSlugs?.length??-1)>0?oo(Yl,{...t}):oo(Ot,{...t,children:oo(Yl,{...t})});var lr=xf("INSERT_RELATIONSHIP_COMMAND"),es=t=>{let e=cf(10),{clientProps:o}=t,[r]=df(),{config:n}=pf(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o?.disabledCollections||e[1]!==i){let a;e[3]!==o?.disabledCollections?(a=p=>{let{slug:m}=p;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=a):a=e[4],d=i.filter(a).map(_f),e[0]=o?.disabledCollections,e[1]=i,e[2]=d}else d=e[2];l=d}let s,u;e[5]!==r?(s=()=>{if(!r.hasNodes([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(lr,wf,Cf)},u=[r],e[5]=r,e[6]=s,e[7]=u):(s=e[6],u=e[7]),bf(s,u);let c;return e[8]!==l?(c=uf(ql,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function _f(t){let{slug:e}=t;return e}function Tf(t){return Ql(t)}function wf(t){let e=hf()||ff();if(gf(e)){let o=je(t);mf(o);let{focus:r}=e,n=r.getNode();Ql(n)&&n.getTextContentSize()===0&&n.getParentOrThrow().getChildren().filter(Tf).length>1&&n.remove()}return!0}var Ef=y({nodes:[Ne],plugins:[{Component:es,position:"normal"}],slashMenu:{groups:[Q([{Icon:nr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(st,{replace:!1})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:nr,isActive:({selection:t})=>{if(!kf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ir(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(st,{replace:!1})}}])]}});import{c as ss}from"react/compiler-runtime";import{jsx as de,jsxs as Gf}from"react/jsx-runtime";import{useLexicalComposerContext as Wf}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Vf,useThrottledEffect as Kf,useTranslation as Jf}from"@payloadcms/ui";import*as Le from"react";import{useMemo as Xf}from"react";import{c as Nf}from"react/compiler-runtime";import{jsx as Lf}from"react/jsx-runtime";import{mergeRegister as Sf}from"@lexical/utils";import{$addUpdateTag as If,$getSelection as Rf}from"lexical";import{useEffect as ro,useState as sr}from"react";var ar="toolbar-popup__button",It=t=>{let e=Nf(34),{children:o,editor:r,item:n}=t,[i,l]=sr(!0),[s,u]=sr(!1),[c,d]=sr(ar),a=j(),p;e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==i||e[4]!==n?(p=()=>{r.getEditorState().read(()=>{let M=Rf();if(M){if(n.isActive){let D=n.isActive({editor:r,editorConfigContext:a,selection:M});s!==D&&u(D)}if(n.isEnabled){let D=n.isEnabled({editor:r,editorConfigContext:a,selection:M});i!==D&&l(D)}}})},e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=n,e[5]=p):p=e[5];let m=p,f,h;e[6]!==m?(f=()=>{m()},h=[m],e[6]=m,e[7]=f,e[8]=h):(f=e[7],h=e[8]),ro(f,h);let C,_;e[9]!==m?(C=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),_=[m],e[9]=m,e[10]=C,e[11]=_):(C=e[10],_=e[11]),ro(C,_);let I,A;e[12]!==r||e[13]!==m?(I=()=>Sf(r.registerUpdateListener(()=>{m()})),A=[r,m],e[12]=r,e[13]=m,e[14]=I,e[15]=A):(I=e[14],A=e[15]),ro(I,A);let b;e[16]!==s||e[17]!==i||e[18]!==n.key?(b=()=>{d([ar,i===!1?"disabled":"",s?"active":"",n?.key?`${ar}-`+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]!==c||e[22]!==i||e[23]!==n.key?(T=[i,s,c,n.key],e[20]=s,e[21]=c,e[22]=i,e[23]=n.key,e[24]=T):T=e[24],ro(b,T);let g;e[25]!==s||e[26]!==r||e[27]!==i||e[28]!==n?(g=()=>{if(i!==!1)return r.focus(()=>{r.update(yf),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=i,e[28]=n,e[29]=g):g=e[29];let k;return e[30]!==o||e[31]!==c||e[32]!==g?(k=Lf("button",{className:c,onClick:g,onMouseDown:vf,type:"button",children:o}),e[30]=o,e[31]=c,e[32]=g,e[33]=k):k=e[33],k};function yf(){If("toolbar")}function vf(t){t.preventDefault()}import{c as ls}from"react/compiler-runtime";import{jsx as tt}from"react/jsx-runtime";import dr,{useEffect as is}from"react";import{mergeRegister as Bf}from"@lexical/utils";import{useTranslation as Hf}from"@payloadcms/ui";import{$getSelection as jf}from"lexical";import{jsx as Me,jsxs as ts}from"react/jsx-runtime";import{Button as Mf}from"@payloadcms/ui";import{$addUpdateTag as Af,isDOMNode as Df}from"lexical";import no,{useCallback as Of,useEffect as Rt,useMemo as Ff,useRef as ur,useState as io}from"react";import{createPortal as $f}from"react-dom";var cr="toolbar-popup__dropdown-item",os=no.createContext(null);function rs({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,u]=io(cr);Rt(()=>{u([cr,r===!1?"disabled":"",t?"active":"",i?.key?`${cr}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let c=ur(null),d=no.use(os);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return Rt(()=>{c?.current!=null&&a(c)},[c,a]),Me(Mf,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Af("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:l,type:"button",children:e})}function Pf({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=io(),[l,s]=io(),u=Of(a=>{i(p=>p!=null?[...p,a]:[a])},[i]),c=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=Ff(()=>({registerItem:u}),[u]);return Rt(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),Me(os,{value:d,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function ns({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let u=ur(null),c=ur(null),[d,a]=io(!1),p=()=>{a(!1),c?.current!=null&&c.current.focus()};Rt(()=>{let f=c.current,h=u.current;if(d&&f!==null&&h!==null){let{left:C,top:_}=f.getBoundingClientRect(),I=window.scrollY||document.documentElement.scrollTop;h.style.top=`${_+I+f.offsetHeight+5}px`,h.style.left=`${Math.min(C-5,window.innerWidth-h.offsetWidth-20)}px`}},[u,c,d]),Rt(()=>{let f=c.current;if(f!==null&&d){let h=C=>{let _=C.target;Df(_)&&(s&&u.current&&u.current.contains(_)||f.contains(_)||a(!1))};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[u,c,d,s]);let m=$f(Me(Pf,{dropDownRef:u,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return ts(no.Fragment,{children:[ts("button",{"aria-label":t,className:e+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),a(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[n&&Me(n,{}),l&&Me("span",{className:"toolbar-popup__dropdown-label",children:l}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&Me(no.Fragment,{children:m})]})}var mr="toolbar-popup__dropdown",Uf=t=>{let e=ls(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=Hf(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u;if(l.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==l?(f=l?.Component&&tt(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,p;if(l.label){let f;e[6]!==c||e[7]!==s||e[8]!==l||e[9]!==d?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):l.label,e[6]=c,e[7]=s,e[8]=l,e[9]=d,e[10]=f):f=e[10],a=f}a.length>25?p=a.substring(0,25)+"...":p=a;let m;return e[11]!==o||e[12]!==p||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==a?(m=tt(rs,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?tt(l.ChildComponent,{}):void 0,item:l,tooltip:a,children:tt("span",{className:"text",children:p})},l.key),e[11]=o,e[12]=p,e[13]=n,e[14]=i,e[15]=l,e[16]=a,e[17]=m):m=e[17],m},Ue=t=>{let e=ls(36),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:u,maxActiveItems:c,onActiveChange:d}=t,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[0]=a):a=e[0];let[p,m]=dr.useState(a),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,C]=dr.useState(f),[_,I]=dr.useState(!0),A=j(),{items:b,key:T}=i,g;e[2]!==n||e[3]!==A||e[4]!==i||e[5]!==b||e[6]!==c||e[7]!==d?(g=()=>{n.getEditorState().read(()=>{let $=jf();if(!$)return;let U=[],V=[],pe=[];for(let H of b)H.isActive&&(!c||U.length<c)&&H.isActive({editor:n,editorConfigContext:A,selection:$})&&(U.push(H.key),V.push(H)),H.isEnabled?H.isEnabled({editor:n,editorConfigContext:A,selection:$})&&pe.push(H.key):pe.push(H.key);i.isEnabled&&I(i.isEnabled({editor:n,editorConfigContext:A,selection:$})),m(U),C(pe),d&&d({activeItems:V})})},e[2]=n,e[3]=A,e[4]=i,e[5]=b,e[6]=c,e[7]=d,e[8]=g):g=e[8];let k=g,M,D;e[9]!==k?(M=()=>{k()},D=[k],e[9]=k,e[10]=M,e[11]=D):(M=e[10],D=e[11]),is(M,D);let P,v;e[12]!==n||e[13]!==k?(P=()=>Bf(n.registerUpdateListener(()=>{k()})),v=[n,k],e[12]=n,e[13]=k,e[14]=P,e[15]=v):(P=e[14],v=e[15]),is(P,v);let N=`${T} dropdown`,x=`${mr}-${T}`,E;e[16]!==r?(E=r||[],e[16]=r,e[17]=E):E=e[17];let S;e[18]!==E||e[19]!==x?(S=[mr,x,...E].filter(Boolean),e[18]=E,e[19]=x,e[20]=S):S=e[20];let L=S.join(" "),R=!_,w;e[21]!==s?(w=s||[],e[21]=s,e[22]=w):w=e[22];let F;return e[23]!==l||e[24]!==p||e[25]!==o||e[26]!==n||e[27]!==h||e[28]!==T||e[29]!==b||e[30]!==u||e[31]!==L||e[32]!==R||e[33]!==w||e[34]!==N?(F=tt(ns,{buttonAriaLabel:N,buttonClassName:L,disabled:R,Icon:l,itemsContainerClassNames:[`${mr}-items`,...w],label:u,children:b.length?b.map($=>tt(Uf,{active:p.includes($.key),anchorElem:o,editor:n,enabled:h.includes($.key),item:$},$.key)):null},T),e[23]=l,e[24]=p,e[25]=o,e[26]=n,e[27]=h,e[28]=T,e[29]=b,e[30]=u,e[31]=L,e[32]=R,e[33]=w,e[34]=N,e[35]=F):F=e[35],F};function zf({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&de(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?de(It,{editor:e,item:o,children:de(o.ChildComponent,{})},o.key):null}function Zf(t){let e=ss(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=Jf(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=Le.useState(void 0),[m,f]=Le.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 C;e[4]!==i?(C=[i],e[4]=i,e[5]=C):C=e[5],Le.useEffect(h,C);let _;e[6]!==c||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==d?(_=T=>{let{activeItems:g}=T;if(!g.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let k=g[0],M=k.key;k.label&&(M=typeof k.label=="function"?k.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):k.label),M.length>25&&(M=M.substring(0,25)+"..."),g.length===1?(p(M),f(()=>k.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:g.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=c,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=d,e[12]=_):_=e[12];let I=_,A=`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]!==I||e[21]!==A?(b=Gf("div",{className:A,children:[i.type==="dropdown"&&i.items.length?m?de(Ue,{anchorElem:o,editor:r,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:I}):de(Ue,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:I}):null,i.type==="buttons"&&i.items.length?i.items.map(T=>de(zf,{anchorElem:o,editor:r,item:T},T.key)):null,l<n.features.toolbarFixed?.groups.length-1&&de("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]=I,e[21]=A,e[22]=b):b=e[22],b}function Yf({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=Le.useRef(null),{y:l}=Vf(),s=Xf(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Kf(()=>{if(!s)return;let u=i.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),de("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:i,children:o.isEditable()&&de(Le.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>de(Zf,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var as=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return as(t.parentEditor)}return!1},cs=t=>{let e=ss(6),{clientProps:o}=t,[r]=Wf(),n=j(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=as(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=de(Yf,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var qf=y({plugins:[{Component:cs,position:"aboveContainer"}]});import{c as ms}from"react/compiler-runtime";import{jsx as ge,jsxs as ps}from"react/jsx-runtime";import{useLexicalComposerContext as Qf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as fs}from"@lexical/utils";import{$getSelection as hs,$isRangeSelection as us,$isTextNode as e1,COMMAND_PRIORITY_LOW as t1,getDOMSelection as gs,SELECTION_CHANGE_COMMAND as o1}from"lexical";import{useCallback as so,useEffect as yt,useRef as ds,useState as r1}from"react";import*as ao from"react";import{createPortal as n1}from"react-dom";function pr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function lo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-i;l==="center"&&(h=u.left+u.width/2-a.width/2);let C=0;return!e&&f<m.top&&!s&&(C=a.height+u.height+c*2,f+=C),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-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),C}function i1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ge(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ge(It,{editor:e,item:o,children:ge(o.ChildComponent,{})},o.key):null}function l1(t){let e=ms(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=j(),[s,u]=ao.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],ao.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:C}=h;if(!C.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let _=C[0];u(()=>_?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=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]!==p||e[17]!==m?(f=ps("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?ge(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ge(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ge(i1,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&ge("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]=p,e[17]=m,e[18]=f):f=e[18],f}function s1({anchorElem:t,editor:e}){let o=ds(null),r=ds(null),{editorConfig:n}=j(),i=so(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=so(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||i()}}},[i]),s=so(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);yt(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let u=so(()=>{let c=hs(),d=gs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=pr(d,m),h=lo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&lo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return yt(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,u,t]),yt(()=>(e.getEditorState().read(()=>{u()}),fs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(o1,()=>(u(),!1),t1))),[e,u]),ps("div",{className:"inline-toolbar-popup",ref:o,children:[ge("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>ge(l1,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function a1(t,e){let o=ms(12),[r,n]=r1(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=hs(),m=gs(t._window),f=t.getRootElement();if(m!==null&&(!us(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!us(p))return;if(p.getTextContent()!==""){let C=p.getNodes(),_=!1;for(let I of C)if(e1(I)){n(!0),_=!0;break}_||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,u;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),u=[l],o[2]=l,o[3]=s,o[4]=u):(s=o[3],u=o[4]),yt(s,u);let c,d;if(o[5]!==t||o[6]!==l?(c=()=>fs(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,l],o[5]=t,o[6]=l,o[7]=c,o[8]=d):(c=o[7],d=o[8]),yt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=n1(ge(s1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Cs=t=>{let{anchorElem:e}=t,[o]=Qf();return a1(o,e)};var c1=y({plugins:[{Component:Cs,position:"floatingAnchorElem"}]});import{TableCellNode as Qh,TableNode as eg,TableRowNode as tg}from"@lexical/table";import{jsx as xs}from"react/jsx-runtime";import"react";var fr=()=>xs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:xs("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 u1,$createTableNode as d1,$createTableRowNode as m1,$isTableCellNode as bs,$isTableNode as hr,$isTableRowNode as gr,TableCellHeaderStates as co,TableCellNode as p1,TableNode as f1,TableRowNode as h1}from"@lexical/table";import{$isParagraphNode as g1,$isTextNode as C1}from"lexical";var Ts=/^\|(.+)\|\s?$/,x1=/^(\| ?:?-*:? ?)+\|\s?$/,ws=({allTransformers:t})=>({type:"element",dependencies:[f1,h1,p1],export:e=>{if(!hr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!gr(r))continue;let i=!1;for(let l of r.getChildren())bs(l)&&(n.push(Br(t,l).replace(/\n/g,"\\n").trim()),l.__headerState===co.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
39
+ `)},regExp:Ts,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(x1.test(n)){let a=e.getPreviousSibling();if(!a||!hr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!gr(m))return;m.getChildren().forEach(f=>{bs(f)&&f.setHeaderStyles(co.ROW,co.ROW)}),e.remove();return}let i=_s(n,t);if(i==null)return;let l=[i],s=e.getPreviousSibling(),u=i.length;for(;s&&!(!g1(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!C1(a))break;let p=_s(a.getTextContent(),t);if(p==null)break;u=Math.max(u,p.length),l.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let c=d1();for(let a of l){let p=m1();c.append(p);for(let m=0;m<u;m++)p.append(m<a.length?a[m]:ks("",t))}let d=e.getPreviousSibling();hr(d)&&b1(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function b1(t){let e=t.getFirstChild();return gr(e)?e.getChildrenSize():0}var ks=(t,e)=>{t=t.replace(/\\n/g,`
40
+ `);let o=u1(co.NO_STATUS);return Pr(t,e,o),o},_s=(t,e)=>{let o=t.match(Ts);return!o||!o[1]?null:o[1].split("|").map(r=>ks(r,e))};import{c as T1}from"react/compiler-runtime";import{jsx as B,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as Ss}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as w1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as xr,$deleteTableColumn__EXPERIMENTAL as k1,$deleteTableRow__EXPERIMENTAL as E1,$getNodeTriplet as N1,$getTableCellNodeFromLexicalNode as Ns,$getTableColumnIndexFromTableCellNode as L1,$getTableNodeFromLexicalNodeOrThrow as Ie,$getTableRowIndexFromTableCellNode as S1,$insertTableColumn__EXPERIMENTAL as I1,$insertTableRow__EXPERIMENTAL as R1,$isTableCellNode as Is,$isTableSelection as vt,$unmergeCell as y1,getTableElement as br,getTableObserverFromTableElement as _r,TableCellHeaderStates as Ae,TableCellNode as v1}from"@lexical/table";import{mergeRegister as M1}from"@lexical/utils";import{useScrollInfo as A1}from"@payloadcms/ui";import{$createParagraphNode as D1,$getSelection as mo,$isElementNode as O1,$isParagraphNode as F1,$isRangeSelection as Tr,$isTextNode as $1,$setSelection as P1,COMMAND_PRIORITY_CRITICAL as B1,getDOMSelection as H1,isDOMNode as j1,SELECTION_CHANGE_COMMAND as U1}from"lexical";import*as wr from"react";import{useCallback as me,useEffect as ot,useRef as uo,useState as rt}from"react";import{createPortal as Rs}from"react-dom";import{jsx as Cr,jsxs as _1}from"react/jsx-runtime";import"react";var Es=()=>_1("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 Ls(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function G1(){let t=mo();if(Tr(t)&&!t.isCollapsed()||vt(t)&&!t.anchor.is(t.focus)||!Tr(t)&&!vt(t))return!1;let[e]=N1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function W1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!F1(e)||!e.isEmpty())}function V1(t){let e=t.getLastDescendant();$1(e)?e.select():O1(e)?e.selectEnd():e!==null&&e.selectNext()}function K1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Ss(),l=uo(null),[s,u]=rt(n),[c,d]=rt({columns:1,rows:1}),[a,p]=rt(!1),[m,f]=rt(!1),{y:h}=A1();ot(()=>i.registerMutationListener(v1,x=>{x.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[i,s]),ot(()=>{i.getEditorState().read(()=>{let x=mo();if(vt(x)){let E=Ls(x);d(Ls(x)),p(E.columns>1||E.rows>1)}f(G1())})},[i]),ot(()=>{let x=e.current,E=l.current,S=i.getRootElement();if(x!=null&&E!=null&&S!=null){let L=S.getBoundingClientRect(),R=x.getBoundingClientRect();E.style.opacity="1";let w=E.getBoundingClientRect(),F=5,$=R.right+F;if($+w.width>window.innerWidth||$+w.width>L.right){let V=R.left-w.width-F;$=(V<0?F:V)+window.pageXOffset}E.style.left=`${$+window.pageXOffset}px`;let U=R.top;if(U+w.height>window.innerHeight){let V=R.bottom-w.height;U=V<0?F:V}E.style.top=`${U}px`}},[e,l,i,h]),ot(()=>{function x(E){l.current!=null&&e.current!=null&&j1(E.target)&&!l.current.contains(E.target)&&!e.current.contains(E.target)&&r(!1)}return window.addEventListener("click",x),()=>window.removeEventListener("click",x)},[r,e]);let C=me(()=>{i.update(()=>{if(s.isAttached()){let x=Ie(s),E=br(x,i.getElementByKey(x.getKey()));if(E===null)throw new Error("Expected to find tableElement in DOM");let S=_r(E);S!==null&&S.$clearHighlight(),x.markDirty(),u(s.getLatest())}P1(null)})},[i,s]),_=()=>{i.update(()=>{let x=mo();if(vt(x)){let S=x.getNodes().filter(Is);if(S.length===0)return;let L=Ie(S[0]),[R]=xr(L,null,null),w=1/0,F=-1/0,$=1/0,U=-1/0,V=new Set;for(let Y of R)for(let K of Y){if(!K||!K.cell)continue;let oe=K.cell.getKey();if(!V.has(oe)&&S.some(re=>re.is(K.cell))){V.add(oe);let re=K.startRow,le=K.startColumn,De=K.cell.__rowSpan||1,it=K.cell.__colSpan||1;w=Math.min(w,re),F=Math.max(F,re+De-1),$=Math.min($,le),U=Math.max(U,le+it-1)}}if(w===1/0||$===1/0)return;let pe=F-w+1,H=U-$+1,W=R?.[w]?.[$];if(!W?.cell)return;let te=W.cell;te.setColSpan(H),te.setRowSpan(pe);let ce=new Set([te.getKey()]);for(let Y=w;Y<=F;Y++)for(let K=$;K<=U;K++){let oe=R?.[Y]?.[K];if(!oe?.cell)continue;let re=oe.cell,le=re.getKey();ce.has(le)||(ce.add(le),W1(re)||te.append(...re.getChildren()),re.remove())}te.getChildrenSize()===0&&te.append(D1()),V1(te),o()}})},I=()=>{i.update(()=>{y1()})},A=me(x=>{i.update(()=>{for(let E=0;E<c.rows;E++)R1(x);o()})},[i,o,c.rows]),b=me(x=>{i.update(()=>{for(let E=0;E<c.columns;E++)I1(x);o()})},[i,o,c.columns]),T=me(()=>{i.update(()=>{E1(),o()})},[i,o]),g=me(()=>{i.update(()=>{Ie(s).remove(),C(),o()})},[i,s,C,o]),k=me(()=>{i.update(()=>{k1(),o()})},[i,o]),M=me(()=>{i.update(()=>{let x=Ie(s),E=S1(s),[S]=xr(x,null,null),L=new Set,R=s.getHeaderStyles()^Ae.ROW;if(S[E])for(let w=0;w<S[E].length;w++){let F=S[E][w];F?.cell&&(L.has(F.cell)||(L.add(F.cell),F.cell.setHeaderStyles(R,Ae.ROW)))}C(),o()})},[i,s,C,o]),D=me(()=>{i.update(()=>{let x=Ie(s),E=L1(s),[S]=xr(x,null,null),L=new Set,R=s.getHeaderStyles()^Ae.COLUMN;if(S)for(let w=0;w<S.length;w++){let F=S?.[w]?.[E];F?.cell&&(L.has(F.cell)||(L.add(F.cell),F.cell.setHeaderStyles(R,Ae.COLUMN)))}C(),o()})},[i,s,C,o]),P=me(()=>{i.update(()=>{if(s.isAttached()){let x=Ie(s);x&&x.setRowStriping(!x.getRowStriping())}C(),o()})},[i,s,C,o]),v=me(()=>{i.update(()=>{if(s.isAttached()){let x=Ie(s);x&&x.setFrozenColumns(x.getFrozenColumns()===0?1:0)}C(),o()})},[i,s,C,o]),N=null;return t&&(a?N=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):m&&(N=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),Rs(Se("div",{className:"table-action-menu-dropdown",onClick:x=>{x.stopPropagation()},ref:l,children:[N?Se(wr.Fragment,{children:[N,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>P(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>A(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>A(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>T(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&Ae.ROW)===Ae.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&Ae.COLUMN)===Ae.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function J1({anchorElem:t,cellMerge:e}){let[o]=Ss(),r=uo(null),n=uo(null),[i,l]=rt(!1),[s,u]=rt(null),c=me(()=>{let a=r.current,p=mo(),m=H1(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")),u(null)}if(p==null||a==null)return h();let C=o.getRootElement(),_=null,I=null;if(Tr(p)&&C!==null&&m!==null&&C.contains(m.anchorNode)){let b=Ns(p.anchor.getNode());if(b==null||(I=o.getElementByKey(b.getKey()),I==null||!b.isAttached()))return h();let T=Ie(b),g=br(T,o.getElementByKey(T.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=_r(g),u(b)}else if(vt(p)){let b=Ns(p.anchor.getNode());if(!Is(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let T=Ie(b),g=br(T,o.getElementByKey(T.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=_r(g),I=o.getElementByKey(b.getKey())}else if(!f)return h();if(_===null||I===null)return h();let A=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",A),a.classList.toggle("table-cell-action-button-container--inactive",!A),A){let b=I.getBoundingClientRect(),T=t.getBoundingClientRect(),g=b.top-T.top,k=b.right-T.left;a.style.transform=`translate(${k}px, ${g}px)`}},[o,t]);ot(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return M1(o.registerUpdateListener(m),o.registerCommand(U1,m,B1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=uo(s);return ot(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),B("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Se(wr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),l(!i)},ref:n,type:"button",children:B(Es,{})}),i&&B(K1,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var ys=t=>{let e=T1(3),{anchorElem:o}=t,r=w1(),n;return e[0]!==o||e[1]!==r?(n=Rs(r?B(J1,{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 X1}from"react/compiler-runtime";import{jsx as fo,jsxs as z1}from"react/jsx-runtime";import{useLexicalComposerContext as Z1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Y1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as q1,$getTableNodeFromLexicalNodeOrThrow as kr,$getTableRowIndexFromTableCellNode as Q1,$isTableCellNode as vs,$isTableRowNode as eh,getDOMCellFromTarget as th,getTableElement as oh,TableNode as Ms}from"@lexical/table";import{calculateZoomLevel as As,mergeRegister as rh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Er,isHTMLElement as nh}from"lexical";import*as Os from"react";import{useCallback as Mt,useEffect as Nr,useRef as po,useState as nt}from"react";import{createPortal as ih}from"react-dom";var lh=33,Ds=92;function sh({editor:t}){let e=po(null),o=po(null),r=po(null),[n,i]=nt(!1),l=j(),s=po(null),[u,c]=nt(null),[d,a]=nt(null),[p,m]=nt(!1),[f,h]=nt(null),C=Mt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),_=v=>(v.buttons&1)===1;Nr(()=>{let v=new Set;return rh(t.registerMutationListener(Ms,N=>{for(let[x,E]of N)E==="destroyed"?v.delete(x):v.add(x);i(v.size>0)}),t.registerNodeTransform(Ms,N=>{if(N.getColWidths())return N;let x=N.getColumnCount(),E=Ds;return N.setColWidths(Array(x).fill(E)),N}))},[t]),Nr(()=>{if(!n)return;let v=S=>{let L=S.target;if(nh(L)){if(f){c({x:S.clientX,y:S.clientY});return}if(m(_(S)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let R=th(L);R&&d!==R?t.getEditorState().read(()=>{let w=Er(R.elem);if(!w)throw new Error("TableCellResizer: Table cell node not found.");let F=kr(w),$=oh(F,t.getElementByKey(F.getKey()));if(!$)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=$.getBoundingClientRect(),a(R)},{editor:t}):R==null&&C()}}},N=S=>{m(!0)},x=S=>{m(!1)},E=t.registerRootListener((S,L)=>{L?.removeEventListener("mousemove",v),L?.removeEventListener("mousedown",N),L?.removeEventListener("mouseup",x),S?.addEventListener("mousemove",v),S?.addEventListener("mousedown",N),S?.addEventListener("mouseup",x)});return()=>{E()}},[d,f,t,n,C]);let I=v=>v==="bottom",A=Mt(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Er(d.elem);if(!vs(N))throw new Error("TableCellResizer: Table cell node not found.");let x=kr(N),E=Q1(N),S=x.getChildren(),R=N.getColSpan()===x.getColumnCount()?E:E+N.getRowSpan()-1;if(R>=S.length||R<0)throw new Error("Expected table cell to be inside of table row.");let w=S[R];if(!eh(w))throw new Error("Expected table row");let F=w.getHeight();if(F===void 0){let U=w.getChildren();F=Math.min(...U.map(V=>b(V,t)??1/0))}let $=Math.max(F+v,lh);w.setHeight($)},{tag:"skip-scroll-into-view"})},[d,t]),b=(v,N)=>N.getElementByKey(v.getKey())?.clientHeight,T=(v,N)=>{let x;return N.forEach(E=>{E.forEach((S,L)=>{S.cell===v&&(x=L)})}),x},g=Mt(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Er(d.elem);if(!vs(N))throw new Error("TableCellResizer: Table cell node not found.");let x=kr(N),[E]=q1(x,null,null),S=T(N,E);if(S===void 0)throw new Error("TableCellResizer: Table column not found.");let L=x.getColWidths();if(!L)return;let R=L[S];if(R===void 0)return;let w=[...L],F=Math.max(R+v,Ds);w[S]=F,x.setColWidths(w)},{tag:"skip-scroll-into-view"})},[d,t]),k=Mt(v=>{let N=x=>{if(x.preventDefault(),x.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:E,y:S}=s.current;if(d===null)return;let L=As(x.target);if(I(v)){let R=(x.clientY-S)/L;A(R)}else{let R=(x.clientX-E)/L;g(R)}C(),document.removeEventListener("mouseup",N)}};return N},[d,C,g,A]),M=Mt(v=>N=>{if(N.preventDefault(),N.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:N.clientX,y:N.clientY},c(s.current),h(v),document.addEventListener("mouseup",k(v))},[d,k]),[D,P]=nt({bottom:null,left:null,right:null,top:null});return Nr(()=>{if(d){let{height:v,left:N,top:x,width:E}=d.elem.getBoundingClientRect(),S=As(d.elem),L=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+x+v-L/2}px`,width:`${E}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+N+E-L/2}px`,top:`${window.scrollY+x}px`,width:`${L}px`}},w=r.current;f&&u&&w&&(I(f)?(R[f].left=`${window.scrollX+w.left}px`,R[f].top=`${window.scrollY+u.y/S}px`,R[f].height="3px",R[f].width=`${w.width}px`):(R[f].top=`${window.scrollY+w.top}px`,R[f].left=`${window.scrollX+u.x/S}px`,R[f].width="3px",R[f].height=`${w.height}px`),R[f].backgroundColor="#adf"),P(R)}else P({bottom:null,left:null,right:null,top:null})},[d,f,u]),fo("div",{ref:o,children:d!=null&&!p&&z1(Os.Fragment,{children:[fo("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:D.right||void 0}),fo("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:D.bottom||void 0})]})})}var Fs=()=>{let t=X1(3),[e]=Z1(),o=Y1(),r,n;return t[0]!==e||t[1]!==o?(n=o?ih(fo(sh,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as hh}from"react/compiler-runtime";import{jsx as Lr,jsxs as gh,Fragment as Ch}from"react/jsx-runtime";import{useLexicalComposerContext as Ws}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as xh,$getTableColumnIndexFromTableCellNode as bh,$getTableRowIndexFromTableCellNode as _h,$insertTableColumn__EXPERIMENTAL as Th,$insertTableRow__EXPERIMENTAL as wh,$isTableCellNode as kh,$isTableNode as Bs,getTableElement as Eh,TableNode as Nh}from"@lexical/table";import{$findMatchingParent as Lh,mergeRegister as Sh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Hs,isHTMLElement as Ih}from"lexical";import{useEffect as js,useMemo as Rh,useRef as Us,useState as ho}from"react";import"react";import{createPortal as yh}from"react-dom";import{c as mh}from"react/compiler-runtime";import{useEffect as ph,useRef as fh}from"react";var ah="Expected a function",ch=Math.max,uh=Math.min;function dh(t,e,o){let r,n,i=0,l,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(ah);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?ch(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(g){let k=r,M=l;return r=l=void 0,i=g,d=t.apply(M,k),d}function f(g){return i=g,a=setTimeout(_,e),s?m(g):d}function h(g){let k=g-n,M=g-i,D=e-k;return u?uh(D,c-M):D}function C(g){let k=g-n,M=g-i;return n===void 0||k>=e||k<0||u&&M>=c}function _(){let g=Date.now();if(C(g))return I(g);a=setTimeout(_,h(g))}function I(g){return a=void 0,p&&r?m(g):(r=l=void 0,d)}function A(){a!==void 0&&clearTimeout(a),i=0,r=n=l=a=void 0}function b(){return a===void 0?d:I(Date.now())}function T(){let g=Date.now(),k=C(g);if(r=arguments,l=this,n=g,k){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(_,e),m(n)}return a===void 0&&(a=setTimeout(_,e)),d}return T.cancel=A,T.flush=b,T}var $s=dh;function Ps(t,e,o){let r=mh(6),n=fh(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=$s(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]),ph(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Gs=20;function vh({anchorElem:t}){let[e]=Ws(),o=j(),[r,n]=ho(!1),[i,l]=ho(!1),[s,u]=ho(!1),[c,d]=ho({}),a=Us(new Set),p=Us(null),m=Ps(C=>{let{isOutside:_,tableDOMNode:I}=Mh(C,o.editorConfig?.lexical);if(_){n(!1),l(!1);return}if(!I)return;p.current=I;let A=null,b=null,T=null;if(e.getEditorState().read(()=>{let L=Hs(I);if(kh(L)){let R=Lh(L,w=>Bs(w));if(!Bs(R))return;if(T=Eh(R,e.getElementByKey(R.getKey())),T){let w=R.getChildrenSize(),F=R.getChildAtIndex(0)?.getChildrenSize(),$=_h(L),U=bh(L);$===w-1?A=L:U===F-1&&(b=L)}}},{editor:e}),!T)return;let g=T.parentElement;if(!g)return;let{bottom:k,height:M,left:D,right:P,width:v,y:N}=T.getBoundingClientRect(),x=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(x=g.scrollWidth>g.clientWidth);let{left:E,y:S}=t.getBoundingClientRect();A?(l(!1),n(!0),d({height:Gs,left:x&&g?g.offsetLeft:D-E,top:k-S+5,width:x&&g?g.offsetWidth:v})):b&&(l(!0),n(!1),d({height:M,left:P-E+5,top:N-S,width:Gs}))},50,250),f=Rh(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);js(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),l(!1),document.removeEventListener("mousemove",m)}},[s,m]),js(()=>Sh(e.registerMutationListener(Nh,C=>{e.getEditorState().read(()=>{let _=!1;for(let[I,A]of C)switch(A){case"created":{a.current.add(I),_=!0;break}case"destroyed":{a.current.delete(I),_=!0;break}default:break}if(_){f.disconnect();for(let I of a.current){let{tableElement:A}=xh(I);f.observe(A)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{p.current&&(Hs(p.current)?.selectEnd(),C?(wh(),n(!1)):(Th(),l(!1)))})};return e?.isEditable()?gh(Ch,{children:[r&&Lr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),i&&Lr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function Mh(t,e){let o=t.target;if(Ih(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Vs(t){let e=hh(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Ws();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=yh(Lr(vh,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as Ah}from"react/compiler-runtime";import{jsx as Sr,jsxs as Dh}from"react/jsx-runtime";import{useLexicalComposerContext as Oh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Fh}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as $h,TableCellNode as Ph,TableNode as Bh,TableRowNode as Hh}from"@lexical/table";import{mergeRegister as jh}from"@lexical/utils";import{formatDrawerSlug as Uh,useEditDepth as Gh}from"@payloadcms/ui";import{$getSelection as Wh,$isRangeSelection as Vh,COMMAND_PRIORITY_EDITOR as Kh,createCommand as Jh}from"lexical";import{createContext as Xh,use as zh,useEffect as Zh,useMemo as Yh,useState as qh}from"react";import*as Ks from"react";var go=Jh("OPEN_EMBED_DRAWER_COMMAND"),Js=Xh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Xs({children:t}){let[e,o]=qh({cellEditorConfig:null,cellEditorPlugins:null});return Sr(Js,{value:Yh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var zs=()=>{let t=Ah(16),[e]=Oh(),o=zh(Js),r=Gh(),{fieldProps:n,uuid:i}=j(),{schemaPath:l}=n,s="lexical-table-create-"+i,u;t[0]!==r||t[1]!==s?(u=Uh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=Ce(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([Bh,Hh,Ph]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return jh(e.registerCommand(go,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=Wh();Vh(C)&&(h=C)}),h&&d(),!0},Kh))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],Zh(a,p);let m;t[10]!==e?(m=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand($h,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==l||t[14]!==m?(f=Dh(Ks.Fragment,{children:[Sr(lt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:l,schemaPathSuffix:"fields"}),Sr(Fh,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=l,t[14]=m,t[15]=f):f=t[15],f};var og=y({markdownTransformers:[ws],nodes:[eg,Qh,tg],plugins:[{Component:zs,position:"normal"},{Component:Fs,position:"normal"},{Component:ys,position:"floatingAnchorElem"},{Component:Vs,position:"floatingAnchorElem"}],providers:[Xs],slashMenu:{groups:[Q([{Icon:fr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:fr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]}});import{$isNodeSelection as Ag}from"lexical";import{jsx as Ir,jsxs as rg}from"react/jsx-runtime";import"react";var Rr=()=>rg("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:[Ir("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"}),Ir("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"}),Ir("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 ag}from"react/jsx-runtime";import qs from"bson-objectid";import{$applyNodeReplacement as cg}from"lexical";import*as Qs from"react";import{jsx as ng}from"react/jsx-runtime";import{DecoratorBlockNode as ig}from"@lexical/react/LexicalDecoratorBlockNode.js";import Zs from"bson-objectid";import{$applyNodeReplacement as lg}from"lexical";import"react";function yr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function sg(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:Ys({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||yr(e),null}var At=class extends ig{__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:sg,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Zs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ys({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return ng(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 Ys({data:t}){return t?.id||(t.id=new Zs.default().toHexString()),lg(new At({data:t}))}var ug=Qs.lazy(()=>import("./component-NNKG7K3O.js").then(t=>({default:t.UploadComponent})));function dg(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:Ge({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||yr(e),null}var Re=class extends At{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:dg,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new qs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ge({data:o});return r.setFormat(e.format),r}decorate(){return ag(ug,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge({data:t}){return t?.id||(t.id=new qs.default().toHexString()),cg(new Re({data:t}))}function vr(t){return t instanceof Re}import{c as bg}from"react/compiler-runtime";import{jsx as _g}from"react/jsx-runtime";import{useLexicalComposerContext as Tg}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as wg,mergeRegister as kg}from"@lexical/utils";import{useConfig as Eg}from"@payloadcms/ui";import{$getPreviousSelection as Ng,$getSelection as Lg,$isParagraphNode as Sg,$isRangeSelection as Ig,COMMAND_PRIORITY_EDITOR as Rg,createCommand as yg}from"lexical";import{useEffect as vg}from"react";import{c as ea}from"react/compiler-runtime";import{jsx as Mr}from"react/jsx-runtime";import{useLexicalComposerContext as ta}from"@lexical/react/LexicalComposerContext.js";import{toast as mg}from"@payloadcms/ui";import{$getNodeByKey as pg,COMMAND_PRIORITY_EDITOR as oa}from"lexical";import{useEffect as ra,useState as fg}from"react";var hg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=pg(o);n&&n.replace(Ge({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Ar,{fields:null,relationTo:e,value:r})},gg=t=>{let e=ea(13),{enabledCollectionSlugs:o}=t,[r]=ta(),[n,i]=fg(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=St(l),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ve,h=>(i(h?.replace?h?.replace.nodeKey:null),c(),!0),oa),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),ra(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:C,doc:_}=h;s(),hg({editor:r,relationTo:C,replaceNodeKey:n,value:_.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=Mr(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},Cg=()=>{let t=ea(3),[e]=ta(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ve,xg,oa),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ra(o,r),null},na=t=>Mr(Ot,{...t,FallbackComponent:Cg,uploads:!0,children:Mr(gg,{...t})});function xg(){return mg.error("No upload collections enabled"),!0}var Ar=yg("INSERT_UPLOAD_COMMAND"),ia=t=>{let e=bg(5),[o]=Tg(),{config:r}=Eg(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Re]))throw new Error("UploadPlugin: UploadNode not registered on editor");return kg(o.registerCommand(Ar,u=>(o.update(()=>{let c=Lg()||Ng();if(Ig(c)){let d=Ge({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}});wg(d);let{focus:a}=c,p=a.getNode();Sg(p)&&!p.__first&&(p.__prev||p.__next)&&p.remove()}}),!0),Rg))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),vg(i,l);let s;return e[3]!==n?(s=_g(na,{enabledCollectionSlugs:n.map(Mg)}),e[3]=n,e[4]=s):s=e[4],s};function Mg(t){let{slug:e}=t;return e}var Dg=y({nodes:[Re],plugins:[{Component:ia,position:"normal"}],slashMenu:{groups:[Q([{Icon:Rr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Rr,isActive:({selection:t})=>{if(!Ag(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]}});import{c as Og}from"react/compiler-runtime";import{jsx as Or}from"react/jsx-runtime";import{ShimmerEffect as Fg,useConfig as $g}from"@payloadcms/ui";import{lazy as Pg,Suspense as Bg,useEffect as Hg,useState as jg}from"react";var la={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",hrSelected:"LexicalEditorTheme__hrSelected",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",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Co={namespace:"lexical",theme:la};function sa({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:i}){for(let c of i.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");i.features=i.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let l=new Map;for(let c of i.features)l.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of i.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:l,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:i}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}var aa=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 Dr(t,e,o){return{admin:o,features:aa(t),lexical:e,resolvedFeatureMap:t}}var Ug=Pg(()=>import("./Field-VKDIZQ73.js").then(t=>({default:t.RichText}))),Gg=t=>{let e=Og(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:i,field:l,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?Co:s,{config:p}=$g(),[m,f]=jg(null),h,C;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let I=[];for(let[T,g]of Object.entries(r))g.clientFeatureProvider&&I.push(g.clientFeatureProvider(g.clientFeatureProps));let A=a||Co,b=sa({config:p,featureClientImportMap:n,featureClientSchemaMap:i,field:l,schemaPath:u??l.name,unSanitizedEditorConfig:{features:I,lexical:A}});f(Dr(b,A,d))},C=[a,d,m,r,n,i,l,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=i,e[7]=l,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=C):(h=e[11],C=e[12]),Hg(h,C);let _;return e[13]!==m||e[14]!==t?(_=Or(Bg,{fallback:Or(Fg,{height:"35vh"}),children:m&&Or(Ug,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=_):_=e[15],_};function Wg(t){return t instanceof HTMLElement}function Vg(...t){return t.filter(Boolean).join(" ")}var xo=new WeakMap;function ca(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function bo(t,e){let o=xo.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=ca(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=ca(l);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},xo.set(t,o)}return o.listeners.add(e),()=>{Kg(t,e)}}function Kg(t,e){let o=xo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(xo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Jg(t,e){return bo(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function Xg(t,e){return bo(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function zg(t,e){return bo(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function Zg(t,e){return bo(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}import{c as Yg}from"react/compiler-runtime";import{jsx as qg}from"react/jsx-runtime";import"react";var Qg=()=>{let t=Yg(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?qg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as eC}from"react/compiler-runtime";import{jsx as tC}from"react/jsx-runtime";import"react";var oC=()=>{let t=eC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?tC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as rC}from"react/compiler-runtime";import{jsx as nC}from"react/jsx-runtime";import"react";var iC=()=>{let t=rC(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?nC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as lC}from"react/compiler-runtime";import{jsx as sC}from"react/jsx-runtime";import"react";var aC=t=>{let e=lC(3),{children:o}=t,{InlineBlockContainer:r}=xe(),n;return e[0]!==r||e[1]!==o?(n=r?sC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as cC}from"react/compiler-runtime";import{jsx as uC}from"react/jsx-runtime";import"react";var dC=t=>{let e=cC(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=Oe(),s;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(s=l?uC(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 mC}from"react/compiler-runtime";import{jsx as pC}from"react/jsx-runtime";import"react";var fC=()=>{let t=mC(2),{EditButton:e}=Oe(),o;return t[0]!==e?(o=e?pC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as hC}from"react/compiler-runtime";import{jsx as gC}from"react/jsx-runtime";import"react";var CC=()=>{let t=hC(2),{RemoveButton:e}=Oe(),o;return t[0]!==e?(o=e?gC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as xC}from"qs-esm";var bC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:i,collectionSlug:l,select:s})=>{let u=xC({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${l}/${i}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};export{Ct as $createAutoLinkNode,Vt as $createBlockNode,To as $createInlineBlockNode,Te as $createLinkNode,je as $createRelationshipNode,Ge as $createUploadNode,ke as $isAutoLinkNode,pt as $isBlockNode,wo as $isInlineBlockNode,Z as $isLinkNode,ir as $isRelationshipNode,vr as $isUploadNode,wa as AlignFeatureClient,we as AutoLinkNode,dC as BlockCollapsible,fC as BlockEditButton,be as BlockNode,CC as BlockRemoveButton,Sa as BlockquoteFeatureClient,Ec as BlocksFeatureClient,Jc as BoldFeatureClient,ae as CAN_USE_DOM,Fm as ChecklistFeatureClient,Lp as DETAIL_TYPE_TO_DETAIL,wp as DOUBLE_LINE_BREAK,Pp as DebugJsxConverterFeatureClient,Ip as ELEMENT_FORMAT_TO_TYPE,Sp as ELEMENT_TYPE_TO_FORMAT,ha as ENABLE_SLASH_MENU_COMMAND,da as EditorConfigProvider,lt as FieldsDrawer,qf as FixedToolbarFeatureClient,Ru as HeadingFeatureClient,Ku as HorizontalRuleFeatureClient,Ke as INSERT_BLOCK_COMMAND,Je as INSERT_INLINE_BLOCK_COMMAND,_p as IS_ALL_FORMATTING,ad as IndentFeatureClient,aC as InlineBlockContainer,Qg as InlineBlockEditButton,iC as InlineBlockLabel,_o as InlineBlockNode,oC as InlineBlockRemoveButton,qc as InlineCodeFeatureClient,c1 as InlineToolbarFeatureClient,ou as ItalicFeatureClient,Ep as LTR_REGEX,np as LexicalPluginToLexicalFeatureClient,Tm as LinkFeatureClient,ie as LinkNode,Tp as NON_BREAKING_SPACE,O as NodeFormat,Wm as OrderedListFeatureClient,mp as ParagraphFeatureClient,pa as Point,kp as RTL_REGEX,ga as Rect,Ef as RelationshipFeatureClient,Ne as RelationshipNode,Gg as RichTextField,up as SlateToLexicalFeatureClient,su as StrikethroughFeatureClient,du as SubscriptFeatureClient,hu as SuperscriptFeatureClient,Rp as TEXT_MODE_TO_TYPE,Np as TEXT_TYPE_TO_FORMAT,yp as TEXT_TYPE_TO_MODE,he as TOGGLE_LINK_COMMAND,og as TableFeatureClient,Pc as TestRecorderFeatureClient,It as ToolbarButton,Ue as ToolbarDropdown,Gc as TreeViewFeatureClient,_u as UnderlineFeatureClient,qm as UnorderedListFeatureClient,Dg as UploadFeatureClient,Re as UploadNode,Zg as addSwipeDownListener,Jg as addSwipeLeftListener,Xg as addSwipeRightListener,zg as addSwipeUpListener,$o as createBlockNode,y as createClientFeature,Co as defaultEditorLexicalConfig,pr as getDOMRangeRect,Ca as getEnabledNodes,bC as getRestPopulateFn,Xe as getSelectedNode,Wg as isHTMLElement,fa as isPoint,Vg as joinClasses,Dr as sanitizeClientEditorConfig,aa as sanitizeClientFeatures,lo as setFloatingElemPosition,Qt as setFloatingElemPositionForLinkEditor,Q as slashMenuBasicGroupWithItems,_e as toolbarAddDropdownGroupWithItems,Bo as toolbarFeatureButtonsGroupWithItems,ee as toolbarFormatGroupWithItems,ne as toolbarTextDropdownGroupWithItems,Oe as useBlockComponentContext,j as useEditorConfigContext,xe as useInlineBlockComponentContext,ma as useLexicalDocumentDrawer,Ce as useLexicalDrawer,St as useLexicalListDrawer};
41
41
  //# sourceMappingURL=index.js.map